Exemplo n.º 1
0
 public static function init()
 {
     Once::exec(__FILE__ . 'init', function () {
         $action = Ans::GET('-update');
         Config::init();
         $path = Path::$conf;
         if ($action) {
             Access::test(true);
             if (!Update::$is) {
                 Path::fullrmdir($path['cache']);
                 Update::exec();
             }
         }
         if ($path['fs'] && !Update::$is) {
             if (!is_dir($path['cache'])) {
                 Access::$conf['test'] = true;
                 Update::exec();
             }
             if (Access::isTest()) {
                 if (is_file($path['data'] . 'update')) {
                     unlink($path['data'] . 'update');
                     Access::$conf['test'] = true;
                     if (!Update::$is) {
                         Path::fullrmdir($path['cache']);
                         Update::exec();
                     }
                 }
             }
         }
         if (Update::$is) {
             if (is_file($path['data'] . 'update')) {
                 unlink($path['data'] . 'update');
             }
         }
     });
 }
Exemplo n.º 2
0
<?php

use infrajs\access\Access;
use infrajs\ans\Ans;
use infrajs\nostore\Nostore;
$action = Ans::GET('-access');
if ($action == 'false') {
    if (Access::isTest()) {
        Access::$conf['test'] = true;
    } else {
        Access::$conf['test'] = false;
    }
    //Повышать права нельзя, если я не тестер, то нетестером и останусь!!!
    Access::$conf['debug'] = false;
    Access::$conf['admin'] = false;
    Nostore::on();
} else {
    if ($action == 'true') {
        Access::test(true);
        Access::adminSetTime();
        Nostore::on();
        //Страница с таким параметром не кэшируется в браузере и её можно всегда спокойно вызывать
        //Устанавливает будто админ только что заходил... это мягко обновит кэши шаблонов и проверит изменения файлов
    }
}
Exemplo n.º 3
0
<?php

use infrajs\ans\Ans;
use infrajs\access\Access;
use infrajs\nostore\Nostore;
if (!is_file('vendor/autoload.php')) {
    chdir('../../../');
    require_once 'vendor/autoload.php';
}
Nostore::on();
$ans = array();
$ans['test'] = Access::test();
$ans['debug'] = Access::debug();
$ans['admin'] = Access::admin();
return Ans::ret($ans);
Exemplo n.º 4
0
use infrajs\ans\Ans;
use infrajs\each\Each;
use infrajs\config\Config;
if (!is_file('vendor/autoload.php')) {
    chdir('../../../../');
    require_once 'vendor/autoload.php';
}
Access::test(true);
$ans = array();
$ans['title'] = 'Тест на значение отладки debug и test';
$conf = Config::get('access');
if (Access::debug() && !is_string($conf['debug']) && !is_array($conf['debug'])) {
    $ans['class'] = 'bg-warning';
    return Ans::ret($ans, 'Значение config.infra.debug = true');
}
if (Access::test() && !is_string($conf['test']) && !is_array($conf['test'])) {
    $ans['class'] = 'bg-warning';
    return Ans::ret($ans, 'Значение config.infra.test = true');
}
$debug = $conf['debug'];
if ($debug) {
    if (!is_array($debug)) {
        $debug = array($debug);
    }
    $key = array_search('::1', $debug);
    if ($key !== false) {
        array_splice($debug, $key, 1);
    }
    $key = array_search('127.0.0.1', $debug);
    if ($key !== false) {
        array_splice($debug, $key, 1);
Exemplo n.º 5
0
<?php

use infrajs\router\Router;
use infrajs\ans\Ans;
use infrajs\config\Config;
use infrajs\access\Access;
use infrajs\load\Load;
use infrajs\nostore\Nostore;
if (!is_file('vendor/autoload.php')) {
    chdir('../../../');
    require_once 'vendor/autoload.php';
    Router::init();
}
$action = Ans::GET('-tester');
if ($action == 'true') {
    Nostore::on();
    if (Access::test()) {
        $ans = Load::loadJSON('-tester/?type=auto');
        if (!$ans || !$ans['result']) {
            error_log('TESTER: There are errors in the tests /-tester/?type=errors ' . $ans['msg']);
            //if (Access::debug()) die('TESTER: There are errors in the tests <a href="/-tester/?type=errors">errors</a> <b>'.$ans['msg'].'</b>');
        } else {
            echo '<div class="well"><a href="/-tester/">Тестирование</a> выполнено, ошибок не обнаружено.</div>';
        }
    } else {
        $ans = array();
        die('<div class="alert alert-danger">Недостаточно прав для тестирования.</div>');
    }
}