コード例 #1
0
 * along with Textpattern. If not, see <http://www.gnu.org/licenses/>.
 */
if (!defined('TXP_UPDATE')) {
    exit("Nothing here. You can't access this file directly.");
}
// Doctype prefs.
if (!safe_field("name", 'txp_prefs', "name = 'doctype'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'doctype', val = 'xhtml', type = '0', event = 'publish', html = 'doctypes', position = '190'");
}
// Publisher's email address.
if (!safe_field("name", 'txp_prefs', "name = 'publisher_email'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'publisher_email', val = '', type = 1, event = 'admin', position = 115");
}
// Goodbye raw ?php support.
if (safe_field("name", 'txp_prefs', "name = 'allow_raw_php_scripting'")) {
    safe_delete('txp_prefs', "name = 'allow_raw_php_scripting'");
}
safe_alter('txp_users', "\n    MODIFY RealName VARCHAR(255) NOT NULL DEFAULT '',\n    MODIFY email VARCHAR(254) NOT NULL DEFAULT ''");
// Remove any setup strings from lang table.
safe_delete('txp_lang', "event = 'setup'");
safe_create_index('textpattern', 'url_title', 'url_title_idx');
// Remove is_default from txp_section table and make it a preference.
if (!safe_field("name", 'txp_prefs', "name = 'default_section'")) {
    $current_default_section = safe_field("name", 'txp_section', "is_default = 1");
    safe_insert('txp_prefs', "prefs_id = 1, name = 'default_section', val = '" . doSlash($current_default_section) . "', type = '2', event = 'section', html = 'text_input', position = '0'");
}
$cols = getThings("DESCRIBE `" . PFX . "txp_section`");
if (in_array('is_default', $cols)) {
    safe_alter('txp_section', "DROP is_default");
}
safe_alter('txp_css', "MODIFY css MEDIUMTEXT NOT NULL");
コード例 #2
0
    safe_insert('txp_prefs', "prefs_id = 1, name = 'default_event', val = 'article', type = '1', event = 'admin', html = 'default_event', position = '150'");
}
// Add columns for thumbnail dimensions.
$cols = getThings("DESCRIBE `" . PFX . "txp_image`");
if (!in_array('thumb_w', $cols)) {
    safe_alter('txp_image', "\n        ADD thumb_w int(8) NOT NULL DEFAULT 0,\n        ADD thumb_h int(8) NOT NULL DEFAULT 0");
}
// Plugin flags.
$cols = getThings('DESCRIBE `' . PFX . 'txp_plugin`');
if (!in_array('flags', $cols)) {
    safe_alter('txp_plugin', "ADD flags SMALLINT UNSIGNED NOT NULL DEFAULT 0");
}
// Default theme.
if (!safe_field("name", 'txp_prefs', "name = 'theme_name'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'theme_name', val = 'classic', type = '1', event = 'admin', html = 'themename', position = '160'");
}
safe_alter('txp_plugin', "\n    CHANGE code code MEDIUMTEXT NOT NULL,\n    CHANGE code_restore code_restore MEDIUMTEXT NOT NULL");
safe_alter('txp_prefs', "CHANGE val val TEXT NOT NULL");
// Add author column to files and links, boldy assuming that the publisher in
// charge of updating this site is the author of any existing content items.
foreach (array('txp_file', 'txp_link') as $table) {
    $cols = getThings("DESCRIBE `" . PFX . $table . "`");
    if (!in_array('author', $cols)) {
        safe_alter($table, "\n            ADD author varchar(64) NOT NULL DEFAULT '',\n            ADD INDEX author_idx (author)");
        safe_update($table, "author = '" . doSlash($txp_user) . "'", '1 = 1');
    }
}
// Add indices on author columns.
safe_create_index('textpattern', 'AuthorID', 'author_idx');
safe_create_index('txp_image', 'author', 'author_idx');
コード例 #3
0
<?php

/*
 * Textpattern Content Management System
 * http://textpattern.com
 *
 * Copyright (C) 2015 The Textpattern Development Team
 *
 * This file is part of Textpattern.
 *
 * Textpattern is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, version 2.
 *
 * Textpattern is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Textpattern. If not, see <http://www.gnu.org/licenses/>.
 */
