Esempio n. 1
0
    public function render()
    {
        $isDev = Auth::getInstance('dev')->isProvidedDemandOnWrong();
        ?>
<html>
<head>
    <title><?php 
        echo $this->title;
        ?>
</title>
    <link rel="stylesheet" type="text/css" href="/css/style.css" />
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
    <script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script>
    <script src="/js/tag-filter.js"></script>

</head>
<body>
<div class="list">
    <?php 
        echo $this->list;
        ?>
</div>

<div class="filters">
    <?php 
        echo $this->filters;
        ?>
</div>

<div class="main">
    <?php 
        echo $this->main;
        ?>
</div>

<?php 
        if ($isDev) {
            ?>
<div class="dev-debug">
    <a href="/dev?logout">Logout debug mode</a>
    <?php 
            $debugStorage = Storage::getInstance('debug_log');
            $debugStorage->set('_SERVER', $_SERVER);
            CollapsiblePrintR::create($debugStorage->exportArray())->render();
            ?>
</div><?php 
        }
        ?>

</body>
</html>
<?php 
    }
Esempio n. 2
0
 public function __construct($dsnUrl = null)
 {
     parent::__construct($dsnUrl);
     if ($this->username && $this->password) {
         if ($this->salt) {
             $this->users[$this->username] = $this->password;
         } else {
             $this->users[$this->username] = Auth::makeHash($this->username, $this->password, '');
         }
     }
 }
Esempio n. 3
0
<?php

namespace PHPerf;

use Yaoi\Database;
use Yaoi\Http\Auth;
use Yaoi\Http\Auth\Settings;
use Yaoi\Log;
use Yaoi\Storage;
date_default_timezone_set('Europe/Moscow');
header("Content-Type: text/html; charset=utf8");
error_reporting(E_ALL);
ini_set('display_errors', 'on');
umask('0002');
Auth::register(function () {
    $dsn = new Settings();
    $dsn->title = 'Developers Only Area';
    $dsn->salt = '<random-string>';
    $dsn->users = array('<login>' => '<password-hash>');
    return $dsn;
}, 'dev');
Storage::register(new Storage\PhpVar(), 'debug_log');
Log::register('storage:///?storage=debug_log', 'debug_log');
Database::register(function () {
    $database = new Database('mysqli://root@localhost/phperf_result');
    $database->log(Log::getInstance('debug_log'));
    return $database;
});
Esempio n. 4
0
            break;
        case 'startSession':
            $result = Api::startSession($json);
            break;
    }
    $result = array('result' => $result);
    header('Content-Type: application/json');
    echo json_encode($result);
    exit;
} else {
    switch (true) {
        case '/' === $path || Utils::starts($path, '/?'):
            Ui::index();
            break;
        case Utils::starts($path, '/suite'):
            Ui::suite();
            break;
        case Utils::starts($path, '/session'):
            Ui::session();
            break;
            /** @noinspection PhpMissingBreakStatementInspection */
        /** @noinspection PhpMissingBreakStatementInspection */
        case Utils::starts($path, '/dev'):
            if (Dev::create('/dev')->setAuth(Auth::getInstance('dev'))->route($path)) {
                break;
            }
        default:
            Ui::notFound();
            break;
    }
}
Esempio n. 5
0
 public function logoutAction()
 {
     $this->auth->logout();
 }