X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Findex.php;h=6c7b5b2c0538e0e432a74c8ddc85a35f48563c8f;hb=7379a6c57be3c4ced0871d429bc1de1d6e2a91f8;hp=9fb6b3d5b01313078f67a3b3c2eeed227d585911;hpb=818b1bd911888487f2c217ac84f414d3ec527de5;p=brisk.git
diff --git a/web/index.php b/web/index.php
index 9fb6b3d..6c7b5b2 100644
--- a/web/index.php
+++ b/web/index.php
@@ -2,7 +2,7 @@
/*
* brisk - index.php
*
- * Copyright (C) 2006-2011 Matteo Nastasi
+ * Copyright (C) 2006-2012 Matteo Nastasi
* mailto: nastasi@alternativeoutput.it
* matteo.nastasi@milug.org
* web: http://www.alternativeoutput.it
@@ -20,13 +20,7 @@
* not, write to the Free Software Foundation, Inc, 59 Temple Place -
* Suite 330, Boston, MA 02111-1307, USA.
*
-
-
-TODO:
- - header
- - setcookie
- - gestire per intero la var globale di output
-*/
+ */
require_once("Obj/brisk.phh");
require_once("Obj/auth.phh");
@@ -44,7 +38,7 @@ $mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati
'en' => 'Standing players'),
'headline' => array('it' => 'briscola chiamata in salsa ajax',
'en' => 'declaration briscola in ajax sauce (Beta)'),
- 'wellcome' => array('it' => 'Digita il tuo nickname per accedere ai tavoli della briscola',
+ 'welcome' => array('it' => 'Digita il tuo nickname per accedere ai tavoli della briscola',
'en' => 'Enter your nickname to access to the tables of briscola'),
'btn_enter' => array('it' => 'entra',
'en' => 'enter'),
@@ -88,6 +82,14 @@ $mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati
'en' => 'baby'),
'st_mop_desc' => array('it' => 'pulizie',
'en' => 'mop'),
+ 'st_babbo_desc' => array('it' => 'babbo',
+ 'en' => 'mop'),
+ 'st_renna_desc' => array('it' => 'renna',
+ 'en' => 'mop'),
+ 'st_pupaz_desc' => array('it' => 'pupazzo',
+ 'en' => 'mop'),
+ 'st_visch_desc' => array('it' => 'vischio',
+ 'en' => 'mop'),
'tit_ticker' => array('it' => 'scrivi un invito al tavolo e clicca',
'en' => 'write an invitation at the table and click'),
@@ -182,13 +184,6 @@ $mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati
require_once("briskin5/Obj/briskin5.phh");
-if (DEBUGGING == "local" && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
- echo "Debugging time!";
- exit;
-}
-
-log_load("index.php");
-
function poll_dom() {
GLOBAL $G_with_poll, $G_poll_title, $G_poll_entries;
@@ -220,7 +215,7 @@ function carousel_top()
return (sprintf('', $rn));
}
-function index_main(&$room, &$header_out, $addr, $get, $post, $cookie)
+function index_main(&$room, $transp_type, &$header_out, $addr, $get, $post, $cookie)
{
GLOBAL $G_with_donors, $G_donors_cur, $G_donors_all;
GLOBAL $G_with_topbanner, $G_topbanner, $G_is_local;
@@ -231,7 +226,7 @@ function index_main(&$room, &$header_out, $addr, $get, $post, $cookie)
GLOBAL $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER;
if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE)
- unset($sess);
+ $sess = "";
if (($name = gpcs_var('name', $get, $post, $cookie)) === FALSE)
unset($name);
if (($pass_private = gpcs_var('pass_private', $get, $post, $cookie)) === FALSE)
@@ -240,8 +235,7 @@ function index_main(&$room, &$header_out, $addr, $get, $post, $cookie)
unset ($table_idx);
if (($table_token = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE)
unset ($table_token);
-
-
+
// Use of proxies isn't allowed.
if (!$G_is_local && is_proxy($addr)) {
return FALSE;
@@ -267,9 +261,11 @@ function index_main(&$room, &$header_out, $addr, $get, $post, $cookie)
if (($user = &$room->get_user($sess, &$idx)) != FALSE) {
log_main("user stat: ".$user->stat);
if ($user->stat == "table") {
- setcookie("table_token", $user->table_token, $curtime + 31536000);
- setcookie("table_idx", $user->table, $curtime + 31536000);
- $header_out['Location'] = "Location: briskin5/index.php";
+ $cookies = new Cookies();
+ $cookies->add("table_token", $user->table_token, $curtime + 31536000);
+ $cookies->add("table_idx", $user->table, $curtime + 31536000);
+ $header_out['cookies'] = $cookies;
+ $header_out['Location'] = "briskin5/index.php";
return TRUE;
}
$ACTION = "room";
@@ -287,20 +283,29 @@ function index_main(&$room, &$header_out, $addr, $get, $post, $cookie)
$room->garbage_manager(TRUE);
/* try login */
- if (($user = $room->add_user(&$sess, &$idx, $name, $pass_private, $addr)) != FALSE) {
+ $ipv4addr_arr = explode(':' , $addr);
+ if (isset($ipv4addr_arr[3])) {
+ $ipv4addr = $ipv4addr_arr[3];
+ }
+ else {
+ $ipv4addr = $addr;
+ }
+ if (($user = $room->add_user(&$sess, &$idx, $name, $pass_private, $ipv4addr, $cookie)) != FALSE) {
$ACTION = "room";
if ($idx < 0) {
$idx = -$idx - 1;
$is_login = TRUE;
}
- log_legal($curtime, $addr, $user, "STAT:LOGIN", '');
+ log_legal($curtime, $ipv4addr, $user, "STAT:LOGIN", '');
// recovery lost game
if ($user->stat == "table") {
- setcookie("table_token", $user->table_token, $curtime + 31536000);
- setcookie("table_idx", $user->table, $curtime + 31536000);
- $header_out['Location'] = "Location: briskin5/index.php";
+ $cookies = new Cookies();
+ $cookies->add("table_token", $user->table_token, $curtime + 31536000);
+ $cookies->add("table_idx", $user->table, $curtime + 31536000);
+ $header_out['cookies'] = $cookies;
+ $header_out['Location'] = "briskin5/index.php";
return TRUE;
}
@@ -409,14 +414,18 @@ function index_main(&$room, &$header_out, $addr, $get, $post, $cookie)
array ( 'id' => 'btn_foroli',
'url' => 'http://www.forumolimpia.it',
'content' => 'img/forumolimpia.gif',
- 'content_big' => 'img/forumolimpia_big.png' ) );
+ 'content_big' => 'img/forumolimpia_big.png' ),
+ array ( 'id'=> 'btn_niini',
+ 'url' => 'http://www.niinivirta.it',
+ 'content' => 'img/niinivirta.png',
+ 'content_big' => 'img/niinivirta_big.png') );
$altout_support = "";
$altout_support_big = "";
- for ($i = 0 ; $i < 3 ; $i++) {
- $ii = ($i < 2 ? $i : 0);
+ for ($i = 0 ; $i < 4 ; $i++) {
+ $ii = ($i < 3 ? $i : 0);
$altout_support .= sprintf('
',
$i * 20, $altout_support_arr[$ii]['url'],
@@ -517,7 +526,7 @@ google_color_url = "000000";
"