X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2FObj%2Fbriskin5.phh;h=0c36306bbdc1e538322907493427c6fa5e36fdc8;hb=9cbf3bfaad0cad7feaf6413eb53df0a1475c6303;hp=e05e7b99f3a73c5983216216079650607ac2495f;hpb=fa82ba0deaaab26b5b9efe37c392a34cbec50a66;p=brisk.git diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index e05e7b9..0c36306 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -170,12 +170,10 @@ class Table_briskin5 extends Table { /* CREATE() NOT USED - function &create($idx) + function create($idx) { - GLOBAL $G_false; - if (($thiz =& new Table_briskin5()) == FALSE) - return ($G_false); + return (FALSE); $thiz->create($idx); @@ -206,12 +204,10 @@ class Table_briskin5 extends Table { */ /* CLONE() NOT USED - function &myclone(&$from) + function myclone(&$from) { - GLOBAL $G_false; - if (($thiz =& new Table_briskin5()) == FALSE) - return ($G_false); + return (FALSE); parent::copy($from); @@ -250,18 +246,17 @@ class Table_briskin5 extends Table { parent::copy($from); } - function &spawn(&$from) + function spawn(&$from) { - GLOBAL $G_false; - if (($thiz =& new Table_briskin5()) == FALSE) - return ($G_false); + return (FALSE); $thiz->parentcopy($from); log_main("PLAYER_N - spawn.".$thiz->player_n); - $thiz->card = &$thiz->bunch_create(); + $thiz->card = array(); + $thiz->bunch_create(); $thiz->mazzo = rand(0,PLAYERS_N-1); $thiz->points_n = 0; $thiz->mult = 1; @@ -279,17 +274,26 @@ class Table_briskin5 extends Table { } - function &bunch_create() + // function bunch_create_old() function AND + // { + // $ret = array(); + // + // for ($i = 0 ; $i < (BRISKIN5_PLAYERS_N == 5 ? 40 : 24) ; $i++) { + // // for ($i = 0 ; $i < 40 ; $i++) { + // $ret[$i] =& new Card($i, 'bunch', 'no_owner'); + // } + // + // $oret = &$ret; + // return ($oret); + // } + + function bunch_create() { - $ret = array(); - - for ($i = 0 ; $i < (BRISKIN5_PLAYERS_N == 5 ? 40 : 24) ; $i++) { - // for ($i = 0 ; $i < 40 ; $i++) { - $ret[$i] =& new Card($i, 'bunch', 'no_owner'); - } - - $oret = &$ret; - return ($oret); + $ret = array(); + + for ($i = 0 ; $i < (BRISKIN5_PLAYERS_N == 5 ? 40 : 24) ; $i++) { + $this->card[$i] = new Card($i, 'bunch', 'no_owner'); + } } function bunch_make() @@ -428,11 +432,9 @@ class User_briskin5 extends User { } /* CREATE NOT USED - function &create($name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") { - GLOBAL $G_false; - + function create($name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") { if (($thiz =& new User()) == FALSE) - return ($G_false); + return (FALSE); $thiz->asta_card = -2; $thiz->asta_pnt = -1; @@ -461,12 +463,10 @@ class User_briskin5 extends User { } /* CLONE NOT USED - function &myclone(&$from) + function myclone(&$from) { - GLOBAL $G_false; - if (($thiz =& new User()) == FALSE) - return ($G_false); + return (FALSE); $thiz->copy($from); @@ -474,12 +474,12 @@ class User_briskin5 extends User { } */ - function &spawn(&$from, $table, $table_pos) + function spawn(&$from, $table, $table_pos) { - GLOBAL $G_false, $CO_bin5_pref_ring_endauct; + GLOBAL $CO_bin5_pref_ring_endauct; if (($thiz =& new User_briskin5()) == FALSE) - return ($G_false); + return (FALSE); $thiz->parentcopy($from); @@ -548,9 +548,9 @@ class Briskin5 { } - function &get_user($sess, &$idx) + function get_user($sess, &$idx) { - GLOBAL $PHP_SELF, $G_false; + GLOBAL $PHP_SELF; if (validate_sess($sess)) { for ($i = 0 ; $i < BRISKIN5_MAX_PLAYERS ; $i++) { @@ -569,13 +569,14 @@ class Briskin5 { log_main(sprintf("get_user: Wrong strlen [%s]",$sess)); } - return ($G_false); + return (FALSE); } function garbage_manager($force) { - + GLOBAL $G_base; + /* Garbage collector degli utenti in timeout */ $ismod = FALSE; $curtime = time(); @@ -606,7 +607,7 @@ class Briskin5 { /* se gli altri utenti non erano d'accordo questo utente viene bannato */ $remcalc = $this->table[0]->exitlock_calc(&$this->user, $user_cur->table_pos); if ($remcalc < 3) { - require_once("/var/www/webspace/trusty/Obj/hardban.phh"); + require_once("${G_base}Obj/hardban.phh"); Hardbans::add(($user_cur->flags & USER_FLAG_AUTH ? $user_cur->name : FALSE), $user_cur->ip, $user_cur->sess, $user_cur->laccwr + BAN_TIME); } @@ -631,7 +632,7 @@ class Briskin5 { // // static functions // - function &load_data($table_idx, $table_token = "") + function load_data($table_idx, $table_token = "") { GLOBAL $G_false, $sess; $doexit = FALSE; @@ -677,7 +678,7 @@ class Briskin5 { if ($doexit) exit(); - return ($G_false); + return (FALSE); } @@ -1496,4 +1497,17 @@ function game_result($asta_pnt, $pnt) } } +function log_points($curtime, &$user, $where, $mesg) +{ + GLOBAL $_SERVER; + + if (($fp = @fopen(LEGAL_PATH."/points.log", 'a')) != FALSE) { + /* Unix time | session | nickname | IP | where was | mesg */ + fwrite($fp, sprintf("%ld|%s|%s|%s|%s|%s|%s|\n", $curtime, $user->sess, + ($user->flags & USER_FLAG_AUTH ? 'A' : 'N'), + $user->name, $_SERVER['REMOTE_ADDR'], $where , $mesg)); + fclose($fp); + } +} + ?>