Exemple #1
0
 function __construct($table)
 {
     $class = get_class($this);
     print_r(strToLower($class));
     echo "\n";
     parent::__construct($table);
 }
 function __construct()
 {
     parent::__construct();
     $this->selectStmt = self::$db_handler->prepare('SELECT * FROM health_goal WHERE uid=?');
     $this->updateStmt = self::$db_handler->prepare('UPDATE health_goal SET walk=?, upper_limb=?, lower_limb=? WHERE uid=?');
     $this->insertStmt = self::$db_handler->prepare('INSERT INTO health_goal ( walk, upper_limb, lower_limb ) VALUES( ?, ?, ? )');
 }
 public function __construct()
 {
     parent::__construct();
     $this->selectStmt = self::$db_handler->prepare('SELECT * FROM setting WHERE uid=?');
     $this->updateStmt = self::$db_handler->prepare('UPDATE setting SET weight=?, heart_rate=?, slumber=?, walk=?, upper_limb=?, lower_limb=?, send_campaign=?, sync_time=? WHERE uid=?');
     $this->insertStmt = self::$db_handler->prepare('INSERT INTO setting ( uid ) VALUES( ? )');
 }
 function __construct()
 {
     parent::__construct();
     $this->selectStmt = self::$db_handler->prepare('SELECT * FROM user WHERE uname=?');
     $this->updateStmt = self::$db_handler->prepare('UPDATE user SET uname=?, gender=?, email=?, age=?, location=? WHERE uid=?');
     $this->insertStmt = self::$db_handler->prepare('INSERT INTO user ( uname, email, password ) VALUES( ?, ?, ? )');
 }
