Allow disabling applying of kick filters on moderators
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
Version 1.23 - Dec. 25, 2016
|
||||||
Optimizations
|
Optimizations
|
||||||
More secure session key generation and password storage
|
More secure session key generation and password storage
|
||||||
Add option to make your own font small
|
Add option to make your own font small
|
||||||
@@ -5,6 +6,7 @@ Separate changing nickname and password
|
|||||||
Use PHPs native timezones
|
Use PHPs native timezones
|
||||||
Add message asking for manual refresh, when it stopped working
|
Add message asking for manual refresh, when it stopped working
|
||||||
Add personal notes
|
Add personal notes
|
||||||
|
Allow disabling applying of kick filters on moderators
|
||||||
|
|
||||||
Version 1.22.1 - Nov. 13, 2016
|
Version 1.22.1 - Nov. 13, 2016
|
||||||
Performance optimizations
|
Performance optimizations
|
||||||
|
50
chat.php
50
chat.php
@@ -57,6 +57,7 @@ route();
|
|||||||
function route(){
|
function route(){
|
||||||
global $U;
|
global $U;
|
||||||
if(!isset($_REQUEST['action'])){
|
if(!isset($_REQUEST['action'])){
|
||||||
|
update_db();
|
||||||
send_login();
|
send_login();
|
||||||
}elseif($_REQUEST['action']==='view'){
|
}elseif($_REQUEST['action']==='view'){
|
||||||
check_session();
|
check_session();
|
||||||
@@ -228,7 +229,7 @@ function route_setup(){
|
|||||||
if(!valid_admin()){
|
if(!valid_admin()){
|
||||||
send_alogin();
|
send_alogin();
|
||||||
}
|
}
|
||||||
$C['bool_settings']=['suguests', 'imgembed', 'timestamps', 'trackip', 'memkick', 'forceredirect', 'incognito', 'sendmail', 'modfallback', 'disablepm', 'eninbox', 'enablegreeting', 'sortupdown', 'hidechatters', 'enfileupload'];
|
$C['bool_settings']=['suguests', 'imgembed', 'timestamps', 'trackip', 'memkick', 'forceredirect', 'incognito', 'sendmail', 'modfallback', 'disablepm', 'eninbox', 'enablegreeting', 'sortupdown', 'hidechatters', 'enfileupload', 'personalnotes', 'filtermodkick'];
|
||||||
$C['colour_settings']=['colbg', 'coltxt'];
|
$C['colour_settings']=['colbg', 'coltxt'];
|
||||||
$C['msg_settings']=['msgenter', 'msgexit', 'msgmemreg', 'msgsureg', 'msgkick', 'msgmultikick', 'msgallkick', 'msgclean', 'msgsendall', 'msgsendmem', 'msgsendmod', 'msgsendadm', 'msgsendprv', 'msgattache'];
|
$C['msg_settings']=['msgenter', 'msgexit', 'msgmemreg', 'msgsureg', 'msgkick', 'msgmultikick', 'msgallkick', 'msgclean', 'msgsendall', 'msgsendmem', 'msgsendmod', 'msgsendadm', 'msgsendprv', 'msgattache'];
|
||||||
$C['number_settings']=['memberexpire', 'guestexpire', 'kickpenalty', 'entrywait', 'captchatime', 'messageexpire', 'messagelimit', 'maxmessage', 'maxname', 'minpass', 'defaultrefresh', 'numnotes', 'maxuploadsize'];
|
$C['number_settings']=['memberexpire', 'guestexpire', 'kickpenalty', 'entrywait', 'captchatime', 'messageexpire', 'messagelimit', 'maxmessage', 'maxname', 'minpass', 'defaultrefresh', 'numnotes', 'maxuploadsize'];
|
||||||
@@ -805,6 +806,9 @@ function send_backup($C){
|
|||||||
if(isset($_REQUEST['notes'])){
|
if(isset($_REQUEST['notes'])){
|
||||||
$result=$db->query('SELECT * FROM ' . PREFIX . "notes;");
|
$result=$db->query('SELECT * FROM ' . PREFIX . "notes;");
|
||||||
while($note=$result->fetch(PDO::FETCH_ASSOC)){
|
while($note=$result->fetch(PDO::FETCH_ASSOC)){
|
||||||
|
if(MSGENCRYPTED){
|
||||||
|
$note['text']=openssl_decrypt($note['text'], 'aes-256-cbc', ENCRYPTKEY, 0, '1234567890123456');
|
||||||
|
}
|
||||||
$code['notes'][]=$note;
|
$code['notes'][]=$note;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1492,11 +1496,6 @@ function send_inbox(){
|
|||||||
}else{
|
}else{
|
||||||
$timestamps=false;
|
$timestamps=false;
|
||||||
}
|
}
|
||||||
if(MSGENCRYPTED){
|
|
||||||
if(!extension_loaded('openssl')){
|
|
||||||
send_fatal_error($I['opensslextrequired']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($U['sortupdown']){
|
if($U['sortupdown']){
|
||||||
$direction='ASC';
|
$direction='ASC';
|
||||||
}else{
|
}else{
|
||||||
@@ -1543,9 +1542,6 @@ function send_notes($type){
|
|||||||
}
|
}
|
||||||
if(isset($_REQUEST['text'])){
|
if(isset($_REQUEST['text'])){
|
||||||
if(MSGENCRYPTED){
|
if(MSGENCRYPTED){
|
||||||
if(!extension_loaded('openssl')){
|
|
||||||
send_fatal_error($I['opensslextrequired']);
|
|
||||||
}
|
|
||||||
$_REQUEST['text']=openssl_encrypt($_REQUEST['text'], 'aes-256-cbc', ENCRYPTKEY, 0, '1234567890123456');
|
$_REQUEST['text']=openssl_encrypt($_REQUEST['text'], 'aes-256-cbc', ENCRYPTKEY, 0, '1234567890123456');
|
||||||
}
|
}
|
||||||
$time=time();
|
$time=time();
|
||||||
@@ -1583,9 +1579,6 @@ function send_notes($type){
|
|||||||
$stmt->execute([$U['nickname']]);
|
$stmt->execute([$U['nickname']]);
|
||||||
$settings=$stmt->fetch(PDO::FETCH_ASSOC);
|
$settings=$stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
if(MSGENCRYPTED){
|
if(MSGENCRYPTED){
|
||||||
if(!extension_loaded('openssl')){
|
|
||||||
send_fatal_error($I['opensslextrequired']);
|
|
||||||
}
|
|
||||||
$note['text']=openssl_decrypt($note['text'], 'aes-256-cbc', ENCRYPTKEY, 0, '1234567890123456');
|
$note['text']=openssl_decrypt($note['text'], 'aes-256-cbc', ENCRYPTKEY, 0, '1234567890123456');
|
||||||
}
|
}
|
||||||
echo "</p>".form('notes');
|
echo "</p>".form('notes');
|
||||||
@@ -2980,7 +2973,7 @@ function validate_input(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function apply_filter($message, $poststatus, $nickname){
|
function apply_filter($message, $poststatus, $nickname){
|
||||||
global $I;
|
global $I, $U;
|
||||||
$message=str_replace('<br>', "\n", $message);
|
$message=str_replace('<br>', "\n", $message);
|
||||||
$message=apply_mention($message);
|
$message=apply_mention($message);
|
||||||
$filters=get_filters();
|
$filters=get_filters();
|
||||||
@@ -2992,7 +2985,7 @@ function apply_filter($message, $poststatus, $nickname){
|
|||||||
$message=preg_replace("/$filter[match]/iu", $filter['replace'], $message, -1, $count);
|
$message=preg_replace("/$filter[match]/iu", $filter['replace'], $message, -1, $count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isset($count) && $count>0 && $filter['kick']){
|
if(isset($count) && $count>0 && $filter['kick'] && ($U['status']<5 || get_setting('filtermodkick'))){
|
||||||
kick_chatter([$nickname], $filter['replace'], false);
|
kick_chatter([$nickname], $filter['replace'], false);
|
||||||
setcookie(COOKIENAME, false);
|
setcookie(COOKIENAME, false);
|
||||||
$_REQUEST['session']='';
|
$_REQUEST['session']='';
|
||||||
@@ -3146,11 +3139,8 @@ function add_system_message($mes){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function write_message($message){
|
function write_message($message){
|
||||||
global $I, $db;
|
global $db;
|
||||||
if(MSGENCRYPTED){
|
if(MSGENCRYPTED){
|
||||||
if(!extension_loaded('openssl')){
|
|
||||||
send_fatal_error($I['opensslextrequired']);
|
|
||||||
}
|
|
||||||
$message['text']=openssl_encrypt($message['text'], 'aes-256-cbc', ENCRYPTKEY, 0, '1234567890123456');
|
$message['text']=openssl_encrypt($message['text'], 'aes-256-cbc', ENCRYPTKEY, 0, '1234567890123456');
|
||||||
}
|
}
|
||||||
$stmt=$db->prepare('INSERT INTO ' . PREFIX . 'messages (postdate, poststatus, poster, recipient, text, delstatus) VALUES (?, ?, ?, ?, ?, ?);');
|
$stmt=$db->prepare('INSERT INTO ' . PREFIX . 'messages (postdate, poststatus, poster, recipient, text, delstatus) VALUES (?, ?, ?, ?, ?, ?);');
|
||||||
@@ -3218,7 +3208,7 @@ function del_last_message(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function print_messages($delstatus=0){
|
function print_messages($delstatus=0){
|
||||||
global $I, $U, $db;
|
global $U, $db;
|
||||||
$dateformat=get_setting('dateformat');
|
$dateformat=get_setting('dateformat');
|
||||||
if(!$U['embed'] && get_setting('imgembed')){
|
if(!$U['embed'] && get_setting('imgembed')){
|
||||||
$removeEmbed=true;
|
$removeEmbed=true;
|
||||||
@@ -3230,11 +3220,6 @@ function print_messages($delstatus=0){
|
|||||||
}else{
|
}else{
|
||||||
$timestamps=false;
|
$timestamps=false;
|
||||||
}
|
}
|
||||||
if(MSGENCRYPTED){
|
|
||||||
if(!extension_loaded('openssl')){
|
|
||||||
send_fatal_error($I['opensslextrequired']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($U['sortupdown']){
|
if($U['sortupdown']){
|
||||||
$direction='ASC';
|
$direction='ASC';
|
||||||
}else{
|
}else{
|
||||||
@@ -3525,6 +3510,7 @@ function destroy_chat($C){
|
|||||||
}
|
}
|
||||||
$memcached->delete(DBNAME . '-' . PREFIX . 'settings-dbversion');
|
$memcached->delete(DBNAME . '-' . PREFIX . 'settings-dbversion');
|
||||||
$memcached->delete(DBNAME . '-' . PREFIX . 'settings-msgencrypted');
|
$memcached->delete(DBNAME . '-' . PREFIX . 'settings-msgencrypted');
|
||||||
|
$memcached->delete(DBNAME . '-' . PREFIX . 'settings-nextcron');
|
||||||
}
|
}
|
||||||
echo "<h2>$I[destroyed]</h2><br><br><br>";
|
echo "<h2>$I[destroyed]</h2><br><br><br>";
|
||||||
echo form('setup').submit($I['init']).'</form>'.credit();
|
echo form('setup').submit($I['init']).'</form>'.credit();
|
||||||
@@ -3685,6 +3671,7 @@ function init_chat(){
|
|||||||
'eninbox' =>0,
|
'eninbox' =>0,
|
||||||
'sortupdown' =>0,
|
'sortupdown' =>0,
|
||||||
'hidechatters' =>0,
|
'hidechatters' =>0,
|
||||||
|
'filtermodkick' =>1,
|
||||||
];
|
];
|
||||||
$stmt=$db->prepare('INSERT INTO ' . PREFIX . 'members (nickname, passhash, status, refresh, bgcolour, timestamps, style, embed, incognito, nocache, tz, eninbox, sortupdown, hidechatters, nocache_old) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);');
|
$stmt=$db->prepare('INSERT INTO ' . PREFIX . 'members (nickname, passhash, status, refresh, bgcolour, timestamps, style, embed, incognito, nocache, tz, eninbox, sortupdown, hidechatters, nocache_old) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);');
|
||||||
$stmt->execute([$reg['nickname'], $reg['passhash'], $reg['status'], $reg['refresh'], $reg['bgcolour'], $reg['timestamps'], $reg['style'], $reg['embed'], $reg['incognito'], $reg['nocache'], $reg['tz'], $reg['eninbox'], $reg['sortupdown'], $reg['hidechatters'], $reg['nocache_old']]);
|
$stmt->execute([$reg['nickname'], $reg['passhash'], $reg['status'], $reg['refresh'], $reg['bgcolour'], $reg['timestamps'], $reg['style'], $reg['embed'], $reg['incognito'], $reg['nocache'], $reg['tz'], $reg['eninbox'], $reg['sortupdown'], $reg['hidechatters'], $reg['nocache_old']]);
|
||||||
@@ -3699,7 +3686,10 @@ function init_chat(){
|
|||||||
function update_db(){
|
function update_db(){
|
||||||
global $I, $db, $memcached;
|
global $I, $db, $memcached;
|
||||||
$dbversion=(int) get_setting('dbversion');
|
$dbversion=(int) get_setting('dbversion');
|
||||||
if($dbversion<DBVERSION || get_setting('msgencrypted')!=MSGENCRYPTED){
|
$msgencrypted=(bool) get_setting('msgencrypted');
|
||||||
|
if($dbversion>=DBVERSION && $msgencrypted===MSGENCRYPTED){
|
||||||
|
return;
|
||||||
|
}
|
||||||
ignore_user_abort(true);
|
ignore_user_abort(true);
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
if(DBDRIVER===0){//MySQL
|
if(DBDRIVER===0){//MySQL
|
||||||
@@ -4005,8 +3995,11 @@ function update_db(){
|
|||||||
$db->exec('CREATE INDEX ' . PREFIX . 'notes_type ON ' . PREFIX . 'notes(type);');
|
$db->exec('CREATE INDEX ' . PREFIX . 'notes_type ON ' . PREFIX . 'notes(type);');
|
||||||
$db->exec('CREATE INDEX ' . PREFIX . 'notes_editedby ON ' . PREFIX . 'notes(editedby);');
|
$db->exec('CREATE INDEX ' . PREFIX . 'notes_editedby ON ' . PREFIX . 'notes(editedby);');
|
||||||
}
|
}
|
||||||
|
if($dbversion<40){
|
||||||
|
$db->exec('INSERT INTO ' . PREFIX . "settings (setting, value) VALUES ('filtermodkick', '1');");
|
||||||
|
}
|
||||||
update_setting('dbversion', DBVERSION);
|
update_setting('dbversion', DBVERSION);
|
||||||
if(get_setting('msgencrypted')!=MSGENCRYPTED){
|
if($msgencrypted!==MSGENCRYPTED){
|
||||||
if(!extension_loaded('openssl')){
|
if(!extension_loaded('openssl')){
|
||||||
send_fatal_error($I['opensslextrequired']);
|
send_fatal_error($I['opensslextrequired']);
|
||||||
}
|
}
|
||||||
@@ -4033,7 +4026,6 @@ function update_db(){
|
|||||||
update_setting('msgencrypted', (int) MSGENCRYPTED);
|
update_setting('msgencrypted', (int) MSGENCRYPTED);
|
||||||
}
|
}
|
||||||
send_update($msg);
|
send_update($msg);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_setting($setting){
|
function get_setting($setting){
|
||||||
@@ -4175,8 +4167,8 @@ function load_lang(){
|
|||||||
|
|
||||||
function load_config(){
|
function load_config(){
|
||||||
mb_internal_encoding('UTF-8');
|
mb_internal_encoding('UTF-8');
|
||||||
define('VERSION', '1.22.1'); // Script version
|
define('VERSION', '1.23'); // Script version
|
||||||
define('DBVERSION', 39); // Database layout version
|
define('DBVERSION', 40); // Database layout version
|
||||||
define('MSGENCRYPTED', false); // Store messages encrypted in the database to prevent other database users from reading them - true/false - visit the setup page after editing!
|
define('MSGENCRYPTED', false); // Store messages encrypted in the database to prevent other database users from reading them - true/false - visit the setup page after editing!
|
||||||
define('ENCRYPTKEY', 'MY_KEY'); // Encryption key for messages
|
define('ENCRYPTKEY', 'MY_KEY'); // Encryption key for messages
|
||||||
define('DBHOST', 'localhost'); // Database host
|
define('DBHOST', 'localhost'); // Database host
|
||||||
|
@@ -368,5 +368,6 @@ $T=[
|
|||||||
'cssupdate' => 'Hinweis: Standard CSS ist jetzt hardcoded und kann aus der CSS Einstellung entfernt werden',
|
'cssupdate' => 'Hinweis: Standard CSS ist jetzt hardcoded und kann aus der CSS Einstellung entfernt werden',
|
||||||
'manualrefresh' => 'Manuelles Neuladen erforderlich',
|
'manualrefresh' => 'Manuelles Neuladen erforderlich',
|
||||||
'personalnotes' => 'Persönliche Notizen',
|
'personalnotes' => 'Persönliche Notizen',
|
||||||
|
'filtermodkick' => 'Kickfilter auf Moderatoren anwenden',
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
|
@@ -368,5 +368,6 @@ $I=[
|
|||||||
'cssupdate' => 'Note: Default CSS is now hardcoded and can be removed from the CSS setting',
|
'cssupdate' => 'Note: Default CSS is now hardcoded and can be removed from the CSS setting',
|
||||||
'manualrefresh' => 'Manual refresh required',
|
'manualrefresh' => 'Manual refresh required',
|
||||||
'personalnotes' => 'Personal notes',
|
'personalnotes' => 'Personal notes',
|
||||||
|
'filtermodkick' => 'Apply kick filter on moderators',
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user