public function signUpForm() { if (file_exists(DIR_APP . '/config.php')) { return; } $packages = glob(DIR_LANGUAGE . '/*'); $langs = []; if (empty($packages)) { $langs = json_decode(getContentByUrl(API_HOST . 'languages/list'), true); if (!is_array($langs)) { return 'Please, download language package manually and unzip into /app/languages'; } } else { foreach ($packages as $package) { $key = str_replace(DIR_LANGUAGE . '/', '', $package); $arr = (include $package . '/translation.php'); $langs[$key] = $arr['lang_native_name']; } } return render(DIR_SYSTEM . '/modules/user/views/login-signup.php', ['langs' => $langs, 'lang' => app('request')->getPreferredLanguage(array_keys($langs)), 'errors' => checkServer(), 'title' => 'Sign up for', 'signUp' => true]); }
<?php $app['event']->on('after.system.init', '*', function () use($app) { if ($app['section'] == 'admin' && !$app['user']->isEditor()) { $_SESSION['entry'] = $app['request']->url; throw new App\Exception\RedirectException('login'); } }); $app['event']->on('before.render', 'admin/*', function () use($app) { if (!$app['config']['app']['check_updates']) { return; } $app['cache']->remember('update_checked', function () use($app) { $need = getContentByUrl(API_HOST . 'update?version=' . VERSION . '&site=' . md5($_SERVER['HTTP_HOST'])); $updateText = 0; if ($need == 1) { $updateText = t('common_update_cms'); } elseif ($need == 2) { $updateText = t('security_update_cms'); } $app['cache']->put('update_text', $updateText, 600); return 1; }, 86400); $update_text = $app['cache']->get('update_text'); if ($update_text) { alert($update_text); } });
function extractOuterZip($destination, $archive) { $temp = DIR_TEMP . '/' . token(6); file_put_contents($temp, getContentByUrl($archive)); $zip = new ZipArchive(); if ($zip->open($temp) === true) { $zip->extractTo($destination); $zip->close(); unlink($temp); } }