diff --git a/CHANGELOG b/CHANGELOG index 3693443..4212f13 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ Don't send messages to inbox when in incognito Remove up to two characters from the end of @mention to also match @mention, etc. Make colour input use colorChooser, if supported Add integrated file upload support +Allow making CSS more unique, by adding more ids/classes and allowing to over-write hardcoded CSS Version 1.21 - Aug. 29, 2016 Don't display empty option for system messages in delete messages by name diff --git a/chat.php b/chat.php index a99dee6..3414de0 100644 --- a/chat.php +++ b/chat.php @@ -258,19 +258,40 @@ function route_setup(){ } // html output subs -function print_stylesheet(){ +function print_stylesheet($init=false){ global $U; + //default css + echo ''; + if($init){ + return; + } $css=get_setting('css'); - $externalcss=get_setting('externalcss'); $coltxt=get_setting('coltxt'); if(!empty($U['bgcolour'])){ $colbg=$U['bgcolour']; }else{ $colbg=get_setting('colbg'); } - if($externalcss!=''){ + if(($externalcss=get_setting('externalcss'))!=''){ + //external css echo ""; } + //overwrite with custom css echo ""; } @@ -316,7 +337,7 @@ function print_start($class='', $ref=0, $url=''){ } if($class==='init'){ echo "$I[init]"; - echo ""; + print_stylesheet(true); }else{ echo ''.get_setting('chatname').''; print_stylesheet(); @@ -377,7 +398,7 @@ function send_captcha(){ $stmt=$db->prepare('INSERT INTO ' . PREFIX . 'captcha (id, time, code) VALUES (?, ?, ?);'); $stmt->execute(array($randid, $time, $code)); } - echo "$I[copy]
"; + echo "$I[copy]
"; if($difficulty===1){ $im=imagecreatetruecolor(55, 24); $bg=imagecolorallocate($im, 0, 0, 0); @@ -457,7 +478,7 @@ function send_captcha(){ imagegif($im); imagedestroy($im); echo base64_encode(ob_get_clean()).'">'; - echo ''.hidden('challenge', $randid).''; + echo ''.hidden('challenge', $randid).''; } function send_setup($C){ @@ -467,10 +488,10 @@ function send_setup($C){ if(!isSet($_REQUEST['session'])){ echo hidden('session', $U['session']); } - echo ''; + echo '
'; thr(); $ga=(int) get_setting('guestaccess'); - echo "
'; thr(); $englobal=(int) get_setting('englobalpass'); - echo "
$I[guestacc]"; + echo "
$I[guestacc]"; echo '
$I[globalloginpass]"; - echo ''; + echo "
'; thr(); $ga=(int) get_setting('guestreg'); - echo "
$I[globalloginpass]"; + echo ''; echo '
'; thr(); - echo "
$I[guestreg]"; + echo "
$I[guestreg]"; echo '
$I[sysmessages]"; - echo ''; + echo "'; foreach($C['text_settings'] as $setting){ thr(); - echo '
$I[sysmessages]"; + echo ''; foreach($C['msg_settings'] as $setting){ echo "'; } echo '
 $I[$setting] 
'; } foreach($C['colour_settings'] as $setting){ thr(); - echo '
'.$I[$setting].''; + echo "
".$I[$setting].''; echo "'; echo '
'; } thr(); - echo "
'.$I[$setting].''; + echo "
".$I[$setting].''; echo "'; echo '
$I[captcha]"; - echo ''; + echo "'; thr(); - echo "
$I[captcha]"; + echo ''; if(!extension_loaded('gd')){ echo ""; }else{ @@ -604,8 +625,8 @@ function send_setup($C){ } echo '
$I[gdextrequired]
'; foreach($C['textarea_settings'] as $setting){ thr(); - echo '
$I[defaulttz]"; - echo "
$I[defaulttz]"; + echo "
'; } foreach($C['number_settings'] as $setting){ thr(); - echo '
'.$I[$setting].''; + echo "
".$I[$setting].''; echo "'; echo '
'; } foreach($C['bool_settings'] as $setting){ thr(); - echo '
'.$I[$setting].''; + echo "
".$I[$setting].''; echo "'; echo '
'.$I[$setting].''; + echo "
".$I[$setting].''; echo "'.submit($I['apply']).'

