card_hand=3
players_n=3
tables_n=44
- tables_auth_n=12
+ tables_appr_n=12
+ tables_auth_n=8
tables_cert_n=4
brisk_auth_conf="brisk_spu_auth.conf.pho"
brisk_debug="0x0400"
echo "$1 -h"
echo "$1 chk - run lintian on all ph* files."
echo "$1 pkg - build brisk packages."
- echo "$1 [-W] [-n 3|5] [-c 2|8] [-t <(n>=4)>] [-T <auth_tab>] [-G <cert_tab>] [-A <apache-conf>] [-a <auth_file_name>] [-f <conffile>] [-p <outconf>] [-U <usock_path>] [-u <sys_user>] [-d <TRUE|FALSE>] [-w <web_dir>] [-k <ftok_dir>] [-l <legal_path>] [-y <proxy_path>] [-P <prefix_path>] [-x]"
+ echo "$1 [-W] [-n 3|5] [-c 2|8] [-t <(n>=4)>] [-T <auth_tab>] [-r <appr_tab>] [-G <cert_tab>] [-A <apache-conf>] [-a <auth_file_name>] [-f <conffile>] [-p <outconf>] [-U <usock_path>] [-u <sys_user>] [-d <TRUE|FALSE>] [-w <web_dir>] [-k <ftok_dir>] [-l <legal_path>] [-y <proxy_path>] [-P <prefix_path>] [-x]"
echo " -h this help"
echo " -f use this config file"
echo " -p save preferences in the file"
echo " -c number cards in hand - def. $card_hand"
echo " -n number of players - def. $players_n"
echo " -t number of tables - def. $tables_n"
+ echo " -r number of appr-only tables - def. $tables_appr_n"
echo " -T number of auth-only tables - def. $tables_auth_n"
echo " -G number of cert-only tables - def. $tables_cert_n"
echo " -a authorization file name - def. \"$brisk_auth_conf\""
-c*) card_hand="$(get_param "-c" "$1" "$2")"; sh=$?;;
-n*) players_n="$(get_param "-n" "$1" "$2")"; sh=$?;;
-t*) tables_n="$(get_param "-t" "$1" "$2")"; sh=$?;;
+ -r*) tables_appr_n="$(get_param "-r" "$1" "$2")"; sh=$?;;
-T*) tables_auth_n="$(get_param "-T" "$1" "$2")"; sh=$?;;
-G*) tables_cert_n="$(get_param "-G" "$1" "$2")"; sh=$?;;
-a*) brisk_auth_conf="$(get_param "-a" "$1" "$2")"; sh=$?;;
echo " card_hand: $card_hand"
echo " players_n: $players_n"
echo " tables_n: $tables_n"
+ echo " tables_appr_n: $tables_appr_n"
echo " tables_auth_n: $tables_auth_n"
echo " tables_cert_n: $tables_cert_n"
echo " brisk_auth_conf: \"$brisk_auth_conf\""
echo "card_hand=$card_hand"
echo "players_n=$players_n"
echo "tables_n=$tables_n"
+ echo "tables_appr_n=$tables_appr_n"
echo "tables_auth_n=$tables_auth_n"
echo "tables_cert_n=$tables_cert_n"
echo "brisk_auth_conf=\"$brisk_auth_conf\""
done
chmod -R 777 ${proxy_path}/bin5
+ mkdir -p "${legal_path}"
+ chmod 777 "${legal_path}"
fi
install -d ${web_path}__
for i in $(find web -type d | grep '/' | sed 's/^....//g'); do
for i in $(find web -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^....//g'); do
install -m 644 "web/$i" "${web_path}__/$i"
done
+
+# hardlink for nginx managed websocket files.
+ln "${web_path}__/xynt_test01.php" "${web_path}__/xynt_test01_wss.php"
+
if [ "$test_add" = "TRUE" ]; then
for i in $(find webtest -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^........//g'); do
install -m 644 "webtest/$i" "${web_path}__/$i"
sed -i "s@define *( *'USOCK_PATH',[^)]*)@define('USOCK_PATH', \"$usock_path\")@g" ${web_path}__/spush/brisk-spush.phh
sed -i "s@define *( *'TABLES_N',[^)]*)@define('TABLES_N', $tables_n)@g;
+ s@define *( *'TABLES_APPR_N',[^)]*)@define('TABLES_APPR_N', $tables_appr_n)@g;
s@define *( *'TABLES_AUTH_N',[^)]*)@define('TABLES_AUTH_N', $tables_auth_n)@g;
s@define *( *'TABLES_CERT_N',[^)]*)@define('TABLES_CERT_N', $tables_cert_n)@g;
s@define *( *'BRISK_DEBUG',[^)]*)@define('BRISK_DEBUG', $brisk_debug)@g;
define('LEGAL_PATH', "/tmp/legal_brisk");
define('PROXY_PATH', "/var/lib/brisk_proxy");
define('TABLES_N', 36);
+ define('TABLES_APPR_N', 12);
define('TABLES_AUTH_N', 8);
define('TABLES_CERT_N', 4);
define('PLAYERS_N', 3);
$G_lng = langtolng($G_lang);
$G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 );
- $G_brisk_version = "5.1.3";
+ $G_brisk_version = "5.2.1";
/* MLANG: ALL THE INFO STRINGS IN brisk.phh */
- $root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: comando /info e doppio click sugli utenti registrati, nuovi utenti apprendisti, info su numero di mani e di partite.',
+ $root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: puoi creare la tua rete di amicizie con /info, vedere cosa pensano i tuoi amici degli altri utenti e ci sono i nuovi tavoli riservati per registrati e apprendisti, corretti alcuni errori.',
'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>: ENcomando /info e doppio click sugli utenti registrati, nuovi utenti apprendisti.',
- 'If you want to subscribe our <a target="_blank" href="ml-briscola+subscribe@milug.org">Mailing List</a>, click it!' ) );
+ 'en' => array ( 'EN Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: puoi creare la tua rete di amicizie con /info,',
+ 'vedere cosa pensano i tuoi amici degli altri utenti e tavoli riservati per registrati e apprendisti.',
+ 'Se vuoi iscriverti alla <a target="_blank" href="mailto:ml-briscola+subscribe@milug.org">Mailing List</a>, cliccala!' ) );
$G_room_help = array( 'it' => '
<div style=\\"text-align: left; padding: 8px;\\">
}
define('TABLE_AUTH_TY_PUBL', 0);
- define('TABLE_AUTH_TY_AUTH', 1);
- define('TABLE_AUTH_TY_CERT', 2);
+ define('TABLE_AUTH_TY_APPR', 1);
+ define('TABLE_AUTH_TY_AUTH', 2);
+ define('TABLE_AUTH_TY_CERT', 3);
class Table {
$thiz->auth_type = TABLE_AUTH_TY_CERT;
else if ($idx < TABLES_AUTH_N)
$thiz->auth_type = TABLE_AUTH_TY_AUTH;
+ else if ($idx < TABLES_APPR_N)
+ $thiz->auth_type = TABLE_AUTH_TY_APPR;
else
$thiz->auth_type = TABLE_AUTH_TY_PUBL;
else
$act = 'reserved';
break;
+ case TABLE_AUTH_TY_APPR:
+ if ($user->is_auth())
+ $act = "sitappr";
+ else
+ $act = 'reserved';
+ break;
default:
$act = 'sit';
break;
}
}
- function info_show($user, $user_login, $dt)
+ /*
+ function info_show($user, $target, $dt)
+
+ if success return assoc. array with "ret" => 0 and other fields
+ else return an assoc. array with "ret: != 0 and "mesg" with an error description
+ */
+ function info_show($user, $target, $dt)
{
GLOBAL $G_lang, $mlang_brisk, $G_base;
$ret = 0;
do {
- if ($user_login == "") {
+ if ($target == "") {
$ret = 1;
break;
}
$ret = 2;
break;
}
- if (($user_item = $bdb->getitem_bylogin($user_login, $user_code)) == FALSE) {
+ if ($target == $user->name) {
$ret = 3;
+ $mesg = sprintf($mlang_brisk['inf_self'][$G_lang]);
break;
}
- if ($user_login == $user->name) {
+ if (($user_item = $bdb->getitem_bylogin($target, $user_code)) == FALSE) {
$ret = 4;
- $mesg = sprintf($mlang_brisk['inf_self'][$G_lang]);
break;
}
if (($guar_item = $bdb->getitem_bycode($user_item->guar_code_get())) != FALSE) {
}
$user_tos_vers = $user_item->tos_vers_get();
+ $partyskill = $bdb->usersnet_partyskill($user->code, $user_item->code);
+
+ $widefriend = $bdb->usersnet_widefriend($user->code, $user_item->code);
+ $widefriend['skill'] = $bdb->usersnet_wideskill($user->code, $user_item->code);
+ $narrowfriend = $bdb->usersnet_narrowfriend($user->code, $user_item->code);
+ $narrowfriend['skill'] = $bdb->usersnet_narrowskill($user->code, $user_item->code);
+
+ if (($usersnet_item = $bdb->usersnet_bycode($user->code, $user_item->code,
+ $widefriend, $narrowfriend)) == FALSE) {
+ $usersnet_item = $bdb->usersnet_default($user->code, $user_item->code,
+ $widefriend, $narrowfriend);
+ }
+
if (versions_cmp($user_tos_vers, "1.2") < 0) {
- $mesg = sprintf($mlang_brisk['tos_old'][$G_lang], xcape($user_login));
+ $mesg = sprintf($mlang_brisk['tos_old'][$G_lang], xcape($target));
}
else if ($guar_login == "") {
- $mesg = sprintf($mlang_brisk['inf_nfd'][$G_lang], xcape($user_login));
+ $mesg = sprintf($mlang_brisk['inf_nfd'][$G_lang], xcape($target));
}
} while (0);
else {
$jret = json_encode(array("ret" => 0,
"mesg" => "",
- "login" => $user_login,
+ "login" => $target,
// FIXME: state internationalization
"state" =>
($user_item->type & USER_FLAG_TY_APPR ? "Apprendista" :
"Normale" : "Stato sconosciuto"))),
"guar" => ($user_item->type & USER_FLAG_TY_APPR ?
"" : $guar_login),
+ "party" => $partyskill,
"match" => (versions_cmp($user_tos_vers, "1.4") < 0 ? "non autorizzato" : $user_item->match_cnt) ,
"game" => (versions_cmp($user_tos_vers, "1.4") < 0 ? "non autorizzato" : $user_item->game_cnt),
- "friend" => "unknown"));
+ "friend" => usersnet_friend_getlabel($usersnet_item->friend),
+ "skill" => $usersnet_item->skill,
+ "trust" => $usersnet_item->trust,
+ "widefriend" => $usersnet_item->widefriend,
+ "narrowfriend" => $usersnet_item->narrowfriend
+ ));
}
return $jret;
}
+ function info_save($user, $json_s)
+ {
+ GLOBAL $G_lang, $mlang_brisk, $G_base;
+
+ $mesg = "";
+ $user_code = -1;
+ $ret = 0;
+ $subret = 0;
+
+ do {
+ if (($json = json_decode($json_s)) == FALSE) {
+ $ret = 1;
+ break;
+ }
+
+ if (($bdb = BriskDB::create()) == FALSE) {
+ $ret = 2;
+ break;
+ }
+
+ if (($subret = $bdb->usersnet_save($user->code, $json)) != 0) {
+ $ret = 4000 + $subret;
+ break;
+ }
+ } while(0);
+
+ return ($ret);
+ }
+
function room_outstandup($user)
{
$this->room_sitdown($user, -1);
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;
if (($bdb = BriskDB::create()) != FALSE) {
$bdb->users_load();
/* MLANG: "Il nickname <b>\'%s\'</b> è già registrato, <b>se il suo proprietario si autentificherà verrai rinominato d\'ufficio come ghost<i>N</i>.</b>" */
- if ($bdb->login_exists($name_new)) {
+ if ($bdb->login_exists(strtolower($name_new))) {
$prestr = sprintf($mlang_brisk['nickjust'][$G_lang], xcape($name_new));
$to_user .= nickserv_msg($dt, $prestr);
}
} while (0);
} // nick chat command
else if (strncmp($msg, "/info ", 6) == 0) {
- $guar_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);
- error_log("here [" . $guar_user."]");
- echo $this->info_show($user, $guar_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");
}
}
else {
- $login_exists = $bdb->login_exists($name_new);
+ $login_exists = $bdb->login_exists(strtolower($name_new));
}
}
else {
break;
case "index_rd.php":
+ case "index_rd_wss.php":
if (($transp = gpcs_var('transp', $get, $post, $cookie)) === FALSE)
$transp = "iframe";
- if ($transp == 'websocket')
+ if ($transp == 'websocket' || $transp == 'websocketsec')
$enc = 'plain';
do {
$subs = "briskin5/";
$subs_l = strlen($subs);
if (!strncmp($path, $subs, $subs_l)) {
- $ret = Bin5::request_mgr(&$s_a_p, $header, &$header_out, &$new_socket, substr($path, $subs_l) , $addr, $get, $post, $cookie);
+ $ret = Bin5::request_mgr($s_a_p, $header, $header_out, $new_socket, substr($path, $subs_l) , $addr, $get, $post, $cookie);
return ($ret);
}
break;
}
}
+ function login_consistency($name)
+ {
+ $old_c = '';
+ if (($len = mb_strlen($name)) > 12) {
+ return FALSE;
+ }
+ for ($i = 0 ; $i < mb_strlen($name) ; $i++) {
+ $c = mb_substr($name, $i, 1);
+ if (mb_ereg_match ("[a-zA-Z0-9]", $c)) {
+ if ($old_c != $c) {
+ $old_c = $c;
+ $old_ct = 1;
+ }
+ else {
+ $old_ct++;
+ if ($old_ct > 2) {
+ return (FALSE);
+ }
+ }
+ }
+ else {
+ return (FALSE);
+ }
+ }
+ return (TRUE);
+ }
?>
require_once("${G_base}Obj/dbase_base.phh");
$escsql_from = array( "\\", "'" );
- $escsql_to = array( "\\\\", "\\'" );
+ $escsql_to = array( "\\\\", "''" );
function escsql($s)
{
static function destroy()
{
if (DBConn::$dbcnnx != FALSE) {
+ $ret = pg_close(DBConn::$dbcnnx);
DBConn::$dbcnnx = FALSE;
- return (pg_close(DBConn::$dbcnnx));
+ return ($ret);
}
return TRUE;
}
function query($sql)
{
- if (($res = pg_query($this->dbconn->db(), $sql)) == FALSE) {
+ if (!$this->dbconn)
+ if (($this->dbconn = DBConn::recover()) == FALSE)
+ return FALSE;
+
+ if (($res = @pg_query($this->dbconn->db(), $sql)) == FALSE) {
+ error_log('pg_result_status: ' . pg_result_status($res));
+ error_log('pg_connection_status: ' . pg_connection_status($this->dbconn->db()));
// try to recover the connection
if (($this->dbconn = DBConn::recover()) == FALSE)
return FALSE;
- return (pg_query($this->dbconn->db(), $sql));
+ return (@pg_query($this->dbconn->db(), $sql));
}
return ($res);
/* check the existence of the nick in the BriskDB */
log_main("login_exists: ".$login);
- $user_sql = sprintf("SELECT * FROM %susers WHERE login = lower('%s')",
+ $user_sql = sprintf("SELECT * FROM %susers WHERE login = '%s'",
$G_dbpfx, escsql($login));
if (($user_pg = $this->query($user_sql)) != FALSE)
if (pg_numrows($user_pg) == 1)
return (FALSE);
}
- if (($sere_pg = $this->query($sere_sql)) == FALSE) {
- return (FALSE);
- }
-
$sere_sql = sprintf("SELECT * FROM %sselfreg_chk WHERE (ip & %d) = %d;",
$G_dbpfx, int2four($G_selfreg_mask), int2four($laddr & $G_selfreg_mask));
if (($sere_pg = $this->query($sere_sql)) == FALSE) {
$user_sql = sprintf("UPDATE %susers SET (type, supp_comp) = (%d, '%s') WHERE code = %d;",
$G_dbpfx, $flags, escsql($supp_comp), $code);
- fprintf(STDERR, "REQUEST [%s]\n", $user_sql);
if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
return FALSE;
}
- fprintf(STDERR, "REQUEST GOOD [%s]\n", $user_sql);
return TRUE;
}
$user_sql = sprintf("UPDATE %susers SET (type, disa_reas) = (%d, %d) WHERE code = %d;",
$G_dbpfx, $flags, $disa_reas, $code);
- fprintf(STDERR, "REQUEST [%s]\n", $user_sql);
if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
return FALSE;
}
- fprintf(STDERR, "REQUEST GOOD [%s]\n", $user_sql);
return TRUE;
}
$user_sql = sprintf("UPDATE %susers SET (tos_vers) = ('%s') WHERE code = %d;",
$G_dbpfx, escsql($tos_vers), $code);
- fprintf(STDERR, "REQUEST [%s]\n", $user_sql);
if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
return FALSE;
}
- fprintf(STDERR, "REQUEST GOOD [%s]\n", $user_sql);
return TRUE;
}
}
if ($chals->ismod()) {
- Challenges::save_data(&$chals);
+ Challenges::save_data($chals);
}
Challenges::unlock_data($a_sem);
return (TRUE);
}
+ function friendship_default()
+ {
+ return (array(usersnet_friend_getlabel(1) => "0",
+ usersnet_friend_getlabel(2) => "0",
+ usersnet_friend_getlabel(3) => "0",
+ usersnet_friend_getlabel(4) => "0",
+ usersnet_friend_getlabel(5) => "0"));
+ }
+
+ function usersnet_widefriend($owner, $target)
+ {
+ GLOBAL $G_dbpfx;
+
+ $widefriend = $this->friendship_default();
+
+ $wfri_sql = sprintf("SELECT * FROM %susersnet_widefriend WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($wfri_pg = $this->query($wfri_sql)) == FALSE) {
+ return ($widefriend);
+ }
+
+ for ($i = 0 ; $i < pg_numrows($wfri_pg) ; $i++) {
+ $wfri_obj = pg_fetch_object($wfri_pg, $i);
+ $widefriend[usersnet_friend_getlabel(intval($wfri_obj->friend))] = $wfri_obj->count;
+ }
+
+ return ($widefriend);
+ }
+
+ function usersnet_wideskill($owner, $target)
+ {
+ GLOBAL $G_dbpfx;
+
+ $wideskill = "//";
+ $wskl_sql = sprintf("SELECT * FROM %susersnet_wideskill WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($wskl_pg = $this->query($wskl_sql)) == FALSE) {
+ return ($wideskill);
+ }
+
+ if (pg_numrows($wskl_pg) > 0) {
+ $wskl_obj = pg_fetch_object($wskl_pg, 0);
+ // TODO: UNCOMMENT IF THE NETWORK WORKS VERY WELL
+ // if ($wskl_obj->count >= 3)
+ $wideskill = sprintf("%3.2f", $wskl_obj->skill);
+ }
+ return ($wideskill);
+ }
+
+ function usersnet_narrowfriend($owner, $target)
+ {
+ GLOBAL $G_dbpfx;
+
+ $narrowfriend = $this->friendship_default();
+
+ $nfri_sql = sprintf("SELECT * FROM %susersnet_narrowfriend WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($nfri_pg = $this->query($nfri_sql)) == FALSE) {
+ return $narrowfriend;
+ }
+
+ for ($i = 0 ; $i < pg_numrows($nfri_pg) ; $i++) {
+ $nfri_obj = pg_fetch_object($nfri_pg, $i);
+ $narrowfriend[usersnet_friend_getlabel(intval($nfri_obj->friend))] = $nfri_obj->count;
+ }
+ return ($narrowfriend);
+ }
+
+ function usersnet_narrowskill($owner, $target)
+ {
+ GLOBAL $G_dbpfx;
+
+ $narrowskill = "//";
+
+ $nskl_sql = sprintf("SELECT * FROM %susersnet_narrowskill WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($nskl_pg = $this->query($nskl_sql)) == FALSE) {
+ return ($narrowskill);
+ }
+
+ if (pg_numrows($nskl_pg) > 0) {
+ $nskl_obj = pg_fetch_object($nskl_pg, 0);
+ // TODO: UNCOMMENT IF THE NETWORK WORKS VERY WELL
+ // if ($nskl_obj->count >= 3)
+ $narrowskill = sprintf("%3.2f", $nskl_obj->skill);
+ }
+ return ($narrowskill);
+ }
+
+ function usersnet_partyskill($owner, $target)
+ {
+ GLOBAL $G_dbpfx;
+
+ $partyskill = "non disponibile";
+
+ $pskl_sql = sprintf("SELECT * FROM %susersnet_party WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($pskl_pg = $this->query($pskl_sql)) == FALSE) {
+ return ($partyskill);
+ }
+
+ if (pg_numrows($pskl_pg) > 0) {
+ $pskl_obj = pg_fetch_object($pskl_pg, 0);
+ // TODO: UNCOMMENT IF THE NETWORK WORKS VERY WELL
+ // if ($wskl_obj->count >= 3)
+ $partyskill = sprintf("%3.2f", $pskl_obj->skill);
+ }
+ return ($partyskill);
+ }
+
+ function usersnet_bycode($owner, $target, $widefriend, $narrowfriend)
+ {
+ GLOBAL $G_dbpfx;
+ $ret = FALSE;
+
+ $net_sql = sprintf("SELECT * FROM %susersnet WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($net_pg = $this->query($net_sql)) == FALSE)
+ return FALSE;
+
+ if (pg_numrows($net_pg) != 1)
+ return FALSE;
+
+ $net_obj = pg_fetch_object($net_pg, 0);
+
+ return (UsersNetItem::UsersNetItemFromRecord($net_obj, $widefriend, $narrowfriend));
+ }
+
+ function usersnet_default($owner, $target, $widefriend, $narrowfriend)
+ {
+ return (UsersNetItem::UsersNetItemDefaults($owner, $target, $widefriend, $narrowfriend));
+ }
+
+ function usersnet_save($owner_id, $json)
+ {
+ GLOBAL $G_dbpfx;
+ $ret = 99999;
+ $trans = FALSE;
+
+ do {
+ $friend = usersnet_friend_getid($json->friend);
+
+ $json->skill = intval($json->skill);
+ $json->trust = intval($json->trust);
+
+ if ($json->skill < 1 || $json->skill > 5 ||
+ $json->trust < 1 || $json->trust > 5 ||
+ $friend == FALSE) {
+ $ret = 1;
+ break;
+ }
+ $this->transaction('BEGIN');
+ $trans = TRUE;
+
+ if ($friend == USERSNET_FRIEND_UNKNOWN) {
+ // try to update
+ $net_sql = sprintf("
+ DELETE FROM %susersnet
+ USING %susers as us
+ WHERE owner = %d AND us.login = '%s' AND target = us.code;",
+ $G_dbpfx, $G_dbpfx,
+ $owner_id, escsql(strtolower($json->login)));
+
+ if (($net_pg = $this->query($net_sql)) == FALSE) {
+ $ret = 5;
+ break;
+ }
+ }
+ else { // if ($friend == USERSNET_FRIEND_UNKNOWN
+ // try to update
+ $net_sql = sprintf("
+ UPDATE %susersnet SET (friend, skill, trust, mtime) =
+ (%d, %d, %d, now())
+ FROM %susers as us
+ WHERE owner = %d AND us.login = '%s' AND target = us.code RETURNING *;",
+ $G_dbpfx,
+ $friend, $json->skill, $json->trust,
+ $G_dbpfx,
+ $owner_id, escsql(strtolower($json->login)));
+ if (($net_pg = $this->query($net_sql)) == FALSE || pg_numrows($net_pg) == 0) {
+ $net_sql = sprintf("
+ INSERT INTO %susersnet SELECT %d AS owner, us.code as target,
+ %d as friend, %d as skill, %d as trust
+ FROM %susers as us WHERE us.login = '%s' RETURNING *;",
+ $G_dbpfx, $owner_id,
+ $friend, $json->skill, $json->trust,
+ $G_dbpfx, escsql(strtolower($json->login)));
+ if (($net_pg = $this->query($net_sql)) == FALSE) {
+ log_wr('insert query failed');
+ $ret = 2;
+ break;
+ }
+ if (pg_numrows($net_pg) != 1) {
+ log_wr(sprintf('insert numrow failed [%s] [%d]', $net_sql, pg_numrows($net_pg)));
+ $ret = 3;
+ break;
+ }
+ }
+ else {
+ if (pg_numrows($net_pg) != 1) {
+ log_wr('update numrow failed');
+ $ret = 4;
+ break;
+ }
+ }
+ }
+ $this->transaction('COMMIT');
+ return (0);
+ } while (0);
+
+ if ($trans)
+ $this->transaction('ROLLBACK');
+
+ return ($ret);
+ }
} // End class BriskDB
class LoginDBOld
declare(ticks = 1);
+ /* this list is created with bin/get_globals.sh */
+ $_globals_list = array(
+ 'G_admin_mail', 'G_alarm_passwd', 'G_all_points', 'G_ban_list', 'G_base',
+ 'G_black_list', 'G_brisk_version', 'G_btrace_pref_sub', 'G_cloud_smasher',
+ 'G_crypt_key', 'G_dbasetype', 'G_dbauth', 'G_dbpfx', 'G_doc_path',
+ 'G_domain', 'G_donors_all', 'G_donors_cur', 'G_is_local', 'G_lang', 'G_lng',
+ 'G_mail_seed', 'G_notguar_code', 'G_PG_cons', 'G_PG_cons_n', 'G_PG_vow',
+ 'G_PG_vow_n', 'G_poll_entries', 'G_poll_name', 'G_poll_title',
+ 'G_provider_proxy', 'G_proxy_white_list', 'G_room_about', 'G_room_help',
+ 'G_room_passwdhowto', 'G_room_roadmap',
+ 'G_selfreg_mask', 'G_selfreg_tout', 'G_shutdown', 'G_sidebanner',
+ 'G_sidebanner_idx', 'G_splash_content', 'G_splash_contents',
+ 'G_splash_cont_idx', 'G_splash_h', 'G_splash_idx', 'G_splash_interval',
+ 'G_splash_timeout', 'G_splash_w', 'G_topbanner', 'G_tos_dthard',
+ 'G_tos_dtsoft', 'G_tos_fname', 'G_tos_idx', 'G_tos_vers', 'G_webbase');
+
function global_dump()
{
GLOBAL $G_alarm_passwd, $G_ban_list, $G_black_list, $G_btrace_pref_sub, $G_dbauth;
GLOBAL $G_splash_h, $G_splash_idx, $G_splash_interval, $G_splash_timeout;
GLOBAL $G_splash_w, $G_topbanner, $G_with_donors, $G_with_poll;
GLOBAL $G_with_splash, $G_sidebanner, $G_sidebanner_idx;
- GLOBAL $G_with_topbanner, $G_selfreg_tout;
+ GLOBAL $G_with_topbanner, $G_selfreg_tout, $G_selfreg_mask;
fprintf(STDERR, "G_alarm_passwd = [%s]\n", print_r($G_alarm_passwd, TRUE));
fprintf(STDERR, "G_ban_list = [%s]\n", print_r($G_ban_list, TRUE));
function pendpage_try_addcont(&$new_socket, $tout, $method, $header, $get, $post, $cookie, $path, $addr, $rest, $cont)
{
- $pendpage = PendingPage::pendingpage_continue(&$new_socket, $this->curtime, $tout, $method,
+ $pendpage = PendingPage::pendingpage_continue( $new_socket, $this->curtime, $tout, $method,
$header, $get, $post, $cookie,
$path, $addr, $rest, $cont);
$this->app->users_cleanup();
}
+ function check_globals()
+ {
+ GLOBAL $_globals_list;
+ foreach ($_globals_list as $g) {
+ if (!array_search($g, $GLOBALS) || !isset($GLOBALS[$g])) {
+ error_log(sprintf("Global [%s] not declared", $g));
+ return FALSE;
+ }
+ }
+ return TRUE;
+ }
+
function run()
{
GLOBAL $DOCUMENT_ROOT, $HTTP_HOST;
GLOBAL $G_with_topbanner;
GLOBAL $G_tos_vers, $G_tos_fname, $G_tos_dtsoft, $G_tos_dthard, $G_tos_idx, $G_doc_path;
+ if (!$this->check_globals()) {
+ fprintf(STDERR, "Take a look to the phplog file, GLOBALS missing!\n");
+ sleep(10);
+ }
+
if ($this->main_loop) {
return (FALSE);
}
$this->reload(FALSE, $G_provider_proxy);
$this->app->reload(FALSE, $G_ban_list, $G_black_list,
$G_cloud_smasher);
+ if (!$this->check_globals()) {
+ fprintf(STDERR, "Take a look to the phplog file, GLOBALS missing!\n");
+ sleep(10);
+ }
global_dump();
}
else if ($line == "shutdown" || $line == "sd") {
return cmd_return(401, 'malformed cmd');
}
$idx = -1;
- if (($user = $this->app->get_user($cmd['sess'], &$idx)) == FALSE)
+ if (($user = $this->app->get_user($cmd['sess'], $idx)) == FALSE)
return cmd_return(402, 'user not found');
if (($user->flags & USER_FLAG_TY_ADMIN) == 0x00)
$this->rd_data_set($curtime, $transp, $enc, $stat, $subst, $step, $from);
- $ret = $this->rd_transp->init($enc, $header, &$header_out, $init_string, self::base_get(), $this->rd_scristp);
+ $ret = $this->rd_transp->init($enc, $header, $header_out, $init_string, self::base_get(), $this->rd_scristp);
if ($ret === FALSE) {
return FALSE;
} // end class User
+ define('USERSNET_FRIEND_BLACK', 1);
+ define('USERSNET_FRIEND_UNKNOWN', 2);
+ define('USERSNET_FRIEND_TEST', 3);
+ define('USERSNET_FRIEND_FRIEND', 4);
+ define('USERSNET_FRIEND_BFF', 5);
+
+ if (!isset($__usersnet_friend_map)) {
+ $__usersnet_friend_map = array("black", "unknown", "test", "friend", "bff");
+ }
+
+ function usersnet_friend_getlabel($id)
+ {
+ GLOBAL $__usersnet_friend_map;
+
+ $id_i = intval($id);
+
+ if ($id_i < 1 || $id_i > count($__usersnet_friend_map)) {
+ return FALSE;
+ }
+ return ($__usersnet_friend_map[$id_i - 1]);
+ }
+
+ /* return index + 1 of friend label */
+ function usersnet_friend_getid($label_in)
+ {
+ GLOBAL $__usersnet_friend_map;
+ foreach ($__usersnet_friend_map as $id => $label) {
+ if ($label == $label_in) {
+ return ($id + 1);
+ }
+ }
+
+ return FALSE;
+ }
?>
$game_delta = 1;
// $this->game_next(1);
- $this->game_init(&$bri->user);
+ $this->game_init($bri->user);
}
else if ($action == BIN5_RULES_ABANDON) { // return TRUE if all correct
if (!($user->handpt <= 2)) {
// Non si cambia mazzo se si abbandona la partita
$game_delta = 0;
// $this->game_next(0);
- $this->game_init(&$bri->user);
+ $this->game_init($bri->user);
}
else if ($action == BIN5_RULES_FINISH) { // return TRUE if all correct
$this->old_act = $action;
log_points($user->ip, $curtime, $user, "STAT:BRISKIN5:FINISH_GAME", $plist);
}
- $this->game_init(&$bri->user);
+ $this->game_init($bri->user);
return (TRUE);
}
$this->mazzo = $match_data['mazzo_next'];
$this->mult = $match_data['mult_next'];
$this->match_id = $match_id;
- $this->game_init(&$bri->user);
+ $this->game_init($bri->user);
/* reload of the page with the new layout */
for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) {
$user_cur->comm[$user_cur->step % COMM_N] = "";
$user_cur->step_inc();
- $user_cur->comm[$user_cur->step % COMM_N] = show_table(&$bri, &$user_cur, $user_cur->step+1, TRUE, FALSE);
+ $user_cur->comm[$user_cur->step % COMM_N] = show_table($bri, $user_cur, $user_cur->step+1, TRUE, FALSE);
$user_cur->step_inc();
}
return (TRUE);
log_load("RESYNC");
/* NOTE: $this->room is associated with the current $bri object */
printf("xXx CLASS NAME [%s]\n", get_class($this->room));
- $ret = show_table(&$this->room, $this, $this->step, FALSE, FALSE);
+ $ret = show_table($this->room, $this, $this->step, FALSE, FALSE);
}
log_rd2("NEWSTAT: ".$this->stat);
$user[$table->player[$i]]->table_token = $table_token;
$this->user[$i] = Bin5_user::spawn($user[$table->player[$i]], $this, $table_idx, $i, $get, $post, $cookie);
}
- $this->table[0] = Bin5_table::spawn(&$table);
+ $this->table[0] = Bin5_table::spawn($table);
log_main("TABLE_OLD_WIN - Bin5:".$this->table[0]->old_asta_win);
$user_cur->the_end = TRUE;
/* se gli altri utenti non erano d'accordo questo utente viene bannato */
- $remcalc = $this->table[0]->exitlock_calc(&$this->user, $user_cur->table_pos);
+ $remcalc = $this->table[0]->exitlock_calc($this->user, $user_cur->table_pos);
if ($remcalc < 3) {
require_once("${G_base}Obj/hardban.phh");
Hardbans::add(($user_cur->is_auth() ? $user_cur->name : FALSE),
}
- function chatt_send($user, $mesg)
+ function chatt_send($user, $mesg, $mlang_indwr = NULL)
{
GLOBAL $mlang_brisk, $G_lang;
case "":
case "index.php":
ob_start();
- bin5_index_main($transp_type, $header_out, $addr, $get, $post, $cookie);
+ bin5_index_main($transp_type, $header, $header_out, $addr, $get, $post, $cookie);
$content = ob_get_contents();
ob_end_clean();
break;
case "index_rd.php":
+ case "index_rd_wss.php":
if (($transp = gpcs_var('transp', $get, $post, $cookie)) === FALSE)
$transp = "iframe";
- if ($transp == 'websocket')
+ if ($transp == 'websocket' || $transp == 'websocketsec')
$enc = 'plain';
do {
$table_pos = $user->table_pos;
$ret = "table_init();";
- $ret .= $table->exitlock_show(&$bri->user, $table_pos);
+ $ret .= $table->exitlock_show($bri->user, $table_pos);
if (!$is_again) {
/* GENERAL STATUS */
$ret .= sprintf( 'gst.st = %d; stat = "%s"; subst = "%s"; table_pos = %d;',
}
/* NOTIFY FOR THE CARD MAKER */
if ($is_transition) { // && $user->subst == "asta" superfluo
- $ret .= show_table_info(&$bri, &$table, $table_pos);
+ $ret .= show_table_info($bri, $table, $table_pos);
$ret .= "setTimeout(preload_images, 500, g_preload_img_arr, g_imgct);";
}
else {
send_mesg("roadmap");
}
- function act_whysupport()
- {
- send_mesg("whysupport");
- }
-
function act_lascio()
{
send_mesg("lascio");
for (i = 0 ; i < 4 ; i++) {
if (flags & (1 << i)) {
- cl += sp + "au" + i;
+ cl += sp + "au" + i + (is_real ? "" : "_off");
sp = " ";
}
}
}
// alert("host: ["+host+"] path: ["+path+"]");
- if (url.substring(0,6) == 'http:/' || url.substring(0,7) == 'https:/' || url.substring(0,4) == 'ws:/') {
+ if (url.substring(0,6) == 'http:/' || url.substring(0,7) == 'https:/' || url.substring(0,4) == 'ws:/' || url.substring(0,5) == 'wss:/') {
return (url);
}
else if (url.substring(0,1) == '/') {
'en' => 'Send a message to the administrator:'),
'mesgtoadm_sub'=> array('it' => 'soggetto:',
'en' => 'subject:'),
- 'info_login' => array('it' => 'Utente:',
- 'en' => 'User:'),
- 'info_state' => array('it' => 'Stato:',
- 'en' => 'State:'),
- 'info_guar' => array('it' => 'Garante:',
- 'en' => 'Guarantee:'),
- 'info_match' => array('it' => 'Partite:',
- 'en' => 'Matches:'),
- 'info_game' => array('it' => 'Mani:',
- 'en' => 'Hands:'),
+ 'info_login' => array('it' => 'Utente',
+ 'en' => 'User'),
+ 'info_status' => array('it' => 'Stato',
+ 'en' => 'Status'),
+ 'info_status_tit' => array('it' => 'Stato dell\' utente.',
+ 'en' => 'User status.'),
+ 'info_guar' => array('it' => 'Garante',
+ 'en' => 'Guarantee'),
+ 'info_match' => array('it' => 'Partite',
+ 'en' => 'Matches'),
+ 'info_match_tit' => array('it' => 'Partite giocate ai tavoli riservati.',
+ 'en' => 'Matches played at reserved tables.'),
+ 'info_party' => array('it' => 'Party',
+ 'en' => 'Party'),
+ 'info_party_tit' => array('it' => 'Bravura calcolata in base ad amici, agli amici fidati e agli amici degli amici fidati in base alla credibilità degli amici fidati.',
+ 'en' => 'Skill calculated with party rules.'),
+ 'info_game' => array('it' => 'Mani',
+ 'en' => 'Hands'),
+ 'info_game_tit' => array('it' => 'Mani giocate ai tavoli riservati.',
+ 'en' => 'Hands played at reserved tables.'),
'info_frie' => array('it' => 'Conoscenza:',
'en' => 'Friendship:'),
+ 'info_repfrie' => array('it' => 'Cosa ne pensano gli amici',
+ 'en' => 'Friends reputation'),
+ 'info_repbff' => array('it' => 'Cosa ne pensano gli amici fidati',
+ 'en' => 'Best friends reputation'),
+ 'info_skill' => array('it' => 'Bravura',
+ 'en' => 'Skill')
);
require_once("briskin5/Obj/briskin5.phh");
GLOBAL $G_lang, $G_lng, $mlang_room;
GLOBAL $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER, $_COOKIE;
+ $transp_port = ((array_key_exists("X-Forwarded-Proto", $header) &&
+ $header["X-Forwarded-Proto"] == "https") ? 443 : 80);
+
if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE)
$sess = "";
if (($name = gpcs_var('name', $get, $post, $cookie)) === FALSE)
log_main("pre garbage_manager UNO");
$brisk->garbage_manager(TRUE);
log_main("post garbage_manager");
- if (($user = &$brisk->get_user($sess, &$idx)) != FALSE) {
+ if (($user = $brisk->get_user($sess, $idx)) != FALSE) {
if ($user->the_end == FALSE) {
$brisk->sess_cur_set($user->sess);
log_main("user stat: ".$user->stat);
/* try login */
if ($banned == FALSE &&
- ($user = $brisk->add_user(&$sess, &$idx, $name, $pass_private,
+ ($user = $brisk->add_user($sess, $idx, $name, $pass_private,
$remote_addr, $header, $cookie)) != FALSE) {
$brisk->sess_cur_set($user->sess);
$ACTION = "room";
google_color_url = "000000";
//-->
</script>
-<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
+<script type="text/javascript" src="https://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
$banner_top_right = carousel_top();
}
else {
google_color_url = "000000";
//-->
</script>
-<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
+<script type="text/javascript" src="https://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
}
}
else { // !$G_is_local
<table width="100%%" border="0" cols="3"><tr>
<td align="left"><div style="padding-left: 8px;">'.$banner_top_left.'</div></td>
<td align="center">'.(($G_with_topbanner || $G_with_donors) ? '<table><tr><td>' : '').'<div style="text-align: center;">
- <img class="nobo" src="img/brisk_logo64.png">
+ <!--<img class="nobo" src="img/brisk_logo64.png">--><img class="nobo" src="img/brisk_logo64_blackribbon.png" title="ciao grrr">
'.$mlang_room['headline'][$G_lang].'<br>
</div>'.( ($G_with_topbanner || $G_with_donors) ? sprintf('</td><td>%s</td></tr></table>',
($G_with_topbanner ? $G_topbanner :
alt="'.$mlang_room['tit_cook'][$G_lang].'">'.$mlang_room['itm_cook'][$G_lang].'</a><br>
<hr>
- <!--
- <a href="#"
- onmouseover="menu_hide(0,1);"
- title="perché supportare brisk?" onclick="act_whysupport();">supportare?</a><br>
- -->
<a href="#"
onmouseover="menu_hide(0,1);"
title="'.$mlang_room['tit_cla'][$G_lang].'" onclick="act_placing();">'.$mlang_room['itm_cla'][$G_lang].'</a><br>
<a href="http://it-it.facebook.com/event.php?eid=165523204539&index=1"
target="_blank" onmouseover="menu_hide(0,2);"
- title="1° Torneo-Meeting di Parma del 22/11/2009" <img style="display: inline;" class="nobo" src="img/coppa16.png">Parma 11/09</a><br>
+ title="1° Torneo-Meeting di Parma del 22/11/2009"><img style="display: inline;" class="nobo" src="img/coppa16.png">Parma 11/09</a><br>
<a href="http://it-it.facebook.com/event.php?eid=105699129890&index=1"
target="_blank" onmouseover="menu_hide(0,2);"
<div style="position: absolute;">
'.$altout_support_big.'
</div>
- <a style="/* position: absolute; top: 40px; left: 6px;" */ target="_blank" href="http://it-it.facebook.com/group.php?gid=59742820791"><img class="nobo" id="btn_facebook" src="img/facebook_btn.png" title="unisciti al gruppo \'quelli della brisk\'"></a>
+ <a style="/* position: absolute; top: 40px; left: 6px; */" target="_blank" href="http://it-it.facebook.com/group.php?gid=59742820791"><img class="nobo" id="btn_facebook" src="img/facebook_btn.png" title="unisciti al gruppo \'quelli della brisk\'"></a>
' . ( /* NOTE: here facebook or fake facebook */
(!$G_is_local && $_cookie_law_3party == 'true') ?
'<div class="fb-like" style="margin-top: 4px;" data-href="https://www.facebook.com/pages/Brisk-briscola-chiamata-in-salsa-ajax/716026558416911" data-share="false" data-send="true" data-width="70" data-show-faces="false" data-colorscheme="dark" layout="button_count"></div>
<script type="text/javascript" src="commons.js"></script>
<script type="text/javascript" src="fieldify.js"></script>
<script type="text/javascript" src="prefs.js"></script>
+ <script type="text/javascript" src="info.js"></script>
<!-- <script type="text/javascript" src="myconsole.js"></script> -->
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript" src="heartbit.js"></script>
var g_lang = "<? echo $G_lang; ?>";
var g_lng = "<? echo $G_lng; ?>";
var g_tables_n = <? echo TABLES_N; ?>;
+ var g_tables_appr_n = <? echo TABLES_APPR_N; ?>;
var g_tables_auth_n = <? echo TABLES_AUTH_N; ?>;
var g_tables_cert_n = <? echo TABLES_CERT_N; ?>;
var g_prefs, g_prefs_new = null;
<script type="text/javascript" src="commons.js"></script>
<script type="text/javascript" src="fieldify.js"></script>
<script type="text/javascript" src="prefs.js"></script>
+ <script type="text/javascript" src="info.js"></script>
<!-- <script type="text/javascript" src="myconsole.js"></script> -->
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript" src="ticker.js"></script>
var g_lang = "<? echo $G_lang; ?>";
var g_lng = "<? echo $G_lng; ?>";
var g_tables_n = <? echo TABLES_N; ?>;
+ var g_tables_appr_n = <? echo TABLES_APPR_N; ?>;
var g_tables_auth_n = <? echo TABLES_AUTH_N; ?>;
var g_tables_cert_n = <? echo TABLES_CERT_N; ?>;
var g_prefs, g_prefs_new = null;
sidebanners_init($G_sidebanner_idx);
?>
sess = "<?php echo "$sess"; ?>";
-xstm = new xynt_streaming(window, "<?php echo "$transp_type"; ?>", 80, 2, null /* console */, gst, 'index_php', 'sess', sess, $('sandbox'), 'index_rd.php', function(com){eval(com);});
+xstm = new xynt_streaming(window, <?php printf("\"%s\", %d", $transp_type, $transp_port); ?>, 2, null /* console */, gst, 'index_php', 'sess', sess, $('sandbox'), 'index_rd.php', function(com){eval(com);});
xstm.hbit_set(heartbit);
tra = new train($('room_tit'));
window.onunload = onunload_cb;
<div id="xhrdeltalog"></div>
</div>
- <div id="info" class="notify" style="z-index: 200; width: 400px; margin-left: -200px; height: 340px; top: 150px; visibility: hidden;">
+ <div id="info" class="notify" style="z-index: 200; width: 500px; margin-left: -250px; height: 340px; top: 150px; visibility: hidden;">
<table class="info">
- <tr><td class="le"><b><?php echo $mlang_room['info_login'][$G_lang]; ?></b></td><td class="ri"><span class="login_id"></span></td></tr>
- <tr><td class="le"><b><?php echo $mlang_room['info_state'][$G_lang]; ?></b></td><td class="ri"><span class="state_id"></span></td></tr>
- <tr><td class="le"><b><?php echo $mlang_room['info_guar'][$G_lang]; ?></b></td><td class="ri"><span class="guar_id"></span></td></tr>
- <tr><td class="le"><b><?php echo $mlang_room['info_match'][$G_lang]; ?></b></td><td class="ri"><span class="match_id"></span></td></tr>
- <tr><td class="le"><b><?php echo $mlang_room['info_game'][$G_lang]; ?></b></td><td class="ri"><span class="game_id"></span></td></tr>
- <tr><td colspan="2" style="background-color: pink;">di seguito le opzioni che verranno attivate successivamente:</td></tr>
- <tr><td class="le ri" colspan="2"><b><?php echo $mlang_room['info_frie'][$G_lang]; ?></b></td></tr>
- <tr><td class="le info-opt"><input type="radio" name="friend" class="friend_id" value="black">Da evitare</td>
- <td class="ri info-opt"><input type="radio" name="friend" class="friend_id" value="friend">Amico</td></tr>
- <tr><td class="le info-opt"><input type="radio" name="friend" class="friend_id" value="unknown">Sconosciuto</td>
- <td class="ri info-opt"><input type="radio" name="friend" class="friend_id" value="bff">Amico fidato</td></tr>
- <tr><td class="le info-opt"><input type="radio" name="friend" class="friend_id" value="test">In prova</td></tr>
- <tr><td class="le"><b>Bravura:</b></td><td class="le"><b>Credibilità:</b></td></tr>
- <tr><td class="info-opt">
+
+ <tr>
+ <td class="head"><span><?php echo $mlang_room['info_login'][$G_lang]; ?>:</span></td>
+ <td class="ri b-right data"><span class="login_id"></span></td>
+ <td class="head"><span><?php echo $mlang_room['info_status'][$G_lang]; ?>:</span></td>
+ <td class="ri data"><span class="state_id"></span></td>
+ </tr>
+
+ <tr>
+ <td class="head"><span><?php echo $mlang_room['info_guar'][$G_lang]; ?>:</span></td>
+ <td class="ri b-right data"><span class="guar_id"></span></td>
+ <td class="head"><span class="title" title="<?php echo $mlang_room['info_match_tit'][$G_lang]; ?>"><?php echo $mlang_room['info_match'][$G_lang]; ?>:</span></td>
+ <td class="ri data"><span class="match_id"></span></td>
+ </tr>
+
+ <tr>
+ <td class="head"><span class="title" title="<?php echo $mlang_room['info_party_tit'][$G_lang]; ?>"><?php echo $mlang_room['info_party'][$G_lang]; ?>:</span></td>
+ <td class="ri b-right data"><span class="party_id"></span></td>
+ <td class="head"><span class="title" title="<?php echo $mlang_room['info_game_tit'][$G_lang]; ?>"><?php echo $mlang_room['info_game'][$G_lang]; ?>:</span></td>
+ <td class="ri data"><span class="game_id"></span></td>
+ </tr>
+
+ <tr class="widefriend_id">
+ <td colspan="3" class="head"><span><?php echo $mlang_room['info_repfrie'][$G_lang]; ?>:</span></td>
+ <td class="le data"><?php echo $mlang_room['info_skill'][$G_lang]; ?>: <span class="skill_id"></span></td>
+ </tr>
+
+ <tr class="widefriend_id"><td class="le info-opt data">Da evitare: <span class="black_id"></span></td>
+ <td class="le info-opt data">In prova: <span class="test_id"></span></td>
+ <td class="le info-opt data">Amico: <span class="friend_id"></span></td>
+ <td class="le data">Fidato: <span class="bff_id"></span></td></tr>
+
+ <tr class="narrowfriend_id">
+ <td colspan="3" class="head"><span><?php echo $mlang_room['info_repbff'][$G_lang]; ?>:</span></td>
+ <td class="le data"><?php echo $mlang_room['info_skill'][$G_lang]; ?>: <span class="skill_id"></span></td></tr>
+
+ <tr class="narrowfriend_id"><td class="le info-opt data">Da evitare: <span class="black_id"></span></td>
+ <td class="le info-opt data">In prova: <span class="test_id"></span></td>
+ <td class="le info-opt data">Amico: <span class="friend_id"></span></td>
+ <td class="le data">Fidato: <span class="bff_id"></span></td></tr>
+ <tr><td class="le ri triple" colspan="3"><b><?php echo $mlang_room['info_frie'][$G_lang]; ?></b></td>
+ <td class="le data triple"><input type="radio" name="friend" class="friend_id" value="black"
+ onclick="info_onlyifknown_isvisible();">Da evitare</td></tr>
+ <tr>
+ <td class="le info-opt data"><input type="radio" name="friend" class="friend_id" value="unknown"
+ onclick="info_onlyifknown_isvisible();">Sconosciuto</td>
+ <td class="le info-opt data"><input type="radio" name="friend" class="friend_id" value="test"
+ onclick="info_onlyifknown_isvisible();">In prova</td>
+ <td class="ri info-opt data"><input type="radio" name="friend" class="friend_id" value="friend"
+ onclick="info_onlyifknown_isvisible();">Amico</td>
+ <td class="ri info-opt data"><input type="radio" name="friend" class="friend_id" value="bff"
+ onclick="info_onlyifknown_isvisible();">Amico fidato</td>
+ </tr>
+ <tr class="onlyifknown_gid">
+ <td class="le head"><span><?php echo $mlang_room['info_skill'][$G_lang]; ?>:</span></td>
+ <td class="data">
<table class="fiverank" style="margin: auto;">
<tr><td class="c1t">1</td>
<td class="c2t">2</td>
<td class="c5b"><input type="radio" name="skill" class="skill_id" value="5"></td>
</tr>
</table>
- </td><td class="info-opt">
+ </td>
+ <td class="le"><b>Credibilità:</b></td>
+ <td class="data">
<table class="fiverank" style="margin: auto;">
<tr><td class="c1t">1</td>
<td class="c2t">2</td>
<td class="c3t">3</td>
<td class="c4t">4</td>
<td class="c5t">5</td></tr>
- <tr><td class="c1b"><input type="radio" name="credib" class="credib_id" value="1"></td>
- <td class="c2b"><input type="radio" name="credib" class="credib_id" value="2"></td>
- <td class="c3b"><input type="radio" name="credib" class="credib_id" value="3"></td>
- <td class="c4b"><input type="radio" name="credib" class="credib_id" value="4"></td>
- <td class="c5b"><input type="radio" name="credib" class="credib_id" value="5"></td>
+ <tr><td class="c1b"><input type="radio" name="trust" class="trust_id" value="1"></td>
+ <td class="c2b"><input type="radio" name="trust" class="trust_id" value="2"></td>
+ <td class="c3b"><input type="radio" name="trust" class="trust_id" value="3"></td>
+ <td class="c4b"><input type="radio" name="trust" class="trust_id" value="4"></td>
+ <td class="c5b"><input type="radio" name="trust" class="trust_id" value="5"></td>
</tr>
</table>
</td></tr>
</table>
<div style="position: absolute; bottom: 8px; margin: auto; width: 100%;">
<input type="submit" class="input_sub" style="bottom: 4px;" onclick="$('info').style.visibility = 'hidden';" value="<?php echo $mlang_room['btn_close'][$G_lang]; ?>"/>
- <!-- <input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_reset();" value="<?php echo $mlang_room['btn_reset'][$G_lang]; ?>"/>
- <input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_save();" value="<?php echo $mlang_room['btn_save'][$G_lang]; ?>"/> -->
+ <input type="submit" class="input_sub" style="bottom: 4px;" onclick="info_reset();" value="<?php echo $mlang_room['btn_reset'][$G_lang]; ?>"/>
+ <input type="submit" class="input_sub" style="bottom: 4px;" onclick="info_save();" value="<?php echo $mlang_room['btn_save'][$G_lang]; ?>"/>
</div>
</div>
'en' => 'To send a message to the administrator you have to be authenticated'),
'shutmsg' => array( 'it' => '<b>Il server sta per essere riavviato, non possono avere inizio nuove partite.</b>',
'en' => '<b>The server is going to be rebooted, new games are not allowed.</b>'),
+ 'mustappr' => array( 'it' => '<b>Il tavolo a cui volevi sederti richiede autentifica o apprendistato.</b>',
+ 'en' => '<b>The table where you want to sit require authentication or apprentice</b>'),
'mustauth' => array( 'it' => '<b>Il tavolo a cui volevi sederti richiede autentifica.</b>',
'en' => '<b>The table where you want to sit require authentication</b>'),
'mustcert' => array( 'it' => '<b>Il tavolo a cui volevi sederti richiede autentifica e certificazione.</b>',
Ciò è necessario per ottenere la password.<br><br>
Saluti e buone partite, mop.<br>',
'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.')
);
define('LICMGR_CHO_ACCEPT', 0);
$curtime = time();
$dt = date("H:i ", $curtime);
- if (($user = $brisk->get_user($sess, &$idx)) == FALSE) {
+ if (($user = $brisk->get_user($sess, $idx)) == FALSE) {
$argz = explode('|', xcapemesg($mesg));
if ($argz[0] == 'getchallenge') {
echo '1|';
}
if ($chals->ismod()) {
- Challenges::save_data(&$chals);
+ Challenges::save_data($chals);
}
}
echo show_notify(str_replace("\n", " ", placings_show(FALSE)), 0, $mlang_indwr['btn_close'][$G_lang], 800, 600);
}
- else if ($argz[0] == 'whysupport') {
- echo show_notify(str_replace("\n", " ", $G_room_whysupport[$G_lang]), 0, $mlang_indwr['btn_close'][$G_lng], 400, 200);
- }
else if ($argz[0] == 'apprentice') {
if (($cli_name = gpcs_var('cli_name', $get, $post, $cookie)) === FALSE)
$cli_name = "";
// check existence of username or email
$is_trans = FALSE;
do {
+ error_log($cli_name);
+ if (login_consistency($cli_name) == FALSE) {
+ $mesg_to_user = "Il nickname non è conforme alle regole per la sua costruzione.";
+ break;
+ }
+
if (($bdb = BriskDB::create()) == FALSE) {
$mesg_to_user = "Connessione al database fallita";
break;
if ($argz[0] == 'ping') {
log_wr("PING RECEIVED");
}
+ else if ($argz[0] == '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;
+ }
+ }
+ else {
+ printf($mlang_indwr['info_auth'][$G_lang]);
+ return FALSE;
+ }
+ }
else if ($argz[0] == 'prefs') {
if ($argz[1] == 'save') {
if (!isset($post['prefs'])) {
if ($user->subst == 'sitdown' || $user->stat == 'table')
$brisk->room_wakeup($user);
else if ($user->subst == 'standup')
- $brisk->room_outstandup(&$user);
+ $brisk->room_outstandup($user);
else {
log_rd2("SHUTDOWN FROM WHAT ???");
}
if (($wa_lock = Warrant::lock_data(TRUE)) != FALSE) {
if (($fp = @fopen(LEGAL_PATH."/warrant.txt", 'a')) != FALSE) {
/* Unix time | session | nickname | IP | where was | mesg */
- fwrite($fp, sprintf("%ld|%s|%s|%s|\n", $curtime, xcapelt($user->name), xcapelt(urldecode($cli_name)), xcapelt(urldecode($cli_email))));
+ fwrite($fp, sprintf("%ld|%s|%s|%s|\n", $curtime, xcapelt($user->name), xcapelt(trim(urldecode($cli_name))), xcapelt(trim(urldecode($cli_email)))));
fclose($fp);
}
Warrant::unlock_data($wa_lock);
if (($bdb = BriskDB::create()) == FALSE)
break;
- $cli_name = urldecode($cli_name);
- $cli_email = urldecode($cli_email);
+ $cli_name = trim(urldecode($cli_name));
+ $cli_email = trim(urldecode($cli_email));
// check for already used fields
if (($idret = $bdb->check_record_by_login_or_email($cli_name, $cli_email)) != 0) {
log_wr($user->comm[$user->step % COMM_N]);
$user->step_inc();
- }
- else if ($argz[0] == 'whysupport') {
- $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
- $user->comm[$user->step % COMM_N] .= show_notify(str_replace("\n", " ", $G_room_whysupport[$G_lang]), 0, $mlang_indwr['btn_backtotab'][$G_lang], 400, 200);
-
- log_wr($user->comm[$user->step % COMM_N]);
- $user->step_inc();
-
}
else if ($argz[0] == 'chatt') {
- $brisk->chatt_send($user, xcapemesg($mesg));
- $brisk->chatt_send(&$user, xcapemesg($mesg), $mlang_indwr);
++ $brisk->chatt_send($user, xcapemesg($mesg), $mlang_indwr);
}
else if ($argz[0] == 'tosmgr') {
// check IF is authnticated user, both terms of service versions matches
(!$user->is_auth() || $user->is_appr()) ) {
$not_allowed_msg = nickserv_msg($dt, $mlang_indwr['mustauth'][$G_lang]);
}
+ else if ( $table->auth_type == TABLE_AUTH_TY_APPR &&
+ (!$user->is_auth()) ) {
+ $not_allowed_msg = nickserv_msg($dt, $mlang_indwr['mustappr'][$G_lang]);
+ }
else if ($user->flags & USER_FLAG_TY_FIRONLY && $table->player_n > 0) {
$not_allowed_msg = nickserv_msg($dt, $mlang_indwr['mustfirst'][$G_lang]);
}
$bin5_user_cur->trans_step = $user_cur->step + 1;
$bin5_user_cur->comm[$bin5_user_cur->step % COMM_N] = "";
$bin5_user_cur->step_inc();
- $bin5_user_cur->comm[$bin5_user_cur->step % COMM_N] = show_table(&$bin5,&$bin5_user_cur,$bin5_user_cur->step+1,TRUE,FALSE);
+ $bin5_user_cur->comm[$bin5_user_cur->step % COMM_N] = show_table($bin5, $bin5_user_cur,
+ $bin5_user_cur->step+1,
+ TRUE, FALSE);
$bin5_user_cur->step_inc();
log_wr("TRY PRESAVE: ".$bin5_user_cur->step." TRANS STEP: ".$bin5_user_cur->trans_step);