Пример #1
0
function pageAddMessages($smarty)
{
    if (Config::get('debug/debug')) {
        Notifications::addDebug('PHP Version: ' . PHP_VERSION, true);
        Notifications::addDebug('Current Time: ' . date('H:i:s'), true);
        Notifications::addDebug(Notifications::getAsJson(), true);
    }
    $smarty->assign('notifications_success', Session::flashRead('notifications-success'));
    $smarty->assign('notifications_info', Session::flashRead('notifications-info'));
    $smarty->assign('notifications_warning', Session::flashRead('notifications-warning'));
    $smarty->assign('notifications_error', Session::flashRead('notifications-error'));
    $smarty->assign('alerts_success', Session::flashRead('alerts-success'));
    $smarty->assign('alerts_info', Session::flashRead('alerts-info'));
    $smarty->assign('alerts_warning', Session::flashRead('alerts-warning'));
    $smarty->assign('alerts_error', Session::flashRead('alerts-error'));
    return $smarty;
}
Пример #2
0
 public function query($sql, $params = array())
 {
     $this->_error = false;
     $params = array_values($params);
     if (Config::get('debug/qrydump')) {
         Notifications::addDebug($sql . ': ' . json_encode($params), true);
     }
     if ($this->_query = $this->_pdo->prepare($sql)) {
         if (count($params)) {
             foreach ($params as $index => $param) {
                 $this->_query->bindValue($index + 1, $param);
             }
         }
         if ($this->_query->execute()) {
             $this->_results = $this->_query->fetchAll(PDO::FETCH_OBJ);
             $this->_count = $this->_query->rowCount();
         } else {
             $this->setError($this->_query->errorInfo());
         }
     } else {
         $this->setError(array(0, 0, "Could not prepare SQL query: {$sql}"));
     }
     return $this;
 }
Пример #3
0
<?php

error_reporting(E_ALL);
require_once 'vendor/smarty/smarty/libs/Smarty.class.php';
require_once 'vendor/autoload.php';
require_once 'dbsettings.php';
session_start();
date_default_timezone_set('Europe/Amsterdam');
@mkdir('storage', 0771, true);
@chmod('storage', 0771);
$GLOBALS['config'] = array('debug' => array('debug' => false, 'smartyDebug' => false, 'qrydump' => false), 'smarty' => array('caching' => true, 'cache_lifetime' => 120), 'mysql' => array('host' => $db_host, 'username' => $db_username, 'password' => $db_password, 'db' => $db_dbname), 'twilio' => array('sid' => 'AC45051091c1437e8c03b5151fc2487029', 'token' => '9c3e5fe94047edd008664ef25649de4b'), 'remember' => array('cookie_name' => 's1704362univ_remember', 'cookie_expiry' => 604800), 'session' => array('loggedId' => 's1704362univ_userId', 'token_name' => 's1704362univ_token'), 'validation' => array('user_info' => array('name' => array('name' => 'Username', 'min' => 1, 'max' => 50), 'sid' => array('name' => 'Student Number', 'wildcard' => 's???????'), 'email' => array('name' => 'Email Address', 'ofType' => array('email')), 'phone' => array('name' => 'Mobile/Phone Number', 'max' => 14, 'ofType' => array('phone'))), 'register_info' => array('name' => array('name' => 'Username', 'required' => true, 'min' => 1, 'max' => 50), 'sid' => array('name' => 'Student Number', 'required' => true, 'wildcard' => 's???????', 'unique' => 'users/student_id'), 'email' => array('name' => 'Email Address', 'ofType' => array('email')), 'phone' => array('name' => 'Mobile/Phone Number', 'max' => 14, 'ofType' => array('phone'))), 'set_password' => array('password' => array('name' => 'Password', 'required' => true, 'min' => 4, 'max' => 72), 'password_again' => array('name' => 'Repeat Password', 'required' => true, 'matches' => 'password')), 'login' => array('sid' => array('name' => 'Student Number', 'required' => true, 'wildcard' => 's???????'), 'password' => array('name' => 'Password', 'required' => true, 'max' => 72))));
spl_autoload_register(function ($class) {
    require_once 'app/classes/' . $class . '.php';
});
require_once 'app/functions/sanitize.php';
require_once 'app/functions/misc.php';
Users::init();
Phone::init();
Update::doUpdate();
if (Config::get('debug/debug')) {
    Notifications::addDebug('POST data: ' . json_encode($_POST), true);
}