Exemple #5
0
 function __construct()
 {
     parent::__construct();
     $this->selectStmt = self::$PDO->prepare("SELECT * FROM venue WHERE id=?");
     $this->updateStmt = self::$PDO->prepare("update venue set name=?, id=? where id=?");
     $this->insertStmt = self::$PDO->prepare("insert into venue ( name ) \n                             values( ? )");
 }
 public function __construct()
 {
     parent::__construct();
     $this->selectStmt = self::$db_handler->prepare('SELECT * FROM role WHERE rid=?');
     $this->updateStmt = self::$db_handler->prepare('UPDATE role SET role=?, role_des=? WHERE rid=?');
     $this->insertStmt = self::$db_handler->prepare('INSERT INTO role ( role, role_des ) VALUES( ?, ? )');
 }
 /**
  * ActivityMapper constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->selectAll = self::$db_handler->prepare('SELECT title, content FROM activity');
     $this->selectStmt = self::$db_handler->prepare('SELECT * FROM activity WHERE acid=?');
     $this->updateStmt = self::$db_handler->prepare('UPDATE activity SET title=?, content=?, a_img_url=?, enter_amount=?, end_time=? WHERE acid=?');
     $this->insertStmt = self::$db_handler->prepare('INSERT INTO activity ( title, content, post_time, end_time ) VALUES( ?, ?, ?, ? )');
 }
 function __construct()
 {
     parent::__construct();
     $this->selectStmt = self::$db_handler->prepare('SELECT * FROM plan WHERE uid=?');
     $this->updateStmt = self::$db_handler->prepare('UPDATE plan SET breakfast=?, lunch=?, dinner=?, exercise=? WHERE uid=? AND pid=?');
     $this->insertStmt = self::$db_handler->prepare('INSERT INTO plan ( pid, uid ) VALUES( ?, ? )');
     $this->countStmt = self::$db_handler->prepare('SELECT count(*) ' . self::COUNT . ' FROM plan WHERE uid=?');
 }
 /**
  * PostMapper constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->selectAll = self::$db_handler->prepare('SELECT * FROM post ORDER BY post_id');
     $this->selectStmt = self::$db_handler->prepare('SELECT * FROM post WHERE post_id=?');
     $this->updateStmt = self::$db_handler->prepare('UPDATE post SET content=? WHERE post_id=?');
     $this->insertStmt = self::$db_handler->prepare('INSERT INTO post (content, post_time) VALUES(?, ? )');
 }
Exemple #10
0
 function __construct()
 {
     parent::__construct();
     $this->selectAllStmt = self::$PDO->prepare("SELECT * FROM venue");
     $this->selectStmt = self::$PDO->prepare("SELECT * FROM venue WHERE id=?");
     $this->updateStmt = self::$PDO->prepare("UPDATE venue SET name=?, id=? WHERE id=?");
     $this->insertStmt = self::$PDO->prepare("INSERT into venue ( name ) \n                             values( ? )");
 }
 /**
  * AdviceMapper constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->selectUser = self::$db_handler->prepare('SELECT a.vote, a.content, q.title, q.qid
           FROM advice a JOIN question q ON a.qid = q.qid WHERE ans_user=?');
     $this->selectStmt = self::$db_handler->prepare('SELECT a.*, u.uname FROM advice a JOIN user u on a.ans_user = u.uid WHERE qid=?');
     $this->updateStmt = self::$db_handler->prepare('UPDATE advice SET content=? WHERE qid=?');
     $this->insertStmt = self::$db_handler->prepare('INSERT INTO advice ( qid, content, ans_user, time ) VALUES( ?, ?, ?, ? )');
 }
Exemple #12
0
 function __construct()
 {
     parent::__construct();
     $this->selectAllStmt = self::$PDO->prepare("SELECT * FROM space");
     $this->selectStmt = self::$PDO->prepare("SELECT * FROM space WHERE id=?");
     $this->updateStmt = self::$PDO->prepare("UPDATE space SET name=?, id=? WHERE id=?");
     $this->insertStmt = self::$PDO->prepare("INSERT into space ( name, venue ) \n                             values( ?, ?)");
     $this->findByVenueStmt = self::$PDO->prepare("SELECT * FROM space where venue=?");
 }
Exemple #13
0
 function __construct(PDO $pdo)
 {
     parent::__construct($pdo);
     $this->selectStmt = $this->PDO->prepare("SELECT * FROM usergroups WHERE id=?");
     $this->selectAllStmt = $this->PDO->prepare("SELECT id, title FROM usergroups");
     $this->insertStmt = $this->PDO->prepare("INSERT INTO usergroups (title, color) VALUES (?,?)");
     $this->updateStmt = $this->PDO->prepare("UPDATE usergroups SET title=?, color=? WHERE id=?");
     $this->deleteStmt = $this->PDO->prepare("DELETE FROM usergroups WHERE id=?");
 }
Exemple #14
0
 function __construct()
 {
     parent::__construct();
     $this->selectAllStmt = self::$PDO->prepare("SELECT * FROM event");
     $this->selectBySpaceStmt = self::$PDO->prepare("SELECT * FROM event where space=?");
     $this->selectStmt = self::$PDO->prepare("SELECT * FROM event WHERE id=?");
     $this->updateStmt = self::$PDO->prepare("UPDATE event SET start=?, duration=?, name=?, id=? WHERE id=?");
     $this->insertStmt = self::$PDO->prepare("INSERT into event (start, duration, space, name) \n                             values( ?, ?, ?, ?)");
 }
 /**
  * QuestionMapper constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->selectUser = self::$db_handler->prepare('SELECT title, content, vote, qid FROM question WHERE uid=?');
     $this->selectStmt = self::$db_handler->prepare('SELECT u.uname, q.type, q.to_user, q.title, q.content, q.time, q.vote
         FROM question q JOIN user u ON q.uid = u.uid WHERE qid=?');
     $this->updateStmt = self::$db_handler->prepare('UPDATE question SET title=?, content=?, vote=? WHERE qid=?');
     $this->insertStmt = self::$db_handler->prepare('INSERT INTO question ( uid, type, to_user, title, content, time) VALUES( ?, ?, ?, ?, ?, ? )');
     $this->selectAll = self::$db_handler->prepare('SELECT * FROM question');
 }
 function __construct()
 {
     parent::__construct();
     global $url;
     $this->id = $url->getIdFirstPart();
     if (func_num_args() == 1 && is_object(func_get_arg(0))) {
         $object_ = func_get_arg(0);
         $this->foreignTable = $object_;
     }
 }
Exemple #17
0
 function __construct($pdo)
 {
     parent::__construct($pdo);
     $this->selectCount = $this->PDO->prepare("SELECT COUNT(id) AS count FROM news");
     $this->selectStmt = $this->PDO->prepare("SELECT * FROM news WHERE id=?");
     $this->selectCollectionStmt = $this->PDO->prepare("SELECT id, title, date, type FROM news ORDER BY date DESC LIMIT ?, ?");
     $this->selectAllStmt = $this->PDO->prepare("SELECT * FROM news");
     $this->insertStmt = $this->PDO->prepare("INSERT INTO news (title, text, full_text, date, author, view, type) VALUES (?,?,?,?,?,?,?)");
     $this->updateStmt = $this->PDO->prepare("UPDATE news SET title=?, text=?, full_text=?, date=?, author=?, view=?, type=? WHERE id=?");
     $this->deleteStmt = $this->PDO->prepare("DELETE FROM news WHERE id=?");
 }
Exemple #18
0
 function __construct($pdo)
 {
     parent::__construct($pdo);
     $this->selectCount = $this->PDO->prepare("SELECT COUNT(id) AS count FROM categories");
     $this->selectStmt = $this->PDO->prepare("SELECT * FROM categories WHERE id=?");
     $this->selectCollectionStmt = $this->PDO->prepare("SELECT id, title, meta_d, meta_k FROM categories LIMIT ?, ?");
     $this->selectAllStmt = $this->PDO->prepare("SELECT id, title FROM categories");
     $this->insertStmt = $this->PDO->prepare("INSERT INTO categories (title, text, meta_d, meta_k) VALUES (?,?,?,?)");
     $this->updateStmt = $this->PDO->prepare("UPDATE categories SET title=?, text=?, meta_d=?, meta_k=? WHERE id=?");
     $this->deleteStmt = $this->PDO->prepare("DELETE FROM categories WHERE id=?");
 }
Exemple #19
0
 function __construct(PDO $pdo)
 {
     parent::__construct($pdo);
     $this->selectCount = $this->PDO->prepare("SELECT COUNT(id) AS count FROM settings");
     $this->selectStmt = $this->PDO->prepare("SELECT * FROM settings WHERE id=?");
     $this->selectCollectionStmt = $this->PDO->prepare("SELECT id, page, title, meta_d FROM settings LIMIT ?, ?");
     $this->selectAllStmt = $this->PDO->prepare("SELECT * FROM settings");
     $this->insertStmt = $this->PDO->prepare("INSERT INTO settings (page, title, meta_d, meta_k) VALUES (?,?,?,?)");
     $this->updateStmt = $this->PDO->prepare("UPDATE settings SET page=?, title=?, meta_d=?, meta_k=? WHERE id=?");
     $this->deleteStmt = $this->PDO->prepare("DELETE FROM settings WHERE id=?");
 }
Exemple #20
0
 function __construct($pdo)
 {
     parent::__construct($pdo);
     $this->selectCount = $this->PDO->prepare("SELECT COUNT(id) AS count FROM data");
     $this->selectStmt = $this->PDO->prepare("SELECT * FROM data WHERE id=?");
     $this->selectCollectionStmt = $this->PDO->prepare("SELECT id, cat, title, meta_d FROM data LIMIT ?, ?");
     $this->selectAllStmt = $this->PDO->prepare("SELECT * FROM data LIMIT");
     $this->insertStmt = $this->PDO->prepare("INSERT INTO data (title, text, cat, meta_d, meta_k, description, view, author, date) VALUES (?,?,?,?,?,?,?,?,?)");
     $this->updateStmt = $this->PDO->prepare("UPDATE data SET title=?, text=?, cat=?, meta_d=?, meta_k=?, description=?, view=?, author=?, date=? WHERE id=?");
     $this->deleteStmt = $this->PDO->prepare("DELETE FROM data WHERE id=?");
 }
Exemple #21
0
 /**
  * MySQL driver constructor
  *
  * @param array $settings
  * @param array $classmap
  */
 public function __construct($settings, array $classmap = [])
 {
     // localhost
     if (!is_array($settings)) {
         $settings = ['host' => 'localhost', 'username' => 'root', 'password' => '', 'dbname' => $settings];
     }
     // create pdo instance
     $connector = 'mysql:host=' . $settings['host'] . ';dbname=' . $settings['dbname'];
     $pdo = new \PDO($connector, $settings['username'], $settings['password']);
     parent::__construct($pdo, $classmap);
 }
