コード例 #1
0
$app->get('/phpinfo/?', function () use($app) {
    // Access-controlled page
    if (!$app->user->checkAccess('uri_php_info')) {
        $app->notFound();
    }
    echo "<pre>";
    print_r(phpinfo());
    echo "</pre>";
});
// Error log page
$app->get('/errorlog/?', function () use($app) {
    // Access-controlled page
    if (!$app->user->checkAccess('uri_error_log')) {
        $app->notFound();
    }
    $log = UF\SiteSettings::getLog();
    echo "<pre>";
    echo implode("<br>", $log['messages']);
    echo "</pre>";
});
/************ INSTALLER *************/
$app->get('/install/?', function () use($app) {
    $controller = new UF\InstallController($app);
    if (isset($app->site->install_status)) {
        // If tables have been created, move on to master account setup
        if ($app->site->install_status == "pending") {
            $app->redirect($app->site->uri['public'] . "/install/master");
        } else {
            // Everything is set up, so go to the home page!
            $app->redirect($app->urlFor('uri_home'));
        }
コード例 #2
0
ファイル: upgrade.php プロジェクト: userfrosting/Upgrade
/**
 * 0.3.1 - Updating groups to use dashboard instead of the old accounts page.
 */
echo '(0.3.1) Updating groups to use new dashboard in ' . \UserFrosting\Database::getSchemaTable('group')->name . ': ';
$connection->statement("UPDATE `" . \UserFrosting\Database::getSchemaTable('group')->name . "`\n                        SET `landing_page` = 'dashboard' WHERE `landing_page` = 'account'; ") or die('Failed.' . PHP_EOL . PHP_EOL . 'Exiting.');
echo 'Done.' . PHP_EOL;
/**
 * 0.3.1.5 - Add default value for secret_token.
 */
echo '(0.3.1.5) Creating default value for secret_token: ';
$connection->statement("ALTER TABLE `" . \UserFrosting\Database::getSchemaTable('user')->name . "`\n                        CHANGE `secret_token` `secret_token` varchar(32) NOT NULL DEFAULT ''\n                            COMMENT 'The current one-time use token for various user activities confirmed via email.'") or die('Failed.' . PHP_EOL . PHP_EOL . 'Exiting.');
echo 'Done.' . PHP_EOL;
/**
 * 0.3.1.7 - Change from "default_theme" to "guest_theme".
 */
echo '(0.3.1.7) Updating "default_theme" to "guest_theme": ';
if (isset($settings['default_theme'])) {
    $settings['guest_theme'] = $settings['default_theme'];
    $settings->save();
    $connection->statement('DELETE FROM `' . \UserFrosting\Database::getSchemaTable('configuration')->name . '` WHERE `name` = \'default_theme\'') or die('Failed.' . PHP_EOL . PHP_EOL . 'Exiting.');
}
echo 'Done.' . PHP_EOL;
/**
 * Latest - Update the version number in the database.
 */
$settings = SiteSettings::all()->first();
echo PHP_EOL . '(' . $versionTargetDatabase . ') Updating database version: ';
$settings['version'] = $versionTargetDatabase;
$settings->save() or die('Failed.' . PHP_EOL . PHP_EOL . 'Exiting.');
echo 'Done.' . PHP_EOL;
echo PHP_EOL . 'Conversion complete!' . PHP_EOL;