Пример #1
0
 /**
  * Refreshes the properties of the class
  * @param  string $id_field Column to identify the user with
  * @param  string $field_id Value of the identification column
  * @return void
  */
 public function refreshCache($id_field, $field_id)
 {
     foreach (Sql::Query("SELECT * FROM accounts WHERE {$id_field} = '" . $field_id . "'") as $i) {
         foreach ($i as $key => $i2) {
             if (Text::validate($key, 'num')) {
                 continue;
             }
             $this->{$key} = $i2;
         }
     }
 }
Пример #2
0
 /**
  * Returns all the sitevars on the database
  * @return array Sitevars
  */
 static function getVars()
 {
     $query = Sql::Query("SELECT * FROM sitevars");
     if (!$query) {
         Kernel::Log('Could not retrieve sitevars.');
         trigger_error('Could not retrieve sitevars.', E_USER_ERROR);
         return false;
     }
     foreach ($query as $reg) {
         $sitevars[$reg['name']] = $reg['value'];
     }
     return $sitevars;
 }
Пример #3
0
 /**
  * Retrieves an user's certain info
  * @param  string $id_field Name of the identification column
  * @param  string $field    Field we'll be fetching
  * @return mixed            Returns the value of the column, returns false otherwise
  */
 static function getUserInfo($id_field, $field)
 {
     if (self::userExists($id_field) < 1) {
         return false;
     }
     if (!Sql::hasColumns('accounts', array($field))) {
         return false;
     }
     $data = Sql::Query(array("table" => "accounts", "select" => $field, "where" => self::$id_field . "," . $id_field), true);
     return $data[$field];
 }