Example #1
0
 function __construct()
 {
     date_default_timezone_set('Europe/Berlin');
     define('IN_CORE', true);
     require 'config/config.php';
     $dbconfig = array('hostname' => $mysql_hostname, 'username' => $mysql_username, 'password' => $mysql_password, 'database' => $mysql_database);
     $this->DB = new mysqli($dbconfig['hostname'], $dbconfig['username'], $dbconfig['password'], $dbconfig['database']);
     if (mysqli_connect_errno()) {
         die("Can't connect to database");
     }
     self::$db_con = $this->DB;
     $res = $this->query('SELECT type, name, value FROM {settings}') or die($this->error());
     while ($setting = $res->fetch_array()) {
         if ($setting['type'] == '1' || $setting['type'] == '2' || $setting['type'] == '3') {
             $this->settings[$setting['name']] = stripslashes($setting['value']);
         } else {
             $this->settings[$setting['name']] = NULL;
         }
     }
     $this->rootpath = $this->settings['Bloglink'];
     $this->adminrootpath = $this->rootpath . '/admin';
     $this->design = $this->settings['Design'];
     $this->encoding = $this->settings['Zeichensatz'];
     session_start();
     $username = $this->visitor_as_user();
     if ($username) {
         $this->user = User::find_by_name($username);
         if ($this->user) {
             $this->user->is_online();
         }
     } else {
         $this->user = new User();
     }
 }
Example #2
0
 static function all()
 {
     $sql = "SELECT * FROM {user}";
     $res = Devbird::oquery($sql);
     if (!$res) {
         return array();
     }
     $users = array();
     while ($user = $res->fetch_object()) {
         $users[] = new User($user);
     }
     return $users;
 }