Exemple #1
0
 protected function __construct()
 {
     parent::__construct($this->settings);
     $database = DB::get();
     $result = $database->settings->find();
     foreach ($result as $row) {
         $this->settings[$row["key"]] = $row["value"];
     }
 }
Exemple #2
0
 public function __construct($ids = nil)
 {
     parent::__construct($this->products);
     if ($ids !== nil) {
         return $this->find($ids);
     }
     $database = DB::get();
     $products = $database->products->find();
     foreach ($products as $product) {
         $this->products[] = new Product($product);
     }
 }
Exemple #3
0
 public function __construct($email = nil, $password = nil, $remember = nil, $allowipchange = nil)
 {
     parent::__construct($_SESSION);
     #=====================================================
     # If the person is logged in, check thier login
     # credentials. If not, log them in with the supplied values
     #=====================================================
     #Get the database connection
     $database = DB::get();
     #Query the database for the email address entered
     $result = $database->administrators->findOne(array('email' => $email));
     // LUKE, FIND RETURNS AN ARRAY OF RESULTS, NOT A ASSOC ARRAY OF THE FIRST RESULT!!!!
     // FINDONE DOES JUST RETURN THE FIRST FOUND THINGS, SO USE THAT HERE ^^
     // If there is no user found, send it back! D:
     if ($result === null) {
         return $this->sendback();
     }
     #Assign the result to variables
     $salt = $result['salt'];
     $storedpass = $result['password'];
     $ip = $_SERVER['REMOTE_ADDR'];
     #Add the salt to the password, then hash it, then compare against the stored password
     $pass = hash("sha512", $salt . $password);
     #Compare the passwords
     if ($pass !== $storedpass) {
         #The password is not correct!! YOU SHALL NOT PASS
         return $this->sendback();
     }
     #The login information is correct. Allow the user to enter!
     $this->isLoggedIn = true;
     $this->secureSession();
     #Add all the login detials to the session
     $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
     $_SESSION['user'] = $email;
     $_SESSION['remember'] = $remember;
     $_SESSION['time'] = time();
     $_SESSION['allowipchange'] = $allowipchange;
     $_SESSION['useragent'] = $_SERVER['HTTP_USER_AGENT'];
     #Thats it! Session is stored. We are good to go!
     $this->isLoggedIn = true;
 }
Exemple #4
0
 public function __construct($settings)
 {
     parent::__construct($this->settings);
     $this->settings = $settings;
 }