Beispiel #1
0
 public function __construct()
 {
     $this->clients = new \SplObjectStorage();
     // Now connect to PS DB using Simplon on Composer
     $this->dbConn = new \Simplon\Mysql\Mysql('127.0.0.1', _DB_USER_, _DB_PASSWD_, _DB_NAME_);
     $log_file = 'wasabi.log';
     Analog::handler(\Analog\Handler\File::init($log_file));
 }
Beispiel #2
0
 /**
  * Write a raw message to the log using a function or the default
  * file logging.
  */
 private static function write($struct)
 {
     $handler = self::handler();
     if (!$handler instanceof \Closure) {
         $handler = \Analog\Handler\File::init($handler);
     }
     return $handler($struct);
 }
Beispiel #3
0
    $viewer_log = '';
    $logger = \Analog\Handler\Variable::init($viewer_log);
} else {
    $log_dir = APP_DIR . '/logs/';
    if (defined('APP_LOGS')) {
        $log_dir = APP_LOGS;
    }
    if (!file_exists($log_dir)) {
        throw new \RuntimeException('Log directory (' . $log_dir . ') does not exists!');
    } else {
        if (!is_writeable($log_dir)) {
            throw new \RuntimeException('Log directory (' . $log_dir . ') is not writeable!');
        }
    }
    $log_file = $log_dir . 'viewer.log';
    $logger = \Analog\Handler\File::init($log_file);
}
Analog::handler(\Analog\Handler\LevelBuffer::init($logger, $log_lvl));
$conf = new Conf();
/** I18n stuff */
$lang = null;
$langs = array('en-US', 'fr-FR');
/** Try to detect user language */
if (function_exists('http_negotiate_language')) {
    $nego = http_negotiate_language($langs);
    switch (strtolower($nego)) {
        case 'en-us':
            $lang = 'en_US';
            break;
        case 'fr-fr':
            $lang = 'fr_FR.utf8';
Beispiel #4
0
        $galette_debug_log = \Analog\Handler\File::init($dbg_log_path);
    }
    $galette_run_log = null;
    $galette_log_var = null;
    if (GALETTE_MODE === 'DEV' || $cron || defined('GALETTE_SYS_LOG') && GALETTE_SYS_LOG === true) {
        //logs everything in PHP logs (per chance /var/log/http/error_log)
        $galette_run_log = \Analog\Handler\Stderr::init();
    } else {
        if (!$installer || $installer && defined('GALETTE_LOGGER_CHECKED')) {
            //logs everything in galette log file
            if (!isset($logfile)) {
                //if no filename has been setetd (ie. from install), set default one
                $logfile = 'galette_run';
            }
            $log_path = GALETTE_LOGS_PATH . $logfile . '_' . $now->format('Y-m-d') . '.log';
            $galette_run_log = \Analog\Handler\File::init($log_path);
        } else {
            $galette_run_log = \Analog\Handler\Variable::init($galette_log_var);
        }
    }
    Core\Logs::cleanup();
}
Analog::handler(\Analog\Handler\Multi::init(array(Analog::URGENT => $galette_run_log, Analog::ALERT => $galette_run_log, Analog::CRITICAL => $galette_run_log, Analog::ERROR => $galette_run_log, Analog::WARNING => GALETTE_LOG_LVL >= Analog::WARNING ? $galette_run_log : $galette_null_log, Analog::NOTICE => GALETTE_LOG_LVL >= Analog::NOTICE ? $galette_run_log : $galette_null_log, Analog::INFO => GALETTE_LOG_LVL >= Analog::INFO ? $galette_run_log : $galette_null_log, Analog::DEBUG => GALETTE_LOG_LVL >= Analog::DEBUG ? $galette_debug_log : $galette_null_log)));
require_once GALETTE_ROOT . 'includes/functions.inc.php';
$session_name = null;
//since PREFIX_DB and NAME_DB are required to properly instanciate sessions,
// we have to check here if they're assigned
if ($installer || !defined('PREFIX_DB') || !defined('NAME_DB')) {
    $session_name = 'galette_install';
} else {
    $session_name = PREFIX_DB . '_' . NAME_DB;
Beispiel #5
0
<?php

ini_set('date.timezone', 'America/Sao_Paulo');
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . '/UserProvider.php';
$log_file = __DIR__ . '/../../tmp/logs.txt';
\Analog\Analog::handler(\Analog\Handler\File::init($log_file));
$connectionParams = array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'dbname' => 'test', 'user' => 'root', 'password' => '', 'service' => true, 'charset' => 'UTF8', 'driverOptions' => array('charset' => 'UTF8'));
$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams);
$storage = new \Paliari\Oauth2ServerFacade\Storage($connection, array('user_table' => 'usuarios'));
$oauth = new \Paliari\Oauth2ServerFacade\Oauth2Facade($storage);
$userProvider = new UserProvider($storage);
$oauth->setUserProvider($userProvider);
$oauth->setResourceHandler(function ($path, $user_id) use($storage) {
    if ('user/profile' == $path) {
        return $storage->getUser($user_id);
    }
    return compact('path', 'user_id');
});