Exemple #22
0
 function __construct(PDO $pdo)
 {
     parent::__construct($pdo);
     $this->selectCount = $this->PDO->prepare("SELECT COUNT(id) AS count FROM users");
     $this->selectStmt = $this->PDO->prepare("SELECT * FROM users WHERE id=?");
     $this->selectCollectionStmt = $this->PDO->prepare("SELECT id, login, name, fam, email, access, regDate FROM users LIMIT ?, ?");
     $this->selectAllStmt = $this->PDO->prepare("SELECT id, login FROM users WHERE access=1");
     $this->insertStmt = $this->PDO->prepare("INSERT INTO users (login, password, email, access, name, fam, pol, regDate, birthDate, avatar, activation) VALUES (?,?,?,?,?,?,?,?,?,?,?)");
     $this->updateStmt = $this->PDO->prepare("UPDATE users SET login=?, password=?, email=?, access=?, name=?, fam=?, pol=?, regDate=?, birthDate=?, avatar=?, activation=? WHERE id=?");
     $this->deleteStmt = $this->PDO->prepare("DELETE FROM users WHERE id=?");
 }
Exemple #23
0
 function __construct(PDO $pdo)
 {
     parent::__construct($pdo);
     $this->selectCount = $this->PDO->prepare("SELECT COUNT(id) as count FROM sostav");
     $this->selectStmt = $this->PDO->prepare("SELECT * FROM sostav WHERE id=?");
     $this->selectCollectionStmt = $this->PDO->prepare("SELECT id, name, scores, rang FROM sostav ORDER BY scores DESC LIMIT ?, ?");
     $this->selectAllStmt = $this->PDO->prepare("SELECT * FROM sostav");
     $this->insertStmt = $this->PDO->prepare("INSERT INTO sostav (name, scores, rang, dol, fullName, skype) VALUES (?,?,?,?,?,?)");
     $this->updateStmt = $this->PDO->prepare("UPDATE sostav SET name=?, scores=?, rang=?, dol=?, fullName=?, skype=? WHERE id=?");
     $this->deleteStmt = $this->PDO->prepare("DELETE FROM sostav WHERE id=?");
 }
