X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fuser.phh;h=94df3623b634841dd0ad755e98064db54b61b0a5;hb=8bd0ea95b1b1df4fbb7e9cd0b599ec6869c87f0e;hp=0661c3887bc5c0261c8f1f81a5790a47d666d8a3;hpb=dae8abeb22cc710161ee2d90b80f9a07e706680f;p=brisk.git diff --git a/web/Obj/user.phh b/web/Obj/user.phh index 0661c38..94df362 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -60,9 +60,14 @@ define('USER_FLAG_TY_SUPER', 0x020000); // done define('USER_FLAG_TY_CERT', 0x040000); // done // ... other usefull status ... define('USER_FLAG_TY_FIRONLY', 0x200000); // done -define('USER_FLAG_TY_SUSPEND', 0x400000); // done +// define('USER_FLAG_TY_free-to-use', 0x400000); // done define('USER_FLAG_TY_DISABLE', 0x800000); // done +// ... reasons for disabling account ... +define('USER_DIS_REA_INVMAIL', 1); +define('USER_DIS_REA_LICENCE', 2); +define('USER_DIS_REA_BANNED', 3); + // 240 is the right value, 600 is for fwrite error test define('RD_ENDTIME_DELTA', 240); define('RD_KEEPALIVE_TOUT', 4); @@ -74,11 +79,18 @@ $S_load_stat = array( 'rU_heavy' => 0, 'wR_minusone' => 0, 'wR_the_end' => 0 ); -$mlang_indrd = array( +$mlang_user = array( 'btn_backtotab' => array('it' => ' torna ai tavoli ', 'en' => ' back to tables '), 'btn_btotabsup' => array('it' => ' grazie della donazione, torna ai tavoli ', - 'en' => ' thank you for donation, back to tables ') + 'en' => ' thank you for donation, back to tables '), + + 'btn_agree' => array('it' => ' accetto ', + 'en' => ' agree '), + 'btn_refuse' => array('it' => ' rifiuto ', + 'en' => ' refuse '), + 'btn_after' => array('it' => ' leggo poi ', + 'en' => ' read later ') ); class User { @@ -310,15 +322,34 @@ class User { { $flags_old = $this->flags & (~$mask); $this->flags = ($flags_old | ($flags & $mask)); + + return ($flags_old); } - function store_set() + function prefs_store() { if (($bdb = BriskDB::create()) == FALSE) { return FALSE; } return ($bdb->user_prefs_update($this->code, ($this->flags & (USER_FLAG_TY_ALL | USER_FLAG_MAP_AUTH)), - $this->rec->supp_comp)); + $this->rec->supp_comp_get())); + } + + function tos_store() + { + if (($bdb = BriskDB::create()) == FALSE) { + return FALSE; + } + return ($bdb->user_tos_update($this->code, $this->rec->tos_vers_get())); + } + + function state_store() + { + if (($bdb = BriskDB::create()) == FALSE) { + return FALSE; + } + return ($bdb->user_state_update($this->code, ($this->flags & (USER_FLAG_TY_ALL | USER_FLAG_MAP_AUTH)), + $this->rec->disa_reas_get())); } function rd_data_set($curtime, $transp, $enc, $stat, $subst, $step, $from) @@ -533,11 +564,11 @@ class User { protected function maincheck($get, $post, $cookie) { - GLOBAL $G_lang, $mlang_indrd; + GLOBAL $G_lang, $G_base, $mlang_user; // GLOBAL $first_loop; GLOBAL $G_with_splash, $G_splash_content, $G_splash_interval, $G_splash_idx; GLOBAL $G_splash_w, $G_splash_h, $G_splash_timeout; - GLOBAL $G_lice_vers, $G_lice_fname, $G_lice_dthard, $G_lice_dtsoft, $G_lice_idx; + GLOBAL $G_tos_vers, $G_tos_fname, $G_tos_dthard, $G_tos_dtsoft, $G_tos_idx; GLOBAL $S_load_stat; @@ -586,16 +617,37 @@ class User { if ($this->stat == 'room') { log_rd("roomma ".$this->step); $curtime = time(); - + if ($this->rec !== FALSE) { + if ($curtime > $G_tos_dtsoft || $curtime > $G_tos_dthard) { + if (versions_cmp($this->rec->tos_vers_get(), $G_tos_vers) < 0) { // comparison between user version and current version + if ($curtime > $G_tos_dtsoft) { + // call notify soft + $ret .= show_notify_document(esclfhtml(file_get_contents($G_base.sprintf($G_tos_fname, $G_tos_vers, $G_lang))), + 0, array($mlang_user['btn_agree'][$G_lang], $mlang_user['btn_refuse'][$G_lang], $mlang_user['btn_after'][$G_lang] /* , "Scarico." */), + "tos_confirm", 600, 600, TRUE, 0); + $ret .= sprintf("act_tosmgr('soft', g_nd.ret_get(), '%s', '%s');", + xcape($this->rec->tos_vers_get()), xcape($G_tos_vers)); + } + else if ($curtime > $G_tos_dthard) { + // call notify hard + $ret .= show_notify_document(esclfhtml(file_get_contents($G_base.sprintf($G_tos_fname, $G_tos_vers, $G_lang))), + 0, array($mlang_user['btn_agree'][$G_lang], $mlang_user['btn_refuse'][$G_lang] /* , "Scarico." */), + "tos_confirm", 600, 600, TRUE, 0); + $ret .= sprintf("act_tosmgr('hard', g_nd.ret_get(), '%s', '%s');", + xcape($this->rec->tos_vers_get()), xcape($G_tos_vers)); + } + } + } + } if ($G_with_splash && ($splashdate < $curtime - $G_splash_interval || $splashdate > $curtime)) { $is_super = $this->flags & USER_FLAG_TY_SUPER; - $ret .= show_notify_ex(str_replace("\n", " ", $G_splash_content[$G_lang]), - ($is_super ? 0 : $G_splash_timeout), - // $mlang_indrd[($is_super ? 'btn_btotabsup' : 'btn_backtotab')][$G_lang], - $mlang_indrd['btn_backtotab'][$G_lang], - $G_splash_w, $G_splash_h, true, + $ret .= show_notify_ex(str_replace("\n", " ", $G_splash_content[$G_lang]), + ($is_super ? 0 : $G_splash_timeout), + // $mlang_user[($is_super ? 'btn_btotabsup' : 'btn_backtotab')][$G_lang], + $mlang_user['btn_backtotab'][$G_lang], + $G_splash_w, $G_splash_h, true, ($is_super ? 0 : $G_splash_timeout)); $ret .= sprintf('|createCookie("CO_splashdate%d", %d, 24*365, cookiepath);', $G_splash_idx, $curtime); } @@ -782,7 +834,7 @@ function is_supp_custom() return (TRUE); } /* - if ($this->rec->last_dona > 1356994800) { + if ($this->rec->last_dona_get() > 1356994800) { return (TRUE); } */