diff --git a/chat.php b/chat.php index a0e6b4f..fca40af 100644 --- a/chat.php +++ b/chat.php @@ -128,14 +128,19 @@ function route(){ send_notes(0); }elseif($_POST['do']==='staff' && $U['status']>=5){ send_notes(1); + }elseif($_POST['do']==='public' && $U['status']>=3){ + send_notes(3); } - if($U['status']<3 || !get_setting('personalnotes')){ + if($U['status']<3 || (!get_setting('personalnotes') && !get_setting('publicnotes'))){ send_access_denied(); } send_notes(2); }elseif($_REQUEST['action']==='help'){ check_session(); send_help(); + }elseif($_REQUEST['action']==='viewpublicnotes'){ + check_session(); + view_publicnotes(); }elseif($_REQUEST['action']==='inbox'){ check_session(); if(isset($_POST['do'])){ @@ -230,7 +235,7 @@ function route_setup(){ if(!valid_admin()){ send_alogin(); } - $C['bool_settings']=['suguests', 'imgembed', 'timestamps', 'trackip', 'memkick', 'forceredirect', 'incognito', 'sendmail', 'modfallback', 'disablepm', 'eninbox', 'enablegreeting', 'sortupdown', 'hidechatters', 'personalnotes', 'filtermodkick']; + $C['bool_settings']=['suguests', 'imgembed', 'timestamps', 'trackip', 'memkick', 'forceredirect', 'incognito', 'sendmail', 'modfallback', 'disablepm', 'eninbox', 'enablegreeting', 'sortupdown', 'hidechatters', 'personalnotes', 'publicnotes', 'filtermodkick']; $C['colour_settings']=['colbg', 'coltxt']; $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']; @@ -783,6 +788,8 @@ function restore_backup(array $C){ $note['type']=0; }elseif($note['type']==='staff'){ $note['type']=1; + }elseif($note['type']==='public'){ + $note['type']=3; } if(MSGENCRYPTED){ try { @@ -1579,15 +1586,21 @@ function send_notes(int $type){ global $I, $U, $db; print_start('notes'); $personalnotes=(bool) get_setting('personalnotes'); - if($U['status']>=5 && ($personalnotes || $U['status']>6)){ + $publicnotes=(bool) get_setting('publicnotes'); + if($U['status']>=3 && ($personalnotes || $publicnotes)){ echo '
'.form_target('view', 'notes', 'admin').submit($I['admnotes']).' | '; } + if($U['status']>=5){ echo ''.form_target('view', 'notes', 'staff').submit($I['staffnotes']).' | '; + } if($personalnotes){ echo ''.form_target('view', 'notes').submit($I['personalnotes']).' | '; } + if($publicnotes){ + echo ''.form_target('view', 'notes', 'public').submit($I['publicnotes']).' | '; + } echo '
"; $hiddendo=hidden('do', 'admin'); - }else{ + }elseif($type===2){ echo "
"; $hiddendo=''; + }elseif($type===3){ + echo "
"; + $hiddendo=hidden('do', 'public'); } if(isset($_POST['text'])){ if(MSGENCRYPTED){ @@ -1614,7 +1630,7 @@ function send_notes(int $type){ echo "$I[notessaved] "; } $dateformat=get_setting('dateformat'); - if($type!==2){ + if(($type!==2) && ($type !==3)){ $stmt=$db->prepare('SELECT COUNT(*) FROM ' . PREFIX . 'notes WHERE type=?;'); $stmt->execute([$type]); }else{ @@ -1627,7 +1643,7 @@ function send_notes(int $type){ }else{ $revision=0; } - if($type!==2){ + if(($type!==2) && ($type !==3)){ $stmt=$db->prepare('SELECT * FROM ' . PREFIX . "notes WHERE type=? ORDER BY id DESC LIMIT 1 OFFSET $revision;"); $stmt->execute([$type]); }else{ @@ -1898,6 +1914,25 @@ function send_help(){ print_end(); } +function view_publicnotes(){ + global $I, $db; + $dateformat=get_setting('dateformat'); + print_start('publicnotes'); + echo "
"; + // SQL adapted from AdamMc331 https://stackoverflow.com/questions/27991484/using-max-within-inner-join-sql + $query=$db->query('SELECT pubs.* FROM notes pubs JOIN (SELECT lastedited,editedby,text,MAX(id) AS latest FROM notes WHERE type=3 GROUP BY editedby) t ON t.editedby = pubs.editedby AND t.latest = pubs.id;'); + while($result=$query->fetch(PDO::FETCH_OBJ)){ + if ($result->text <> "") { + print '
'.form_target('post', 'post').submit($I['reloadpb']).' | '; echo ''.form_target('view', 'view').submit($I['reloadmsgs']).' | '; @@ -2058,8 +2094,11 @@ function send_controls(){ echo ''.form_target('view', 'notes', 'staff').submit($I['notes']).' | '; } } + if($publicnotes){ + echo ''.form_target('view', 'viewpublicnotes').submit($I['viewpublicnotes']).' | '; + } if($U['status']>=3){ - if($personalnotes){ + if($personalnotes || $publicnotes){ echo ''.form_target('view', 'notes').submit($I['notes']).' | '; } echo ''.form_target('_blank', 'login').submit($I['clone']).' | '; @@ -3589,7 +3628,7 @@ function cron(){ } // delete old notes $limit=get_setting('numnotes'); - $db->exec('DELETE FROM ' . PREFIX . 'notes WHERE type!=2 AND id NOT IN (SELECT * FROM ( (SELECT id FROM ' . PREFIX . "notes WHERE type=0 ORDER BY id DESC LIMIT $limit) UNION (SELECT id FROM " . PREFIX . "notes WHERE type=1 ORDER BY id DESC LIMIT $limit) ) AS t);"); + $db->exec('DELETE FROM ' . PREFIX . 'notes WHERE type!=2 AND type!=3 AND id NOT IN (SELECT * FROM ( (SELECT id FROM ' . PREFIX . "notes WHERE type=0 ORDER BY id DESC LIMIT $limit) UNION (SELECT id FROM " . PREFIX . "notes WHERE type=1 ORDER BY id DESC LIMIT $limit) ) AS t);"); $result=$db->query('SELECT editedby, COUNT(*) AS cnt FROM ' . PREFIX . "notes WHERE type=2 GROUP BY editedby HAVING cnt>$limit;"); $stmt=$db->prepare('DELETE FROM ' . PREFIX . 'notes WHERE type=2 AND editedby=? AND id NOT IN (SELECT * FROM (SELECT id FROM ' . PREFIX . "notes WHERE type=2 AND editedby=? ORDER BY id DESC LIMIT $limit) AS t);"); while($tmp=$result->fetch(PDO::FETCH_NUM)){ @@ -3764,6 +3803,7 @@ function init_chat(){ ['maxuploadsize', '1024'], ['nextcron', '0'], ['personalnotes', '1'], + ['publicnotes', '1'], ['filtermodkick', '0'], ['metadescription', $I['defaultmetadescription']], ]; diff --git a/lang_bg.php b/lang_bg.php index 5dcb683..c92dd76 100644 --- a/lang_bg.php +++ b/lang_bg.php @@ -164,6 +164,7 @@ $T=[ 'savechanges' => 'Запази промените', 'reloadpb' => 'Презареди пощенската кутия', 'reloadmsgs' => 'Презареди съобщенията', + 'viewpublicnotes' => 'Чета́ обще́ствен Бележки', 'chgprofile' => 'Профил', 'adminbtn' => 'Администрация', 'admnotes' => 'Администраторски бележки', @@ -366,5 +367,6 @@ $T=[ 'cssupdate' => 'Забележка: CSS-ът по подразбиране е вече вграден в кода и може да бъде премахнат от CSS настройките', 'manualrefresh' => 'Необходимо ръчно опресняване', 'personalnotes' => 'Лични бележки', + 'publicnotes' => 'Обще́ствен Бележки', 'filtermodkick' => 'Прилагай филтъра за изгонване и за модераторите', ]; diff --git a/lang_cs.php b/lang_cs.php index f955094..2824e8c 100644 --- a/lang_cs.php +++ b/lang_cs.php @@ -164,6 +164,7 @@ $T=[ 'savechanges' => 'Uložit', 'reloadpb' => 'Znovu načíst poštovní schránku', 'reloadmsgs' => 'Znovu načíst zprávy', + 'viewpublicnotes' => 'Zobrazit poznámky publikovaný', 'chgprofile' => 'Profil', 'adminbtn' => 'Admin', 'admnotes' => 'Admin poznámky', @@ -366,5 +367,6 @@ $T=[ 'cssupdate' => 'Poznámka: Výchozí CSS je nyní napevno a může být odstraněn z nastavení CSS', 'manualrefresh' => 'Nutná ruční aktualizace ', 'personalnotes' => 'Osobní poznámky', + 'publicnotes' => 'Poznámky publikovaný', 'filtermodkick' => 'Použít vyhazovací filtr na moderátory', ]; diff --git a/lang_de.php b/lang_de.php index 5014824..b9487c2 100644 --- a/lang_de.php +++ b/lang_de.php @@ -164,6 +164,7 @@ $T=[ 'savechanges' => 'Änderungen speichern', 'reloadpb' => 'Postbox neu laden', 'reloadmsgs' => 'Nachrichten neu laden', + 'viewpublicnotes' => 'Öffentliche Notizen anzeigen', 'chgprofile' => 'Profil', 'adminbtn' => 'Admin', 'admnotes' => 'Adminnotizen', @@ -367,6 +368,7 @@ $T=[ 'cssupdate' => 'Hinweis: Standard CSS ist jetzt hardcoded und kann aus der CSS Einstellung entfernt werden', 'manualrefresh' => 'Manuelles Neuladen erforderlich', 'personalnotes' => 'Persönliche Notizen', + 'publicnotes' => 'Öffentliche Notizen', 'filtermodkick' => 'Kickfilter auf Moderatoren anwenden', 'forgotlogin' => 'Zugangsdaten vergessen?', 'resetinstruction' => 'Bitte bearbeiten Sie das Skript und fügen Sie folgendes am Ende der Datei hinzu (und ändern Sie das Passwort "changeme"). Danach aktualisieren Sie die Seite bitte: define(\'RESET_SUPERADMIN_PASSWORD\', \'changeme\');', diff --git a/lang_en.php b/lang_en.php index ff5211a..9a9a6ca 100644 --- a/lang_en.php +++ b/lang_en.php @@ -164,6 +164,7 @@ $I=[ 'savechanges' => 'Save changes', 'reloadpb' => 'Reload Post Box', 'reloadmsgs' => 'Reload Messages', + 'viewpublicnotes' => 'View public notes', 'chgprofile' => 'Profile', 'adminbtn' => 'Admin', 'admnotes' => 'Admin Notes', @@ -367,6 +368,7 @@ $I=[ 'cssupdate' => 'Note: Default CSS is now hardcoded and can be removed from the CSS setting', 'manualrefresh' => 'Manual refresh required', 'personalnotes' => 'Personal notes', + 'publicnotes' => 'Public notes', 'filtermodkick' => 'Apply kick filter on moderators', 'forgotlogin' => 'Forgot login?', 'resetinstruction' => 'Please modify the script and put the following at the bottom of it (change the password). Then refresh this page: define(\'RESET_SUPERADMIN_PASSWORD\', \'changeme\');', diff --git a/lang_es.php b/lang_es.php index c8187a5..6f895ac 100644 --- a/lang_es.php +++ b/lang_es.php @@ -164,6 +164,7 @@ $T=[ 'savechanges' => 'Guardar cambios', 'reloadpb' => 'Recargar caja de publicación', 'reloadmsgs' => 'Recargar mensajes', + 'viewpublicnotes' => 'Ver notas públicas', 'chgprofile' => 'Perfil', 'adminbtn' => 'Admin', 'admnotes' => 'Notas de administrador', @@ -366,5 +367,6 @@ $T=[ 'cssupdate' => 'Note: Css predeterminado está ahora hardcoded y puede ser removido de la configuración CSS', 'manualrefresh' => 'Recarga manual requerida', 'personalnotes' => 'Notas personales', + 'publicnotes' => 'Notas públicas', 'filtermodkick' => 'Aplicar Kick filter en moderadores o administradores', ]; diff --git a/lang_fr.php b/lang_fr.php index 0d58305..368ca6d 100644 --- a/lang_fr.php +++ b/lang_fr.php @@ -160,6 +160,8 @@ $T=[ 'savechanges' => 'Sauvegarder les modifications', 'reloadpb' => 'Recharger la boite de texte', 'reloadmsgs' => 'Recharger les messages', + 'viewpublicnotes' => 'Voir notes publiques', + 'publicnotes' => 'Notes publiques', 'chgprofile' => 'Profile', 'adminbtn' => 'Administrateur', 'admnotes' => 'Notes de l\'administrateur', diff --git a/lang_id.php b/lang_id.php index 1c7412c..cf172b1 100644 --- a/lang_id.php +++ b/lang_id.php @@ -160,6 +160,8 @@ $T=[ 'savechanges' => 'Simpan perubahan', 'reloadpb' => 'Muat-ulang kotak pos', 'reloadmsgs' => 'Muat-ulang pesan', + 'viewpublicnotes' => 'Baca catatan terbuka', + 'publicnotes' => 'Catatan terbuka', 'chgprofile' => 'Profil', 'adminbtn' => 'Admin', 'admnotes' => 'Catatan Admin', diff --git a/lang_it.php b/lang_it.php index 5ca2c5a..6d4d025 100644 --- a/lang_it.php +++ b/lang_it.php @@ -164,6 +164,7 @@ $T=[ 'savechanges' => 'Salavre cambiamenti', 'reloadpb' => 'Ricarica Chat', 'reloadmsgs' => 'Aggiorna/Indietro', + 'viewpublicnotes' => 'Leggere appunti pubbliche', 'chgprofile' => 'Profilo', 'adminbtn' => 'Amministratore', 'admnotes' => 'Note del amministratore', @@ -366,5 +367,6 @@ $T=[ 'cssupdate' => 'Note: Default CSS is now hardcoded and can be removed from the CSS setting', 'manualrefresh' => 'Bisogna aggiornare pagina manualmente', 'personalnotes' => 'Appunti personali', + 'publicnotes' => 'Appunti pubbliche', 'filtermodkick' => 'Utlizzare filtro di esclusione per moderatori', ]; diff --git a/lang_pt.php b/lang_pt.php index 83f6599..0d1f1fa 100644 --- a/lang_pt.php +++ b/lang_pt.php @@ -164,6 +164,7 @@ $I=[ 'savechanges' => 'Salvar alterações', 'reloadpb' => 'Reload Post Box', 'reloadmsgs' => 'Reload Messages', + 'viewpublicnotes' => 'Ler notas públicas', 'chgprofile' => 'Perfil', 'adminbtn' => 'Admin', 'admnotes' => 'Admin Notes', @@ -367,6 +368,7 @@ $I=[ 'cssupdate' => 'Nota: CSS padrão agora está codificado e pode ser removido da configuração CSS', 'manualrefresh' => 'Reload manual necessário', 'personalnotes' => 'Notas pessoais', + 'publicnotes' => 'Notas públicas', 'filtermodkick' => 'Aplicar kick filter nos moderadores', 'forgotlogin' => 'Esqueceu o login?', 'resetinstruction' => 'Please modify the script and put the following at the bottom of it (change the password). Then refresh this page: define(\'RESET_SUPERADMIN_PASSWORD\', \'changeme\');', diff --git a/lang_ru.php b/lang_ru.php index 167ad68..9b1f4cb 100644 --- a/lang_ru.php +++ b/lang_ru.php @@ -164,6 +164,7 @@ $T=[ 'savechanges' => 'Сохранить изменения', 'reloadpb' => 'Перезагрузить почтовый ящик', 'reloadmsgs' => 'Обновить', + 'viewpublicnotes' => 'Читать профили пользователей', 'chgprofile' => 'Профиль', 'adminbtn' => 'Администратор', 'admnotes' => 'Примечания администратора', @@ -366,6 +367,7 @@ $T=[ 'cssupdate' => 'Заметка: по установлению CSS он тяжелый и можна убрать его в CSS настройках', 'manualrefresh' => 'Требуется обновить страницу вручную', 'personalnotes' => 'Личные заметки', + 'publicnotes' => ' Профиля пользователяь', 'filtermodkick' => 'Применить фильтр исключения для модераторов', ]; diff --git a/lang_tr.php b/lang_tr.php index 77967ed..3591a1c 100644 --- a/lang_tr.php +++ b/lang_tr.php @@ -164,6 +164,7 @@ $T=[ 'savechanges' => 'Değişiklikleri kaydet', 'reloadpb' => 'Posta Kutusunu Yenile', 'reloadmsgs' => 'İletileri yenile', + 'viewpublicnotes' => 'Oku kamu profilim', 'chgprofile' => 'Profil', 'adminbtn' => 'Yönetici', 'admnotes' => 'Yönetici Notları', @@ -367,6 +368,7 @@ $T=[ 'cssupdate' => 'Not: Default CSS is now hardcoded and can be removed from the CSS setting', 'manualrefresh' => 'Manuel yenileme gerekli', 'personalnotes' => 'Kişisel notlar', + 'publicnotes' => 'Kamu profiller', 'filtermodkick' => 'Moderatörler için atma filtresini etkinleştir', ]; diff --git a/lang_uk.php b/lang_uk.php index afd0c5d..7011311 100644 --- a/lang_uk.php +++ b/lang_uk.php @@ -164,6 +164,7 @@ $T=[ 'savechanges' => 'Зберігти иізмінення', 'reloadpb' => 'Перезагрузити почтовий ящік', 'reloadmsgs' => 'Обновити', + 'viewpublicnotes' => 'Читати зауваження публічний', 'chgprofile' => 'Профіль', 'adminbtn' => 'Администратор', 'admnotes' => 'Зауваження администратора', @@ -366,6 +367,7 @@ $T=[ 'cssupdate' => 'Note: Default CSS is now hardcoded and can be removed from the CSS setting', 'manualrefresh' => 'Потрібно обновити сторінку вручну', 'personalnotes' => 'Лічні замітки', + 'publicnotes' => 'Зауваження публічний', 'filtermodkick' => 'Примінити фільтр исключення для модераторів', ]; diff --git a/lang_zh-Hans.php b/lang_zh-Hans.php index 449ce5c..4eed348 100644 --- a/lang_zh-Hans.php +++ b/lang_zh-Hans.php @@ -143,6 +143,8 @@ $T=[ 'savechanges' => '保存更改', 'reloadpb' => '刷新缓存', 'reloadmsgs' => '刷新一下消息', + 'viewpublicnotes' => '阅读用户配置文件', + 'publicnotes' => '用户配置文件', 'chgprofile' => '个人资料', 'adminbtn' => '管理', 'admnotes' => '管理员公告',