'; if($U['status']==8){ - echo ''; + echo '
'; echo "'; } thr(); @@ -807,7 +828,7 @@ function send_backup($C){ function send_destroy_chat(){ global $H, $I; print_start('destroy_chat'); - echo "
<$H[form]>$H[commonform]".hidden('action', 'setup').hidden('do', 'backup'); if(!isSet($_REQUEST['session'])){ echo hidden('session', $U['session']); @@ -668,7 +689,7 @@ function send_setup($C){ } function restore_backup($C){ - global $db; + global $db, $memcached; if(!extension_loaded('json')){ return; } @@ -775,27 +796,27 @@ function send_backup($C){ $chknotes=''; } print_start('backup'); - echo "

$I[backuprestore]

"; + echo "

$I[backuprestore]

"; thr(); if(!extension_loaded('json')){ echo ""; }else{ echo "'; thr(); echo "
$I[jsonextrequired]
<$H[form]>$H[commonform]".hidden('action', 'setup').hidden('do', 'backup'); - echo ''; + echo '
'; + echo '
'; echo ""; echo ""; echo ""; echo ""; - echo ''.submit($I['backup']).'
'.submit($I['backup']).'
<$H[form]>$H[commonform]".hidden('action', 'setup').hidden('do', 'restore'); - echo ''; + echo '
'; echo "'; - echo "
"; + echo "
"; echo ""; echo ""; echo ""; - echo ''.submit($I['restore']).'
'; + echo '
'.submit($I['restore']).'
'; echo '
$I[confirm]
"; + echo "
$I[confirm]
"; echo "<$H[form] target=\"_parent\">$H[commonform]".hidden('action', 'setup').hidden('do', 'destroy').hidden('confirm', 'yes').submit($I['yes'], 'class="delbutton"').''; echo "<$H[form]>$H[commonform]".hidden('action', 'setup').submit($I['no'], 'class="backbutton"').'
'; print_end(); @@ -816,7 +837,7 @@ function send_destroy_chat(){ function send_delete_account(){ global $H, $I; print_start('delete_account'); - echo "
$I[confirm]
"; + echo "
$I[confirm]
"; echo "<$H[form]>$H[commonform]".hidden('action', 'profile').hidden('do', 'delete').hidden('confirm', 'yes').submit($I['yes'], 'class="delbutton"').''; echo "<$H[form]>$H[commonform]".hidden('action', 'profile').submit($I['no'], 'class="backbutton"').'
'; print_end(); @@ -826,12 +847,12 @@ function send_init(){ global $H, $I, $L; print_start('init'); echo "

$I[init]

"; - echo "<$H[form]>$H[commonform]".hidden('action', 'init')."

$I[sulogin]

"; + echo "<$H[form]>$H[commonform]".hidden('action', 'init')."

$I[sulogin]

"; echo ""; echo ""; echo ""; echo '
$I[sunick]
$I[supass]
$I[suconfirm]

'.submit($I['initbtn']).'
'; - echo "

$I[changelang]"; + echo "

$I[changelang]"; foreach($L as $lang=>$name){ echo " $name"; } @@ -849,12 +870,12 @@ function send_update(){ function send_alogin(){ global $H, $I, $L; print_start('alogin'); - echo "<$H[form]>$H[commonform]".hidden('action', 'setup').''; + echo "<$H[form]>$H[commonform]".hidden('action', 'setup').'
'; echo ""; echo ""; send_captcha(); - echo '
$I[nick]
$I[pass]
'.submit($I['login']).'
'; - echo "

$I[changelang]"; + echo '

'.submit($I['login']).'
'; + echo "

$I[changelang]"; foreach($L as $lang=>$name){ echo " $name"; } @@ -879,15 +900,15 @@ function send_admin($arg=''){ } } $chlist.=''; - echo "

$I[admfunc]

$arg"; + echo "

$I[admfunc]

$arg
"; if($U['status']>=7){ thr(); echo "'; } thr(); - echo "
<$H[form] target=\"view\">$H[commonform]".hidden('action', 'setup').submit($I['initgosetup']).'
$I[cleanmsgs]"; + echo "
'; thr(); - echo '
$I[cleanmsgs]"; frmadm('clean'); - echo '
'; + echo '
'; echo " "; echo " 
"; echo "'; echo submit($I['clean'], 'class="delbutton"').'
'.sprintf($I['kickchat'], get_setting('kickpenalty')).'
'; + echo '
'; thr(); - echo "
'.sprintf($I['kickchat'], get_setting('kickpenalty')).'
'; frmadm('kick'); - echo ""; - echo "
$I[kickreason] 
$chlist"; + echo ""; + echo "
$I[kickreason] 
$chlist"; echo submit($I['kick']).'
$I[logoutinact]"; + echo "
'; $views=array('sessions', 'filter', 'linkfilter'); foreach($views as $view){ thr(); - echo '
$I[logoutinact]"; frmadm('logout'); - echo "
$chlist"; + echo "
$chlist"; echo submit($I['logout']).'
'; } thr(); - echo "
'.$I[$view].''; + echo "
".$I[$view].''; frmadm($view); echo submit($I['view']).'
$I[topic]"; + echo "
'; thr(); - echo "
$I[topic]"; frmadm('topic'); - echo '
'; + echo '
'; echo submit($I['change']).'
'; thr(); if(get_setting('suguests')){ - echo "
$I[guestacc]"; + echo "
$I[guestacc]"; frmadm('guestaccess'); - echo ''; + echo '
'; echo '
'.submit($I['change']).'
$I[addsuguest]"; + echo "
$I[addsuguest]"; frmadm('superguest'); - echo "
$I[admmembers]"; + echo "
'; thr(); - echo "
$I[admmembers]"; frmadm('status'); - echo "
'.submit($I['change']).'
'; echo "
$I[passreset]"; + echo "
'; thr(); - echo "'; + echo '
$I[passreset]"; frmadm('passreset'); - echo "
'.submit($I['change']).'
'; echo "
$I[regguest]"; + echo "
'; thr(); - echo "'; + echo '
$I[regguest]"; frmadm('register'); - echo "
'.submit($I['register']).'
'; thr(); @@ -1040,13 +1061,13 @@ function send_sessions(){ $lines=[]; } print_start('sessions'); - echo "

$I[sessact]

$I[regmem]
"; + echo "
$I[regmem]
"; frmadm('regnew'); - echo ""; + echo "
$I[nick]  
"; echo "
$I[nick]  
$I[pass] "; echo submit($I['register']).'
"; - echo ""; + echo "

$I[sessact]

$I[sessnick]$I[sesstimeout]$I[sessua]
"; + echo ""; $trackip=(bool) get_setting('trackip'); $memexpire=(int) get_setting('memberexpire'); $guestexpire=(int) get_setting('guestexpire'); - if($trackip) echo ""; - echo ""; + if($trackip) echo ""; + echo ""; foreach($lines as $temp){ if($temp['status']==0){ $s=' (K)'; @@ -1063,7 +1084,7 @@ function send_sessions(){ }else{ $s=' (SA)'; } - echo ''; if($U['status']>$temp['status'] || $U['nickname']===$temp['nickname']){ - echo ""; + echo ""; if($trackip){ - echo ""; + echo ""; } - echo ''; } echo '"; echo ""; echo ""; - echo '
$I[sessnick]$I[sesstimeout]$I[sessua]$I[sesip]$I[actions]
$I[sesip]$I[actions]
'.style_this(htmlspecialchars($temp['nickname']).$s, $temp['style']).''; + echo '
'.style_this(htmlspecialchars($temp['nickname']).$s, $temp['style']).''; if($temp['status']>2){ get_timeout($temp['lastpost'], $memexpire); }else{ @@ -1071,11 +1092,11 @@ function send_sessions(){ } echo '$temp[useragent]$temp[useragent]$temp[ip]$temp[ip]'; + echo ''; if($temp['nickname']!==$U['nickname']){ echo ''; if($temp['status']!=0){ @@ -1093,11 +1114,11 @@ function send_sessions(){ } echo ''; }else{ - echo ''; + echo ''; if($trackip){ - echo ''; + echo ''; } - echo ''; + echo ''; } } echo "
-----
-

"; @@ -1126,6 +1147,7 @@ function check_filter_match(&$reg){ function manage_filter(){ global $db, $memcached; if(isSet($_REQUEST['id'])){ + $reg=0; if($tmp=check_filter_match($reg)){ return $tmp; } @@ -1165,6 +1187,7 @@ function manage_filter(){ function manage_linkfilter(){ global $db, $memcached; if(isSet($_REQUEST['id'])){ + $reg=0; if($tmp=check_filter_match($reg)){ return $tmp; } @@ -1225,7 +1248,7 @@ function get_linkfilters(){ function send_filter($arg=''){ global $H, $I, $U; print_start('filter'); - echo "

$I[filter]

$arg"; + echo "

$I[filter]

$arg
"; thr(); echo ''; + echo '
'; echo ""; @@ -1270,7 +1293,7 @@ function send_filter($arg=''){ echo ""; echo ""; echo ""; - echo '
$I[fid]'.submit($I['change']).'
'.submit($I['change']).'
'; frmadm('filter'); @@ -1282,7 +1305,7 @@ function send_filter($arg=''){ echo "'.submit($I['add']).'
'.submit($I['add']).'

"; echo "<$H[form]>$H[commonform]".hidden('action', 'admin').hidden('do', 'filter').submit($I['reload']).''; print_end(); @@ -1291,10 +1314,10 @@ function send_filter($arg=''){ function send_linkfilter($arg=''){ global $H, $I, $U; print_start('linkfilter'); - echo "

$I[linkfilter]

$arg"; + echo "

$I[linkfilter]

$arg
"; thr(); - echo ''; } echo '"; echo ""; echo ""; - echo '
'; - echo ""; + echo ''; + echo '
$I[fid]
'; + echo ""; echo ""; echo ""; echo ""; @@ -1315,7 +1338,7 @@ function send_linkfilter($arg=''){ echo ""; echo '"; echo ""; - echo '
$I[fid]$I[match]$I[replace]$I[regex]'.submit($I['change']).'
'.submit($I['change']).'
'; frmadm('linkfilter'); @@ -1324,7 +1347,7 @@ function send_linkfilter($arg=''){ echo "'.submit($I['add']).'
'.submit($I['add']).'

"; echo "<$H[form]>$H[commonform]".hidden('action', 'admin').hidden('do', 'linkfilter').submit($I['reload']).''; print_end(); @@ -1391,9 +1414,8 @@ function send_messages(){ $sort=''; } print_start('messages', $U['refresh'], "$_SERVER[SCRIPT_NAME]?action=view&session=$U[session]&lang=$language$nocache$sort"); - echo '
'; echo ''; - echo "$I[bottom]"; + echo "$I[bottom]"; if(!$U['sortupdown']){ echo '
'; echo get_setting('topic'); @@ -1409,15 +1431,13 @@ function send_messages(){ echo get_setting('topic'); echo '
'; } - echo "$I[top]"; - echo '
'; + echo "$I[top]"; print_end(); } function send_inbox(){ global $H, $I, $U, $db; - print_start('messages'); - echo '
'; + print_start('inbox'); echo "<$H[form]>$H[commonform]".hidden('action', 'inbox').hidden('do', 'clean').submit($I['delselmes'], 'class="delbutton"').'

'; $dateformat=get_setting('dateformat'); $tz=3600*$U['tz']; @@ -1452,7 +1472,6 @@ function send_inbox(){ echo " $message[text]
"; } echo "
$H[backtochat]"; - echo ''; print_end(); } @@ -1460,7 +1479,7 @@ function send_notes($type){ global $H, $I, $U, $db; print_start('notes'); if($U['status']>=6){ - echo "'; + echo "
<$H[form] target=\"view\">$H[commonform]".hidden('action', 'notes').hidden('do', 'admin').submit($I['admnotes']).'
'; echo "
<$H[form] target=\"view\">$H[commonform]".hidden('action', 'notes').hidden('do', 'admin').submit($I['admnotes']).'<$H[form] target=\"view\">$H[commonform]".hidden('action', 'notes').submit($I['notes']).'
'; } if($type==='staff'){ @@ -1516,7 +1535,7 @@ function send_notes($type){ echo hidden('action', 'notes')."
'; echo submit($I['savenotes']).'
'; if($num[0]>1){ - echo "
"; + echo "
$I[revisions]
"; if($revision<$num[0]-1){ echo ""; + echo '
$I[revisions]<$H[form]>$H[commonform]".hidden('action', 'notes').hidden('revision', $revision+1); if($type==='admin'){ @@ -1543,19 +1562,19 @@ function send_approve_waiting(){ $result=$db->query('SELECT * FROM ' . PREFIX . 'sessions WHERE entry=0 AND status=1 ORDER BY id;'); if($tmp=$result->fetchAll(PDO::FETCH_ASSOC)){ frmadm('approve'); - echo ''; - echo ""; + echo '
$I[sessnick]$I[sessua]
'; + echo ""; foreach($tmp as $temp){ echo ''.hidden('alls[]', htmlspecialchars($temp['nickname'])); - echo ''; - echo ""; + echo ""; } - echo "
$I[sessnick]$I[sessua]
'; + echo ''; echo '$temp[useragent]
$temp[useragent]

"; + echo "

"; echo ""; echo ""; - echo ""; - echo '
$I[denymessage]
'.submit($I['butallowdeny']).'
'; + echo "
$I[denymessage]
'.submit($I['butallowdeny']).'
'; }else{ echo "$I[waitempty]
"; } @@ -1605,7 +1624,7 @@ function send_waiting_room(){ echo hidden('action', 'logout').submit($I['exit'], 'id="exitbutton"').''; $rulestxt=get_setting('rulestxt'); if(!empty($rulestxt)){ - echo "

$I[rules]

$rulestxt"; + echo "

$I[rules]

$rulestxt
"; } print_end(); } @@ -1614,19 +1633,17 @@ function send_waiting_room(){ function send_choose_messages(){ global $I, $U; print_start('choose_messages'); - echo '
'; frmadm('clean'); echo hidden('what', 'selected').submit($I['delselmes'], 'class="delbutton"').'

'; print_messages($U['status']); echo '
'.submit($I['delselmes'], 'class="delbutton"').""; - echo '
'; print_end(); } function send_del_confirm(){ global $I; print_start('del_confirm'); - echo "
$I[confirm]
"; + echo "
$I[confirm]
"; frmpst('delete'); if(isSet($_REQUEST['multi'])){ echo hidden('multi', 'on'); @@ -1653,13 +1670,13 @@ function send_post(){ if(!isSet($_REQUEST['sendto'])){ $_REQUEST['sendto']=''; } - echo '
'; + echo '
'; frmpst('post'); echo hidden('postid', $U['postid']); if(isSet($_REQUEST['multi'])){ echo hidden('multi', 'on'); } - echo '
'; + echo '
'.style_this(htmlspecialchars($U['nickname']), $U['style']).':
'; if(!isSet($U['rejected'])){ $U['rejected']=''; } @@ -1721,7 +1738,7 @@ function send_post(){ echo ''; if(get_setting('enfileupload')){ if(!$disablepm && ($U['status']>=5 || ($U['status']>=3 && get_count_mods()==0 && get_setting('memkick')))){ - echo '
'.style_this(htmlspecialchars($U['nickname']), $U['style']).':
'; + echo '
'; } printf("", get_setting('maxuploadsize')); } @@ -1729,7 +1746,7 @@ function send_post(){ echo ""; echo ""; } - echo '
$I[maxsize]
'; + echo '
'; frmpst('delete'); if(isSet($_REQUEST['multi'])){ echo hidden('multi', 'on'); @@ -1757,23 +1774,20 @@ function send_greeting(){ global $I, $U, $language; print_start('greeting', $U['refresh'], "$_SERVER[SCRIPT_NAME]?action=view&session=$U[session]&lang=$language"); printf("

$I[greetingmsg]

", style_this(htmlspecialchars($U['nickname']), $U['style'])); - echo '
'; printf("
$I[entryhelp]", $U['refresh']); $rulestxt=get_setting('rulestxt'); if(!empty($rulestxt)){ - echo "

$I[rules]

$rulestxt"; + echo "

$I[rules]

$rulestxt
"; } - echo '
'; print_end(); } function send_help(){ global $H, $I, $U; print_start('help'); - echo '
'; $rulestxt=get_setting('rulestxt'); if(!empty($rulestxt)){ - echo "

$I[rules]

$rulestxt


"; + echo "

$I[rules]

$rulestxt

"; } echo "

$I[help]

$I[helpguest]"; if(get_setting('imgembed')){ @@ -1788,15 +1802,14 @@ function send_help(){ } } } - echo "

$H[backtochat]$H[credit]
"; - echo '
'; + echo "

$H[backtochat]$H[credit]
"; print_end(); } function send_profile($arg=''){ global $F, $H, $I, $L, $U, $db, $language; print_start('profile'); - echo "<$H[form]>$H[commonform]".hidden('action', 'profile').hidden('do', 'save')."

$I[profile]

$arg"; + echo "<$H[form]>$H[commonform]".hidden('action', 'profile').hidden('do', 'save')."

$I[profile]

$arg
"; thr(); $ignored=[]; $stmt=$db->prepare('SELECT ign FROM ' . PREFIX . 'ignored WHERE ignby=?;'); @@ -1805,7 +1818,7 @@ function send_profile($arg=''){ $ignored[]=htmlspecialchars($tmp['ign']); } if(count($ignored)>0){ - echo "
'; thr(); } - echo "
$I[unignore]"; + echo "
$I[unignore]"; echo "
'; thr(); - echo "
$I[ignore]"; + echo "
$I[ignore]"; echo "
"; thr(); preg_match('/#([0-9a-f]{6})/i', $U['style'], $matches); - echo "
$I[refreshrate]"; + echo "
$I[refreshrate]"; echo "
"; thr(); - echo "
$I[fontcolour] ($I[viewexample])"; + echo "
$I[fontcolour] ($I[viewexample])"; echo "
"; thr(); if($U['status']>=3){ - echo "
$I[bgcolour] ($I[viewexample])"; + echo "
$I[bgcolour] ($I[viewexample])"; echo "
$I[fontface]"; + echo "
$I[fontface]"; echo "
 
'.$I[$setting].''; + echo "
".$I[$setting].''; echo "=2 && get_setting('eninbox')){ - echo "
'; thr(); } - echo "
$I[eninbox]"; + echo "
$I[eninbox]"; echo "
'; thr(); - echo "
$I[tz]"; - echo "
$I[tz]"; + echo "
$I[pbsize]"; + echo "'; thr(); if($U['status']>=5){ - echo "
$I[pbsize]"; echo ""; echo ""; echo '
 $I[width] $I[height]
$I[nbsize]"; + echo "'; thr(); } if($U['status']>=2){ - echo "
$I[nbsize]"; echo ""; echo ""; echo '
 $I[width] $I[height]
"; - echo '
$I[changepass]
'; + echo "
"; + echo '"; + echo ""; if($ga===0){ echo ""; } echo '
$I[changepass]
'; echo ""; echo ""; echo ""; @@ -1932,19 +1945,18 @@ function send_profile($arg=''){ if($U['status']>1 && $U['status']<8){ echo "
<$H[form]>$H[commonform]".hidden('action', 'profile').hidden('do', 'delete').submit($I['deleteacc'], 'class="delbutton"').''; } - echo "

$I[changelang]"; + echo "

$I[changelang]"; foreach($L as $lang=>$name){ echo " $name"; } - echo '

'; - echo "
$H[backtochat]"; + echo "


$H[backtochat]"; print_end(); } function send_controls(){ global $H, $I, $U; print_start('controls'); - echo '
 $I[oldpass]
 $I[newpass]
 $I[confirmpass]
'; + echo '
'; echo "'; echo "'; echo "'; @@ -1997,18 +2009,18 @@ function send_logout(){ function send_colours(){ global $H, $I; print_start('colours'); - echo "

$I[colourtable]

"; + echo "

$I[colourtable]

"; for($red=0x00;$red<=0xFF;$red+=0x33){ for($green=0x00;$green<=0xFF;$green+=0x33){ for($blue=0x00;$blue<=0xFF;$blue+=0x33){ $hcol=sprintf('%02X', $red).sprintf('%02X', $green).sprintf('%02X', $blue); - echo "$hcol "; + echo "$hcol "; } echo '
'; } echo '
'; } - echo "
<$H[form]>$H[commonform]".hidden('action', 'profile').submit($I['backtoprofile'], ' class="backbutton"').''; + echo "<$H[form]>$H[commonform]".hidden('action', 'profile').submit($I['backtoprofile'], ' class="backbutton"').''; print_end(); } @@ -2025,19 +2037,19 @@ function send_login(){ if($englobal===1 && isSet($_POST['globalpass'])){ echo hidden('globalpass', $_POST['globalpass']); } - echo '
<$H[form] target=\"post\">$H[commonform]".hidden('action', 'post').submit($I['reloadpb']).'<$H[form] target=\"view\">$H[commonform]".hidden('action', 'view').submit($I['reloadmsgs']).'<$H[form] target=\"view\">$H[commonform]".hidden('action', 'profile').submit($I['chgprofile']).'
'; + echo '
'; if($englobal!==1 || (isSet($_POST['globalpass']) && $_POST['globalpass']==get_setting('globalpass'))){ - echo ""; - echo ""; + echo ""; + echo ""; send_captcha(); if($ga!==0){ if(get_setting('guestreg')!=0){ - echo ""; + echo ""; } if($englobal===2){ - echo ""; + echo ""; } - echo "'; }else{ @@ -2045,21 +2057,21 @@ function send_login(){ } echo '
$I[nick]
$I[pass]
$I[nick]
$I[pass]
$I[regpass]
$I[regpass]
$I[globalloginpass]
$I[globalloginpass]
$I[choosecol]
$I[choosecol]
'.submit($I['enter']).'
'; get_nowchatting(); - echo '

'; + echo '
'; echo get_setting('topic'); echo '
'; $rulestxt=get_setting('rulestxt'); if(!empty($rulestxt)){ - echo "

$I[rules]

$rulestxt
"; + echo "

$I[rules]

$rulestxt
"; } }else{ - echo "
$I[globalloginpass]
$I[globalloginpass]
$I[noguests]
'.submit($I['enter']).'
'; } - echo "

$I[changelang]"; + echo "

$I[changelang]"; foreach($L as $lang=>$name){ echo " $name"; } @@ -2076,7 +2088,7 @@ function send_chat_disabled(){ function send_error($err){ global $H, $I; print_start('error'); - echo "

$I[error]: $err

$H[backtologin]
"; + echo "

$I[error]: $err

$H[backtologin]"; print_end(); } @@ -2116,7 +2128,7 @@ function print_notifications(){ function print_chatters(){ global $I, $U, $db, $language; if(!$U['hidechatters']){ - echo '
'; + echo '
'; $stmt=$db->prepare('SELECT nickname, style, status FROM ' . PREFIX . 'sessions WHERE entry!=0 AND status>0 AND incognito=0 AND nickname NOT IN (SELECT ign FROM '. PREFIX . 'ignored WHERE ignby=?) AND nickname NOT IN (SELECT ignby FROM '. PREFIX . 'ignored WHERE ign=?) ORDER BY status DESC, lastpost DESC;'); $stmt->execute([$U['nickname'], $U['nickname']]); $nc=substr(time(), -6); @@ -2129,13 +2141,13 @@ function print_chatters(){ } } if(!empty($M)){ - echo "'; + echo "'; if(!empty($G)){ echo ''; } } if(!empty($G)){ - echo "'; + echo "'; } echo '
$I[members]: ".implode('   ', $M).'$I[members]: ".implode('   ', $M).'  $I[guests]: ".implode('   ', $G).'$I[guests]: ".implode('   ', $G).'
'; } @@ -2450,13 +2462,14 @@ function get_nowchatting(){ parse_sessions(); $stmt=$db->query('SELECT COUNT(*) FROM ' . PREFIX . 'sessions WHERE entry!=0 AND status>0 AND incognito=0;'); $count=$stmt->fetch(PDO::FETCH_NUM); - echo sprintf($I['curchat'], $count[0]).'
'; + echo '
'.sprintf($I['curchat'], $count[0]).'
'; if(!get_setting('hidechatters')){ $stmt=$db->query('SELECT nickname, style FROM ' . PREFIX . 'sessions WHERE entry!=0 AND status>0 AND incognito=0 ORDER BY status DESC, lastpost DESC;'); while($user=$stmt->fetch(PDO::FETCH_NUM)){ echo style_this(htmlspecialchars($user[0]), $user[1]).'   '; } } + echo '
'; } function parse_sessions(){ @@ -2796,6 +2809,10 @@ function set_new_nickname(){ $stmt->execute(array($_REQUEST['newnickname'], $U['nickname'])); $stmt=$db->prepare('UPDATE ' . PREFIX . 'ignored SET ign=? WHERE ign=?;'); $stmt->execute(array($_REQUEST['newnickname'], $U['nickname'])); + $stmt=$db->prepare('UPDATE ' . PREFIX . 'inbox SET poster=? WHERE poster=?;'); + $stmt->execute(array($_REQUEST['newnickname'], $U['nickname'])); + $stmt=$db->prepare('UPDATE ' . PREFIX . 'inbox SET recipient=? WHERE recipient=?;'); + $stmt->execute(array($_REQUEST['newnickname'], $U['nickname'])); $U['nickname']=$_REQUEST['newnickname']; } return ''; @@ -3468,7 +3485,7 @@ function check_init(){ } function destroy_chat($C){ - global $H, $I, $db, $language; + global $H, $I, $db, $language, $memcached; setcookie(COOKIENAME, false); print_start('destory'); $db->exec('DROP TABLE ' . PREFIX . 'captcha;'); @@ -3557,7 +3574,7 @@ function init_chat(){ $db->exec('CREATE INDEX ' . PREFIX . 'incognito ON ' . PREFIX . 'sessions(incognito);'); $db->exec('CREATE TABLE ' . PREFIX . "settings (setting varchar(50) NOT NULL PRIMARY KEY, value text NOT NULL)$diskengine$charset;"); - $settings=[['guestaccess', '0'], ['globalpass', ''], ['englobalpass', '0'], ['captcha', '0'], ['dateformat', 'm-d H:i:s'], ['rulestxt', ''], ['msgencrypted', '0'], ['dbversion', DBVERSION], ['css', 'a:visited{color:#B33CB4;} a:active{color:#FF0033;} a:link{color:#0000FF;} input,select,textarea{color:#FFFFFF;background-color:#000000;} a img{width:15%} a:hover img{width:35%} .error{color:#FF0033;} .delbutton{background-color:#660000;} .backbutton{background-color:#004400;} #exitbutton{background-color:#AA0000;} .center-table{margin-left:auto;margin-right:auto;} body{text-align:center;} .left-table{width:100%;text-align:left;} .right{text-align:right;} .left{text-align:left;} .right-table{border-spacing:0px;margin-left:auto;} .padded{padding:5px;} #chatters{max-height:100px;overflow-y:auto;} .center{text-align:center;}'], ['memberexpire', '60'], ['guestexpire', '15'], ['kickpenalty', '10'], ['entrywait', '120'], ['messageexpire', '14400'], ['messagelimit', '150'], ['maxmessage', 2000], ['captchatime', '600'], ['colbg', '000000'], ['coltxt', 'FFFFFF'], ['maxname', '20'], ['minpass', '5'], ['defaultrefresh', '20'], ['dismemcaptcha', '0'], ['suguests', '0'], ['imgembed', '1'], ['timestamps', '1'], ['trackip', '0'], ['captchachars', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'], ['memkick', '1'], ['forceredirect', '0'], ['redirect', ''], ['incognito', '1'], ['chatname', 'My Chat'], ['topic', ''], ['msgsendall', $I['sendallmsg']], ['msgsendmem', $I['sendmemmsg']], ['msgsendmod', $I['sendmodmsg']], ['msgsendadm', $I['sendadmmsg']], ['msgsendprv', $I['sendprvmsg']], ['msgenter', $I['entermsg']], ['msgexit', $I['exitmsg']], ['msgmemreg', $I['memregmsg']], ['msgsureg', $I['suregmsg']], ['msgkick', $I['kickmsg']], ['msgmultikick', $I['multikickmsg']], ['msgallkick', $I['allkickmsg']], ['msgclean', $I['cleanmsg']], ['numnotes', '3'], ['mailsender', 'www-data '], ['mailreceiver', 'Webmaster '], ['sendmail', '0'], ['modfallback', '1'], ['guestreg', '0'], ['disablepm', '0'], ['disabletext', "

$I[disabledtext]

"], ['defaulttz', '0'], ['eninbox', '0'], ['passregex', '.*'], ['nickregex', '^[A-Za-z0-9]*$'], ['externalcss', ''], ['enablegreeting', '0'], ['sortupdown', '0'], ['hidechatters', '0'], ['enfileupload', '0'], ['msgattache', '%2$s [%1$s]'], ['maxuploadsize', '1024']]; + $settings=[['guestaccess', '0'], ['globalpass', ''], ['englobalpass', '0'], ['captcha', '0'], ['dateformat', 'm-d H:i:s'], ['rulestxt', ''], ['msgencrypted', '0'], ['dbversion', DBVERSION], ['css', ''], ['memberexpire', '60'], ['guestexpire', '15'], ['kickpenalty', '10'], ['entrywait', '120'], ['messageexpire', '14400'], ['messagelimit', '150'], ['maxmessage', 2000], ['captchatime', '600'], ['colbg', '000000'], ['coltxt', 'FFFFFF'], ['maxname', '20'], ['minpass', '5'], ['defaultrefresh', '20'], ['dismemcaptcha', '0'], ['suguests', '0'], ['imgembed', '1'], ['timestamps', '1'], ['trackip', '0'], ['captchachars', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'], ['memkick', '1'], ['forceredirect', '0'], ['redirect', ''], ['incognito', '1'], ['chatname', 'My Chat'], ['topic', ''], ['msgsendall', $I['sendallmsg']], ['msgsendmem', $I['sendmemmsg']], ['msgsendmod', $I['sendmodmsg']], ['msgsendadm', $I['sendadmmsg']], ['msgsendprv', $I['sendprvmsg']], ['msgenter', $I['entermsg']], ['msgexit', $I['exitmsg']], ['msgmemreg', $I['memregmsg']], ['msgsureg', $I['suregmsg']], ['msgkick', $I['kickmsg']], ['msgmultikick', $I['multikickmsg']], ['msgallkick', $I['allkickmsg']], ['msgclean', $I['cleanmsg']], ['numnotes', '3'], ['mailsender', 'www-data '], ['mailreceiver', 'Webmaster '], ['sendmail', '0'], ['modfallback', '1'], ['guestreg', '0'], ['disablepm', '0'], ['disabletext', "

$I[disabledtext]

"], ['defaulttz', '0'], ['eninbox', '0'], ['passregex', '.*'], ['nickregex', '^[A-Za-z0-9]*$'], ['externalcss', ''], ['enablegreeting', '0'], ['sortupdown', '0'], ['hidechatters', '0'], ['enfileupload', '0'], ['msgattache', '%2$s [%1$s]'], ['maxuploadsize', '1024']]; $stmt=$db->prepare('INSERT INTO ' . PREFIX . 'settings (setting, value) VALUES (?, ?);'); foreach($settings as $pair){ $stmt->execute($pair); @@ -3649,7 +3666,7 @@ function update_db(){ $db->exec('ALTER TABLE ' . PREFIX . 'messages DROP postid;'); } if($dbversion<10){ - $db->exec('INSERT INTO ' . PREFIX . "settings (setting, value) VALUES ('css', 'a:visited{color:#B33CB4;} a:active{color:#FF0033;} a:link{color:#0000FF;} input,select,textarea{color:#FFFFFF;background-color:#000000;} a img{width:15%} a:hover img{width:35%} .error{color:#FF0033;} .delbutton{background-color:#660000;} .backbutton{background-color:#004400;} #exitbutton{background-color:#AA0000;}'), ('memberexpire', '60'), ('guestexpire', '15'), ('kickpenalty', '10'), ('entrywait', '120'), ('messageexpire', '14400'), ('messagelimit', '150'), ('maxmessage', 2000), ('captchatime', '600');"); + $db->exec('INSERT INTO ' . PREFIX . "settings (setting, value) VALUES ('css', ''), ('memberexpire', '60'), ('guestexpire', '15'), ('kickpenalty', '10'), ('entrywait', '120'), ('messageexpire', '14400'), ('messagelimit', '150'), ('maxmessage', 2000), ('captchatime', '600');"); $db->exec('ALTER TABLE ' . PREFIX . 'sessions ADD ip varchar(45) NOT NULL;'); } if($dbversion<11){ @@ -3711,11 +3728,6 @@ function update_db(){ if($dbversion<15){ $db->exec('INSERT INTO ' . PREFIX . "settings (setting, value) VALUES ('mailsender', 'www-data '), ('mailreceiver', 'Webmaster '), ('sendmail', '0'), ('modfallback', '1'), ('guestreg', '0');"); } - if($dbversion<16){ - $css=get_setting('css'); - $css.=' .center-table{margin-left:auto;margin-right:auto;} body{text-align:center;} .left-table{width:100%;text-align:left;} .right{text-align:right;} .left{text-align:left;} .right-table{border-spacing:0px;margin-left:auto;} .padded{padding:5px;} #chatters{max-height:100px;overflow-y:auto;} .center{text-align:center;}'; - update_setting('css', $css); - } if($dbversion<17){ $db->exec('ALTER TABLE ' . PREFIX . 'sessions ADD COLUMN nocache smallint NOT NULL DEFAULT 0;'); $db->exec('ALTER TABLE ' . PREFIX . 'members ADD COLUMN nocache smallint NOT NULL DEFAULT 0;'); @@ -3818,7 +3830,7 @@ function update_db(){ } $db->exec('CREATE INDEX ' . PREFIX . 'inbox_poster ON ' . PREFIX . 'inbox(poster);'); $db->exec('CREATE INDEX ' . PREFIX . 'inbox_recipient ON ' . PREFIX . 'inbox(recipient);'); - $result=$olddb->query('SELECT filtermatch, filterreplace, regex FROM ' . PREFIX . 'filter;'); + $result=$olddb->query('SELECT filtermatch, filterreplace, regex FROM ' . PREFIX . 'linkfilter;'); $data=$result->fetchAll(PDO::FETCH_NUM); $db->exec('DROP TABLE ' . PREFIX . 'linkfilter;'); $db->exec('CREATE TABLE ' . PREFIX . "linkfilter (id integer PRIMARY KEY AUTO_INCREMENT, filtermatch varchar(255) NOT NULL, filterreplace varchar(255) NOT NULL, regex smallint NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;"); @@ -4053,6 +4065,7 @@ function load_lang(){ } include('lang_en.php'); //always include English if($language!=='en'){ + $T=[]; include("lang_$language.php"); //replace with translation if available foreach($T as $name=>$translation){ $I[$name]=$translation; diff --git a/lang_de.php b/lang_de.php index c7da9c7..34d5a39 100644 --- a/lang_de.php +++ b/lang_de.php @@ -72,7 +72,7 @@ $T=array( 'selection' => 'Auswahl', 'cleannick' => 'Folgender Nickname:', 'clean' => 'Löschen', - 'kickchat' => 'Teilnehmer rausschmeißen (%d Minuten)', + 'kickchat' => 'Teilnehmer rausschmeißen (%d Minuten)', 'kickreason' => 'Begründung:', 'kickpurge' => 'Nachrichten löschen', 'kick' => 'Rausschmeißen', diff --git a/lang_en.php b/lang_en.php index 2403d1a..8816046 100644 --- a/lang_en.php +++ b/lang_en.php @@ -72,7 +72,7 @@ $I=array( 'selection' => 'Selection', 'cleannick' => 'Following nickname:', 'clean' => 'Clean', - 'kickchat' => 'Kick Chatter (%d minutes)', + 'kickchat' => 'Kick Chatter (%d minutes)', 'kickreason' => 'Kickmessage:', 'kickpurge' => 'Purge messages', 'kick' => 'Kick', diff --git a/lang_es_AR.php b/lang_es_AR.php index f2c407c..ba00a4e 100644 --- a/lang_es_AR.php +++ b/lang_es_AR.php @@ -70,7 +70,7 @@ $T=array( 'selection' => 'Selección', 'cleannick' => 'Following nickname:', 'clean' => 'Clean', - 'kickchat' => 'Expulsado (%d minutos)', + 'kickchat' => 'Expulsado (%d minutos)', 'kickreason' => 'Motivo de expulsión:', 'kickpurge' => 'Mensaje de purga', 'kick' => 'Expulsar', diff --git a/lang_es_ES.php b/lang_es_ES.php index 86978c6..1238846 100644 --- a/lang_es_ES.php +++ b/lang_es_ES.php @@ -70,7 +70,7 @@ $T=array( 'selection' => 'Selección', 'cleannick' => 'Following nickname:', 'clean' => 'Clean', - 'kickchat' => 'Expulsado (%d minutos)', + 'kickchat' => 'Expulsado (%d minutos)', 'kickreason' => 'Motivo de expulsión:', 'kickpurge' => 'Mensaje de purga', 'kick' => 'Expulsar', diff --git a/lang_fr.php b/lang_fr.php index 8d0b178..c9c8c25 100644 --- a/lang_fr.php +++ b/lang_fr.php @@ -70,7 +70,7 @@ $T=array( 'selection' => 'Sélection', 'cleannick' => 'Suivre le pseudo:', 'clean' => 'Nettoyé', - 'kickchat' => 'Pseudos éjectés (%d minutes)', + 'kickchat' => 'Pseudos éjectés (%d minutes)', 'kickreason' => 'Messages interdis:', 'kickpurge' => 'Purger les messages', 'kick' => 'Banni / éjecté', diff --git a/lang_id.php b/lang_id.php index 8a1738e..7fb65d3 100644 --- a/lang_id.php +++ b/lang_id.php @@ -70,7 +70,7 @@ $T=array( 'selection' => 'Pilihan', 'cleannick' => 'Nama berikut:', 'clean' => 'Bersih', - 'kickchat' => 'Usir pengobrol (%d menit)', + 'kickchat' => 'Usir pengobrol (%d menit)', 'kickreason' => 'pesan pengusiran:', 'kickpurge' => 'Bersihkan pesan', 'kick' => 'Usir', diff --git a/lang_ru.php b/lang_ru.php index 8bb648d..ecaa8a2 100644 --- a/lang_ru.php +++ b/lang_ru.php @@ -70,7 +70,7 @@ $T=array( 'selection' => 'Выбор', 'cleannick' => 'По нику:', 'clean' => 'Очистить', - 'kickchat' => 'Бан (%d минут)', + 'kickchat' => 'Бан (%d минут)', 'kickreason' => 'Сообщение забаненому', 'kickpurge' => 'Очистка сообщений', 'kick' => 'Бан',