From: Matteo Nastasi (mop) Date: Thu, 12 Dec 2013 06:36:58 +0000 (+0100) Subject: guar command (guarantee_show method) added X-Git-Tag: v4.12.0~2 X-Git-Url: http://mop.ddnsfree.com/gitweb/?p=brisk.git;a=commitdiff_plain;h=4bc572b7ad20f01404dd133246437a8f67807eeb guar command (guarantee_show method) added --- diff --git a/TODO.txt b/TODO.txt index 44d21cb..a348846 100644 --- a/TODO.txt +++ b/TODO.txt @@ -19,7 +19,12 @@ . opt - checkbox for anonimous users with message when not checked . opt - button enabled when arrived to the bottom of the TOS only . opt - check TOS version between config file and TOS file - . show guaranteer + DONE . show guarantee (/guar command) + DONE . multi-language + DONE . command documentation + DONE . manage disagreeding users investigation + DONE . self guaranteed + . email validation . account expiration diff --git a/bin/get_users.sh b/bin/get_users.sh new file mode 100755 index 0000000..2d62bca --- /dev/null +++ b/bin/get_users.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "select login from bsk_users" | ./sql/builder.sh psql -A -t diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 35196d0..134dab8 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -133,9 +133,18 @@ $mlang_brisk = array( 'btn_backstand'=> array( 'it' => 'torna in piedi', 'tit_onisol'=>array( 'it' => '(isolam.to)', 'en' => '(isolation)'), 'db_failed' =>array('it' => '
Il collegamento al database è fallito.
Temporaneamente tutte le autenticazioni verranno sospese, accederai a Brisk come un utente normale.

Ci scusiamo per il disagio.', - 'en' => 'Connection to the database failed
All authentications are suspended temporarly, you login as normal user.
We are about the limitation') - - + 'en' => 'Connection to the database failed
All authentications are suspended temporarly, you login as normal user.
We are about the limitation'), + + 'tos_old' => array( 'it' => '%s ha sottoscritto dei Termini del Servizio antecedenti a quelli necessari per poter richiedere questa funzionalità.', + 'en' => 'EN %s ha sottoscritto dei Termini del Servizio antecedenti a quelli necessari per poter richiedere questa funzionalità.'), + 'gua_nfd' => array( 'it' => 'Non è stato trovato un garante per %s.', + 'en' => 'EN Non è stato trovato un garante per %s.'), + 'gua_self' => array( 'it' => '%s si è auto-garantito.', + 'en' => 'EN %s si è auto-garantito.'), + 'gua_info' => array( 'it' => 'Il garante di %s è %s.', + 'en' => 'EN Il garante di %s è %s.'), + 'gua_err' => array( 'it' => 'Error %d. Utilizzo: /guar <login>.', + 'en' => 'Error %d. Usage: /guar <login>.') ); $G_lng = langtolng($G_lang); @@ -174,6 +183,7 @@ Dopo che è iniziata una partita per uscirne dovete chiedere agli altri gi
/tav <frase di invito> - invito per gli altri giocatori al tavolo dove si è seduti
/st <stato> - cambia l\'icona associata al tuo user; stato può valere: \\"normale\\", \\"fuori\\", \\"pausa\\", \\"cibo\\", \\"cane\\", \\"lavoro\\", \\"presente\\" oppure \\"sigaretta\\"
/cont <id partita> - quando si è a un tavolo per garantiti, permette di proseguire una partita giocata in precedenza con gli stessi giocatori +
/guar <login> - mostra il garante dell\'utente con il login passato come argomento
/authreq - se si è autenticati permette di garantire per un utente fidato
/mesgtoadm - se si è autenticati permette di lasciare un messaggio all\'amministratore del sito
/listen <all or auth> - se si è autenticati permette leggere solo i messaggi degli altri autenticati (auth) o di tutti (all) @@ -186,7 +196,7 @@ Dopo che è iniziata una partita per uscirne dovete chiedere agli altri gi EN Descrizione
EN Questa è un\'implementazione della briscola in cinque, così come è spiegata su Wikipedia; in breve è la variante con l\'asta prima sulla carta e poi sui punti.

