Exemplo n.º 1
0
 public static function getConnection($provider)
 {
     if (self::$_con) {
         return self::$_con;
     } else {
         $class = __CLASS__;
         self::$_con = new $class($provider);
         return self::$_con;
     }
 }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
 }
Exemplo n.º 3
0
<?php

session_start();
/* Getting the language file. */
$lang = $_SESSION['language'];
if (isset($lang)) {
    require_once '/languages/' . $lang . '.php';
} else {
    // Default: Spanish.
    require_once '/languages/es_ES.php';
}
/*require_once('includes/functions.php');
	$functions = new Functions;*/
require_once "Database.class.php";
$db = DatabaseLayer::getConnection("MySqlProvider");
/* Selecting the comic to show. */
if (isset($_GET['comic'])) {
    $rs = $db->execute("SELECT comics.id, path, title, username, date FROM comics, users WHERE comics.author = users.id AND comics.id = ?", array($_GET['comic']));
} elseif (isset($_GET['first'])) {
    $rs = $db->execute("SELECT comics.id, path, title, username, date FROM comics, users WHERE comics.author = users.id ORDER BY id ASC LIMIT 0, 1");
} elseif (isset($_GET['random'])) {
    $rs = $db->execute("SELECT comics.id, path, title, username, date FROM comics, users WHERE comics.author = users.id ORDER BY RAND() LIMIT 0, 1");
} else {
    $rs = $db->execute("SELECT comics.id, path, title, username, date FROM comics, users WHERE comics.author = users.id ORDER BY id DESC LIMIT 0, 1");
}
// By default, we show the newest comic.
include_once 'includes/header.html';
/* We show the comic only if it exists. */
if ($rs) {
    $comic_id = $rs[0];
    $comic_path = $rs[1];
Exemplo n.º 4
0
 public static function query($query, $type = 'StdClass', $key_by = null)
 {
     $database = DatabaseLayer::getInstance();
     $passthru = $database->passthru($query);
     return $passthru->execute($type);
 }
Exemplo n.º 5
0
 /**
  * @return bool
  * @throws DatabaseLayer\ConfigurationException
  */
 public function wipe()
 {
     if (DatabaseLayer::getInstance()->useCache()) {
         $cache = DatabaseLayer::getInstance()->getCache();
         $cache->flushAll();
         return $cache->deleteAll();
     } else {
         $this->index = [];
         return true;
     }
 }