From 00a2a198331bbb4eb71ed12d3c6384c41791710c Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 9 Jul 2012 23:41:00 -0400 Subject: [PATCH] CC-4090: Make code style PSR compliant Subjects.php --- airtime_mvc/application/models/Subjects.php | 98 +-------------------- 1 file changed, 1 insertion(+), 97 deletions(-) diff --git a/airtime_mvc/application/models/Subjects.php b/airtime_mvc/application/models/Subjects.php index e66bbaa8a..15432d56f 100644 --- a/airtime_mvc/application/models/Subjects.php +++ b/airtime_mvc/application/models/Subjects.php @@ -18,102 +18,6 @@ class Application_Model_Subjects { /* ======================================================= public methods */ - /** - * Check login and password - * - * @param string $login - * @param string $pass - * optional - * @return boolean|int|PEAR_Error - */ - public static function Authenticate($login, $pass='') - { - global $CC_CONFIG; - $con = Propel::getConnection(); - $cpass = md5($pass); - $sql = "SELECT id FROM ".$CC_CONFIG['subjTable'] - ." WHERE login='$login' AND pass='$cpass' AND type='U'" - ." LIMIT 1"; - $query = $con->query($sql)->fetchColumn(0); - return $query; - } - - - /** - * Change user password - * - * @param string $login - * @param string $oldpass - * old password (optional for 'superuser mode') - * @param string $pass - * optional - * @param boolean $passenc - * optional, password already encrypted if true - * @return boolean|PEAR_Error - */ - public static function Passwd($login, $oldpass=null, $pass='', $passenc=FALSE) - { - global $CC_CONFIG; - $con = Propel::getConnection(); - if (!$passenc) { - $cpass = md5($pass); - } else { - $cpass = $pass; - } - if (!is_null($oldpass)) { - $oldcpass = md5($oldpass); - $oldpCond = "AND pass='$oldcpass'"; - } else { - $oldpCond = ''; - } - $sql = "UPDATE ".$CC_CONFIG['subjTable']." SET pass='$cpass'" - ." WHERE login='$login' $oldpCond AND type='U'"; - $con->exec($sql); - return TRUE; - } - - - /* --------------------------------------------------------------- groups */ - - /* --------------------------------------------------------- info methods */ - - /** - * Get subject id from login - * - * @param string $login - * @return int|false - */ - public static function GetSubjId($login) - { - global $CC_CONFIG; - $con = Propel::getConnection(); - $sql = "SELECT id FROM ".$CC_CONFIG['subjTable'] - ." WHERE login='$login'"; - $query = $con->query($sql)->fetchColumn(0); - return ($query !== false) ? $query : NULL; - } - - - /** - * Return true if uid is direct member of gid - * - * @param int $uid - * local user id - * @param int $gid - * local group id - * @return boolean - */ - public static function IsMemberOf($uid, $gid) - { - global $CC_CONFIG; - $con = Propel::getConnection(); - $sql = "SELECT count(*) as cnt" - ." FROM ".$CC_CONFIG['smembTable'] - ." WHERE uid='$uid' AND gid='$gid'"; - $res = $con->query($sql)->fetchColumn(0); - return (intval($res) > 0); - } - public static function increaseLoginAttempts($login) { global $CC_CONFIG; @@ -131,7 +35,7 @@ class Application_Model_Subjects { $sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = '0'" ." WHERE login='$login'"; $res = $con->exec($sql); - return TRUE; + return true; } public static function getLoginAttempts($login)