-EN Configurazione del browser.
+Configurazione del browser.
Occorre abilitare i cookies.

Uso del sito
@@ -205,6 +215,8 @@ Dopo che è iniziata una partita per uscirne dovete chiedere agli altri gi
/nick <nuovo_nickname> - cambio di nickname
/tav <frase di invito> - invito per gli altri giocatori al tavolo dove si è seduti
/st <stato> - cambia l\'icona associata al tuo user; stato può valere: \\"normale\\", \\"fuori\\", \\"pausa\\", \\"cibo\\", \\"cane\\", \\"lavoro\\", \\"presente\\" oppure \\"sigaretta\\" +
/cont <id partita> - quando si è a un tavolo per garantiti, permette di proseguire una partita giocata in precedenza con gli stessi giocatori +
/guar <login> - mostra il garante dell\'utente con il login passato come argomento
/authreq - se si è autenticati permette di garantire per un utente fidato
/mesgtoadm - se si è autenticati permette di lasciare un messaggio all\'amministratore del sito
/listen <all or auth> - se si è autenticati permette leggere solo i messaggi degli altri autenticati (auth) o di tutti (all) @@ -1286,6 +1298,63 @@ class Room } } + function guarantee_show($user, $user_login, $dt) + { + GLOBAL $G_lang, $mlang_brisk, $G_base; + + $user_code = -1; + $ret = 0; + + do { + if ($user_login == "") { + $ret = 1; + break; + } + if (($bdb = BriskDB::create()) == FALSE) { + $ret = 2; + break; + } + if (($user_item = $bdb->getitem_bylogin($user_login, $user_code)) == FALSE) { + $ret = 3; + break; + } + if (($guar_item = $bdb->getitem_bycode($user_item->guar_code_get())) != FALSE) { + $guar_login = $guar_item->login_get(); + } + else { + $guar_login = ""; + } + $user_tos_vers = $user_item->tos_vers_get(); + + if (versions_cmp($user_tos_vers, "1.2") < 0) { + $mesg = sprintf('chatt_sub("%s", [2, "%s"],"%s");', + $dt, NICKSERV, sprintf($mlang_brisk['tos_old'][$G_lang], xcape($user_login))); + } + else if ($guar_login == "") { + $mesg = sprintf('chatt_sub("%s", [2, "%s"],"%s");', + $dt, NICKSERV, sprintf($mlang_brisk['gua_nfd'][$G_lang], xcape($user_login))); + } + else if ($guar_login == $user_login) { + $mesg = sprintf('chatt_sub("%s", [2, "%s"],"%s");', + $dt, NICKSERV, sprintf($mlang_brisk['gua_self'][$G_lang], xcape($user_login))); + } + else { + $mesg = sprintf('chatt_sub("%s", [2, "%s"],"%s");', + $dt, NICKSERV, sprintf($mlang_brisk['gua_info'][$G_lang], + xcape($user_login), xcape($guar_login))); + } + } while (0); + + if ($ret > 0) { + $mesg = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, sprintf($mlang_brisk['gua_err'][$G_lang], $ret)); + } + + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ".$mesg; + $user->step_inc(); + + return TRUE; + } + function room_outstandup($user) { $this->room_sitdown($user, -1); @@ -1578,7 +1647,11 @@ class Room $update_room = TRUE; } while (0); } // nick chat command + else if (strncmp($msg, "/guar ", 6) == 0 || $msg == "/guar") { + $guar_user = substr($msg, 6); + $this->guarantee_show($user, $guar_user, $dt); + } else if (strncmp($msg, "/st ", 4) == 0) { log_main("chatt_send BEGIN");