public function enterAction() { $config = Config::share(); if (!empty($_POST['systemPass'])) { if (empty($config['systemPass'])) { $config['systemPass'] = password_hash($_POST['systemPass'], PASSWORD_DEFAULT); $config['installed'] = true; Config::save('share', $config); } if (password_verify($_POST['systemPass'], $config['systemPass'])) { $_SESSION['systemLogin'] = 1; } else { if (empty($config['failTry'])) { $config['failTry'] = 1; } else { $config['failTry']++; } Config::save('share', $config); } Tools::redirect('/setup'); } if (!empty($config['systemPass']) && !empty($_COOKIE['systemPass']) && $_COOKIE['systemPass'] == $config['systemPass']) { Tools::redirect('/setup'); } $this->view->setTitle('Enter'); $this->view->page(); }
public function init() { $config = Config::share(); if (!empty($config['failTry']) && $config['failTry'] > 3) { exit('Превышен лимит неправильного ввода пароля. Для разблокировки отредактируйте файл %INJI_PROGRAM_DIR%/config/config.php'); } if (empty(App::$cur->params[0]) || App::$cur->params[0] != 'enter') { if (empty($config['systemPass'])) { Tools::redirect('/setup/enter', 'Придумайте системный пароль'); } if (empty($_SESSION['systemLogin'])) { Tools::redirect('/setup/enter', 'Введите системный пароль'); } } }
App::$cur->templatesPath = "/" . App::$cur->name . "/static/templates"; App::$cur->path = INJI_SYSTEM_DIR . '/program/' . App::$cur->name; App::$cur->type = 'app' . ucfirst(strtolower(App::$cur->name)); App::$cur->installed = true; App::$cur->params = array_slice($params, 1); App::$cur->config = Config::app(App::$cur); Inji::$inst->listen('Config-change-app-' . App::$primary->name, 'primaryAppConfig', function ($event) { App::$primary->config = $event['eventObject']; return $event['eventObject']; }); } Inji::$inst->listen('Config-change-app-' . App::$cur->name, 'curAppConfig', function ($event) { App::$cur->config = $event['eventObject']; return $event['eventObject']; }); $shareConfig = Config::share(); if (empty($shareConfig['installed']) && App::$cur->name != 'setup' && (empty(App::$cur->params[0]) || App::$cur->params[0] != 'static')) { Tools::redirect('/setup'); } putenv('COMPOSER_HOME=' . getcwd()); putenv('COMPOSER_CACHE_DIR=' . getcwd() . DIRECTORY_SEPARATOR . 'composerCache'); ComposerCmd::check(); if (!function_exists('idn_to_utf8')) { ComposerCmd::requirePackage("mabrahamde/idna-converter", "dev-master", './'); function idn_to_utf8($domain) { if (empty(Inji::$storage['IdnaConvert'])) { Inji::$storage['IdnaConvert'] = new \idna_convert(array('idn_version' => 2008)); } return Inji::$storage['IdnaConvert']->decode($domain); }
/** * Delete item from module storage * * @param array $options * @return boolean */ public function deleteFromModuleStorage($options) { $col = static::index(); $id = $this->pk(); $appType = ''; $classPath = explode('\\', get_called_class()); if (!empty(static::$storage['options']['share'])) { $moduleConfig = Config::share($classPath[0]); } else { $moduleConfig = Config::module($classPath[0], strpos(static::$storage['type'], 'system') !== false); } if (!empty($moduleConfig['storage']['appTypeSplit'])) { if (empty($options['appType'])) { $appType = App::$cur->type; } else { $appType = $options['appType']; } $storage = !empty($moduleConfig['storage'][$appType]) ? $moduleConfig['storage'][$appType] : []; } else { $storage = !empty($moduleConfig['storage']) ? $moduleConfig['storage'] : []; } if (empty($storage[$classPath[1]])) { $storage[$classPath[1]] = []; } foreach ($storage[$classPath[1]] as $key => $item) { if ($item[$col] == $id) { unset($storage[$classPath[1]][$key]); break; } } if (!empty($moduleConfig['storage']['appTypeSplit'])) { $moduleConfig['storage'][$appType] = $storage; } else { $moduleConfig['storage'] = $storage; } if (empty(static::$storage['options']['share'])) { Config::save('module', $moduleConfig, $classPath[0]); } else { Config::save('share', $moduleConfig, $classPath[0]); } return true; }