anonymize ban reason added
[brisk.git] / web / Obj / brisk.phh
index bc53cac..a57beff 100644 (file)
@@ -153,12 +153,12 @@ $mlang_brisk = array( 'btn_backstand'=> array( 'it' => 'torna in piedi',
 $G_lng = langtolng($G_lang);
 
 $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 );
-$G_brisk_version = "4.15.0";
+$G_brisk_version = "4.16.0";
 
 /* MLANG: ALL THE INFO STRINGS IN brisk.phh */
-$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: primo passo per rendere più robusto il sistema di notifica.',
+$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: rifattorizzazione del motore di Brisk e messaggio di uscita.',
                                        'Se vuoi iscriverti alla <a target="_blank" href="mailto:ml-briscola+subscribe@milug.org">Mailing List</a>, cliccala!' ),
-                       'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NEWS</b>: new users subscription system, refactored sidebanner system.',
+                       'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NEWS</b>: engine refactoring and logout message.',
                                        'If you want to subscribe our <a target="_blank" href="ml-briscola+subscribe@milug.org">Mailing List</a>, click it!' ) );
 
 $G_room_help = array( 'it' => '
@@ -983,11 +983,12 @@ class Client_prefs {
     }
 }
 
-define('GHOST_SESS_TOUT', 300);
+define('GHOST_SESS_TOUT', 1800);
 define('GHOST_SESS_REAS_LOUT', 1); // logout
 define('GHOST_SESS_REAS_ANOT', 2); // another user get session
 define('GHOST_SESS_REAS_TOUT', 3); // room timeout
 define('GHOST_SESS_REAS_TTOT', 4); // table timeout
+define('GHOST_SESS_REAS_ANON', 5); // anonymizer access
 
 class GhostSessEl
 {
@@ -2139,10 +2140,27 @@ class Brisk
         $to_user = sprintf('chatt_sub("%s",[%d,"%s"],"%s");', $dt, $user->flags, xcape($user->name), xcape("== chat ban =="));
       }
       else {
-        $to_user = sprintf('chatt_sub("%s",[%d,"%s"],"%s");', $dt, $user->flags, xcape($user->name), xcape($msg));
-        // temporary silentiation for troll (will became array check)
-        // if (strcasecmp($user->name,'JackRokka') != 0 && $user->sess != '47ea653f602e8')
-        $to_room = $to_user;
+          if ( TRUE && (! $user->is_auth()) ) {
+              $to_user = nickserv_msg($dt, xcape("Visto l'elevato numero di molestatori che ultimamente hanno preso dimora su Brisk abbiamo deciso"));
+              $to_user .= nickserv_msg($dt, xcape("di disattivare temporaneamente la chat in room per i non registrati, non ce ne vogliate e buone feste."));
+              $aug_head = array("Tanti", "Tantissimi", "Un enormità", "Un milione", "Un' esagerazione");
+              $aug_body = array("a tutti gli utenti", "a tutti gli uomini", "a tutte le donne", "a tutti gli utenti");
+              $aug_tail = array("di Brisk", "del sito", "della ciurma", "della comitiva", "del gruppo");
+
+              $auguri = sprintf("%s auguri %s %s.",
+                                $aug_head[mt_rand(0, count($aug_head)-1)],
+                                $aug_body[mt_rand(0, count($aug_body)-1)],
+                                $aug_tail[mt_rand(0, count($aug_tail)-1)]);
+
+              $to_room = sprintf('chatt_sub("%s",[%d,"%s"],"%s");', $dt, $user->flags, xcape($user->name),
+                                 xcape($auguri));
+          }
+          else {
+              $to_user = sprintf('chatt_sub("%s",[%d,"%s"],"%s");', $dt, $user->flags, xcape($user->name), xcape($msg));
+              // temporary silentiation for troll (will became array check)
+              // if (strcasecmp($user->name,'JackRokka') != 0 && $user->sess != '47ea653f602e8')
+              $to_room = $to_user;
+          }
       }
 
       log_legal($curtime, $user->ip, $user,
@@ -2273,7 +2291,7 @@ class Brisk
    *   if ($idx == -3    && ret == FALSE)  =>  wrong password
    *   if ($idx == -1    && ret == FALSE)  =>  no space left
    *   if ($idx ==  0    && ret == user)   =>  SUCCESS
-   *   if ($idx == -$idx && ret == user)   =>  SUCCESS (but the login exists in the auth db)
+   *   if ($idx == -($idx + 1) && ret == user)   =>  SUCCESS (but the login exists in the auth db)
    */
 
   function add_user(&$sess, &$idx, $name, $pass, $ip, $header, $cookie)
@@ -2390,7 +2408,7 @@ class Brisk
 
       $idx = $ghost;
       if (defined('CURL_DE_SAC_VERS')) {
-          brisk_cds_execute($this, $ghost, $real_idx, $sess, $ip, $authenticate, $header);
+          brisk_cds_execute($this, $ghost, $idx, $sess, $ip, $authenticate, $header);
       }
       return ($this->user[$ghost]);
     }