Ejemplo n.º 1
0
Twig_Autoloader::register();
/*
 * Set Debugger::DETECT to Debugger::DEVELOPMENT to force errors to be displayed.
 * This should NEVER be done on a live environment. In most cases Debugger is smart
 * enough to figure out if it is a local or development environment.
 */
if (Config::config('debugging') === true) {
    Debugger::enable(Debugger::DEVELOPMENT, SRC_DIR . '/logs');
} else {
    Debugger::enable(Debugger::DETECT, SRC_DIR . '/logs');
}
Debugger::$strictMode = true;
/*
* MySQL PDO Connection Engine
*/
ORM::configure(array('connection_string' => 'mysql:host=' . Config::config('mysql')->host . ';port=' . Config::config('mysql')->port . ';dbname=' . Config::config('mysql')->database, 'username' => Config::config('mysql')->username, 'password' => Config::config('mysql')->password, 'driver_options' => array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC), 'logging' => true, 'logger' => function ($query, $time) {
    DatabaseManager::logQuery($query, $time);
}, 'caching' => true, 'caching_auto_clear' => true));
/*
 * Initalize Global core
 */
$core = new stdClass();
$klein = new \Klein\Klein();
$core->auth = new Authentication();
$core->user = new User();
$core->server = new Server();
$core->email = new Email();
$core->log = new Log();
$core->daemon = new Daemon();
$core->files = new Files();
$core->twig = new Twig_Environment(new Twig_Loader_Filesystem(APP_DIR . 'views/'));
Ejemplo n.º 2
0
 /**
  * Decrypts a given string using an IV and defined method.
  *
  * @param string $encrypted The encrypted string that you want decrypted.
  * @param string $iv The initalization vector to use.
  * @param string $method Defaults to AES-256-CBC but you can define any other valid encryption method.
  * @return string
  * @static
  */
 public static function decrypt($encrypted, $iv, $method = 'AES-256-CBC')
 {
     return openssl_decrypt($encrypted, $method, Config::config()->hash, 0, base64_decode($iv));
 }