Пример #1
0
 static function config()
 {
     parent::config();
     // load the default panel config file
     self::file(c::get('root.panel') . '/defaults/config/config.php');
     $root = c::get('root.site') . '/' . c::get('panel.folder') . '/config';
     self::file($root . '/config.php');
     self::file($root . '/config.' . server::get('server_name') . '.php');
 }
Пример #2
0
<?php

if (!defined('DINGO')) {
    die('External Access to File Denied');
}
/**
 * DB Library For Dingo Framework
 *
 * @author          Evan Byrne
 * @copyright       2008 - 2010
 * @project page    http://www.dingoframework.com
 */
load::config('db');
function db($table = FALSE, $orm = FALSE, $connection = 'default')
{
    // If no table given, return connection
    if (!$table) {
        return db::connection($connection);
    }
    // Otherwise, return table
    return $orm ? db::connection($connection)->table($table)->orm($orm) : db::connection($connection)->table($table);
}
class db
{
    private static $connections = array();
    private static $pdo = array('mysql', 'pgsql');
    // Add Connection
    // ---------------------------------------------------------------------------
    public static function add_connection($name)
    {
        $config = config::get('db');
Пример #3
0
define('KIRBY', true);
// check for a proper phpversion
if (floatval(phpversion()) < 5.2) {
    die('Please upgrade to PHP 5.2 or higher');
}
// include kirby
require_once $rootKirby . '/lib/kirby.php';
// set the root
c::set('root', $root);
c::set('root.kirby', $rootKirby);
c::set('root.site', $rootSite);
c::set('root.content', $rootContent);
require_once $rootKirby . '/lib/load.php';
// load the rest of the system
load::lib();
load::config();
load::parsers();
load::plugins();
// check for an exisiting content dir
if (!is_dir(c::get('root.content'))) {
    die('The Kirby content directory could not be found');
}
// check for an exisiting site dir
if (!is_dir(c::get('root.site'))) {
    die('The Kirby site directory could not be found');
}
// set the timezone to make sure we
// avoid errors in php 5.3
@date_default_timezone_set(c::get('timezone'));
// switch on errors
if (c::get('debug')) {
Пример #4
0
    // Save
    // ---------------------------------------------------------------------------
    public function save()
    {
        $this->table->update(array('id' => $this->id, 'email' => $this->email, 'username' => $this->username, 'password' => $this->password, 'type' => $this->type, 'data' => json_encode($this->data)))->where('id', '=', $this->id)->execute();
        return $this;
    }
    // Hash
    // ---------------------------------------------------------------------------
    public function hash($i)
    {
        return sha1($i);
    }
}
// Load config file
load::config('user');
user::$types = config::get('user_types');
// Set database table
user::$table = db(config::get('user_table'), NULL, config::get('user_connection'));
// Get session data
user::$_email = session::get('user_email');
user::$_password = session::get('user_password');
// Get information about current user
if (user::$_email and user::$_password) {
    $user = user::$table->select('*')->where('email', '=', user::$_email)->clause('AND')->where('password', '=', user::$_password)->limit(1)->execute();
    // If valid login credentials
    if (!empty($user[0])) {
        $user = $user[0];
        user::$_id = $user->id;
        user::$_email = $user->email;
        user::$_username = $user->username;