home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / FAQ / discus_admin_1357211388 / source / fcn-info.pl < prev    next >
Text File  |  2009-11-06  |  2KB  |  64 lines

  1. # FILE: fcn-info.pl
  2. # DESCRIPTION: Board Information
  3. #-------------------------------------------------------------------------------
  4. # DISCUS COPYRIGHT NOTICE
  5. #
  6. # Discus is copyright (c) 2002 by DiscusWare, LLC, all rights reserved.
  7. # The use of Discus is governed by the Discus License Agreement which is
  8. # available from the Discus WWW site at:
  9. #    http://www.discusware.com/discus/license
  10. #
  11. # Pursuant to the Discus License Agreement, this copyright notice may not be
  12. # removed or altered in any way.
  13. #-------------------------------------------------------------------------------
  14.  
  15. use strict;
  16. use vars qw($GLOBAL_OPTIONS $DCONF $PARAMS);
  17.  
  18. ###
  19. ### board_info_substitutions
  20. ###
  21. ### Enhances page substitutions with data from various board information
  22. ### files, as required by selected options
  23. ###
  24.  
  25. sub board_info_substitutions {
  26.     my ($subst) = @_;
  27.     if ($GLOBAL_OPTIONS->{skinvar_board} == 1) {
  28.         if (defined $PARAMS->{cache}->{boardinfo}) {
  29.             $subst->{boardinfo} = $PARAMS->{cache}->{boardinfo};
  30.         } else {
  31.             my $d = readfile("$DCONF->{admin_dir}/data/boardinf.txt", "board_info_substitutions", { no_lock => 1, no_unlock => 1, zero_ok => 1, create => 1 });    
  32.             my $h = {};
  33.             foreach my $x (@{ $d }) {
  34.                 if ($x =~ m|^(\w+)=(.*)|) {
  35.                     $h->{$1} = unescape($2);
  36.                 }
  37.             }
  38.             $PARAMS->{cache}->{boardinfo} = $h;
  39.             $subst->{boardinfo} = $h;            
  40.         }        
  41.     }
  42.     return $subst;
  43. }
  44.  
  45. ###
  46. ### board_info_topicinfo_save
  47. ###
  48. ### Information on topics storage in a file
  49. ###
  50.  
  51. sub board_info_topicinfo_save {
  52.     my ($topicdata, $X_in) = @_;
  53.     dreq("topic-pg");
  54.     my $X = defined $X_in ? $X_in : topic_page_board_info({}, $topicdata);
  55.     my @d = ();
  56.     foreach my $k (keys %{ $X->{topicinfo} }) {
  57.         push @d, join("", $k, "=", escape($X->{topicinfo}->{$k}), "\n");
  58.     }
  59.     writefile("$DCONF->{admin_dir}/data/boardinf.txt", \@d, "board_info_topicinfo_save", { no_lock => 1, no_unlock => 1, zero_ok => 1, create => 1 });
  60.     return $X->{topicinfo};
  61. }
  62.  
  63. 1;
  64.