if (!defined('TXP_UPDATE')) {
    exit("Nothing here. You can't access this file directly.");
}
safe_create_index('txp_plugin', 'status, type', 'status_type_idx');
// Preserve old tag behaviour during upgrades.
safe_update('txp_page', "user_html = REPLACE(user_html, '<txp:if_section>', '<txp:if_section name=\"\">')", '1 = 1');
safe_update('txp_page', "user_html = REPLACE(user_html, '<txp:if_category name=\"\">', '<txp:if_category>')", '1 = 1');
safe_update('txp_form', "Form = REPLACE(Form, '<txp:if_section>', '<txp:if_section name=\"\">')", '1 = 1');
safe_update('txp_form', "Form = REPLACE(Form, '<txp:if_category name=\"\">', '<txp:if_category>')", '1 = 1');
コード例 #4
0
}
// 1.0: Human-friendly title for sections and categories, to solve i18n problems.
if (!in_array('title', $txpsect)) {
    safe_alter('txp_section', "ADD title VARCHAR(255) NOT NULL DEFAULT ''");
}
if (!in_array('title', $txpcat)) {
    safe_alter('txp_category', "ADD title VARCHAR(255) NOT NULL DEFAULT ''");
}
if (safe_count('txp_section', "title = ''") > 0) {
    safe_update('txp_section', "title = name", "title = ''");
}
if (safe_count('txp_category', "title = ''") > 0) {
    safe_update('txp_category', "title = name", "title = ''");
}
// 1.0: Unique key and 'type' field for the txp_prefs table.
safe_create_index('txp_prefs', 'prefs_id, name', 'prefs_idx', 'unique');
$txpprefs = getThings('DESCRIBE `' . PFX . 'txp_prefs`');
if (!in_array('type', $txpprefs)) {
    safe_alter('txp_prefs', "ADD type SMALLINT UNSIGNED NOT NULL DEFAULT '2'");
}
// Update the updated with default hidden type for old plugins prefs.
safe_alter('txp_prefs', "CHANGE type type SMALLINT UNSIGNED NOT NULL DEFAULT '2'");
if (!in_array('event', $txpprefs)) {
    safe_alter('txp_prefs', "ADD event VARCHAR(12) NOT NULL DEFAULT 'publish'");
}
if (!in_array('html', $txpprefs)) {
    safe_alter('txp_prefs', "ADD html VARCHAR(64) NOT NULL DEFAULT ''");
}
if (!in_array('position', $txpprefs)) {
    safe_alter('txp_prefs', "ADD position SMALLINT UNSIGNED NOT NULL DEFAULT '0'");
    // Add new column values to prefs.
コード例 #5
0
 * Textpattern is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, version 2.
 *
 * Textpattern is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Textpattern. If not, see <http://www.gnu.org/licenses/>.
 */
if (!defined('TXP_UPDATE')) {
    exit("Nothing here. You can't access this file directly.");
}
if (!safe_field("name", 'txp_prefs', "name = 'allow_raw_php_scripting'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'allow_raw_php_scripting', val = '1', type = '1', html = 'yesnoradio'");
} else {
    safe_update('txp_prefs', "html = 'yesnoradio'", "name = 'allow_raw_php_scripting'");
}
if (!safe_field("name", 'txp_prefs', "name = 'log_list_pageby'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'log_list_pageby', val = '25', type = 2, event = 'publish'");
}
// Turn on lastmod handling, and reset the lastmod date.
safe_update('txp_prefs', "val = '1'", "name = 'send_lastmod' AND prefs_id = '1'");
update_lastmod();
// Speed up article queries.
safe_create_index('textpattern', 'Section, Status', 'section_status_idx');
if (!safe_field("name", 'txp_prefs', "name = 'title_no_widow'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'title_no_widow', val = '0', type = '1', html = 'yesnoradio'");
}
コード例 #6
0
ファイル: _to_4.6.0.php プロジェクト: scar45/textpattern
safe_update('txp_prefs', "position = '160'", "name = 'comments_sendmail'");
safe_update('txp_prefs', "position = '180'", "name = 'comments_are_ol'");
safe_update('txp_prefs', "position = '200'", "name = 'comment_means_site_updated'");
safe_update('txp_prefs', "position = '220'", "name = 'comments_require_name'");
safe_update('txp_prefs', "position = '240'", "name = 'comments_require_email'");
safe_update('txp_prefs', "position = '260'", "name = 'never_display_email'");
safe_update('txp_prefs', "position = '280'", "name = 'comment_nofollow'");
safe_update('txp_prefs', "position = '300'", "name = 'comments_disallow_images'");
safe_update('txp_prefs', "position = '320'", "name = 'comments_use_fat_textile'");
safe_update('txp_prefs', "position = '340'", "name = 'spam_blacklists'");
safe_update('txp_prefs', "html = 'permlink_format'", "name = 'permalink_title_format'");
// Support for l10n string owners.
$cols = getThings("DESCRIBE `" . PFX . "txp_lang`");
if (!in_array('owner', $cols)) {
    safe_alter('txp_lang', "ADD owner VARCHAR(64) NOT NULL DEFAULT '' AFTER event");
    safe_create_index('txp_lang', 'owner', 'owner');
}
// Keep all comment-related forms together. The loss of 'preview' ability on the
// comments_display Form is of little consequence compared with the benefit of
// tucking them away neatly when not required.
safe_update('txp_form', "type = 'comment'", "name = 'comments_display'");
// Adds protocol to logged HTTP referers.
safe_update('txp_log', "refer = CONCAT('http://', refer)", "refer != '' AND refer NOT LIKE 'http://%' AND refer NOT LIKE 'https://%'");
// Usernames can be 64 characters long at most.
safe_alter('txp_file', "MODIFY author VARCHAR(64) NOT NULL DEFAULT ''");
safe_alter('txp_link', "MODIFY author VARCHAR(64) NOT NULL DEFAULT ''");
safe_alter('txp_image', "MODIFY author VARCHAR(64) NOT NULL DEFAULT ''");
// Consistent name length limitations for presentation items.
safe_alter('txp_form', "MODIFY name VARCHAR(255) NOT NULL DEFAULT ''");
safe_alter('txp_page', "MODIFY name VARCHAR(255) NOT NULL DEFAULT ''");
safe_alter('txp_section', "MODIFY page VARCHAR(255) NOT NULL DEFAULT ''");
コード例 #7
0
ファイル: _to_4.0.7.php プロジェクト: scar45/textpattern
if (!defined('TXP_UPDATE')) {
    exit("Nothing here. You can't access this file directly.");
}
$txpplugin = getThings('DESCRIBE `' . PFX . 'txp_plugin`');
if (!in_array('load_order', $txpplugin)) {
    safe_alter('txp_plugin', "ADD load_order TINYINT UNSIGNED NOT NULL DEFAULT 5");
}
// Enable XML-RPC server?
if (!safe_field("name", 'txp_prefs', "name = 'enable_xmlrpc_server'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'enable_xmlrpc_server', val = 0, type = 1, event = 'admin', html = 'yesnoradio', position = 130");
}
if (!safe_field("name", 'txp_prefs', "name = 'smtp_from'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'smtp_from', val = '', type = 1, event = 'admin', position = 110");
}
if (!safe_field("val", 'txp_prefs', "name = 'author_list_pageby'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'author_list_pageby', val = 25, type = 2");
}
// Expiry datetime for articles.
$txp = getThings("DESCRIBE `" . PFX . "textpattern`");
if (!in_array('Expires', $txp)) {
    safe_alter('textpattern', "ADD Expires DATETIME AFTER Posted");
}
safe_create_index('textpattern', 'Expires', 'Expires_idx');
// Publish expired articles, or return 410?
if (!safe_field("name", 'txp_prefs', "name = 'publish_expired_articles'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'publish_expired_articles', val = '0', type = '1', event = 'publish', html = 'yesnoradio', position = '130'");
}
// Searchable article fields hidden preference.
if (!safe_field("name", 'txp_prefs', "name = 'searchable_article_fields'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'searchable_article_fields', val = 'Title, Body', type = '2', event = 'publish', html = 'text_input', position = '0'");
}
コード例 #8
0
ファイル: _to_1.0.0.php プロジェクト: scar45/textpattern
<txp:comments_form />
</txp:if_comments_allowed>
EOF;
    safe_insert('txp_form', "name = 'comments_display', type = 'article', Form = '" . doSlash($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.
safe_create_index('txp_log', 'ip', 'ip');
// Language selection moves to Manage languages, Hide it from prefs.
safe_update('txp_prefs', "type = 2", "name = 'language'");
// Show gmt-selection in prefs.
safe_update('txp_prefs', "type = 0, html = 'gmtoffset_select', position = 50", "name = 'gmtoffset'");
if (safe_field("name", 'txp_prefs', "prefs_id = 1 AND name = 'plugin_cache_dir'") === false) {
    $maxpos = safe_field("MAX(position)", 'txp_prefs', "1 = 1");
    safe_insert('txp_prefs', "name = 'plugin_cache_dir', val = '', prefs_id = '1', type = '1', event = 'admin', position = '" . doSlash($maxpos) . "', html = 'text_input'");
}
// Update version.
safe_delete('txp_prefs', "name = 'version'");
safe_insert('txp_prefs', "prefs_id = 1, name = 'version', val = '4.0', type = '2'");