Пример #1
0
 public function __construct($class, $method)
 {
     $this->config = ConfigFactory::getConfig();
     $this->class = $class;
     $this->method = $method;
     $this->loadMethodQueries($this->config->get('installDir'));
 }
Пример #2
0
 /**
  * Initializes the database connection, and the configuration connections,
  * and then makes a call to an abstract method that must be defined in the
  * child classes in order to initialize the template system
  *
  * Contains the only statically called query in the entire application, as it
  * resides in an abstract class and the preparedQueryHandler depends on the fact
  * that it can derive the name of the class at run time and load those queries.
  */
 public function __construct()
 {
     $this->db = DblFactory::getConn();
     $this->config = ConfigFactory::getConfig();
     /** STRONG AUTHENTICATION */
     if (isset($_COOKIE['uName']) && isset($_COOKIE['pass'])) {
         $this->user = UserFactory::getUser($_COOKIE['uName'], md5($_COOKIE['pass']));
     } else {
         // login as a dummy user who is only able to see news
         $this->user = '';
     }
     $this->init();
 }
Пример #3
0
 function Comments($action)
 {
     global $prefix, $path;
     if (!is_null($prefix) && !is_null($path)) {
         $this->prefix = $prefix;
         $this->path = $path;
     }
     $this->init();
     $this->action = $action;
     $this->db = DblFactory::getConn();
     $this->config = ConfigFactory::getConfig();
     $this->siteUrl = '';
 }
Пример #4
0
<?php

use blargon\display\News;
use blargon\lang\Language;
use blargon\factory\ConfigFactory;
use blargon\factory\DblFactory;
require_once dirname(__FILE__) . '/config.php';
$db = DblFactory::getConn();
ConfigFactory::setDb($db);
$config = ConfigFactory::getConfig();
$lang = new Language('login');
if (isset($_POST['submit']) && $_POST['submit']) {
    $result = $db->query('SELECT id, pass FROM ' . $config->get('prefix') . '_user WHERE user=\'' . $_POST['user'] . '\'')->fetchObject();
    if ($db->query('select * from ' . $config->get('prefix') . '_attempts where userId=\'' . $result->id . '\'')->rowCount() >= 5) {
        header('Location: login.php?error=' . $lang->message('general', 'locked') . '.');
        die;
    }
    if (md5($_POST['pass']) == $result->pass) {
        $id = $db->query('SELECT id FROM ' . $config->get('prefix') . '_user WHERE user=\'' . $_POST['user'] . '\'')->fetchObject();
        $db->query('delete from ' . $config->get('prefix') . '_attempts where userId=\'' . $id->id . '\'') or die(mysql_error());
        $level = $db->query('SELECT userLevel FROM ' . $config->get('prefix') . '_user WHERE user=\'' . $_POST['user'] . '\'')->fetchObject();
        if (isset($_POST['stayLogged']) && $_POST['stayLogged']) {
            setcookie('pass', $_POST['pass'], time() + 29030400);
            setcookie('uName', $_POST['user'], time() + 29030400);
            setcookie('uLevel', $level->userLevel, time() + 29030400);
        } else {
            setcookie('pass', $_POST['pass']);
            setcookie('uName', $_POST['user']);
            setcookie('uLevel', $level->userLevel);
        }
        header('Location: index.php');
Пример #5
0
 public function __construct()
 {
     $this->db = DblFactory::getConn();
     $this->config = ConfigFactory::getConfig();
 }
Пример #6
0
<?php

/** Database configuration */
$connect = array('host' => 'localhost', 'user' => 'root', 'pass' => '', 'base' => 'websheets', 'prefix' => 'websheets');
/* DO NOT modify anything below this line */
use blargon\factory\DblFactory;
use blargon\factory\ConfigFactory;
$sedai = array('includeDir' => 'include/view', 'format' => '{@},{obj},{->},{key},{;}');
/** register a classloader and then fall back on japha's */
spl_autoload_register(function ($class) {
    if (file_exists(dirname(__FILE__) . "/lib/{$class}.php")) {
        include_once dirname(__FILE__) . "/lib/{$class}.php";
    }
});
require_once dirname(__FILE__) . '/../japha/japha.php';
DblFactory::load($connect);
$db = DblFactory::getConn();
ConfigFactory::setDb($db);
Пример #7
0
 public function getInstance()
 {
     $this->instance = ConfigFactory::getConfig();
 }