X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Findex_wr.php;h=fe7a798f23d61a0da5c55352a91f5dbac100873f;hb=refs%2Fheads%2Fmoder;hp=8571c76d1bc89874c849e1cfc5fcef473cc81fc8;hpb=628c0ad0666348d62d0e46fcace789c38edb5350;p=brisk.git diff --git a/web/index_wr.php b/web/index_wr.php index 8571c76..fe7a798 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -105,7 +105,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) /* if the IP is banned, exit without do nothing */ if (array_search($remote_addr, $G_black_list) !== FALSE) { - sleep(5); + // TODO: find a way to add a nonblocking sleep(5) here return (FALSE); } @@ -199,6 +199,11 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) // LACC UPDATED $user->lacc = $curtime; + if (array_search($user->ip, $G_black_list) !== FALSE) { + // TODO: find a way to add a nonblocking sleep(5) here + return (FALSE); + } + if ($argz[0] == 'ping') { log_wr("PING RECEIVED"); } @@ -275,13 +280,13 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) } else { /* MLANG: "E\' occorso un errore durante il salvataggio, riprova o contatta l\'amministratore." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); } } else { /* MLANG: "Per autenticare qualcuno devi a tua volta essere autenticato." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['warrmust'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['warrmust'][$G_lang]); } if ($mesg_to_user != "") { @@ -328,19 +333,19 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) } else { /* MLANG: "Il database è temporaneamente irraggiungibile, riprova più tardi o contatta l\'amministratore." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['coerrdb'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['coerrdb'][$G_lang]); $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; } } else { /* MLANG: "E\' occorso un errore durante il salvataggio, riprova o contatta l\'amministratore." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); } } else { /* MLANG: "Per autenticare qualcuno devi a tua volta essere autenticato." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mesgmust'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mesgmust'][$G_lang]); } if ($mesg_to_user != "") { @@ -350,9 +355,6 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) $user->step_inc(); } } - - - else if ($argz[0] == 'poll') { GLOBAL $G_with_poll, $G_poll_name; if (($cli_choose = gpcs_var('cli_choose', $get, $post, $cookie)) === FALSE) @@ -384,7 +386,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) log_wr("INFO:SKIP:argz == poll name: [".$cli_poll_name."] AUTH: ".($user->flags & USER_FLAG_AUTH)); if (($user->flags & USER_FLAG_AUTH) != USER_FLAG_AUTH) { // MLANG: Per partecipare al sondaggio devi essere autenticato. - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['pollmust'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['pollmust'][$G_lang]); log_wr("break1"); break; } @@ -403,7 +405,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) if (($poll_lock = Poll::lock_data(TRUE)) == FALSE) { /* MLANG: "E\' occorso un errore durante il salvataggio, riprova o contatta l\'amministratore." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); log_wr("break3"); break; } @@ -412,7 +414,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) $fp = @fopen(LEGAL_PATH."/".$G_poll_name.".txt", 'w+'); if ($fp == FALSE) { - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); log_wr("break4"); break; } @@ -465,7 +467,24 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) echo "$echont"; } - + else if ($argz[0] == 'moderate') { + // TODO: add certification check + if (1 == 1) { + if ($user->flags_vlt_get(USER_FLAG_MODER) == 0 && $argz[1] == 'true') { + /* enable moderation */ + $moder_enable = 'true'; + $user->flags_vlt_set(USER_FLAG_MODER, USER_FLAG_MODER); + } + else { + /* disable moderation */ + $moder_enable = 'false'; + $user->flags_vlt_set(0, USER_FLAG_MODER); + } + $user->comm[$user->step % COMM_N] = sprintf("gst.st = %d; moderate(%s);", + $user->step+1, $moder_enable); + $user->step_inc(); + } + } /****************** * * * STAT: room * @@ -568,13 +587,13 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) /* MLANG: "Il server sta per essere riavviato, non possono avere inizio nuove partite.", "Il tavolo a cui volevi sederti richiede autentifica.", "Il tavolo si è appena liberato, ci si potrà sedere tra %d secondi." */ if ($G_shutdown) { - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['shutmsg'][$G_lang]); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['shutmsg'][$G_lang]); } else if ($table->auth_only && (($user->flags & USER_FLAG_AUTH) == 0)) { - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mustauth'][$G_lang]); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mustauth'][$G_lang]); } else { - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s%d%s");', $dt, NICKSERV, $mlang_indwr['tabwait_a'][$G_lang], $table->wakeup_time - $curtime, $mlang_indwr['tabwait_b'][$G_lang]); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s%d%s");', $dt, NICKSERV, $mlang_indwr['tabwait_a'][$G_lang], $table->wakeup_time - $curtime, $mlang_indwr['tabwait_b'][$G_lang]); } $user->step_inc(); return TRUE;