From d0accc6cc623168616438ad06f0611a3dbb8f5a4 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Wed, 6 Jan 2016 16:36:22 +0100 Subject: [PATCH] fix not authnticated usersnet management --- web/Obj/brisk.phh | 17 ++++++++++++++--- web/briskin5/Obj/briskin5.phh | 2 +- web/briskin5/index_wr.php | 2 +- web/index_wr.php | 26 +++++++++++++++++--------- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 0ed2eae..c84db31 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -1923,7 +1923,7 @@ class Brisk return ($this->kickuser($user_out, $out_reas)); } - function chatt_send($user, $mesg) + function chatt_send($user, $mesg, $mlang_indwr = NULL) { GLOBAL $G_base, $G_alarm_passwd, $mlang_brisk, $G_lang; $only_you = FALSE; @@ -2137,9 +2137,20 @@ class Brisk } while (0); } // nick chat command else if (strncmp($msg, "/info ", 6) == 0) { - $info_user = substr($msg, 6); + do { + if (! $user->is_auth()) { + if ($mlang_indwr) { + $to_user = nickserv_msg($dt, $mlang_indwr['info_auth'][$G_lang]); + } + else { + $to_user = nickserv_msg($dt, "error"); + } + break; + } + $info_user = substr($msg, 6); - echo $this->info_show($user, urldecode($info_user), $dt); + echo $this->info_show($user, urldecode($info_user), $dt); + } while(0); } else if (strncmp($msg, "/st ", 4) == 0) { log_main("chatt_send BEGIN"); diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index fb696cb..f5db998 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -1353,7 +1353,7 @@ class Bin5 { } - function chatt_send($user, $mesg) + function chatt_send($user, $mesg, $mlang_indwr = NULL) { GLOBAL $mlang_brisk, $G_lang; diff --git a/web/briskin5/index_wr.php b/web/briskin5/index_wr.php index 451b86a..a0d60d4 100644 --- a/web/briskin5/index_wr.php +++ b/web/briskin5/index_wr.php @@ -110,7 +110,7 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) $user->step_inc(); } else if ($argz[0] == 'chatt') { - $bin5->chatt_send(&$user,$mesg); + $bin5->chatt_send(&$user, $mesg); } else if ($argz[0] == 'preferences_update') { log_wr("PER DI PREFERENCES_UPDATE"); diff --git a/web/index_wr.php b/web/index_wr.php index eb01410..c427c3d 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -120,6 +120,8 @@ Ciò è necessario per ottenere la password.

Saluti e buone partite, mop.
', 'en' => 'EN mhtml [%s] [%s]'), 'info_err' => array( 'it' => 'E\' occorso un errore (%d), riprova più tardi.', + 'en' => 'Some error occurs (%d), retry later.'), + 'info_auth' => array('it' => 'Non essendo autenticato non puoi costruire una rete di preferenze.', 'en' => 'Some error occurs (%d), retry later.') ); @@ -359,16 +361,22 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) log_wr("PING RECEIVED"); } else if ($argz[0] == 'info') { - if ($argz[1] == 'save') { - if (!isset($post['info'])) { + if ($user->is_auth()) { + if ($argz[1] == 'save') { + if (!isset($post['info'])) { + return FALSE; + } + if (($ret = $brisk->info_save($user, $post['info'])) == 0) { + echo "1"; + return TRUE; + } + + printf($mlang_indwr['info_err'][$G_lang], $ret); return FALSE; } - if (($ret = $brisk->info_save($user, $post['info'])) == 0) { - echo "1"; - return TRUE; - } - - printf($mlang_indwr['info_err'][$G_lang], $ret); + } + else { + printf($mlang_indwr['info_auth'][$G_lang]); return FALSE; } } @@ -759,7 +767,7 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) } else if ($argz[0] == 'chatt') { - $brisk->chatt_send(&$user, xcapemesg($mesg)); + $brisk->chatt_send(&$user, xcapemesg($mesg), $mlang_indwr); } else if ($argz[0] == 'tosmgr') { // check IF is authnticated user, both terms of service versions matches -- 2.17.1