Added new options to hide buttons, customize refresh limits and allow js
This commit is contained in:
148
chat.php
148
chat.php
@ -40,6 +40,7 @@ $U=[];// This user data
|
|||||||
$db = null;// Database connection
|
$db = null;// Database connection
|
||||||
$memcached = null;// Memcached connection
|
$memcached = null;// Memcached connection
|
||||||
$language = LANG;// user selected language
|
$language = LANG;// user selected language
|
||||||
|
$scripts = []; //js enhancements
|
||||||
$styles = []; //css styles
|
$styles = []; //css styles
|
||||||
$session = $_REQUEST['session'] ?? ''; //requested session
|
$session = $_REQUEST['session'] ?? ''; //requested session
|
||||||
// set session variable to cookie if cookies are enabled
|
// set session variable to cookie if cookies are enabled
|
||||||
@ -94,7 +95,7 @@ function route(){
|
|||||||
if(!isset($_POST['what'])){
|
if(!isset($_POST['what'])){
|
||||||
}elseif($_POST['what']==='all'){
|
}elseif($_POST['what']==='all'){
|
||||||
if(isset($_POST['confirm'])){
|
if(isset($_POST['confirm'])){
|
||||||
del_all_messages($U['nickname'], (int) ($U['status']==1 ? $U['entry'] : 0));
|
del_all_messages('', (int) ($U['status']==1 ? $U['entry'] : 0));
|
||||||
}else{
|
}else{
|
||||||
send_del_confirm();
|
send_del_confirm();
|
||||||
}
|
}
|
||||||
@ -236,10 +237,10 @@ function route_setup(){
|
|||||||
if(!valid_admin()){
|
if(!valid_admin()){
|
||||||
send_alogin();
|
send_alogin();
|
||||||
}
|
}
|
||||||
$C['bool_settings']=['suguests', 'imgembed', 'timestamps', 'trackip', 'memkick', 'memkickalways', 'forceredirect', 'incognito', 'sendmail', 'modfallback', 'disablepm', 'eninbox', 'enablegreeting', 'sortupdown', 'hidechatters', 'personalnotes', 'publicnotes', 'filtermodkick', 'namedoers'];
|
$C['bool_settings']=['suguests', 'imgembed', 'timestamps', 'trackip', 'memkick', 'memkickalways', 'forceredirect', 'incognito', 'sendmail', 'modfallback', 'disablepm', 'eninbox', 'enablegreeting', 'sortupdown', 'hidechatters', 'personalnotes', 'publicnotes', 'filtermodkick', 'namedoers', 'hide_reload_post_box', 'hide_reload_messages', 'hide_profile', 'hide_admin', 'hide_notes', 'hide_clone', 'hide_rearrange', 'hide_help', 'postbox_delete_globally', 'allow_js'];
|
||||||
$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', 'enfileupload'];
|
$C['number_settings']=['memberexpire', 'guestexpire', 'kickpenalty', 'entrywait', 'captchatime', 'messageexpire', 'messagelimit', 'maxmessage', 'maxname', 'minpass', 'defaultrefresh', 'numnotes', 'maxuploadsize', 'enfileupload', 'max_refresh_rate', 'min_refresh_rate'];
|
||||||
$C['textarea_settings']=['rulestxt', 'css', 'disabletext'];
|
$C['textarea_settings']=['rulestxt', 'css', 'disabletext'];
|
||||||
$C['text_settings']=['dateformat', 'captchachars', 'redirect', 'chatname', 'mailsender', 'mailreceiver', 'nickregex', 'passregex', 'externalcss', 'metadescription', 'sysmessagetxt'];
|
$C['text_settings']=['dateformat', 'captchachars', 'redirect', 'chatname', 'mailsender', 'mailreceiver', 'nickregex', 'passregex', 'externalcss', 'metadescription', 'sysmessagetxt'];
|
||||||
$C['settings']=array_merge(['guestaccess', 'englobalpass', 'globalpass', 'captcha', 'dismemcaptcha', 'topic', 'guestreg', 'defaulttz'], $C['bool_settings'], $C['colour_settings'], $C['msg_settings'], $C['number_settings'], $C['textarea_settings'], $C['text_settings']); // All settings in the database
|
$C['settings']=array_merge(['guestaccess', 'englobalpass', 'globalpass', 'captcha', 'dismemcaptcha', 'topic', 'guestreg', 'defaulttz'], $C['bool_settings'], $C['colour_settings'], $C['msg_settings'], $C['number_settings'], $C['textarea_settings'], $C['text_settings']); // All settings in the database
|
||||||
@ -262,8 +263,8 @@ function route_setup(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// html output subs
|
// html output subs
|
||||||
function prepare_stylesheets(bool $init = false){
|
function prepare_stylesheets(string $class){
|
||||||
global $U, $db, $styles;
|
global $U, $db, $scripts, $styles;
|
||||||
$styles['fatal_error'] = 'body{background-color:#000000;color:#FF0033}';
|
$styles['fatal_error'] = 'body{background-color:#000000;color:#FF0033}';
|
||||||
$styles['default'] = 'body,iframe{background-color:#000000;color:#FFFFFF;font-size:14px;text-align:center}';
|
$styles['default'] = 'body,iframe{background-color:#000000;color:#FFFFFF;font-size:14px;text-align:center}';
|
||||||
$styles['default'] .= 'a:visited{color:#B33CB4} a:link{color:#00A2D4} a:active{color:#55A2D4} #messages{word-wrap:break-word}';
|
$styles['default'] .= 'a:visited{color:#B33CB4} a:link{color:#00A2D4} a:active{color:#55A2D4} #messages{word-wrap:break-word}';
|
||||||
@ -289,7 +290,7 @@ function prepare_stylesheets(bool $init = false){
|
|||||||
$styles['default'] .= '@keyframes timeout_messages{0%{top:-200%} 99%{top:-200%} 100%{top:0%}} ';
|
$styles['default'] .= '@keyframes timeout_messages{0%{top:-200%} 99%{top:-200%} 100%{top:0%}} ';
|
||||||
$styles['default'] .= '.notes textarea{height:80vh;width:80%} iframe{width:100%;height:100%;margin:0;padding:0;border:none}';
|
$styles['default'] .= '.notes textarea{height:80vh;width:80%} iframe{width:100%;height:100%;margin:0;padding:0;border:none}';
|
||||||
$styles['default'] .= '.msg{max-height:180px;overflow-y:auto}';
|
$styles['default'] .= '.msg{max-height:180px;overflow-y:auto}';
|
||||||
if($init || ! $db instanceof PDO){
|
if($class === 'init' || ! $db instanceof PDO){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$css=get_setting('css');
|
$css=get_setting('css');
|
||||||
@ -300,17 +301,26 @@ function prepare_stylesheets(bool $init = false){
|
|||||||
$colbg=get_setting('colbg');
|
$colbg=get_setting('colbg');
|
||||||
}
|
}
|
||||||
$styles['custom'] = preg_replace("/(\r?\n|\r\n?)/u", '', "body,iframe{background-color:#$colbg;color:#$coltxt} $css");
|
$styles['custom'] = preg_replace("/(\r?\n|\r\n?)/u", '', "body,iframe{background-color:#$colbg;color:#$coltxt} $css");
|
||||||
|
$allow_js = (bool) get_setting('allow_js');
|
||||||
|
if($allow_js){
|
||||||
|
$scripts['default'] = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_stylesheet(bool $init = false){
|
function print_stylesheet(string $class)
|
||||||
global $styles;
|
{
|
||||||
|
global $scripts, $styles;
|
||||||
//default css
|
//default css
|
||||||
echo "<style>$styles[default]</style>";
|
echo "<style>$styles[default]</style>";
|
||||||
if($init){
|
if ( $class === 'init' ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//overwrite with custom css
|
//overwrite with custom css
|
||||||
echo "<style>$styles[custom]</style>";
|
echo "<style>$styles[custom]</style>";
|
||||||
|
$allow_js = (bool) get_setting( 'allow_js' );
|
||||||
|
if ( $allow_js ) {
|
||||||
|
echo "<script>$scripts[default]</script>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_end(){
|
function print_end(){
|
||||||
@ -375,7 +385,7 @@ function thr(){
|
|||||||
|
|
||||||
function print_start(string $class='', int $ref=0, string $url=''){
|
function print_start(string $class='', int $ref=0, string $url=''){
|
||||||
global $I, $language;
|
global $I, $language;
|
||||||
prepare_stylesheets($class === 'init');
|
prepare_stylesheets($class);
|
||||||
send_headers();
|
send_headers();
|
||||||
if(!empty($url)){
|
if(!empty($url)){
|
||||||
$url=str_replace('&', '&', $url);// Don't escape "&" in URLs here, it breaks some (older) browsers and js refresh!
|
$url=str_replace('&', '&', $url);// Don't escape "&" in URLs here, it breaks some (older) browsers and js refresh!
|
||||||
@ -387,11 +397,10 @@ function print_start(string $class='', int $ref=0, string $url=''){
|
|||||||
}
|
}
|
||||||
if($class==='init'){
|
if($class==='init'){
|
||||||
echo "<title>$I[init]</title>";
|
echo "<title>$I[init]</title>";
|
||||||
print_stylesheet(true);
|
|
||||||
}else{
|
}else{
|
||||||
echo '<title>'.get_setting('chatname').'</title>';
|
echo '<title>'.get_setting('chatname').'</title>';
|
||||||
print_stylesheet();
|
|
||||||
}
|
}
|
||||||
|
print_stylesheet($class);
|
||||||
echo "</head><body class=\"$class\">";
|
echo "</head><body class=\"$class\">";
|
||||||
if($class!=='init' && ($externalcss=get_setting('externalcss'))!=''){
|
if($class!=='init' && ($externalcss=get_setting('externalcss'))!=''){
|
||||||
//external css - in body to make it non-renderblocking
|
//external css - in body to make it non-renderblocking
|
||||||
@ -1452,11 +1461,11 @@ function send_linkfilter(string $arg=''){
|
|||||||
|
|
||||||
function send_frameset(){
|
function send_frameset(){
|
||||||
global $U, $db, $language;
|
global $U, $db, $language;
|
||||||
prepare_stylesheets();
|
prepare_stylesheets('frameset');
|
||||||
send_headers();
|
send_headers();
|
||||||
echo '<!DOCTYPE html><html lang="'.$language.'"><head>'.meta_html();
|
echo '<!DOCTYPE html><html lang="'.$language.'"><head>'.meta_html();
|
||||||
echo '<title>'.get_setting('chatname').'</title>';
|
echo '<title>'.get_setting('chatname').'</title>';
|
||||||
print_stylesheet();
|
print_stylesheet('frameset');
|
||||||
echo '</head><body>';
|
echo '</head><body>';
|
||||||
if(isset($_POST['sort'])){
|
if(isset($_POST['sort'])){
|
||||||
if($_POST['sort']==1){
|
if($_POST['sort']==1){
|
||||||
@ -1970,8 +1979,10 @@ function send_profile(string $arg=''){
|
|||||||
}
|
}
|
||||||
echo '</select></td></tr></table></td></tr>';
|
echo '</select></td></tr></table></td></tr>';
|
||||||
thr();
|
thr();
|
||||||
echo "<tr><td><table id=\"refresh\"><tr><th>$I[refreshrate]</th><td>";
|
$max_refresh_rate = get_setting('max_refresh_rate');
|
||||||
echo "<input type=\"number\" name=\"refresh\" size=\"3\" maxlength=\"3\" min=\"5\" max=\"150\" value=\"$U[refresh]\"></td></tr></table></td></tr>";
|
$min_refresh_rate = get_setting('min_refresh_rate');
|
||||||
|
echo '<tr><td><table id="refresh"><tr><th>'.sprintf($I['refreshrate'], $min_refresh_rate, $max_refresh_rate).'</th><td>';
|
||||||
|
echo '<input type="number" name="refresh" size="3" min="'.$min_refresh_rate.'" max="'.$max_refresh_rate.'" value="'.$U['refresh'].'"></td></tr></table></td></tr>';
|
||||||
thr();
|
thr();
|
||||||
preg_match('/#([0-9a-f]{6})/i', $U['style'], $matches);
|
preg_match('/#([0-9a-f]{6})/i', $U['style'], $matches);
|
||||||
echo "<tr><td><table id=\"colour\"><tr><th>$I[fontcolour] (<a href=\"$_SERVER[SCRIPT_NAME]?action=colours&session=$U[session]&lang=$language\" target=\"view\">$I[viewexample]</a>)</th><td>";
|
echo "<tr><td><table id=\"colour\"><tr><th>$I[fontcolour] (<a href=\"$_SERVER[SCRIPT_NAME]?action=colours&session=$U[session]&lang=$language\" target=\"view\">$I[viewexample]</a>)</th><td>";
|
||||||
@ -2092,13 +2103,29 @@ function send_controls(){
|
|||||||
print_start('controls');
|
print_start('controls');
|
||||||
$personalnotes=(bool) get_setting('personalnotes');
|
$personalnotes=(bool) get_setting('personalnotes');
|
||||||
$publicnotes=(bool) get_setting('publicnotes');
|
$publicnotes=(bool) get_setting('publicnotes');
|
||||||
|
$hide_reload_post_box=(bool) get_setting('hide_reload_post_box');
|
||||||
|
$hide_reload_messages=(bool) get_setting('hide_reload_messages');
|
||||||
|
$hide_profile=(bool) get_setting('hide_profile');
|
||||||
|
$hide_admin=(bool) get_setting('hide_admin');
|
||||||
|
$hide_notes=(bool) get_setting('hide_notes');
|
||||||
|
$hide_clone=(bool) get_setting('hide_clone');
|
||||||
|
$hide_rearrange=(bool) get_setting('hide_rearrange');
|
||||||
|
$hide_help=(bool) get_setting('hide_help');
|
||||||
echo '<table><tr>';
|
echo '<table><tr>';
|
||||||
echo '<td>'.form_target('post', 'post').submit($I['reloadpb']).'</form></td>';
|
if(!$hide_reload_post_box) {
|
||||||
echo '<td>'.form_target('view', 'view').submit($I['reloadmsgs']).'</form></td>';
|
echo '<td>' . form_target( 'post', 'post' ) . submit( $I[ 'reloadpb' ] ) . '</form></td>';
|
||||||
echo '<td>'.form_target('view', 'profile').submit($I['chgprofile']).'</form></td>';
|
}
|
||||||
|
if(!$hide_reload_messages) {
|
||||||
|
echo '<td>' . form_target( 'view', 'view' ) . submit( $I[ 'reloadmsgs' ] ) . '</form></td>';
|
||||||
|
}
|
||||||
|
if(!$hide_profile) {
|
||||||
|
echo '<td>' . form_target( 'view', 'profile' ) . submit( $I[ 'chgprofile' ] ) . '</form></td>';
|
||||||
|
}
|
||||||
if($U['status']>=5){
|
if($U['status']>=5){
|
||||||
echo '<td>'.form_target('view', 'admin').submit($I['adminbtn']).'</form></td>';
|
if(!$hide_admin) {
|
||||||
if(!$personalnotes){
|
echo '<td>' . form_target( 'view', 'admin' ) . submit( $I[ 'adminbtn' ] ) . '</form></td>';
|
||||||
|
}
|
||||||
|
if(!$personalnotes && !$hide_notes){
|
||||||
echo '<td>'.form_target('view', 'notes', 'staff').submit($I['notes']).'</form></td>';
|
echo '<td>'.form_target('view', 'notes', 'staff').submit($I['notes']).'</form></td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2109,15 +2136,21 @@ function send_controls(){
|
|||||||
if($personalnotes || $publicnotes){
|
if($personalnotes || $publicnotes){
|
||||||
echo '<td>'.form_target('view', 'notes').submit($I['notes']).'</form></td>';
|
echo '<td>'.form_target('view', 'notes').submit($I['notes']).'</form></td>';
|
||||||
}
|
}
|
||||||
echo '<td>'.form_target('_blank', 'login').submit($I['clone']).'</form></td>';
|
if(!$hide_clone) {
|
||||||
|
echo '<td>' . form_target( '_blank', 'login' ) . submit( $I[ 'clone' ] ) . '</form></td>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!isset($_GET['sort'])){
|
if(!isset($_GET['sort'])){
|
||||||
$sort=0;
|
$sort=0;
|
||||||
}else{
|
}else{
|
||||||
$sort=1;
|
$sort=1;
|
||||||
}
|
}
|
||||||
echo '<td>'.form_target('_parent', 'login').hidden('sort', $sort).submit($I['sortframe']).'</form></td>';
|
if(!$hide_rearrange) {
|
||||||
echo '<td>'.form_target('view', 'help').submit($I['randh']).'</form></td>';
|
echo '<td>' . form_target( '_parent', 'login' ) . hidden( 'sort', $sort ) . submit( $I[ 'sortframe' ] ) . '</form></td>';
|
||||||
|
}
|
||||||
|
if(!$hide_help) {
|
||||||
|
echo '<td>' . form_target( 'view', 'help' ) . submit( $I[ 'randh' ] ) . '</form></td>';
|
||||||
|
}
|
||||||
echo '<td>'.form_target('_parent', 'logout').submit($I['exit'], 'id="exitbutton"').'</form></td>';
|
echo '<td>'.form_target('_parent', 'logout').submit($I['exit'], 'id="exitbutton"').'</form></td>';
|
||||||
echo '</tr></table>';
|
echo '</tr></table>';
|
||||||
print_end();
|
print_end();
|
||||||
@ -2239,7 +2272,7 @@ function send_error(string $err){
|
|||||||
|
|
||||||
function send_fatal_error(string $err){
|
function send_fatal_error(string $err){
|
||||||
global $I, $language, $styles;
|
global $I, $language, $styles;
|
||||||
prepare_stylesheets();
|
prepare_stylesheets('fatal_error');
|
||||||
send_headers();
|
send_headers();
|
||||||
echo '<!DOCTYPE html><html lang="'.$language.'"><head>'.meta_html();
|
echo '<!DOCTYPE html><html lang="'.$language.'"><head>'.meta_html();
|
||||||
echo "<title>$I[fatalerror]</title>";
|
echo "<title>$I[fatalerror]</title>";
|
||||||
@ -3375,14 +3408,20 @@ function clean_inbox_selected(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function del_all_messages(string $nick, int $entry){
|
function del_all_messages(string $nick, int $entry){
|
||||||
global $db;
|
global $db, $U;
|
||||||
if($nick==''){
|
$globally = (bool) get_setting('postbox_delete_globally');
|
||||||
return;
|
if($globally && $U['status'] > 4){
|
||||||
|
$stmt = $db->prepare( 'DELETE FROM ' . PREFIX . 'messages;' );
|
||||||
|
$stmt->execute();
|
||||||
|
} else {
|
||||||
|
if ( $nick === '' ) {
|
||||||
|
$nick = $U[ 'nickname' ];
|
||||||
|
}
|
||||||
|
$stmt = $db->prepare( 'DELETE FROM ' . PREFIX . 'messages WHERE poster=? AND postdate>=?;' );
|
||||||
|
$stmt->execute( [ $nick, $entry ] );
|
||||||
|
$stmt = $db->prepare( 'DELETE FROM ' . PREFIX . 'inbox WHERE poster=? AND postdate>=?;' );
|
||||||
|
$stmt->execute( [ $nick, $entry ] );
|
||||||
}
|
}
|
||||||
$stmt=$db->prepare('DELETE FROM ' . PREFIX . 'messages WHERE poster=? AND postdate>=?;');
|
|
||||||
$stmt->execute([$nick, $entry]);
|
|
||||||
$stmt=$db->prepare('DELETE FROM ' . PREFIX . 'inbox WHERE poster=? AND postdate>=?;');
|
|
||||||
$stmt->execute([$nick, $entry]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function del_last_message(){
|
function del_last_message(){
|
||||||
@ -3392,13 +3431,19 @@ function del_last_message(){
|
|||||||
}else{
|
}else{
|
||||||
$entry=$U['entry'];
|
$entry=$U['entry'];
|
||||||
}
|
}
|
||||||
$stmt=$db->prepare('SELECT id FROM ' . PREFIX . 'messages WHERE poster=? AND postdate>=? ORDER BY id DESC LIMIT 1;');
|
$globally = (bool) get_setting('postbox_delete_globally');
|
||||||
$stmt->execute([$U['nickname'], $entry]);
|
if($globally && $U['status'] > 4) {
|
||||||
if($id=$stmt->fetch(PDO::FETCH_NUM)){
|
$stmt = $db->prepare( 'SELECT id FROM ' . PREFIX . 'messages WHERE postdate>=? ORDER BY id DESC LIMIT 1;' );
|
||||||
$stmt=$db->prepare('DELETE FROM ' . PREFIX . 'messages WHERE id=?;');
|
$stmt->execute( [ $entry ] );
|
||||||
$stmt->execute($id);
|
} else {
|
||||||
$stmt=$db->prepare('DELETE FROM ' . PREFIX . 'inbox WHERE postid=?;');
|
$stmt = $db->prepare( 'SELECT id FROM ' . PREFIX . 'messages WHERE poster=? AND postdate>=? ORDER BY id DESC LIMIT 1;' );
|
||||||
$stmt->execute($id);
|
$stmt->execute( [ $U[ 'nickname' ], $entry ] );
|
||||||
|
}
|
||||||
|
if ( $id = $stmt->fetch( PDO::FETCH_NUM ) ) {
|
||||||
|
$stmt = $db->prepare( 'DELETE FROM ' . PREFIX . 'messages WHERE id=?;' );
|
||||||
|
$stmt->execute( $id );
|
||||||
|
$stmt = $db->prepare( 'DELETE FROM ' . PREFIX . 'inbox WHERE postid=?;' );
|
||||||
|
$stmt->execute( $id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3479,7 +3524,7 @@ function prepare_message_print(array &$message, bool $removeEmbed){
|
|||||||
// this and that
|
// this and that
|
||||||
|
|
||||||
function send_headers(){
|
function send_headers(){
|
||||||
global $U, $styles;
|
global $U, $scripts, $styles;
|
||||||
header('Content-Type: text/html; charset=UTF-8');
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0, private');
|
header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0, private');
|
||||||
@ -3495,7 +3540,11 @@ function send_headers(){
|
|||||||
foreach($styles as $style) {
|
foreach($styles as $style) {
|
||||||
$style_hashes .= " 'sha256-".base64_encode(hash('sha256', $style, true))."'";
|
$style_hashes .= " 'sha256-".base64_encode(hash('sha256', $style, true))."'";
|
||||||
}
|
}
|
||||||
header("Content-Security-Policy: base-uri 'self'; default-src 'none'; font-src 'self'; form-action 'self'; frame-ancestors 'self'; frame-src 'self'; img-src * data:; media-src * data:; style-src 'self' 'unsafe-inline'"); // $style_hashes"); //we can add computed hashes as soon as all inline css is moved to default css
|
$script_hashes = '';
|
||||||
|
foreach($scripts as $script) {
|
||||||
|
$script_hashes .= " 'sha256-".base64_encode(hash('sha256', $script, true))."'";
|
||||||
|
}
|
||||||
|
header("Content-Security-Policy: base-uri 'self'; default-src 'none'; font-src 'self'; form-action 'self'; frame-ancestors 'self'; frame-src 'self'; img-src * data:; media-src * data:; style-src 'self' 'unsafe-inline'; style-src $script_hashes"); // $style_hashes"); //we can add computed hashes as soon as all inline css is moved to default css
|
||||||
header('X-Content-Type-Options: nosniff');
|
header('X-Content-Type-Options: nosniff');
|
||||||
header('X-Frame-Options: sameorigin');
|
header('X-Frame-Options: sameorigin');
|
||||||
header('X-XSS-Protection: 1; mode=block');
|
header('X-XSS-Protection: 1; mode=block');
|
||||||
@ -3907,6 +3956,18 @@ function init_chat(){
|
|||||||
['filtermodkick', '0'],
|
['filtermodkick', '0'],
|
||||||
['metadescription', $I['defaultmetadescription']],
|
['metadescription', $I['defaultmetadescription']],
|
||||||
['sysmessagetxt', 'ℹ️ '],
|
['sysmessagetxt', 'ℹ️ '],
|
||||||
|
['hide_reload_post_box', '0'],
|
||||||
|
['hide_reload_messages', '0'],
|
||||||
|
['hide_profile', '0'],
|
||||||
|
['hide_admin', '0'],
|
||||||
|
['hide_notes', '0'],
|
||||||
|
['hide_clone', '0'],
|
||||||
|
['hide_rearrange', '0'],
|
||||||
|
['hide_help', '0'],
|
||||||
|
['max_refresh_rate', '150'],
|
||||||
|
['min_refresh_rate', '5'],
|
||||||
|
['postbox_delete_globally', '0'],
|
||||||
|
['allow_js', '1'],
|
||||||
];
|
];
|
||||||
$stmt=$db->prepare('INSERT INTO ' . PREFIX . 'settings (setting, value) VALUES (?, ?);');
|
$stmt=$db->prepare('INSERT INTO ' . PREFIX . 'settings (setting, value) VALUES (?, ?);');
|
||||||
foreach($settings as $pair){
|
foreach($settings as $pair){
|
||||||
@ -4276,6 +4337,9 @@ function update_db(){
|
|||||||
if($dbversion<46){
|
if($dbversion<46){
|
||||||
$db->exec('ALTER TABLE ' . PREFIX . 'members ADD COLUMN loginfails integer unsigned NOT NULL DEFAULT 0;');
|
$db->exec('ALTER TABLE ' . PREFIX . 'members ADD COLUMN loginfails integer unsigned NOT NULL DEFAULT 0;');
|
||||||
}
|
}
|
||||||
|
if($dbversion<47){
|
||||||
|
$db->exec('INSERT INTO ' . PREFIX . "settings (setting,value) VALUES ('hide_reload_post_box', '0'), ('hide_reload_messages', '0'),('hide_profile', '0'),('hide_admin', '0'),('hide_notes', '0'),('hide_clone', '0'),('hide_rearrange', '0'),('hide_help', '0'),('max_refresh_rate', '150'),('min_refresh_rate', '5'),('postbox_delete_globally', '0'),('allow_js', '1');");
|
||||||
|
}
|
||||||
update_setting('dbversion', DBVERSION);
|
update_setting('dbversion', DBVERSION);
|
||||||
if($msgencrypted!==MSGENCRYPTED){
|
if($msgencrypted!==MSGENCRYPTED){
|
||||||
if(!extension_loaded('sodium')){
|
if(!extension_loaded('sodium')){
|
||||||
@ -4476,7 +4540,7 @@ function load_lang(){
|
|||||||
function load_config(){
|
function load_config(){
|
||||||
mb_internal_encoding('UTF-8');
|
mb_internal_encoding('UTF-8');
|
||||||
define('VERSION', '1.24.1'); // Script version
|
define('VERSION', '1.24.1'); // Script version
|
||||||
define('DBVERSION', 46); // Database layout version
|
define('DBVERSION', 47); // 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_PASS', 'MY_SECRET_KEY'); // Recommended length: 32. Encryption key for messages
|
define('ENCRYPTKEY_PASS', 'MY_SECRET_KEY'); // Recommended length: 32. Encryption key for messages
|
||||||
define('AES_IV_PASS', '012345678912'); // Recommended length: 12. AES Encryption IV
|
define('AES_IV_PASS', '012345678912'); // Recommended length: 12. AES Encryption IV
|
||||||
|
@ -139,7 +139,7 @@ $T=[
|
|||||||
'profile' => 'ملفك الشخصي',
|
'profile' => 'ملفك الشخصي',
|
||||||
'ignore' => 'تم التجاهل',
|
'ignore' => 'تم التجاهل',
|
||||||
'unignore' => 'لا تتجاهل مرة أخرى',
|
'unignore' => 'لا تتجاهل مرة أخرى',
|
||||||
'refreshrate' => 'معدل التحديث (5-150 ثانية)',
|
'refreshrate' => 'معدل التحديث (%1$d-%2$d ثانية)',
|
||||||
'fontcolour' => 'لون الخط',
|
'fontcolour' => 'لون الخط',
|
||||||
'viewexample' => 'اعرض الأمثلة',
|
'viewexample' => 'اعرض الأمثلة',
|
||||||
'bgcolour' => 'لون الخلفية',
|
'bgcolour' => 'لون الخلفية',
|
||||||
|
@ -145,7 +145,7 @@ $T=[
|
|||||||
'profile' => 'Твоят профил',
|
'profile' => 'Твоят профил',
|
||||||
'ignore' => 'Игнорирай',
|
'ignore' => 'Игнорирай',
|
||||||
'unignore' => 'Спри да игнорираш',
|
'unignore' => 'Спри да игнорираш',
|
||||||
'refreshrate' => 'Честота на опресняване (5-150 секунди)',
|
'refreshrate' => 'Честота на опресняване (%1$d-%2$d секунди)',
|
||||||
'fontcolour' => 'Цвят на шрифта',
|
'fontcolour' => 'Цвят на шрифта',
|
||||||
'viewexample' => 'Виж примери',
|
'viewexample' => 'Виж примери',
|
||||||
'bgcolour' => 'Цвят на фона',
|
'bgcolour' => 'Цвят на фона',
|
||||||
|
@ -145,7 +145,7 @@ $T=[
|
|||||||
'profile' => 'Váš profil',
|
'profile' => 'Váš profil',
|
||||||
'ignore' => 'Ignorovat',
|
'ignore' => 'Ignorovat',
|
||||||
'unignore' => 'Již neignorovat',
|
'unignore' => 'Již neignorovat',
|
||||||
'refreshrate' => 'Obnovovací frekvence (5-150 sekund)',
|
'refreshrate' => 'Obnovovací frekvence (%1$d-%2$d sekund)',
|
||||||
'fontcolour' => 'Barva písma',
|
'fontcolour' => 'Barva písma',
|
||||||
'viewexample' => 'Zobrazit příklady',
|
'viewexample' => 'Zobrazit příklady',
|
||||||
'bgcolour' => 'Barva pozadí',
|
'bgcolour' => 'Barva pozadí',
|
||||||
|
14
lang_de.php
14
lang_de.php
@ -145,7 +145,7 @@ $T=[
|
|||||||
'profile' => 'Ihr Profil',
|
'profile' => 'Ihr Profil',
|
||||||
'ignore' => 'Ignorieren',
|
'ignore' => 'Ignorieren',
|
||||||
'unignore' => 'Nicht mehr ignorieren',
|
'unignore' => 'Nicht mehr ignorieren',
|
||||||
'refreshrate' => 'Aktualisierungsrate (5-150 Sekunden)',
|
'refreshrate' => 'Aktualisierungsrate (%1$d-%2$d Sekunden)',
|
||||||
'fontcolour' => 'Schriftfarbe',
|
'fontcolour' => 'Schriftfarbe',
|
||||||
'viewexample' => 'Beispiele anzeigen',
|
'viewexample' => 'Beispiele anzeigen',
|
||||||
'bgcolour' => 'Hintergrundfarbe',
|
'bgcolour' => 'Hintergrundfarbe',
|
||||||
@ -383,4 +383,16 @@ $T=[
|
|||||||
'Zurück zur Einrichtungsseite',
|
'Zurück zur Einrichtungsseite',
|
||||||
'defaultmetadescription' => 'Eine Chatgemeinschaft',
|
'defaultmetadescription' => 'Eine Chatgemeinschaft',
|
||||||
'metadescription' => 'Metabeschreibung (Am Besten 50 - 160 Zeichen für SEO)',
|
'metadescription' => 'Metabeschreibung (Am Besten 50 - 160 Zeichen für SEO)',
|
||||||
|
'hide_reload_post_box' => 'Postbox neu Laden Knopf verstecken',
|
||||||
|
'hide_reload_messages' => 'Nachrichten neu laden Knopf verstecken',
|
||||||
|
'hide_profile' => 'Profil-Knopf verstecken',
|
||||||
|
'hide_admin' => 'Admin-Knopf verstecken',
|
||||||
|
'hide_notes' => 'Notizen-Knopf verstecken',
|
||||||
|
'hide_clone' => 'Klonen-Knopf verstecken',
|
||||||
|
'hide_rearrange' => 'Umordnen-Knopf verstecken',
|
||||||
|
'hide_help' => 'Hilfe-Knopf verstecken',
|
||||||
|
'max_refresh_rate' => 'Niedrigste Aktualisierungsrate',
|
||||||
|
'min_refresh_rate' => 'Höchste Aktualisierungsrate',
|
||||||
|
'postbox_delete_globally' => 'Postbox Löschknöpfe global anwenden',
|
||||||
|
'allow_js' => 'Verbessern der Funktionalität mit JavaScript erlauben',
|
||||||
];
|
];
|
||||||
|
14
lang_en.php
14
lang_en.php
@ -145,7 +145,7 @@ $I=[
|
|||||||
'profile' => 'Your Profile',
|
'profile' => 'Your Profile',
|
||||||
'ignore' => 'Ignore',
|
'ignore' => 'Ignore',
|
||||||
'unignore' => 'Don\'t ignore anymore',
|
'unignore' => 'Don\'t ignore anymore',
|
||||||
'refreshrate' => 'Refresh rate (5-150 seconds)',
|
'refreshrate' => 'Refresh rate (%1$d-%2$d seconds)',
|
||||||
'fontcolour' => 'Font colour',
|
'fontcolour' => 'Font colour',
|
||||||
'viewexample' => 'View examples',
|
'viewexample' => 'View examples',
|
||||||
'bgcolour' => 'Background colour',
|
'bgcolour' => 'Background colour',
|
||||||
@ -383,4 +383,16 @@ $I=[
|
|||||||
'backtosetup' => 'Back to setup',
|
'backtosetup' => 'Back to setup',
|
||||||
'defaultmetadescription' => 'A chat community',
|
'defaultmetadescription' => 'A chat community',
|
||||||
'metadescription' => 'Meta description (best 50 - 160 characters for SEO)',
|
'metadescription' => 'Meta description (best 50 - 160 characters for SEO)',
|
||||||
|
'hide_reload_post_box' => 'Hide reload post box button',
|
||||||
|
'hide_reload_messages' => 'Hide reload messages button',
|
||||||
|
'hide_profile' => 'Hide profile button',
|
||||||
|
'hide_admin' => 'Hide admin button',
|
||||||
|
'hide_notes' => 'Hide notes button',
|
||||||
|
'hide_clone' => 'Hide clone button',
|
||||||
|
'hide_rearrange' => 'Hide rearrange button',
|
||||||
|
'hide_help' => 'Hide help button',
|
||||||
|
'max_refresh_rate' => 'Lowest refresh rate',
|
||||||
|
'min_refresh_rate' => 'Highest refresh rate',
|
||||||
|
'postbox_delete_globally' => 'Apply postbox delete button globally',
|
||||||
|
'allow_js' => 'Allow enhancing functionality with JavaScript',
|
||||||
];
|
];
|
||||||
|
@ -145,7 +145,7 @@ $T=[
|
|||||||
'profile' => 'Tu perfil',
|
'profile' => 'Tu perfil',
|
||||||
'ignore' => 'Ignorar',
|
'ignore' => 'Ignorar',
|
||||||
'unignore' => 'Dejar de ignorar',
|
'unignore' => 'Dejar de ignorar',
|
||||||
'refreshrate' => 'Tiempo de actualización (5-150 segundos)',
|
'refreshrate' => 'Tiempo de actualización (%1$d-%2$d segundos)',
|
||||||
'fontcolour' => 'Color de texto',
|
'fontcolour' => 'Color de texto',
|
||||||
'viewexample' => 'Ver ejemplos',
|
'viewexample' => 'Ver ejemplos',
|
||||||
'bgcolour' => 'Color de fondo',
|
'bgcolour' => 'Color de fondo',
|
||||||
|
@ -145,7 +145,7 @@ $T=[
|
|||||||
'profile' => 'Profiilisi',
|
'profile' => 'Profiilisi',
|
||||||
'ignore' => 'Jätä huomiotta',
|
'ignore' => 'Jätä huomiotta',
|
||||||
'unignore' => 'Poista huomiottajättö',
|
'unignore' => 'Poista huomiottajättö',
|
||||||
'refreshrate' => 'Päivitysnopeus (5-150 sekuntia)',
|
'refreshrate' => 'Päivitysnopeus (%1$d-%2$d sekuntia)',
|
||||||
'fontcolour' => 'Fontin väri',
|
'fontcolour' => 'Fontin väri',
|
||||||
'viewexample' => 'Katso esimerkit',
|
'viewexample' => 'Katso esimerkit',
|
||||||
'bgcolour' => 'Taustaväri',
|
'bgcolour' => 'Taustaväri',
|
||||||
|
@ -143,7 +143,7 @@ $T=[
|
|||||||
'profile' => 'Votre profile',
|
'profile' => 'Votre profile',
|
||||||
'ignore' => 'Ignoré',
|
'ignore' => 'Ignoré',
|
||||||
'unignore' => 'Ne jamais plus ignorer',
|
'unignore' => 'Ne jamais plus ignorer',
|
||||||
'refreshrate' => 'Taux de rafraichissement (5-150 seconds)',
|
'refreshrate' => 'Taux de rafraichissement (%1$d-%2$d seconds)',
|
||||||
'fontcolour' => 'Couleur des polices',
|
'fontcolour' => 'Couleur des polices',
|
||||||
'viewexample' => 'Visualiser les exemples',
|
'viewexample' => 'Visualiser les exemples',
|
||||||
'bgcolour' => 'Couleur de fond',
|
'bgcolour' => 'Couleur de fond',
|
||||||
|
@ -143,7 +143,7 @@ $T=[
|
|||||||
'profile' => 'Profil Anda',
|
'profile' => 'Profil Anda',
|
||||||
'ignore' => 'Setuju',
|
'ignore' => 'Setuju',
|
||||||
'unignore' => 'Tak setuju apapun',
|
'unignore' => 'Tak setuju apapun',
|
||||||
'refreshrate' => 'kecepatan penyegaran (5-150 detik)',
|
'refreshrate' => 'kecepatan penyegaran (%1$d-%2$d detik)',
|
||||||
'fontcolour' => 'Warna font',
|
'fontcolour' => 'Warna font',
|
||||||
'viewexample' => 'Lihat contoh',
|
'viewexample' => 'Lihat contoh',
|
||||||
'bgcolour' => 'Warna latar belakang',
|
'bgcolour' => 'Warna latar belakang',
|
||||||
|
@ -145,7 +145,7 @@ $T=[
|
|||||||
'profile' => 'Mio profilo',
|
'profile' => 'Mio profilo',
|
||||||
'ignore' => 'Ignorare',
|
'ignore' => 'Ignorare',
|
||||||
'unignore' => 'Non ignorare più',
|
'unignore' => 'Non ignorare più',
|
||||||
'refreshrate' => 'Ricarica Chat (5-150 secondi)',
|
'refreshrate' => 'Ricarica Chat (%1$d-%2$d secondi)',
|
||||||
'fontcolour' => 'Colore carattere',
|
'fontcolour' => 'Colore carattere',
|
||||||
'viewexample' => 'Visualizza esempi',
|
'viewexample' => 'Visualizza esempi',
|
||||||
'bgcolour' => 'Colore sfondo',
|
'bgcolour' => 'Colore sfondo',
|
||||||
|
@ -145,7 +145,7 @@ $I=[
|
|||||||
'profile' => 'Seu perfil',
|
'profile' => 'Seu perfil',
|
||||||
'ignore' => 'Ignorar',
|
'ignore' => 'Ignorar',
|
||||||
'unignore' => 'Não ignorar mais',
|
'unignore' => 'Não ignorar mais',
|
||||||
'refreshrate' => 'Taxa de recarregar (5-150 segundos)',
|
'refreshrate' => 'Taxa de recarregar (%1$d-%2$d segundos)',
|
||||||
'fontcolour' => 'Cor da fonte',
|
'fontcolour' => 'Cor da fonte',
|
||||||
'viewexample' => 'Ver exemplos',
|
'viewexample' => 'Ver exemplos',
|
||||||
'bgcolour' => 'Cor de fundo',
|
'bgcolour' => 'Cor de fundo',
|
||||||
|
@ -145,7 +145,7 @@ $T=[
|
|||||||
'profile' => 'Ваш профиль',
|
'profile' => 'Ваш профиль',
|
||||||
'ignore' => 'Игнорировать',
|
'ignore' => 'Игнорировать',
|
||||||
'unignore' => 'Больше не игнорировать',
|
'unignore' => 'Больше не игнорировать',
|
||||||
'refreshrate' => 'Частота обновления (5-150 секунд)',
|
'refreshrate' => 'Частота обновления (%1$d-%2$d секунд)',
|
||||||
'fontcolour' => 'Цвет шрифта',
|
'fontcolour' => 'Цвет шрифта',
|
||||||
'viewexample' => 'Посмотреть примеры',
|
'viewexample' => 'Посмотреть примеры',
|
||||||
'bgcolour' => 'Фоновый цвет',
|
'bgcolour' => 'Фоновый цвет',
|
||||||
|
@ -145,7 +145,7 @@ $T=[
|
|||||||
'profile' => 'Profiliniz',
|
'profile' => 'Profiliniz',
|
||||||
'ignore' => 'Görmezden gel',
|
'ignore' => 'Görmezden gel',
|
||||||
'unignore' => 'Görmezden gelmeyi bırak',
|
'unignore' => 'Görmezden gelmeyi bırak',
|
||||||
'refreshrate' => 'Yenileme aralığı (5-150 saniye)',
|
'refreshrate' => 'Yenileme aralığı (%1$d-%2$d saniye)',
|
||||||
'fontcolour' => 'Yazı tipi rengi',
|
'fontcolour' => 'Yazı tipi rengi',
|
||||||
'viewexample' => 'Örnekleri görüntüle',
|
'viewexample' => 'Örnekleri görüntüle',
|
||||||
'bgcolour' => 'Arkaplan rengi',
|
'bgcolour' => 'Arkaplan rengi',
|
||||||
|
@ -145,7 +145,7 @@ $T = [
|
|||||||
'profile' => 'Ваш профіль',
|
'profile' => 'Ваш профіль',
|
||||||
'ignore' => 'Ігнорувати',
|
'ignore' => 'Ігнорувати',
|
||||||
'unignore' => 'Більше не ігнорувати',
|
'unignore' => 'Більше не ігнорувати',
|
||||||
'refreshrate' => 'Частота оновлення (5-150 секунд)',
|
'refreshrate' => 'Частота оновлення (%1$d-%2$d секунд)',
|
||||||
'fontcolour' => 'Колір шрифту',
|
'fontcolour' => 'Колір шрифту',
|
||||||
'viewexample' => 'Подивитися приклади',
|
'viewexample' => 'Подивитися приклади',
|
||||||
'bgcolour' => 'Фоновий колір',
|
'bgcolour' => 'Фоновий колір',
|
||||||
|
@ -126,7 +126,7 @@ $T=[
|
|||||||
'profile' => '你的个人资料',
|
'profile' => '你的个人资料',
|
||||||
'ignore' => '忽略',
|
'ignore' => '忽略',
|
||||||
'unignore' => '取消忽略',
|
'unignore' => '取消忽略',
|
||||||
'refreshrate' => '刷新时间(5秒-150秒)',
|
'refreshrate' => '刷新时间(%1$d秒-%2$d秒)',
|
||||||
'fontcolour' => '字体颜色',
|
'fontcolour' => '字体颜色',
|
||||||
'viewexample' => '查看示例',
|
'viewexample' => '查看示例',
|
||||||
'bgcolour' => '背景色',
|
'bgcolour' => '背景色',
|
||||||
|
@ -126,7 +126,7 @@ $T=[
|
|||||||
'profile' => '你的個人資料',
|
'profile' => '你的個人資料',
|
||||||
'ignore' => '忽略',
|
'ignore' => '忽略',
|
||||||
'unignore' => '取消忽略',
|
'unignore' => '取消忽略',
|
||||||
'refreshrate' => '刷新時間(5秒-150秒)',
|
'refreshrate' => '刷新時間(%1$d秒-%2$d秒)',
|
||||||
'fontcolour' => '字體顏色',
|
'fontcolour' => '字體顏色',
|
||||||
'viewexample' => '查看示例',
|
'viewexample' => '查看示例',
|
||||||
'bgcolour' => '背景色',
|
'bgcolour' => '背景色',
|
||||||
|
Reference in New Issue
Block a user