Beispiel #1
0
function prefs_save()
{
    $prefnames = safe_column("name", "txp_prefs", "prefs_id='1'");
    $post = doSlash(stripPost());
    if (empty($post['tempdir'])) {
        $post['tempdir'] = doSlash(find_temp_dir());
    }
    if (!empty($post['language'])) {
        $post['locale'] = doSlash(getlocale($post['language']));
    }
    foreach ($prefnames as $prefname) {
        if (isset($post[$prefname])) {
            if ($prefname == 'lastmod') {
                safe_update("txp_prefs", "val=now()", "name='lastmod'");
            } else {
                if ($prefname == 'siteurl') {
                    $post[$prefname] = str_replace("http://", '', $post[$prefname]);
                    $post[$prefname] = rtrim($post[$prefname], "/");
                }
                safe_update("txp_prefs", "val = '" . $post[$prefname] . "'", "name = '{$prefname}' and prefs_id ='1'");
            }
        }
    }
    prefs_list(gTxt('preferences_saved'));
}
Beispiel #2
0
/**
 * Commits prefs to the database.
 */
function prefs_save()
{
    global $prefs, $gmtoffset, $is_dst, $auto_dst, $timezone_key, $txp_user;
    // Update custom fields count from database schema and cache it as a hidden pref.
    // TODO: move this when custom fields are refactored.
    $max_custom_fields = count(preg_grep('/^custom_\\d+/', getThings('describe ' . safe_pfx('textpattern'))));
    set_pref('max_custom_fields', $max_custom_fields, 'publish', 2);
    $sql = array();
    $sql[] = 'prefs_id = 1 and event != "" and type in(' . PREF_CORE . ', ' . PREF_PLUGIN . ', ' . PREF_HIDDEN . ')';
    $sql[] = "(user_name = '' or (user_name='" . doSlash($txp_user) . "' and name not in(\n            select name from " . safe_pfx('txp_prefs') . " where user_name = ''\n        )))";
    if (!get_pref('use_comments', 1, 1)) {
        $sql[] = "event != 'comments'";
    }
    $prefnames = safe_rows_start("name, event, user_name, val", 'txp_prefs', join(' and ', $sql));
    $post = stripPost();
    if (isset($post['tempdir']) && empty($post['tempdir'])) {
        $post['tempdir'] = find_temp_dir();
    }
    if (!empty($post['file_max_upload_size'])) {
        $post['file_max_upload_size'] = real_max_upload_size($post['file_max_upload_size']);
    }
    if (isset($post['auto_dst'])) {
        $prefs['auto_dst'] = $auto_dst = $post['auto_dst'];
        if (isset($post['is_dst']) && !$post['auto_dst']) {
            $is_dst = $post['is_dst'];
        }
    }
    // Forge $gmtoffset and $is_dst from $timezone_key if present.
    if (isset($post['timezone_key'])) {
        $key = $post['timezone_key'];
        $tzd = Txp::get('Textpattern_Date_Timezone')->getTimeZones();
        if (isset($tzd[$key])) {
            $prefs['timezone_key'] = $timezone_key = $key;
            $post['gmtoffset'] = $prefs['gmtoffset'] = $gmtoffset = $tzd[$key]['offset'];
            $post['is_dst'] = $prefs['is_dst'] = $is_dst = Txp::get('Textpattern_Date_Timezone')->isDst(null, $key);
        }
    }
    if (isset($post['siteurl'])) {
        $post['siteurl'] = preg_replace('#^https?://#', '', rtrim($post['siteurl'], '/ '));
    }
    while ($a = nextRow($prefnames)) {
        extract($a);
        if (!isset($post[$name]) || !has_privs('prefs.' . $event)) {
            continue;
        }
        if ($name === 'logging' && $post[$name] === 'none' && $post[$name] !== $val) {
            safe_truncate('txp_log');
        }
        if ($name === 'expire_logs_after' && (int) $post[$name] !== (int) $val) {
            safe_delete('txp_log', 'time < date_sub(now(), interval ' . intval($post[$name]) . ' day)');
        }
        update_pref($name, (string) $post[$name], null, null, null, null, (string) $user_name);
    }
    update_lastmod();
    prefs_list(gTxt('preferences_saved'));
}
Beispiel #3
0
/**
 * Commits prefs to the database.
 */
