- $this->asta_card = $from->asta_card;
- $this->asta_pnt = $from->asta_pnt;
- $this->handpt = $from->handpt;
- $this->exitislock = $from->exitislock;
-
- $this->flags = $from->flags;
-
- $this->chattime = array();
- for ($i = 0 ; $i < CHAT_N ; $i++)
- $this->chattime[$i] = $from->chattime[$i];
- $this->chat_cur = $from->chat_cur;
- $this->chat_lst = $from->chat_lst;
- $this->chat_ban = $from->chat_ban;
- $this->chat_dlt = $from->chat_dlt;
-
- $this->table_orig = $from->table_orig;
- $this->table = $from->table;
- $this->table_pos = $from->table_pos;
- $this->table_token = $from->table_token;
- $this->the_end = $from->the_end;
- $this->shm_sz = $from->shm_sz;
- return (TRUE);
- }
-
-
- function myclone($from)
- {
- if (($thiz = new User()) == FALSE)
- return (FALSE);
-
- $thiz->copy($from);
-
- return ($thiz);
- }
-
- function spawn($from, $table, $table_pos)
- {
- if (($thiz = new User()) == FALSE)
- return (FALSE);
-
- $thiz->idx = $from->idx;
- $thiz->idx_orig = $from->idx;
- $thiz->code = $from->code;
- $thiz->name = $from->name;
- $thiz->sess = $from->sess;
- $thiz->ip = $from->ip;
- $thiz->lacc = $from->lacc;
- $thiz->laccwr = $from->laccwr;
- $thiz->bantime = $from->bantime;
- $thiz->stat = $from->stat;
- $thiz->subst = $from->subst;
- $thiz->step = $from->step;
- $thiz->trans_step = $from->trans_step;
- $thiz->comm = array();
-
- /*
- $i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N));
- for ($i = $i_start ; $i < $from->step ; $i++) {
- log_wr("TRY PUSH:".$i);
- $ii = $i % COMM_N;
- $thiz->comm[$ii] = $from->comm[$ii];
- }
- */
- $thiz->asta_card = $from->asta_card;
- $thiz->asta_pnt = $from->asta_pnt;
- $thiz->handpt = $from->handpt;
- $thiz->exitislock = $from->exitislock;
- $thiz->the_end = $from->the_end;
-
- $thiz->flags = $from->flags;
-
- $thiz->chattime = array_fill(0, CHAT_N, 0);
- $thiz->chat_cur = 0;
- $thiz->chat_lst = "";
- $thiz->chat_ban = 0;
- $thiz->chat_dlt = 0;
-
-
- $thiz->table_orig = $table;
- $thiz->table = 0;
- $thiz->table_pos = $table_pos;
- $thiz->table_token = $from->table_token;
- $thiz->shm_sz = $from->shm_sz;
-
- return ($thiz);
- }
-
- function idx_get() {
- return ($this->idx);
- }
-
- function code_get() {
- return ($this->code);
- }
-
- function stat_set($stat) {
- log_main("sess: [".$this->sess. "] NEW STAT: [".$stat."]");
- $this->stat = "$stat";
-
- /*
- if (validate_sess($this->sess)) {
- if (file_exists(PROXY_PATH) == FALSE)
- mkdir(PROXY_PATH, 0775, TRUE);
- $fp = fopen(PROXY_PATH."/".$this->sess.".stat", 'w');
- fwrite($fp, sprintf("%s\n",$this->stat));
- fclose($fp);
- }
- */
- }
-
- function step_set($step)
- {
- $this->step = $step & 0x7fffffff;
-
- return (TRUE);
- }
-
- function step_inc($delta = 1) {
- $this->step += $delta;
- /* modularization because unpack() not manage unsigned 32bit int correctly */
- $this->step &= 0x7fffffff;
-
- return TRUE;
- }
-
- function save_step()
- {
- do {
- if (validate_sess($this->sess) == FALSE)
- break;
- if (file_exists(PROXY_PATH) == FALSE)
- mkdir(PROXY_PATH, 0775, TRUE);
- if (($fp = @fopen(PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE)
- break;
- fwrite($fp, pack("LL",$this->step, $this->idx));
- fclose($fp);
-
- log_main("step_set [".$this->sess. "] [".$this->step."]");
-
- return (TRUE);
- } while (0);
-
- return (FALSE);
- }
-
- static function load_step($sess)
- {
- $fp = FALSE;
- do {
- if (validate_sess($sess) == FALSE)
- break;
-
- if (file_exists(PROXY_PATH) == FALSE)
- mkdir(PROXY_PATH, 0775, TRUE);
- if (($fp = @fopen(PROXY_PATH."/".$sess.".step", 'rb')) == FALSE)
- break;
- if (($s = fread($fp, 8)) == FALSE)
- break;
- if (mb_strlen($s, "ASCII") != 8)
- break;
- $arr = unpack('Ls/Li', $s);
- fclose($fp);
-
- // log_rd2("A0: ".$arr[0]." A1: ".$arr[1]);
- return ($arr);
- } while (0);
-
- if ($fp != FALSE)
- fclose($fp);
-
- log_rd2("STEP_GET [".$sess."]: return false ");
-
- return (FALSE);
- }
-
- static function unproxy_step($sess) {
- log_rd2("UNPROXY: ".PROXY_PATH."/".$sess.".step");
- if (file_exists(PROXY_PATH) == FALSE)
- return;
- @unlink(PROXY_PATH."/".$sess.".step");
- }