/** * * @return Controller */ protected function _getErrorController() { $config = Application::getConfig(); if (class_exists($config['defaults'][self::CONFIG_KEY_ERROR_CONTROLLER_NAME])) { $controller = new $config['defaults'][self::CONFIG_KEY_ERROR_CONTROLLER_NAME](); } else { $controller = $this; } return $controller; }
protected function getTwitterService() { if (!$this->twitterService) { $config = Application::getConfig(); if (!isset($config[Twitter::CONFIG_KEY])) { throw new \Exception("Unable to find twitter configuration."); } $this->twitterService = new Twitter($config[Twitter::CONFIG_KEY]); } return $this->twitterService; }
public static function authenticate($username, $password) { $db = Application::getDbAdapter(); $config = Application::getConfig(); $table = $config[self::SETUP_KEY]['table_name']; $username_col = $config[self::SETUP_KEY][self::IDENTITY_FIELD_KEY]; $password_col = $config[self::SETUP_KEY][self::PASSWORD_FIELD_KEY]; $query = "\n SELECT {$config[self::SETUP_KEY][self::IDENTITY_ID_FIELD_KEY]} FROM {$table}\n WHERE {$username_col} = ? AND {$password_col} = MD5(?);"; $rowset = $db->prepareExecuteAndFetch($query, array($username, $password)); if (count($rowset) == 1) { self::setAuthenticated(true, $rowset[0][$config[self::SETUP_KEY]['identity_id_field']]); } }