X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fdbase_file.phh;h=9461f1e99da381d267da84dfc4e06dcb5fc8d72b;hb=1fc2a56fc5b81d917ce929be0e2f0d53672a26fa;hp=2245efdf038f2a8490d7a2937e13627c275d160f;hpb=624de6cc9fb76254d07a81a13bdedfef847324ea;p=brisk.git diff --git a/web/Obj/dbase_file.phh b/web/Obj/dbase_file.phh index 2245efd..9461f1e 100644 --- a/web/Obj/dbase_file.phh +++ b/web/Obj/dbase_file.phh @@ -2,7 +2,7 @@ /* * brisk - dbase_file.phh * - * 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 @@ -22,19 +22,32 @@ * */ -require_once("Obj/dbase_base.phh"); +require_once("${G_base}Obj/dbase_base.phh"); define(BRISK_AUTH_CONF, "brisk_auth.conf.pho"); -class LoginDB { +class BriskDB { var $item; var $item_n; - function LoginDB() + function BriskDB() + { + log_main("BriskDB create:start"); + + log_main("BriskDB create:end"); + } + + static function create() + { + $ret = new BriskDB(); + + return ($ret); + } + + function users_load() { GLOBAL $DOCUMENT_ROOT; - log_main("LoginDB create:start"); if (file_exists("$DOCUMENT_ROOT/Etc/".BRISK_AUTH_CONF)) { require("$DOCUMENT_ROOT/Etc/".BRISK_AUTH_CONF); @@ -46,7 +59,6 @@ class LoginDB { new LoginDBItem(4, "tre", md5("three"), "pippo@pluto.com", USER_FLAG_TY_NORM) ); } $this->item_n = count($this->item); - log_main("LoginDB create:end"); } function count() @@ -58,7 +70,7 @@ class LoginDB { { log_main("login_exists: ".$login); - /* check the existence of the nick in the LoginDB */ + /* check the existence of the nick in the BriskDB */ for ($i = 0 ; $i < $this->item_n ; $i++) { if (strcasecmp($this->item[$i]->login, $login) == 0) { log_main("login[".$i."]: ".$this->item[$i]->login); @@ -75,13 +87,11 @@ class LoginDB { return ($this->item[$idx]->login); } - function &getitem_bylogin($login, &$id) + function getitem_bylogin($login, &$id) { - GLOBAL $G_false; - log_main("login_exists: ".$login); - /* check the existence of the nick in the LoginDB */ + /* check the existence of the nick in the BriskDB */ for ($i = 0 ; $i < $this->item_n ; $i++) { if (strcasecmp($this->item[$i]->login, $login) == 0) { log_main("login[".$i."]: ".$this->item[$i]->login); @@ -91,14 +101,14 @@ class LoginDB { } } $id = -1; - return ($G_false); + return (FALSE); } function getmail($login) { log_main("getmail"); - /* check the existence of the nick in the LoginDB */ + /* check the existence of the nick in the BriskDB */ for ($i = 0 ; $i < $this->item_n ; $i++) { if (strcasecmp($this->item[$i]->login, $login) == 0) { log_main("login[".$i."]: ".$this->item[$i]->login); @@ -112,7 +122,7 @@ class LoginDB { { log_main("getmail"); - /* check the existence of the nick in the LoginDB */ + /* check the existence of the nick in the BriskDB */ for ($i = 0 ; $i < $this->item_n ; $i++) { if (strcasecmp($this->item[$i]->login, $login) == 0) { log_main("login[".$i."]: ".$this->item[$i]->login); @@ -122,53 +132,56 @@ class LoginDB { return (FALSE); } - function &login_verify($login, $pass) - { - GLOBAL $G_false; - - $ret = &$G_false; - - log_main("login_verify: ".$login); + function login_verify($login, $pass) + { + $ret = FALSE; - /* check the existence of the nick in the LoginDB */ - for ($i = 0 ; $i < $this->item_n ; $i++) { - log_main("login_verify: LOOP"); - if (strcasecmp($this->item[$i]->login, $login) == 0) { - log_main("login[".$i."]: ".$this->item[$i]->login); - - /* if it exists check for a valid challenge */ - if (($a_sem = Challenges::lock_data()) != FALSE) { - - if (($chals = &Challenges::load_data()) != FALSE) { - for ($e = 0 ; $e < $chals->item_n ; $e++) { - - log_main("challenge[".$i."]: ".$chals->item[$e]->login); - if (strcmp($login, $chals->item[$e]->login) == 0) { - log_main("login_verify [".$pass."] with [".md5($chals->item[$e]->token.$this->item[$i]->pass)."]"); - - if (strcmp($pass , md5($chals->item[$e]->token.$this->item[$i]->pass)) == 0) { - log_main("login_verify SUCCESS for ".$login); - - $chals->rem($login); - $ret = &$this->item[$i]; - break; - } + log_main("login_verify: ".$login); + + /* check the existence of the nick in the BriskDB */ + for ($i = 0 ; $i < $this->item_n ; $i++) { + log_main("login_verify: LOOP"); + if (strcasecmp($this->item[$i]->login, $login) == 0) { + log_main("login[".$i."]: ".$this->item[$i]->login); + + /* if it exists check for a valid challenge */ + if (($a_sem = Challenges::lock_data(TRUE)) != FALSE) { + + if (($chals = &Challenges::load_data()) != FALSE) { + for ($e = 0 ; $e < $chals->item_n ; $e++) { + + log_main("challenge[".$i."]: ".$chals->item[$e]->login); + if (strcmp($login, $chals->item[$e]->login) == 0) { + log_main("login_verify [".$pass."] with [".md5($chals->item[$e]->token.$this->item[$i]->pass)."]"); + + if (strcmp($pass , md5($chals->item[$e]->token.$this->item[$i]->pass)) == 0) { + log_main("login_verify SUCCESS for ".$login); + + $chals->rem($login); + $ret = &$this->item[$i]; + break; } - } // end for ($e = 0 ... - } - - if ($chals->ismod()) { - Challenges::save_data(&$chals); - } - - Challenges::unlock_data($a_sem); + } + } // end for ($e = 0 ... } - break; - } // if (strcasecmp($this->item[$i]->login, ... - } - - return ($ret); + + if ($chals->ismod()) { + Challenges::save_data($chals); + } + + Challenges::unlock_data($a_sem); + } + break; + } // if (strcasecmp($this->item[$i]->login, ... } -} // End class LoginDB + + return ($ret); + } + + function bin5_points_save($date, $table, $tidx, $action, $ucodes, $pts) + { + return TRUE; + } +} // End class BriskDB ?> \ No newline at end of file