function prefs_save()
{
    global $prefs, $gmtoffset, $is_dst, $auto_dst, $timezone_key, $txp_user;
    // Update custom fields count from database schema and cache it as a hidden pref.
    // TODO: move this when custom fields are refactored.
    $max_custom_fields = count(preg_grep('/^custom_\\d+/', getThings("DESCRIBE " . safe_pfx('textpattern'))));
    set_pref('max_custom_fields', $max_custom_fields, 'publish', 2);
    $sql = array();
    $sql[] = "prefs_id = 1 AND event != '' AND type IN (" . PREF_CORE . ", " . PREF_PLUGIN . ", " . PREF_HIDDEN . ")";
    $sql[] = "(user_name = '' OR (user_name = '" . doSlash($txp_user) . "' AND name NOT IN (\n            SELECT name FROM " . safe_pfx('txp_prefs') . " WHERE user_name = ''\n        )))";
    if (!get_pref('use_comments', 1, 1)) {
        $sql[] = "event != 'comments'";
    }
    $prefnames = safe_rows_start("name, event, user_name, val", 'txp_prefs', join(" AND ", $sql));
    $post = stripPost();
    if (isset($post['tempdir']) && empty($post['tempdir'])) {
        $post['tempdir'] = find_temp_dir();
    }
    if (!empty($post['file_max_upload_size'])) {
        $post['file_max_upload_size'] = real_max_upload_size($post['file_max_upload_size']);
    }
    if (isset($post['auto_dst'])) {
        $prefs['auto_dst'] = $auto_dst = $post['auto_dst'];
        if (isset($post['is_dst']) && !$post['auto_dst']) {
            $is_dst = $post['is_dst'];
        }
    }
    // Forge $gmtoffset and $is_dst from $timezone_key if present.
    if (isset($post['timezone_key'])) {
        $key = $post['timezone_key'];
        $tzd = Txp::get('\\Textpattern\\Date\\Timezone')->getTimeZones();
        if (isset($tzd[$key])) {
            $prefs['timezone_key'] = $timezone_key = $key;
            $post['gmtoffset'] = $prefs['gmtoffset'] = $gmtoffset = $tzd[$key]['offset'];
            $post['is_dst'] = $prefs['is_dst'] = $is_dst = Txp::get('\\Textpattern\\Date\\Timezone')->isDst(null, $key);
        }
    }
    if (isset($post['siteurl'])) {
        $post['siteurl'] = preg_replace('#^https?://#', '', rtrim($post['siteurl'], '/ '));
    }
    while ($a = nextRow($prefnames)) {
        extract($a);
        if (!isset($post[$name]) || !has_privs('prefs.' . $event)) {
            continue;
        }
        if ($name === 'logging' && $post[$name] === 'none' && $post[$name] !== $val) {
            safe_truncate('txp_log');
        }
        if ($name === 'expire_logs_after' && (int) $post[$name] !== (int) $val) {
            safe_delete('txp_log', "time < DATE_SUB(NOW(), INTERVAL " . intval($post[$name]) . " DAY)");
        }
        update_pref($name, (string) $post[$name], null, null, null, null, (string) $user_name);
    }
    update_lastmod('preferences_saved');
    prefs_list(gTxt('preferences_saved'));
}
Beispiel #4
0
 function prefs_post()
 {
     // special considerations
     if (isset($_POST['siteurl'])) {
         $_POST['siteurl'] = rtrim(str_replace("http://", '', $this->ps('siteurl')), "/ ");
     }
     if (isset($_POST['tempdir']) && empty($_POST['tempdir'])) {
         $_POST['tempdir'] = doSlash(find_temp_dir());
     }
     if (!empty($_POST['file_max_upload_size'])) {
         $_POST['file_max_upload_size'] = $this->real_max_upload_size($this->ps('file_max_upload_size'));
     }
     // safe them all
     $prefnames = array_keys(get_prefs());
     foreach ($prefnames as $prefname) {
         if (isset($_POST[$prefname])) {
             update_pref($prefname, $this->ps($prefname));
         }
     }
     update_lastmod();
     $this->_message(gTxt('preferences_saved'));
 }
