Example #1
0
 /**
  * Class constructor
  * @param $userId ID of user that will be represented by this class
  */
 function __construct($userId)
 {
     //update local user id with given user id
     $this->userId = $userId;
     //connect to database
     $this->db = ASDatabase::getInstance();
 }
 /**
  * Class constructor
  */
 function __construct()
 {
     //get database class instance
     $this->db = ASDatabase::getInstance();
     //create new object of ASEmail class
     $this->mailer = new ASEmail();
 }
Example #3
0
 /**
  * Instance of ASDatabase class. Singleton pattern.
  * @return ASDatabase|Instance Instance of ASDatabase class
  */
 public static function getInstance()
 {
     // create instance if doesn't exist
     if (self::$instance === null) {
         self::$instance = new self(DB_TYPE, DB_HOST, DB_NAME, DB_USER, DB_PASS);
     }
     return self::$instance;
 }
 public static function getAdmin()
 {
     $role = new ASRole();
     $db = ASDatabase::getInstance();
     $adminRoleId = $role->getId('admin');
     $result = $db->select('SELECT * FROM `as_users` WHERE `user_role` = :role_id', array('role_id' => $adminRoleId));
     if (count($result) > 0) {
         return $result[0];
     } else {
         return null;
     }
 }
Example #5
0
<?php

include_once 'ASConfig.php';
include_once 'ASSession.php';
include_once 'ASValidator.php';
include_once 'ASLang.php';
include_once 'ASRole.php';
include_once 'ASDatabase.php';
include_once 'ASEmail.php';
include_once 'ASLogin.php';
include_once 'ASRegister.php';
include_once 'ASUser.php';
include_once 'ASComment.php';
$db = ASDatabase::getInstance();
ASSession::startSession();
$login = new ASLogin();
$register = new ASRegister();
$mailer = new ASEmail();
if (isset($_GET['lang'])) {
    ASLang::setLanguage($_GET['lang']);
}
Example #6
0
 /**
  * Class constructor
  */
 function __construct()
 {
     $this->db = ASDatabase::getInstance();
 }
 /**
  * Class constructor
  */
 public function __construct()
 {
     $this->db = ASDatabase::getInstance();
     $this->validator = new ASValidator();
 }