Exemple #24
0
 public function __construct($user = null)
 {
     parent::__construct("users");
     $this->_salt = config::get('encryption/salt');
     $this->_sessionName = config::get('session/session_name');
     $this->_cookieName = config::get('cookie/name');
     if (!$user) {
         if (Session::exist($this->_sessionName)) {
             $user = Session::get($this->_sessionName);
             if ($this->find(['id', '=', $user])) {
                 $this->_isLoggedIn = true;
             }
         }
     } else {
         $this->find(['id', '=', $user]);
     }
 }
Exemple #25
0
 /**
  *	Instantiate class
  *	@param $db \DB\Mongo
  *	@param $table string
  *	@param $onsuspect callback
  *	@param $key string
  **/
 function __construct(\DB\Mongo $db, $table = 'sessions', $onsuspect = NULL, $key = NULL)
 {
     parent::__construct($db, $table);
     $this->onsuspect = $onsuspect;
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'cleanup'));
     register_shutdown_function('session_commit');
     $fw = \Base::instance();
     $headers = $fw->get('HEADERS');
     $this->_csrf = $fw->hash($fw->get('ROOT') . $fw->get('BASE')) . '.' . $fw->hash(mt_rand());
     if ($key) {
         $fw->set($key, $this->_csrf);
     }
     $this->_agent = isset($headers['User-Agent']) ? $headers['User-Agent'] : '';
     $this->_ip = $fw->get('IP');
 }
 public function __construct(\Erfurt_Store $store, $url, $vocabulary)
 {
     parent::__construct($store, $url, $vocabulary);
 }
 function __construct()
 {
     parent::__construct();
 }
