From e6265ba296146e0d509818682242592573858a83 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Thu, 2 Apr 2015 18:19:36 +0200 Subject: [PATCH] Moved rules to database to make changes more easily in the setup --- CHANGELOG | 4 ++++ README | 1 + README.md | 1 + chat.php | 48 ++++++++++++++++++++++++++++++------------------ 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index cff707b..83941ea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +Version 1.2 - Apr. 2, 2015 +Include letters when generating captchas not only numbers +Moved rules to database to make changes more easily in the setup + Version 1.1 - Apr. 2, 2015 Some simplifications Added ignore feature diff --git a/README b/README index 57b5fa7..ea7e7a4 100644 --- a/README +++ b/README @@ -60,6 +60,7 @@ Then copy the script to your web-server directory and call the script in your br http://(server)/(script-name).php?action=setup Now you can create the Superadmin account. With this account you can administer the chat and add new members and set the guest access. As soon as you are done with the setup, all necessary database tables will be created and the chat can be used. +Note: If you updated the script, please visit http://(server)/(script-name).php?action=setup again, to make sure, that any database changes are applied and no errors occure. TRANSLATING: diff --git a/README.md b/README.md index dd02293..758bc08 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Then copy the script to your web-server directory and call the script in your br http://(server)/(script-name).php?action=setup Now you can create the Superadmin account. With this account you can administer the chat and add new members and set the guest access. As soon as you are done with the setup, all necessary database tables will be created and the chat can be used. +Note: If you updated the script, please visit http://(server)/(script-name).php?action=setup again, to make sure, that any database changes are applied and no errors occure. Translating: ------------ diff --git a/chat.php b/chat.php index 43d4c44..8314919 100755 --- a/chat.php +++ b/chat.php @@ -162,6 +162,11 @@ if(!isSet($_REQUEST['action'])){ } }elseif($_REQUEST['do']=='messages'){ update_messages(); + }elseif($_REQUEST['do']=='rules'){ + $_REQUEST['rulestxt']=preg_replace("/\r\n/", '
', $_REQUEST['rulestxt']); + $_REQUEST['rulestxt']=preg_replace("/\n/", '
', $_REQUEST['rulestxt']); + $_REQUEST['rulestxt']=preg_replace("/\r/", '
', $_REQUEST['rulestxt']); + update_setting('rulestxt', $_REQUEST['rulestxt']); } send_setup(); }elseif($_REQUEST['action']=='init'){ @@ -263,22 +268,22 @@ function send_setup(){ echo "

$I[setup]

"; thr(); echo "
"; + echo '
$I[guestacc]"; - echo "<$H[form]>".hidden('action', 'setup').hidden('do', 'guestaccess').hidden('nick', $_REQUEST['nick']).hidden('pass', $_REQUEST['pass']).""; - echo "
 ".hidden('action', 'setup').hidden('do', 'guestaccess').hidden('nick', $_REQUEST['nick']).hidden('pass', $_REQUEST['pass']).''; + echo '"; - echo ""; - echo ""; - echo "
  
   
   
  
 ".submit($I['change'])."
  
 ".submit($I['change']).'
'; thr(); echo "
$I[sysmessages]"; - echo "<$H[form]>".hidden('action', 'setup').hidden('do', 'messages').hidden('nick', $_REQUEST['nick']).hidden('pass', $_REQUEST['pass']).""; + echo "<$H[form]>".hidden('action', 'setup').hidden('do', 'messages').hidden('nick', $_REQUEST['nick']).hidden('pass', $_REQUEST['pass']).'
'; echo "'; echo "'; echo "'; @@ -289,6 +294,11 @@ function send_setup(){ echo "'; echo '
 $I[msgenter] 
 $I[msgexit] 
 $I[msgmemreg] 
 $I[msgclean] 
 '.submit($I['apply']).'
'; thr(); + echo "
$I[rules]"; + echo "<$H[form]>".hidden('action', 'setup').hidden('do', 'rules').hidden('nick', $_REQUEST['nick']).hidden('pass', $_REQUEST['pass']).''; + echo ''; + echo '
 '.submit($I['apply']).'
'; + thr(); echo "<$H[form]>".hidden('action', 'setup').submit($I['logout']).''; print_credits(); print_end(); @@ -647,7 +657,7 @@ function send_waiting_room(){ echo "$H[begin_body]

$I[waitingroom]

".sprintf($I['admwaittext'], $U['displayname']).'


'.sprintf($I['waitreload'], $C['defaultrefresh']).'



'; } echo "
".hidden('action', 'wait').hidden('session', $U['session']).submit($I['reload']).'

'; - echo "

$I[rules]

$C[rulestxt]
"; + echo "

$I[rules]

".get_setting('rulestxt').'
'; print_end(); } } @@ -729,7 +739,7 @@ function send_post(){ function send_help(){ global $U, $C, $H, $I; print_start(); - echo "

$I[rules]

$C[rulestxt]


$I[help]

$I[helpguest]"; + echo "

$I[rules]

".get_setting('rulestxt')."


$I[help]

$I[helpguest]"; if($C['imgembed'] || $C['vidembed']) echo "
$I[helpembed]"; if($U['status']>=3){ echo "
$I[helpmem]
"; @@ -921,7 +931,7 @@ function send_login(){ } $nowchatting=get_nowchatting(); echo ''.submit($I['enter'])."$nowchatting"; - echo "

$I[rules]

$C[rulestxt]

$I[changelang]"; + echo "

$I[rules]

".get_setting('rulestxt')."

$I[changelang]"; foreach($L as $lang=>$name){ echo " $name"; } @@ -2011,6 +2021,9 @@ function update_db(){ mysqli_query($mysqli, 'ALTER TABLE `ignored` ADD PRIMARY KEY (`id`)'); mysqli_query($mysqli, 'ALTER TABLE `ignored` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT'); } + if($dbversion<3){ + mysqli_query($mysqli, 'INSERT INTO `settings` (`setting`, `value`) VALUES (\'rulestxt\', \'1. YOUR_RULS
2. YOUR_RULES\')'); + } update_setting('dbversion', $C['dbversion']); send_update(); } @@ -2113,8 +2126,8 @@ function load_lang(){ function load_config(){ global $C; $C=array( - 'version' =>'1.1', // Script version - 'dbversion' =>2, // Database version + 'version' =>'1.2', // Script version + 'dbversion' =>3, // Database version 'showcredits' =>false, // Allow showing credits 'colbg' =>'000000', // Background colour 'coltxt' =>'FFFFFF', // Default text colour @@ -2158,8 +2171,7 @@ function load_config(){ 'mailsender' =>'www-data ', // Send mail using this e-Mail address 'mailreceiver' =>'Webmaster ', // Send mail to this e-Mail address 'redirect' =>"$_SERVER[SCRIPT_NAME]?action=redirect&url=", // Redirect script default: "$_SERVER[SCRIPT_NAME]?action=redirect&url=" - 'lang' =>'en', // Default language - 'rulestxt' =>'1. YOUR_RULS
2. YOUR_RULES' // Rules - divide multiple rules by
to make them appear in a new line + 'lang' =>'en' // Default language ); } ?>