Beispiel #1
0
            $return[$name] = Model\Config\get($name);
        }
    }
    Response\json($return);
});
// Display help page
Router\get_action('help', function () {
    Response\html(Template\layout('help', array('config' => Model\Config\get_all(), 'nb_unread_items' => Model\Item\count_by_status('unread'), 'menu' => 'config', 'title' => t('Preferences'))));
});
// Display about page
Router\get_action('about', function () {
    Response\html(Template\layout('about', array('csrf' => Model\Config\generate_csrf(), 'config' => Model\Config\get_all(), 'nb_unread_items' => Model\Item\count_by_status('unread'), 'menu' => 'config', 'title' => t('Preferences'))));
});
// Display database page
Router\get_action('database', function () {
    Response\html(Template\layout('database', array('csrf' => Model\Config\generate_csrf(), 'config' => Model\Config\get_all(), 'db_size' => filesize(\Model\Database\get_path()), 'nb_unread_items' => Model\Item\count_by_status('unread'), 'menu' => 'config', 'title' => t('Preferences'))));
});
// Display API page
Router\get_action('api', function () {
    Response\html(Template\layout('api', array('config' => Model\Config\get_all(), 'nb_unread_items' => Model\Item\count_by_status('unread'), 'menu' => 'config', 'title' => t('Preferences'))));
});
// Display bookmark services page
Router\get_action('services', function () {
    Response\html(Template\layout('services', array('errors' => array(), 'values' => Model\Config\get_all() + array('csrf' => Model\Config\generate_csrf()), 'menu' => 'config', 'title' => t('Preferences'))));
});
// Update bookmark services
Router\post_action('services', function () {
    $values = Request\values() + array('pinboard_enabled' => 0, 'instapaper_enabled' => 0);
    Model\Config\check_csrf_values($values);
    if (Model\Config\save($values)) {
        Session\flash(t('Your preferences are updated.'));
Beispiel #2
0
defined('THEME_DIRECTORY') or define('THEME_DIRECTORY', 'themes');
defined('SESSION_SAVE_PATH') or define('SESSION_SAVE_PATH', '');
defined('PROXY_HOSTNAME') or define('PROXY_HOSTNAME', '');
defined('PROXY_PORT') or define('PROXY_PORT', 3128);
defined('PROXY_USERNAME') or define('PROXY_USERNAME', '');
defined('PROXY_PASSWORD') or define('PROXY_PASSWORD', '');
defined('ENABLE_AUTO_UPDATE') or define('ENABLE_AUTO_UPDATE', true);
defined('AUTO_UPDATE_DOWNLOAD_DIRECTORY') or define('AUTO_UPDATE_DOWNLOAD_DIRECTORY', DATA_DIRECTORY . DIRECTORY_SEPARATOR . 'download');
defined('AUTO_UPDATE_ARCHIVE_DIRECTORY') or define('AUTO_UPDATE_ARCHIVE_DIRECTORY', DATA_DIRECTORY . DIRECTORY_SEPARATOR . 'archive');
defined('AUTO_UPDATE_BACKUP_DIRECTORY') or define('AUTO_UPDATE_BACKUP_DIRECTORY', DATA_DIRECTORY . DIRECTORY_SEPARATOR . 'backup');
defined('SUBSCRIPTION_CONCURRENT_REQUESTS') or define('SUBSCRIPTION_CONCURRENT_REQUESTS', 5);
defined('RULES_DIRECTORY') or define('RULES_DIRECTORY', ROOT_DIRECTORY . DIRECTORY_SEPARATOR . 'rules');
defined('ENABLE_HSTS') or define('ENABLE_HSTS', true);
require __DIR__ . '/check_setup.php';
PicoDb\Database::setInstance('db', function () {
    $db = new PicoDb\Database(array('driver' => 'sqlite', 'filename' => Model\Database\get_path()));
    if ($db->schema()->check(Schema\VERSION)) {
        return $db;
    } else {
        $errors = $db->getLogMessages();
        $pdo = new \PDO('sqlite::memory:');
        $result = $pdo->query('select sqlite_version()', PDO::FETCH_COLUMN, 0);
        $sqlite_version = $result ? $result->fetch() : '?';
        $html = 'Unable to migrate the database schema, <strong>please copy and paste this message and create a bug report:</strong><hr/>';
        $html .= '<pre><code>';
        $html .= (isset($errors[0]) ? $errors[0] : 'Unknown SQL error') . PHP_EOL . PHP_EOL;
        $html .= '- PHP version: ' . phpversion() . PHP_EOL;
        $html .= '- SAPI: ' . php_sapi_name() . PHP_EOL;
        $html .= '- PDO Sqlite version: ' . phpversion('pdo_sqlite') . PHP_EOL;
        $html .= '- Sqlite version: ' . $sqlite_version . PHP_EOL;
        $html .= '- OS: ' . php_uname();