Beispiel #5
0
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'img_dir', 'images', 1, 'admin', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'comments_disallow_images', '0', 0, 'comments', 'yesnoradio', 170, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'comments_sendmail', '0', 0, 'comments', 'yesnoradio', 160, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'file_max_upload_size', '2000000', 1, 'admin', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'file_list_pageby', '25', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'path_to_site', '', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'article_list_pageby', '25', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'link_list_pageby', '25', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'image_list_pageby', '25', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'log_list_pageby', '25', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'comment_list_pageby', '25', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'permlink_mode', '" . doSlash($permlink_mode) . "', 0, 'publish', 'permlinkmodes', 90, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'comments_are_ol', '1', 0, 'comments', 'yesnoradio', 150, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'is_dst', '0', 0, 'publish', 'yesnoradio', 60, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'locale', 'en_GB.UTF-8', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'tempdir', '" . doSlash(find_temp_dir()) . "', 1, 'admin', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'file_base_path', '" . doSlash(dirname(txpath) . DS . 'files') . "', 1, 'admin', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'blog_uid', '" . $prefs['blog_uid'] . "', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'blog_mail_uid', '" . doSlash(ps('email')) . "', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'blog_time_uid', '2005', 2, 'publish', 'text_input', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'edit_raw_css_by_default', '1', 1, 'css', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'allow_page_php_scripting', '1', 1, 'publish', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'allow_article_php_scripting', '1', 1, 'publish', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'allow_raw_php_scripting', '0', 1, 'publish', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'textile_links', '0', 1, 'link', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'show_article_category_count', '1', 2, 'category', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'show_comment_count_in_feed', '1', 1, 'publish', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'syndicate_body_or_excerpt', '1', 1, 'publish', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'include_email_atom', '1', 1, 'publish', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'comment_means_site_updated', '1', 1, 'publish', 'yesnoradio', 0, '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` VALUES (1, 'never_display_email', '0', 1, 'publish', 'yesnoradio', 0, '')";
Beispiel #6
0
function fbCreate()
{
    echo n . '<div id="setup_container" class="txp-container">' . txp_setup_progress_meter(4) . n . '<div class="txp-setup">';
    if ($GLOBALS['txp_install_successful'] === false) {
        return n . graf('<span class="error">' . setup_gTxt('errors_during_install', array('{num}' => $GLOBALS['txp_err_count'])) . '</span>') . n . '</div>' . n . '</div>';
    } else {
        // Clear the session so no data is leaked.
        $_SESSION = array();
        $warnings = @find_temp_dir() ? '' : n . graf('<span class="warning">' . setup_gTxt('set_temp_dir_prefs') . '</span>');
        $login_url = $GLOBALS['rel_txpurl'] . '/index.php';
        return n . hed(setup_gTxt('that_went_well'), 1) . $warnings . n . graf(setup_gTxt('you_can_access', array('index.php' => $login_url))) . n . graf(setup_gTxt('installation_postamble')) . n . hed(setup_gTxt('thanks_for_interest'), 3) . n . graf('<a href="' . $login_url . '" class="navlink publish">' . setup_gTxt('go_to_login') . '</a>');
        n . '</div>' . n . '</div>';
    }
}
Beispiel #7
0
    safe_insert('txp_prefs', "name='override_emailcharset', val='0', prefs_id='1', type='1', event='admin', position='" . doSlash($maxpos) . "', html='yesnoradio'");
}
if (safe_field('val', 'txp_prefs', "name='comments_auto_append'") === false) {
    safe_insert('txp_prefs', "val = '1', name = 'comments_auto_append' , prefs_id ='1', type='0', html='yesnoradio', event='comments', position='211'");
    $form = <<<EOF
<txp:comments />
<txp:if_comments_allowed>
<txp:comments_form />
</txp:if_comments_allowed>
EOF;
    safe_insert('txp_form', "name='comments_display', type='article', Form='{$form}'");
}
// /tmp is bad for permanent storage of files,
// if no files are uploaded yet, switch to the files directory in the top-txp dir.
if (!safe_count('txp_file', "1")) {
    $tempdir = find_temp_dir();
    if ($tempdir == safe_field('val', 'txp_prefs', "name='file_base_path'")) {
        safe_update('txp_prefs', "val='" . doSlash(dirname(txpath) . DS . 'files') . "',prefs_id=1", "name='file_base_path'");
    }
}
// After this point the changes after RC4
// let's get the advanced fields in the right order
for ($i = 1; $i <= 10; $i++) {
    safe_update("txp_prefs", "position={$i}", "name='custom_{$i}_set'");
}
// index ip column in txp_log
$ipidxset = false;
$i = safe_show('index', 'txp_log');
foreach ($i as $a => $b) {
    if ($b['Column_name'] == 'ip') {
        $ipidxset = true;
Beispiel #8
0
function fbCreate()
{
    if ($GLOBALS['txp_install_successful'] === false) {
        return '<div width="450" valign="top" style="margin-right: auto; margin-left: auto;">' . graf(gTxt('errors_during_install', array('{num}' => $GLOBALS['txp_err_count'])), ' style="margin-top: 3em;"') . '</div>';
    } else {
        $warnings = @find_temp_dir() ? '' : graf(gTxt('set_temp_dir_prefs'));
        return '<div width="450" valign="top" style="margin-right: auto; margin-left: auto;">' . graf(gTxt('that_went_well'), ' style="margin-top:3em"') . $warnings . graf(gTxt('you_can_access', array('index.php' => $GLOBALS['rel_txpurl'] . '/index.php'))) . graf(gTxt('thanks_for_interest')) . '</div>';
    }
}
Beispiel #9
0
function advanced_prefs_save()
{
    $prefnames = safe_column("name", "txp_prefs", "prefs_id = 1 AND type = 1");
    $post = doSlash(stripPost());
    if (empty($post['tempdir'])) {
        $post['tempdir'] = doSlash(find_temp_dir());
    }
    if (!empty($post['file_max_upload_size'])) {
        $post['file_max_upload_size'] = real_max_upload_size($post['file_max_upload_size']);
    }
    foreach ($prefnames as $prefname) {
        if (isset($post[$prefname])) {
            safe_update("txp_prefs", "val = '" . $post[$prefname] . "'", "name = '" . doSlash($prefname) . "' and prefs_id = 1");
        }
    }
    update_lastmod();
    advanced_prefs(gTxt('preferences_saved'));
}
Beispiel #10
0
$create_sql[] = "INSERT INTO `" . PFX . "txp_link` VALUES (4, NOW(), 'textpattern', 'http://textpattern.com/@textpattern', '@textpattern',                   '40', '', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_link` VALUES (5, NOW(), 'textpattern', 'http://textpattern.com/+',            '+Textpattern CMS',               '50', '', '')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_link` VALUES (6, NOW(), 'textpattern', 'http://textpattern.com/facebook',     'Textpattern Facebook Group',     '60', '', '')";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_log` (\n    id     INT          NOT NULL AUTO_INCREMENT,\n    time   DATETIME     NOT NULL,\n    host   VARCHAR(255) NOT NULL DEFAULT '',\n    page   VARCHAR(255) NOT NULL DEFAULT '',\n    refer  MEDIUMTEXT   NOT NULL,\n    status INT          NOT NULL DEFAULT '200',\n    method VARCHAR(16)  NOT NULL DEFAULT 'GET',\n    ip     VARCHAR(45)  NOT NULL DEFAULT '',\n\n    PRIMARY KEY (id),\n    INDEX time  (time),\n    INDEX ip    (ip)\n) {$tabletype} ";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_page` (\n    name      VARCHAR(255) NOT NULL DEFAULT '',\n    user_html TEXT         NOT NULL,\n\n    PRIMARY KEY (name(250))\n) {$tabletype} ";
foreach (scandir($themedir . DS . 'pages') as $pagefile) {
    if (preg_match('/^(\\w+)\\.txp$/', $pagefile, $match)) {
        $page = doSlash(file_get_contents($themedir . DS . 'pages' . DS . $pagefile));
        $create_sql[] = "INSERT INTO `" . PFX . "txp_page`(name, user_html) VALUES('" . $match[1] . "', '" . $page . "')";
    }
}
$create_sql[] = "CREATE TABLE `" . PFX . "txp_plugin` (\n    name         VARCHAR(64)       NOT NULL DEFAULT '',\n    status       INT               NOT NULL DEFAULT '1',\n    author       VARCHAR(128)      NOT NULL DEFAULT '',\n    author_uri   VARCHAR(128)      NOT NULL DEFAULT '',\n    version      VARCHAR(255)      NOT NULL DEFAULT '1.0',\n    description  TEXT              NOT NULL,\n    help         TEXT              NOT NULL,\n    code         MEDIUMTEXT        NOT NULL,\n    code_restore MEDIUMTEXT        NOT NULL,\n    code_md5     VARCHAR(32)       NOT NULL DEFAULT '',\n    type         INT               NOT NULL DEFAULT '0',\n    load_order   TINYINT  UNSIGNED NOT NULL DEFAULT '5',\n    flags        SMALLINT UNSIGNED NOT NULL DEFAULT '0',\n\n    UNIQUE name            (name),\n    INDEX  status_type_idx (status, type)\n) {$tabletype} ";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_prefs` (\n    prefs_id  INT               NOT NULL DEFAULT '1',\n    name      VARCHAR(255)      NOT NULL DEFAULT '',\n    val       TEXT              NOT NULL,\n    type      SMALLINT UNSIGNED NOT NULL DEFAULT '2',\n    event     VARCHAR(255)      NOT NULL DEFAULT 'publish',\n    html      VARCHAR(255)      NOT NULL DEFAULT 'text_input',\n    position  SMALLINT UNSIGNED NOT NULL DEFAULT '0',\n    user_name VARCHAR(64)       NOT NULL DEFAULT '',\n\n    UNIQUE prefs_idx (prefs_id, name(185), user_name),\n    INDEX  name      (name(250)),\n    INDEX  user_name (user_name)\n) {$tabletype} ";
$blog_uid = md5(uniqid(rand(), true));
$gmtoffset = sprintf("%+d", gmmktime(0, 0, 0) - mktime(0, 0, 0));
$prefs = array('admin' => array(array(0, 20, 'text_input', 'img_dir', 'images'), array(0, 40, 'text_input', 'file_base_path', dirname(txpath) . DS . 'files'), array(0, 60, 'text_input', 'file_max_upload_size', '2000000'), array(0, 80, 'text_input', 'tempdir', find_temp_dir()), array(0, 100, 'text_input', 'plugin_cache_dir', ''), array(0, 110, 'text_input', 'smtp_from', ''), array(0, 115, 'text_input', 'publisher_email', ''), array(0, 120, 'yesnoradio', 'override_emailcharset', '0'), array(0, 130, 'yesnoradio', 'enable_xmlrpc_server', '0'), array(0, 150, 'default_event', 'default_event', 'article'), array(0, 160, 'themename', 'theme_name', $theme)), 'category' => array(array(2, 0, 'yesnoradio', 'show_article_category_count', '1')), 'comments' => array(array(0, 20, 'yesnoradio', 'comments_on_default', '0'), array(0, 40, 'text_input', 'comments_default_invite', $setup_comment_invite), array(0, 60, 'yesnoradio', 'comments_moderate', '1'), array(0, 80, 'weeks', 'comments_disabled_after', '42'), array(0, 100, 'yesnoradio', 'comments_auto_append', '0'), array(0, 120, 'commentmode', 'comments_mode', '0'), array(0, 140, 'dateformats', 'comments_dateformat', '%b %d, %I:%M %p'), array(0, 160, 'commentsendmail', 'comments_sendmail', '0'), array(0, 180, 'yesnoradio', 'comments_are_ol', '1'), array(0, 200, 'yesnoradio', 'comment_means_site_updated', '1'), array(0, 220, 'yesnoradio', 'comments_require_name', '1'), array(0, 240, 'yesnoradio', 'comments_require_email', '1'), array(0, 260, 'yesnoradio', 'never_display_email', '1'), array(0, 280, 'yesnoradio', 'comment_nofollow', '1'), array(0, 300, 'yesnoradio', 'comments_disallow_images', '0'), array(0, 320, 'yesnoradio', 'comments_use_fat_textile', '0'), array(0, 340, 'text_input', 'spam_blacklists', '')), 'custom' => array(array(0, 1, 'custom_set', 'custom_1_set', 'custom1'), array(0, 2, 'custom_set', 'custom_2_set', 'custom2'), array(0, 3, 'custom_set', 'custom_3_set', ''), array(0, 4, 'custom_set', 'custom_4_set', ''), array(0, 5, 'custom_set', 'custom_5_set', ''), array(0, 6, 'custom_set', 'custom_6_set', ''), array(0, 7, 'custom_set', 'custom_7_set', ''), array(0, 8, 'custom_set', 'custom_8_set', ''), array(0, 9, 'custom_set', 'custom_9_set', ''), array(0, 10, 'custom_set', 'custom_10_set', '')), 'feeds' => array(array(0, 20, 'yesnoradio', 'syndicate_body_or_excerpt', '1'), array(0, 40, 'text_input', 'rss_how_many', '5'), array(0, 60, 'yesnoradio', 'show_comment_count_in_feed', '1'), array(0, 80, 'yesnoradio', 'include_email_atom', '1'), array(0, 100, 'yesnoradio', 'use_mail_on_feeds_id', '0')), 'publish' => array(array(0, 20, 'yesnoradio', 'title_no_widow', '0'), array(0, 40, 'yesnoradio', 'articles_use_excerpts', '1'), array(0, 60, 'yesnoradio', 'allow_form_override', '1'), array(0, 80, 'yesnoradio', 'attach_titles_to_permalinks', '1'), array(0, 100, 'yesnoradio', 'permalink_title_format', '1'), array(0, 120, 'yesnoradio', 'send_lastmod', '1'), array(0, 130, 'yesnoradio', 'publish_expired_articles', '0'), array(0, 140, 'yesnoradio', 'lastmod_keepalive', '0'), array(0, 160, 'yesnoradio', 'ping_weblogsdotcom', '0'), array(0, 200, 'pref_text', 'use_textile', '1'), array(0, 220, 'yesnoradio', 'use_dns', '0'), array(0, 260, 'yesnoradio', 'use_plugins', '1'), array(0, 280, 'yesnoradio', 'admin_side_plugins', '1'), array(0, 300, 'yesnoradio', 'allow_page_php_scripting', '1'), array(0, 320, 'yesnoradio', 'allow_article_php_scripting', '1'), array(0, 340, 'text_input', 'max_url_len', '1000'), array(2, 0, 'text_input', 'blog_mail_uid', $_SESSION['email']), array(2, 0, 'text_input', 'blog_time_uid', '2005'), array(2, 0, 'text_input', 'blog_uid', $blog_uid), array(2, 0, 'text_input', 'dbupdatetime', '0'), array(2, 0, 'languages', 'language', LANG), array(2, 0, 'text_input', 'lastmod', '2005-07-23 16:24:10'), array(2, 0, 'text_input', 'locale', getlocale(LANG)), array(2, 0, 'text_input', 'path_from_root', '/'), array(2, 0, 'text_input', 'path_to_site', dirname(txpath)), array(2, 0, 'text_input', 'prefs_id', '1'), array(2, 0, 'text_input', 'searchable_article_fields', 'Title, Body'), array(2, 0, 'text_input', 'textile_updated', '1'), array(2, 0, 'text_input', 'timeoffset', '0'), array(2, 0, 'text_input', 'timezone_key', ''), array(2, 0, 'text_input', 'url_mode', '1'), array(2, 0, 'text_input', 'use_categories', '1'), array(2, 0, 'text_input', 'use_sections', '1'), array(2, 0, 'text_input', 'version', '4.5.7')), 'section' => array(array(2, 0, 'text_input', 'default_section', 'articles')), 'site' => array(array(0, 20, 'text_input', 'sitename', gTxt('my_site')), array(0, 40, 'text_input', 'siteurl', $siteurl), array(0, 60, 'text_input', 'site_slogan', gTxt('my_slogan')), array(0, 80, 'prod_levels', 'production_status', 'testing'), array(0, 100, 'gmtoffset_select', 'gmtoffset', $gmtoffset), array(0, 115, 'yesnoradio', 'auto_dst', '0'), array(0, 120, 'is_dst', 'is_dst', '0'), array(0, 140, 'dateformats', 'dateformat', 'since'), array(0, 160, 'dateformats', 'archive_dateformat', '%b %d, %I:%M %p'), array(0, 180, 'permlinkmodes', 'permlink_mode', $permlink_mode), array(0, 190, 'doctypes', 'doctype', 'html5'), array(0, 220, 'logging', 'logging', 'none'), array(0, 230, 'text_input', 'expire_logs_after', '7'), array(0, 240, 'yesnoradio', 'use_comments', '1')));
foreach ($prefs as $event => $event_prefs) {
    foreach ($event_prefs as $p) {
        $create_sql[] = "INSERT INTO `" . PFX . "txp_prefs` (event, type, position, html, name, val) " . "VALUES ('" . $event . "', " . $p[0] . ", " . $p[1] . ", '" . $p[2] . "', '" . $p[3] . "', '" . doSlash($p[4]) . "')";
    }
}
$create_sql[] = "CREATE TABLE `" . PFX . "txp_section` (\n    name         VARCHAR(255) NOT NULL DEFAULT '',\n    page         VARCHAR(255) NOT NULL DEFAULT '',\n    css          VARCHAR(255) NOT NULL DEFAULT '',\n    description  VARCHAR(255) NOT NULL DEFAULT '',\n    in_rss       INT          NOT NULL DEFAULT '1',\n    on_frontpage INT          NOT NULL DEFAULT '1',\n    searchable   INT          NOT NULL DEFAULT '1',\n    title        VARCHAR(255) NOT NULL DEFAULT '',\n\n    PRIMARY KEY (name(250))\n) {$tabletype} ";
$create_sql[] = "INSERT INTO `" . PFX . "txp_section` VALUES ('articles', 'archive', 'default', 1, 1, 1, 1, 'Articles')";
$create_sql[] = "INSERT INTO `" . PFX . "txp_section` VALUES ('default', 'default', 'default', 0, 1, 1, 1, 'Default')";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_users` (\n    user_id     INT          NOT NULL AUTO_INCREMENT,\n    name        VARCHAR(64)  NOT NULL DEFAULT '',\n    pass        VARCHAR(128) NOT NULL,\n    RealName    VARCHAR(255) NOT NULL DEFAULT '',\n    email       VARCHAR(254) NOT NULL DEFAULT '',\n    privs       TINYINT      NOT NULL DEFAULT '1',\n    last_access DATETIME         NULL DEFAULT NULL,\n    nonce       VARCHAR(64)  NOT NULL DEFAULT '',\n\n    PRIMARY KEY (user_id),\n    UNIQUE name (name)\n) {$tabletype} ";
$create_sql[] = "INSERT INTO `" . PFX . "txp_users` VALUES (\n    1,\n    '" . doSlash($_SESSION['name']) . "',\n    '" . doSlash(txp_hash_password($_SESSION['pass'])) . "',\n    '" . doSlash($_SESSION['realname']) . "',\n    '" . doSlash($_SESSION['email']) . "',\n    1,\n    NOW(),\n    '" . md5(uniqid(rand(), true)) . "')";
$create_sql[] = "CREATE TABLE `" . PFX . "txp_token` (\n    id           INT          NOT NULL AUTO_INCREMENT,\n    reference_id INT          NOT NULL DEFAULT 0,\n    type         VARCHAR(255) NOT NULL DEFAULT '',\n    selector     VARCHAR(12)  NOT NULL DEFAULT '',\n    token        VARCHAR(255) NOT NULL DEFAULT '',\n    expires      DATETIME         NULL DEFAULT NULL,\n\n    PRIMARY KEY (id)\n) {$tabletype} ";
$GLOBALS['txp_install_successful'] = true;
$GLOBALS['txp_err_count'] = 0;
$GLOBALS['txp_err_html'] = '';
foreach ($create_sql as $query) {
Beispiel #11
0
function advanced_prefs_save()
{
    // update custom fields count from database schema and cache it as a hidden pref
    $max_custom_fields = count(preg_grep('/^custom_\\d+/', getThings('describe `' . PFX . 'textpattern`')));
    set_pref('max_custom_fields', $max_custom_fields, 'publish', 2);
    // safe all regular advanced prefs
    $prefnames = safe_column("name", "txp_prefs", "prefs_id = 1 AND type = 1");
    $post = doSlash(stripPost());
    if (empty($post['tempdir'])) {
        $post['tempdir'] = doSlash(find_temp_dir());
    }
    if (!empty($post['file_max_upload_size'])) {
        $post['file_max_upload_size'] = real_max_upload_size($post['file_max_upload_size']);
    }
    foreach ($prefnames as $prefname) {
        if (isset($post[$prefname])) {
            safe_update("txp_prefs", "val = '" . $post[$prefname] . "'", "name = '" . doSlash($prefname) . "' and prefs_id = 1");
        }
    }
    update_lastmod();
    advanced_prefs(gTxt('preferences_saved'));
}
Beispiel #12
0
/**
 * Renders stage 4: either installation completed panel (success) or
 * installation error message (fail).
 */
function fbCreate()
{
    echo txp_setup_progress_meter(4) . n . '<div class="txp-setup">';
    if ($GLOBALS['txp_install_successful'] === false) {
        return graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('config_php_not_found', array('{num}' => $GLOBALS['txp_err_count'])), array('class' => 'alert-block error')) . n . '<ol>' . $GLOBALS['txp_err_html'] . n . '</ol>' . n . '</div>';
    } else {
        // Clear the session so no data is leaked.
        $_SESSION = array();
        $warnings = @find_temp_dir() ? '' : graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . setup_gTxt('set_temp_dir_prefs'), array('class' => 'alert-block warning'));
        $login_url = $GLOBALS['rel_txpurl'] . '/index.php';
        return hed(setup_gTxt('that_went_well'), 1) . $warnings . graf(setup_gTxt('you_can_access', array('index.php' => $login_url))) . graf(setup_gTxt('installation_postamble')) . hed(setup_gTxt('thanks_for_interest'), 3) . graf(href(setup_gTxt('go_to_login'), $login_url, ' class="navlink publish"')) . n . '</div>';
    }
}
Beispiel #13
0
 function txp_prefs_table()
 {
     $table = new txp_prefs_table();
     # Default to messy URLs if we know clean ones won't work
     $permlink_mode = 'section_id_title';
     if (is_callable('apache_get_modules')) {
         $modules = apache_get_modules();
         if (!in_array('mod_rewrite', $modules)) {
             $permlink_mode = 'messy';
         }
     } else {
         $server_software = @$_SERVER['SERVER_SOFTWARE'] || @$_SERVER['HTTP_HOST'] ? @$_SERVER['SERVER_SOFTWARE'] ? @$_SERVER['SERVER_SOFTWARE'] : $_SERVER['HTTP_HOST'] : '';
         if (!stristr($server_software, 'Apache')) {
             $permlink_mode = 'messy';
         }
     }
     $setup_comment_invite = addslashes(gTxt('setup_comment_invite') == 'setup_comment_invite' ? 'Comment' : gTxt('setup_comment_invite'));
     require_once txpath . '/lib/txplib_prefs.php';
     $prefs = get_default_prefs();
     $prefs['blog_uid'] = md5(uniqid(rand(), true));
     /*		echo '<pre>';
     		echo var_dump($prefs);
     		echo '</pre>';*/
     $preferences = array();
     # public prefs:
     $preferences[] = array('name' => 'sitename', 'val' => gTxt('my_site'), 'type' => 0, 'event' => 'publish', 'html' => 'text_input', 'position' => 10);
     $preferences[] = array('name' => 'siteurl', 'val' => 'comment.local', 'type' => 0, 'event' => 'publish', 'html' => 'text_input', 'position' => 20);
     $preferences[] = array('name' => 'site_slogan', 'val' => gTxt('my_slogan'), 'type' => 0, 'event' => 'publish', 'html' => 'text_input', 'position' => 30);
     $preferences[] = array('name' => 'is_dst', 'val' => '0', 'type' => 0, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 60);
     $preferences[] = array('name' => 'dateformat', 'val' => 'since', 'type' => 0, 'event' => 'publish', 'html' => 'dateformats', 'position' => 70);
     $preferences[] = array('name' => 'archive_dateformat', 'val' => '%b %d, %I:%M %p', 'type' => 0, 'event' => 'publish', 'html' => 'dateformats', 'position' => 80);
     $preferences[] = array('name' => 'permlink_mode', 'val' => $permlink_mode, 'type' => 0, 'event' => 'publish', 'html' => 'permlinkmodes', 'position' => 90);
     $preferences[] = array('name' => 'logging', 'val' => 'all', 'type' => 0, 'event' => 'publish', 'html' => 'logging', 'position' => 100);
     $preferences[] = array('name' => 'use_textile', 'val' => '2', 'type' => 0, 'event' => 'publish', 'html' => 'pref_text', 'position' => 110);
     $preferences[] = array('name' => 'use_comments', 'val' => '1', 'type' => 0, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 120);
     $preferences[] = array('name' => 'production_status', 'val' => 'testing', 'type' => 0, 'event' => 'publish', 'html' => 'prod_levels', 'position' => 210);
     # public comments prefs:
     $preferences[] = array('name' => 'comments_moderate', 'val' => '1', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 130);
     $preferences[] = array('name' => 'comments_on_default', 'val' => '0', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 140);
     $preferences[] = array('name' => 'comments_are_ol', 'val' => '1', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 150);
     $preferences[] = array('name' => 'comments_sendmail', 'val' => '0', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 160);
     $preferences[] = array('name' => 'comments_disallow_images', 'val' => '0', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 170);
     $preferences[] = array('name' => 'comments_default_invite', 'val' => $setup_comment_invite, 'type' => 0, 'event' => 'comments', 'html' => 'text_input', 'position' => 180);
     $preferences[] = array('name' => 'comments_dateformat', 'val' => '%b %d, %I:%M %p', 'type' => 0, 'event' => 'comments', 'html' => 'dateformats', 'position' => 190);
     $preferences[] = array('name' => 'comments_mode', 'val' => '0', 'type' => 0, 'event' => 'comments', 'html' => 'commentmode', 'position' => 200);
     $preferences[] = array('name' => 'comments_disabled_after', 'val' => '42', 'type' => 0, 'event' => 'comments', 'html' => 'weeks', 'position' => 210);
     $preferences[] = array('name' => 'comments_auto_append', 'val' => '1', 'type' => 0, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 211);
     # admin prefs:
     $preferences[] = array('name' => 'ping_weblogsdotcom', 'val' => '0', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'rss_how_many', 'val' => '5', 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'send_lastmod', 'val' => '0', 'type' => 1, 'event' => 'admin', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'img_dir', 'val' => 'images', 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'file_max_upload_size', 'val' => '2000000', 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'tempdir', 'val' => find_temp_dir(), 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'file_base_path', 'val' => dirname(txpath) . DS . 'files', 'type' => 1, 'event' => 'admin', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'edit_raw_css_by_default', 'val' => '1', 'type' => 1, 'event' => 'css', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'allow_page_php_scripting', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'allow_article_php_scripting', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'allow_raw_php_scripting', 'val' => '0', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'textile_links', 'val' => '0', 'type' => 1, 'event' => 'link', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'show_comment_count_in_feed', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'syndicate_body_or_excerpt', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'include_email_atom', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'comment_means_site_updated', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'never_display_email', 'val' => '0', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'comments_require_name', 'val' => '1', 'type' => 1, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'comments_require_email', 'val' => '1', 'type' => 1, 'event' => 'comments', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'articles_use_excerpts', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'allow_form_override', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'attach_titles_to_permalinks', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'permalink_title_format', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'expire_logs_after', 'val' => '7', 'type' => 1, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'use_plugins', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'custom_1_set', 'val' => 'custom1', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 1);
     $preferences[] = array('name' => 'custom_2_set', 'val' => 'custom2', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 2);
     $preferences[] = array('name' => 'custom_3_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 3);
     $preferences[] = array('name' => 'custom_4_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 4);
     $preferences[] = array('name' => 'custom_5_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 5);
     $preferences[] = array('name' => 'custom_6_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 6);
     $preferences[] = array('name' => 'custom_7_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 7);
     $preferences[] = array('name' => 'custom_8_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 8);
     $preferences[] = array('name' => 'custom_9_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 9);
     $preferences[] = array('name' => 'custom_10_set', 'val' => '', 'type' => 1, 'event' => 'custom', 'html' => 'text_input', 'position' => 10);
     $preferences[] = array('name' => 'ping_textpattern_com', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'use_dns', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'admin_side_plugins', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'comment_nofollow', 'val' => '1', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'use_mail_on_feeds_id', 'val' => '0', 'type' => 1, 'event' => 'publish', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'max_url_len', 'val' => '200', 'type' => 1, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'spam_blacklists', 'val' => 'sbl.spamhaus.org', 'type' => 1, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'override_emailcharset', 'val' => '0', 'type' => 1, 'event' => 'admin', 'html' => 'yesnoradio', 'position' => 21);
     # hidden prefs:
     $preferences[] = array('name' => 'prefs_id', 'val' => '1', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'use_categories', 'val' => '1', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'use_sections', 'val' => '1', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'language', 'val' => 'en-gb', 'type' => 2, 'event' => 'publish', 'html' => 'languages', 'position' => 40);
     $preferences[] = array('name' => 'url_mode', 'val' => '1', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'timeoffset', 'val' => '0', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'lastmod', 'val' => '2005-07-23 16:24:10', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'file_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'path_to_site', 'val' => '', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'article_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'link_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'image_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'log_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'comment_list_pageby', 'val' => '25', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'locale', 'val' => 'en_GB.UTF-8', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'blog_uid', 'val' => $prefs['blog_uid'], 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'blog_mail_uid', 'val' => $_POST['email'], 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'blog_time_uid', 'val' => '2005', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'show_article_category_count', 'val' => '1', 'type' => 2, 'event' => 'category', 'html' => 'yesnoradio', 'position' => 0);
     $preferences[] = array('name' => 'dbupdatetime', 'val' => '1122194504', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     $preferences[] = array('name' => 'version', 'val' => '1.0rc4', 'type' => 2, 'event' => 'publish', 'html' => 'text_input', 'position' => 0);
     foreach ($preferences as $preference) {
         if (!$table->row(array('name' => $preference['name']))) {
             $table->insert($preference);
         }
     }
 }
Beispiel #14
0
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'img_dir', 'images', 1, 'admin', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'comments_disallow_images', '0', 0, 'comments', 'yesnoradio', 170)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'comments_sendmail', '0', 0, 'comments', 'yesnoradio', 160)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'file_max_upload_size', '2000000', 1, 'admin', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'file_list_pageby', '25', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'path_to_site', '', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'article_list_pageby', '25', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'link_list_pageby', '25', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'image_list_pageby', '25', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'log_list_pageby', '25', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'comment_list_pageby', '25', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'permlink_mode', '" . addslashes($permlink_mode) . "', 0, 'publish', 'permlinkmodes', 90)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'comments_are_ol', '1', 0, 'comments', 'yesnoradio', 150)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'is_dst', '0', 0, 'publish', 'yesnoradio', 60)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'locale', 'en_GB.UTF-8', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'tempdir', '" . addslashes(find_temp_dir()) . "', 1, 'admin', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'file_base_path', '" . addslashes(dirname(txpath) . DS . 'files') . "', 1, 'admin', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'blog_uid', '" . $prefs['blog_uid'] . "', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'blog_mail_uid', '" . addslashes($_POST['email']) . "', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'blog_time_uid', '2005', 2, 'publish', 'text_input', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'edit_raw_css_by_default', '1', 1, 'css', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'allow_page_php_scripting', '1', 1, 'publish', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'allow_article_php_scripting', '1', 1, 'publish', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'allow_raw_php_scripting', '0', 1, 'publish', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'textile_links', '0', 1, 'link', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'show_article_category_count', '1', 2, 'category', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'show_comment_count_in_feed', '1', 1, 'publish', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'syndicate_body_or_excerpt', '1', 1, 'publish', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'include_email_atom', '1', 1, 'publish', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'comment_means_site_updated', '1', 1, 'publish', 'yesnoradio', 0)";
$create_sql[] = "INSERT INTO " . PFX . "txp_prefs VALUES (1, 'never_display_email', '0', 1, 'publish', 'yesnoradio', 0)";