Ejemplo n.º 1
0
 function init()
 {
     $this->db = NyaaDB::factory(sprintf('sqlite:localhost:/%s/data/twitter.db', $this->Ctrl->getConf('root.dir')));
     $this->uid = $this->Ctrl->getSession()->get('user.id');
     $this->con_key = $this->Ctrl->getConf('twitter.key');
     $this->con_secret = $this->Ctrl->getConf('twitter.secret');
 }
Ejemplo n.º 2
0
 function __construct($str)
 {
     parent::__construct();
     if (preg_match('/^([^:]+):([^\\/]+)\\/(.*)/', $str, $m)) {
         $type = $m[1];
         $host = $m[2];
         $db = $this->db = $m[3];
     }
     $this->con = sqlite_open($db);
 }
Ejemplo n.º 3
0
 function init()
 {
     $this->db = $this->Ctrl->get('db.system');
     $this->db = NyaaDB::factory('sqlite:localhost/' . $this->Ctrl->getConf('root.dir') . '/data/profile.photo.db');
     /*
     		$this->db->query('drop table photo;');
     		$this->db->query('create table photo (id integer primary key, userid int, name varchar(128), type varchar(128), size int(16), bin blob);');
     */
     $this->type = "photo";
     $this->uid = $this->Ctrl->getSession()->get('user.id');
     $this->imageDir = $this->Ctrl->getConf('root.dir') . '/data/user/' . $this->uid;
     /*
     mkdir($this->imageDir);
     chmod($this->imageDir,0777);
     mkdir($this->imageDir.'/img');
     mkdir($this->imageDir.'/img/300x300');
     mkdir($this->imageDir.'/img/200x200');
     mkdir($this->imageDir.'/img/150x150');
     mkdir($this->imageDir.'/img/100x100');
     mkdir($this->imageDir.'/img/75x75');
     mkdir($this->imageDir.'/img/50x50');
     mkdir($this->imageDir.'/img/25x25');
     */
 }
Ejemplo n.º 4
0
<?php

require_once 'db/db.class.php';
$dir = dirname(__FILE__);
$handler = NyaaDB::factory("sqlite:localhost/{$dir}/sample.db");
$hadnler->query('CREATE TABLE sample (id integer,name varchar(128))');
$sth = $hadnler->prepare('INSERT INTO sample (id,name) VALUES (:id,:name)');
$sth->bindParam('id', 1, 'int');
$sth->bindParam('name', "hajime", 'str');
$sth->execute();
$id = $sth->getLastId();
$sth = $hadnler->prepare('SELECT * FROM sample WHERE id=:id;');
$sth->bindParam('id', 1, 'int');
$sth->execute();
$row = $sth->fetch();
echo $row['name'];
Ejemplo n.º 5
0
 function dbFactory($con)
 {
     require_once 'db/db.class.php';
     $handler = NyaaDB::factory($con);
     return $handler;
 }
Ejemplo n.º 6
0
<?php

set_include_path('../lib');
require_once 'controller/controller.class.php';
require_once 'log/log.class.php';
// Logger Setup
$_NYAA_LOG = array();
$logger = new NyaaLog();
$handler = $logger->createHandler('capture');
$handler->bind($_NYAA_LOG);
$logger->addHandler(NyaaLog::ALL, $handler);
NyaaLog::addStack($logger);
$Ctrl = NyaaController::factory('web', '../site/root.conf', array('root.dir' => realpath(dirname(__FILE__) . '/../site')));
$Ctrl->request(isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : "", $_POST, $_GET, $_FILES);
// Connect Database
require_once 'db/db.class.php';
$db = NyaaDB::factory($Ctrl->getConf('db.system'));
$Ctrl->set("db.system", $db);
$Ctrl->init();
$Ctrl->run();
foreach ($_NYAA_LOG as $log) {
    echo '<li>' . $log . '</li>';
}