Exemple #28
0
 /**
  *	Instantiate class
  *	@param $db object
  *	@param $table string
  *	@param $force bool
  *	@param $onsuspect callback
  **/
 function __construct(\DB\SQL $db, $table = 'sessions', $force = TRUE, $onsuspect = NULL)
 {
     if ($force) {
         $eol = "\n";
         $tab = "\t";
         $db->exec((preg_match('/mssql|sqlsrv|sybase/', $db->driver()) ? 'IF NOT EXISTS (SELECT * FROM sysobjects WHERE ' . 'name=' . $db->quote($table) . ' AND xtype=\'U\') ' . 'CREATE TABLE dbo.' : 'CREATE TABLE IF NOT EXISTS ' . (($name = $db->name()) && $db->driver() != 'pgsql' ? $name . '.' : '')) . $table . ' (' . $eol . $tab . $db->quotekey('session_id') . ' VARCHAR(40),' . $eol . $tab . $db->quotekey('data') . ' TEXT,' . $eol . $tab . $db->quotekey('csrf') . ' TEXT,' . $eol . $tab . $db->quotekey('ip') . ' VARCHAR(40),' . $eol . $tab . $db->quotekey('agent') . ' VARCHAR(255),' . $eol . $tab . $db->quotekey('stamp') . ' INTEGER,' . $eol . $tab . 'PRIMARY KEY (' . $db->quotekey('session_id') . ')' . $eol . ');');
     }
     parent::__construct($db, $table);
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'cleanup'));
     register_shutdown_function('session_commit');
     @session_start();
     $fw = \Base::instance();
     $headers = $fw->get('HEADERS');
     if (($ip = $this->ip()) && $ip != $fw->get('IP') || ($agent = $this->agent()) && (!isset($headers['User-Agent']) || $agent != $headers['User-Agent'])) {
         if (isset($onsuspect)) {
             $fw->call($onsuspect, array($this));
         } else {
             session_destroy();
             $fw->error(403);
         }
     }
     $csrf = $fw->hash($fw->get('ROOT') . $fw->get('BASE')) . '.' . $fw->hash(mt_rand());
     if ($this->load(array('session_id=?', $this->sid = session_id()))) {
         $this->set('csrf', $csrf);
         $this->save();
     }
 }
Exemple #29
0
 /**
  *	Instantiate class
  *	@param $db object
  *	@param $table string
  **/
 function __construct(\DB\Jig $db, $table = 'sessions')
 {
     parent::__construct($db, 'sessions');
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'cleanup'));
     register_shutdown_function('session_commit');
 }
Exemple #30
0
 /**
  *	Instantiate class
  *	@param $db object
  *	@param $table string
  **/
 function __construct(\DB\Jig $db, $table = 'sessions')
 {
     parent::__construct($db, 'sessions');
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'cleanup'));
     register_shutdown_function('session_commit');
     @session_start();
     $fw = \Base::instance();
     $headers = $fw->get('HEADERS');
     if (($ip = $this->ip()) && $ip != $fw->get('IP') || ($agent = $this->agent()) && (!isset($headers['User-Agent']) || $agent != $headers['User-Agent'])) {
         session_destroy();
         $fw->error(403);
     }
     $csrf = $fw->hash($fw->get('ROOT') . $fw->get('BASE')) . '.' . $fw->hash(mt_rand());
     if ($this->load(array('@session_id=?', $this->sid = session_id()))) {
         $this->set('csrf', $csrf);
         $this->save();
     }
 }