| ############################################################################### |
| ############################################################################### |
| # Settings_News.pl # |
| # Settings_News.pm # |
| |
| # $Date: 01.05.16 $ # |
| ############################################################################### |
| ############################################################################### |
| # YaBB: Yet another Bulletin Board # |
| # YaBB: Yet another Bulletin Board # |
| # Open-Source Community Software for Webmasters # |
| # Open-Source Community Software for Webmasters # |
| # Version: YaBB 2.5.2 # |
| # Version: YaBB 2.6.12 # |
| # Packaged: October 21, 2012 # |
| # Packaged: January 5, 2016 # |
| # Distributed by: http://www.yabbforum.com # |
| # Distributed by: http://www.yabbforum.com # |
| # =========================================================================== # |
| # =========================================================================== # |
| # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Copyright (c) 2000-2016 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Software by: The YaBB Development Team # |
| # Software by: The YaBB Development Team # |
| # with assistance from the YaBB community. # |
| # with assistance from the YaBB community. # |
| ############################################################################### |
| ############################################################################### |
| |
| # use strict; |
| |
| use English '-no_match_vars'; |
| |
| our $VERSION = '2.6.12'; |
| |
| |
| $settings_newsplver = 'YaBB 2.5.2 $Revision: 1.0 $'; |
| $settings_newspmver = 'YaBB 2.6.12 $Revision: 1651 $'; |
| if ($action eq 'detailedversion') { return 1; } |
| if ( $action eq 'detailedversion' ) { return 1; } |
| |
| |
| # Load the news from news.txt |
| # Load the news from news.txt |
| fopen(NEWS, "$vardir/news.txt") || &fatal_error('cannot_open', "$vardir/news.txt", 1); |
| fopen( NEWS, "$vardir/news.txt" ) |
| my $yabbnews = join('', <NEWS>); |
| || fatal_error( 'cannot_open', "$vardir/news.txt", 1 ); |
| |
| $yabbnews = do { local $INPUT_RECORD_SEPARATOR = undef; <NEWS> }; |
| fclose(NEWS); |
| fclose(NEWS); |
| |
| |
| # ToHTML, in case they have some crazy HTML in it like </textarea> |
| # ToHTML, in case they have some crazy HTML in it like </textarea> |
| &ToHTML($yabbnews); |
| ToHTML($yabbnews); |
| &ToChars($yabbnews); |
| ToChars($yabbnews); |
| |
| |
| # List of settings |
| # List of settings |
| @settings = ( |
| @settings = ( |
| # Begin tab |
| |
| { |
| # Begin tab |
| name => $settings_txt{'news'}, # Tab name |
| { |
| id => 'settings', # Javascript ID |
| name => $settings_txt{'news'}, # Tab name |
| items => [ |
| id => 'settings', # Javascript ID |
| { |
| items => [ |
| header => $settings_txt{'news'}, # Section header |
| { |
| }, |
| header => $settings_txt{'news'}, # Section header |
| { |
| }, |
| description => qq~<label for="enable_news">$admin_txt{'379'}</label>~, # Description of item (displayed on left) |
| { |
| input_html => qq~<input type="checkbox" name="enable_news" id="enable_news" value="1" ${ischecked($enable_news)}/>~, # HTML for item |
| description => |
| name => 'enable_news', # Variable/FORM name |
| qq~<label for="enable_news">$admin_txt{'379'}</label>~, |
| validate => 'boolean', # Regex(es) to validate against |
| # Description of item (displayed on left) |
| }, |
| input_html => |
| { |
| qq~<input type="checkbox" name="enable_news" id="enable_news" value="1" ${ischecked($enable_news)}/>~, |
| header => $settings_txt{'newsfader'}, |
| # HTML for item |
| }, |
| name => 'enable_news', # Variable/FORM name |
| { |
| validate => 'boolean', # Regex(es) to validate against |
| description => qq~<label for="shownewsfader">$admin_txt{'387'}</label>~, |
| }, |
| input_html => qq~<input type="checkbox" name="shownewsfader" id="shownewsfader" value="1" ${ischecked($shownewsfader)}/>~, |
| { header => $settings_txt{'newsfader'}, }, |
| name => 'shownewsfader', |
| { |
| validate => 'boolean', |
| description => |
| depends_on => ['enable_news'], |
| qq~<label for="shownewsfader">$admin_txt{'387'}</label>~, |
| }, |
| input_html => |
| { |
| qq~<input type="checkbox" name="shownewsfader" id="shownewsfader" value="1" ${ischecked($shownewsfader)}/>~, |
| description => qq~<label for="maxsteps">$admintxt{'41'}</label>~, |
| name => 'shownewsfader', |
| input_html => qq~<input type="text" name="maxsteps" id="maxsteps" size="3" value="$maxsteps" />~, |
| validate => 'boolean', |
| name => 'maxsteps', |
| depends_on => ['enable_news'], |
| validate => 'number', |
| }, |
| depends_on => ['enable_news', 'shownewsfader'], |
| { |
| }, |
| description => |
| { |
| qq~<label for="maxsteps">$admintxt{'41'}</label>~, |
| description => qq~<label for="stepdelay">$admintxt{'42'}</label>~, |
| input_html => |
| input_html => qq~<input type="text" name="stepdelay" id="stepdelay" size="3" value="$stepdelay" /> $admintxt{'ms'}~, |
| qq~<input type="text" name="maxsteps" id="maxsteps" size="3" value="$maxsteps" />~, |
| name => 'stepdelay', |
| name => 'maxsteps', |
| validate => 'number', |
| validate => 'number', |
| depends_on => ['enable_news', 'shownewsfader'], |
| depends_on => [ 'enable_news', 'shownewsfader' ], |
| }, |
| }, |
| { |
| { |
| description => qq~<label for="fadelinks">$admintxt{'40'}</label>~, |
| description => |
| input_html => qq~<input type="checkbox" name="fadelinks" id="fadelinks" value="1" ${ischecked($fadelinks)}/>~, |
| qq~<label for="stepdelay">$admintxt{'42'}</label>~, |
| name => 'fadelinks', |
| input_html => |
| validate => 'boolean', |
| qq~<input type="text" name="stepdelay" id="stepdelay" size="3" value="$stepdelay" /> $admintxt{'ms'}~, |
| depends_on => ['enable_news', 'shownewsfader'], |
| name => 'stepdelay', |
| }, |
| validate => 'number', |
| ], |
| depends_on => [ 'enable_news', 'shownewsfader' ], |
| }, |
| }, |
| { |
| { |
| name => $admin_txt{'7'}, |
| description => |
| id => 'editnews', |
| qq~<label for="fadelinks">$admintxt{'40'}</label>~, |
| items => [ |
| input_html => |
| { |
| qq~<input type="checkbox" name="fadelinks" id="fadelinks" value="1" ${ischecked($fadelinks)}/>~, |
| header => $admin_txt{'7'}, |
| name => 'fadelinks', |
| }, |
| validate => 'boolean', |
| { |
| depends_on => [ 'enable_news', 'shownewsfader' ], |
| two_rows => 1, # Use to rows to display this item |
| }, |
| description => qq~<label for="news">$admin_txt{'670'}</label>~, |
| ], |
| input_html => qq~<textarea cols="80" rows="35" name="news" id="news" style="width: 99%">$yabbnews</textarea>~, |
| }, |
| name => 'news', |
| { |
| validate => 'null,fulltext', |
| name => $admin_txt{'7'}, |
| depends_on => ['enable_news'], |
| id => 'editnews', |
| }, |
| items => [ |
| ], |
| { header => $admin_txt{'7'}, }, |
| }); |
| { |
| |
| two_rows => 1, # Use to rows to display this item |
| |
| description => qq~<label for="news">$admin_txt{'670'}</label>~, |
| |
| input_html => |
| |
| qq~<textarea cols="80" rows="35" name="news" id="news" style="width: 99%">$yabbnews</textarea>~, |
| |
| name => 'news', |
| |
| validate => 'null,fulltext', |
| |
| depends_on => ['enable_news'], |
| |
| }, |
| |
| ], |
| |
| } |
| |
| ); |
| |
| |
| # Routine to save them |
| # Routine to save them |
| sub SaveSettings { |
| sub SaveSettings { |
| my %settings = @_; |
| my %settings = @_; |
| |
| |
| $settings{'news'} =~ tr/\r//d; |
| |
| chomp $settings{'news'}; |
| |
| &FromChars($settings{'news'}); |
| |
| # news.txt stuff |
| |
| fopen(NEWS, ">$vardir/news.txt", 1) || &fatal_error('cannot_open', "$vardir/news.txt", 1); |
| |
| print NEWS $settings{'news'}; # Remove it from the hash |
| |
| fclose(NEWS); |
| |
| delete $settings{'news'}; |
| |
| |
| |
| # Settings.pl stuff |
| $settings{'news'} =~ tr/\r//d; |
| &SaveSettingsTo('Settings.pl', %settings); |
| chomp $settings{'news'}; |
| |
| FromChars( $settings{'news'} ); |
| |
| |
| |
| # news.txt stuff |
| |
| fopen( NEWS, ">$vardir/news.txt", 1 ) |
| |
| || fatal_error( 'cannot_open', "$vardir/news.txt", 1 ); |
| |
| print {NEWS} $settings{'news'} |
| |
| or croak "$croak{'print'} NEWS"; # Remove it from the hash |
| |
| fclose(NEWS); |
| |
| delete $settings{'news'}; |
| |
| |
| |
| # Settings.pm stuff |
| |
| SaveSettingsTo( 'Settings.pm', %settings ); |
| |
| return; |
| } |
| } |
| |
| |
| 1; |
| 1; |
| |
| |