Module: nagvis Branch: master Commit: 929b45266457a3fef4be609f36ae211f62468cf6 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=929b45266457a3fef4be609f36ae211f62468cf6
Author: Lars Michelsen <[email protected]> Date: Tue Aug 24 21:03:46 2010 +0200 Added better error reporting when auth.db is not writeable during transparent authentication --- share/server/core/classes/CoreAuthModSQLite.php | 4 ++++ share/server/core/classes/CoreSQLiteHandler.php | 6 ++++++ share/server/core/classes/GlobalCore.php | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/share/server/core/classes/CoreAuthModSQLite.php b/share/server/core/classes/CoreAuthModSQLite.php index e9bb787..1dd0cf8 100644 --- a/share/server/core/classes/CoreAuthModSQLite.php +++ b/share/server/core/classes/CoreAuthModSQLite.php @@ -101,10 +101,14 @@ class CoreAuthModSQLite extends CoreAuthModule { } private function updatePassword() { + if(!$this->DB->isWriteable()) + return false; $this->DB->query('UPDATE users SET password='.$this->DB->escape($this->sPasswordHash).' WHERE name='.$this->DB->escape($this->sUsername)); } private function addUser($user, $hash) { + if(!$this->DB->isWriteable()) + return false; $this->DB->query('INSERT INTO users (name,password) VALUES ('.$this->DB->escape($user).','.$this->DB->escape($hash).')'); } diff --git a/share/server/core/classes/CoreSQLiteHandler.php b/share/server/core/classes/CoreSQLiteHandler.php index 582aef3..6c3cf53 100644 --- a/share/server/core/classes/CoreSQLiteHandler.php +++ b/share/server/core/classes/CoreSQLiteHandler.php @@ -27,6 +27,7 @@ */ class CoreSQLiteHandler { private $DB = null; + private $file = null; public function __construct() {} @@ -35,6 +36,7 @@ class CoreSQLiteHandler { if($this->checkSQLiteSupport()) { try { $this->DB = new PDO("sqlite:".$file); + $this->file = $file; } catch(PDOException $e) { echo $e->getMessage(); return false; @@ -49,6 +51,10 @@ class CoreSQLiteHandler { return false; } } + + public function isWriteable() { + return GlobalCore::getInstance()->checkWriteable($this->file); + } public function tableExist($table) { $RET = $this->query('SELECT COUNT(*) AS num FROM sqlite_master WHERE type=\'table\' AND name='.$this->escape($table))->fetch(PDO::FETCH_ASSOC); diff --git a/share/server/core/classes/GlobalCore.php b/share/server/core/classes/GlobalCore.php index 5e4f402..413f098 100644 --- a/share/server/core/classes/GlobalCore.php +++ b/share/server/core/classes/GlobalCore.php @@ -391,9 +391,9 @@ class GlobalCore { continue; if($setKey) - $files[] = $arrRet[$returnPart]; + $files[$arrRet[$returnPart]] = $arrRet[$returnPart]; else - $files[$$arrRet[$returnPart]] = $arrRet[$returnPart]; + $files[] = $arrRet[$returnPart]; } if($files) ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
