• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getThings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getThings函数的典型用法代码示例。如果您正苦于以下问题:PHP getThings函数的具体用法?PHP getThings怎么用?PHP getThings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getThings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: prefs_save

/**
 * 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'));
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:59,代码来源:txp_prefs.php


示例2: prefs_save

/**
 * 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'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:59,代码来源:txp_prefs.php


示例3: advanced_prefs_save

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'));
}
开发者ID:psic,项目名称:websites,代码行数:22,代码来源:txp_prefs.php


示例4: zem_event_install

function zem_event_install()
{
    if (!getThings("show tables like '" . safe_pfx('zem_event_calendar') . "'")) {
        safe_query("create table if not exists " . safe_pfx('zem_event_calendar') . " (\n\n\t\t\tid bigint auto_increment not null primary key,\n\t\t\tarticle_id bigint not null,\n\n\t\t\tmodified timestamp,\n\t\t\tcreated timestamp,\n\n\t\t\tevent_date date default null,\n\t\t\tevent_time time default null,\n\n\t\t\tname varchar(255)\n\n\t\t\t);");
    }
    if (!safe_field('name', 'txp_form', "name='zem_event_display'")) {
        $form = <<<EOF
<txp:zem_event_permlink wraptag="" ><txp:zem_event_name label="Event" wraptag="" /></txp:zem_event_permlink>
<txp:zem_event_date label="Date" wraptag="" />
<txp:zem_event_time label="Time" wraptag="" />

EOF;
        safe_insert('txp_form', "name='zem_event_display',\n\t\t\ttype='misc',\n\t\t\tForm='" . doSlash($form) . "'");
    }
    if (!safe_field('name', 'txp_form', "name='zem_event_display_feed'")) {
        $form = <<<EOF
<txp:zem_event_permlink wraptag="" ><txp:zem_event_name label="Event" wraptag="" /></txp:zem_event_permlink>
<txp:zem_event_date label="Date" wraptag="" />
<txp:zem_event_time label="Time" wraptag="" />

EOF;
        safe_insert('txp_form', "name='zem_event_display_feed',\n\t\t\ttype='misc',\n\t\t\tForm='" . doSlash($form) . "'");
    }
    if (!safe_field('name', 'txp_form', "name='zem_event_cal_entry'")) {
        $form = <<<EOF
<txp:zem_event_permlink wraptag="" ><txp:zem_event_name label="Event" wraptag="" /></txp:zem_event_permlink>
<txp:zem_event_time label="Time" wraptag="" />

EOF;
        safe_insert('txp_form', "name='zem_event_cal_entry',\n\t\t\ttype='misc',\n\t\t\tForm='" . doSlash($form) . "'");
    }
    // add finish date and time fields
    $cal = getThings('describe ' . safe_pfx('zem_event_calendar'));
    if (!in_array('finish_date', $cal)) {
        zem_alter('zem_event_calendar', 'add finish_date date default null');
    }
    if (!in_array('finish_time', $cal)) {
        zem_alter('zem_event_calendar', 'add finish_time time default null');
    }
    if (!in_array('location', $cal)) {
        zem_alter('zem_event_calendar', 'add location varchar(255)');
    }
    if (!in_array('location_url', $cal)) {
        zem_alter('zem_event_calendar', 'add location_url varchar(255)');
    }
    if (!in_array('url', $cal)) {
        zem_alter('zem_event_calendar', 'add url varchar(255)');
    }
    if (!in_array('email', $cal)) {
        zem_alter('zem_event_calendar', 'add email varchar(128)');
    }
    if (!in_array('description', $cal)) {
        zem_alter('zem_event_calendar', 'add description text');
    }
    if (!in_array('description_html', $cal)) {
        zem_alter('zem_event_calendar', 'add description_html text');
    }
    if (!in_array('repeat_n', $cal)) {
        zem_alter('zem_event_calendar', 'add repeat_n int');
    }
    if (!in_array('repeat_period', $cal)) {
        zem_alter('zem_event_calendar', 'add repeat_period varchar(16)');
    }
    if (!in_array('repeat_to', $cal)) {
        zem_alter('zem_event_calendar', 'add repeat_to date default null');
    }
    if (!safe_row('id', 'txp_category', "type = 'event' and name = 'root'")) {
        safe_insert('txp_category', "type = 'event', name = 'root', title = 'root'");
    }
    // event m->m category
    if (!getThings("show tables like '" . safe_pfx('zem_event_category') . "'")) {
        safe_query("create table if not exists " . safe_pfx('zem_event_category') . " (\n\t\t\t\tk1 int not null,\n\t\t\t\tk2 int not null,\n\t\t\t\tPRIMARY KEY (k1,k2)\n\t\t\t)");
    }
    if (!getThings("show tables like '" . safe_pfx('zem_event_date') . "'")) {
        safe_query("create table if not exists " . safe_pfx('zem_event_date') . " (\n\t\t\t\tevent_id bigint not null,\n\t\t\t\tevent_date date not null,\n\t\t\t\tevent_time time default null,\n\t\t\t\tfinish_date date default null,\n\t\t\t\tfinish_time time default null,\n\n\t\t\t\tPRIMARY KEY (event_id, event_date)\n\t\t\t)");
        if (in_array('event_date', $cal)) {
            // copy dates and times to the new zem_event_date table
            $rs = safe_rows('id, event_date, event_time, finish_date, finish_time', 'zem_event_calendar', '1=1');
            foreach ($rs as $row) {
                extract($row);
                safe_insert('zem_event_date', "event_id='" . doSlash($id) . "',\n\t\t\t\t\tevent_date=" . ($event_date ? "'" . doSlash($event_date) . "'" : "NULL") . ",\n\t\t\t\t\tevent_time=" . ($event_time ? "'" . doSlash($event_time) . "'" : "NULL") . ",\n\t\t\t\t\tfinish_date=" . ($finish_date ? "'" . doSlash($finish_date) . "'" : "NULL") . ",\n\t\t\t\t\tfinish_time=" . ($finish_time ? "'" . doSlash($finish_time) . "'" : "NULL"));
            }
        }
    }
}
开发者ID:gbp,项目名称:zem_event,代码行数:85,代码来源:zem_event.php


示例5: getThings

}
// 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', 'CHANGE code code MEDIUMTEXT NOT NULL, 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, "ADD author varchar(255) NOT NULL default '', ADD INDEX author_idx (author)");
        safe_update($table, "author='" . doSlash($txp_user) . "'", '1=1');
    }
}
// Add indices on author columns.
foreach (array('textpattern' => 'AuthorID', 'txp_image' => 'author') as $table => $col) {
    $has_idx = 0;
    $rs = getRows('show index from `' . PFX . $table . '`');
    foreach ($rs as $row) {
        if ($row['Key_name'] == 'author_idx') {
            $has_idx = 1;
        }
    }
    if (!$has_idx) {
开发者ID:bgarrels,项目名称:textpattern,代码行数:31,代码来源:_to_4.2.0.php


示例6: section_edit

function section_edit()
{
    global $event, $step, $txp_user, $all_pages, $all_styles;
    $name = gps('name');
    $is_edit = $name && $step == 'section_edit';
    if ($is_edit) {
        $name = assert_string($name);
        $rs = safe_row('*', 'txp_section', "name = '" . doSlash($name) . "'");
    } else {
        $rs = array_flip(getThings('describe `' . PFX . 'txp_section`'));
    }
    if ($rs) {
        if (!has_privs('section.edit')) {
            sec_section_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('tab_sections'));
        extract($rs, EXTR_PREFIX_ALL, 'sec');
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        $is_default_section = $is_edit && $sec_name == 'default';
        $caption = gTxt($is_default_section ? 'edit_default_section' : ($is_edit ? 'edit_section' : 'create_section'));
        if (!$is_edit) {
            // Pulling out the radio items from the default entry might seem pointless since they can't be directly
            // edited, but they will take on either:
            //  a) the default (SQL) values as defined at table creation time, or
            //  b) the values set when a multi-edit was performed that included the default section (because the values are silently updated then)
            $default = doSlash(safe_row('page, css, on_frontpage, in_rss, searchable', 'txp_section', "name = 'default'"));
            $sec_name = $sec_title = '';
            $sec_page = $default['page'];
            $sec_css = $default['css'];
            $sec_on_frontpage = $default['on_frontpage'];
            $sec_in_rss = $default['in_rss'];
            $sec_searchable = $default['searchable'];
        }
        echo '<div id="' . $event . '_container" class="txp-container">';
        echo form('<div class="txp-edit">' . hed($caption, 2) . ($is_default_section ? hInput('name', 'default') : inputLabel('section_name', fInput('text', 'name', $sec_name, '', '', '', INPUT_REGULAR, '', 'section_name'), 'section_name')) . ($is_default_section ? '' : inputLabel('section_title', fInput('text', 'title', $sec_title, '', '', '', INPUT_REGULAR, '', 'section_title'), 'section_longtitle')) . inputLabel('section_page', selectInput('section_page', $all_pages, $sec_page, '', '', 'section_page'), 'uses_page', 'section_uses_page') . inputLabel('section_css', selectInput('css', $all_styles, $sec_css, '', '', 'section_css'), 'uses_style', 'section_uses_css') . ($is_default_section ? '' : inputLabel('on_front_page', yesnoradio('on_frontpage', $sec_on_frontpage, '', $sec_name), '', 'section_on_frontpage')) . ($is_default_section ? '' : inputLabel('syndicate', yesnoradio('in_rss', $sec_in_rss, '', $sec_name), '', 'section_syndicate')) . ($is_default_section ? '' : inputLabel('include_in_search', yesnoradio('searchable', $sec_searchable, '', $sec_name), '', 'section_searchable')) . pluggable_ui('section_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('save'), 'publish')) . eInput('section') . sInput('section_save') . hInput('old_name', $sec_name) . hInput('search_method', $search_method) . hInput('crit', $crit) . hInput('page', $page) . hInput('sort', $sort) . hInput('dir', $dir) . '</div>', '', '', 'post', 'edit-form', '', 'section_details');
        echo '</div>';
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:39,代码来源:txp_section.php


示例7: safe_update

}
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
$has_prefs_idx = 0;
$rs = getRows('show index from `' . PFX . 'txp_prefs`');
foreach ($rs as $row) {
    if ($row['Key_name'] == 'prefs_idx') {
        $has_prefs_idx = 1;
    }
}
if (!$has_prefs_idx) {
    safe_query('alter ignore table `' . PFX . 'txp_prefs` add unique prefs_idx(prefs_id,name)');
}
$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
    $prefs_new_cols = array('attach_titles_to_permalinks' => array('html' => 'yesnoradio', 'event' => 'publish', 'type' => '1', 'position' => '1'), 'sitename' => array('html' => 'text_input', 'event' => 'publish', 'type' => '0', 'position' => '1'), 'siteurl' => array('html' => 'text_input', 'event' => 'publish', 'type' => '0', 'position' => '2'), 'site_slogan' => array('html' => 'text_input', 'event' => 'publish', 'type' => '0', 'position' => '3'), 'language' => array('html' => 'languages', 'event' => 'publish', 'type' => '0', 'position' => '4'), 'gmtoffset' => array('html' => 'gmtoffset_select', 'event' => 'publish', 'type' => '0', 'position' => '5'), 'is_dst' => array('html' => 'yesnoradio', 'event' => 'publish', 'type' => '0', 'position' => '6'), 'dateformat' => array('html' => 'dateformats', 'event' => 'publish', 'type' => '0', 'position' => '7'), 'archive_dateformat' => array('html' => 'dateformats', 'event' => 'publish', 'type' => '0', 'position' => '8'), 'permlink_mode' => array('html' => 'permlinkmodes', 'event' => 'publish', 'type' => '0', 'position' => '9'), 'send_lastmod' => array('html' => 'yesnoradio', 'event' => 'admin', 'type' => '1', 'position' => '0'), 'ping_weblogsdotcom' => array('html' => 'yesnoradio', 'event' => 'publish', 'type' => '1', 'position' => '0'), 'use_comments' => array('html' => 'yesnoradio', 'event' => 'publish', 'type' => '0', 'position' => '12'), 'logging' => array('html' => 'logging', 'event' => 'publish', 'type' => '0', 'position' => '10'), 'use_textile' => array('html' => 'pref_text', 'event' => 'publish', 'type' => '0', 'position' => '11'), 'tempdir' => array('html' => 'text_input', 'event' => 'admin', 'type' => '1', 'position' => '0'), 'file_base_path' => array('html' => 'text_input', 'event' => 'admin', 'type' => '1', 'position' => '0'), 'file_max_upload_size' => array('html' => 'text_input', 'event' => 'admin', 'type' => '1', 'position' => '0'), 'comments_moderate' => array('html' => 'yesnoradio', 'event' => 'comments', 'type' => '0', 'position' => '13'), 'comments_on_default' => array('html' => 'yesnoradio', 'event' => 'comments', 'type' => '0', 'position' => '14'), 'comments_are_ol' => array('html' => 'yesnoradio', 'event' => 'comments', 'type' => '0', 'position' => '15'), 'comments_sendmail' => array('html' => 'yesnoradio', 'event' => 'comments', 'type' => '0', 'position' => '16'), 'comments_disallow_images' => array('html' => 'yesnoradio', 'event' => 'comments', 'type' => '0', 'position' => '17'), 'comments_default_invite' => array('html' => 'text_input', 'event' => 'comments', 'type' => '0', 'position' => '18'), 'comments_dateformat' => array('html' => 'dateformats', 'event' => 'comments', 'type' => '0', 'position' => '19'), 'comments_mode' => array('html' => 'commentmode', 'event' => 'comments', 'type' => '0', 'position' => '20'), 'comments_disabled_after' => array('html' => 'weeks', 'event' => 'comments', 'type' => '0', 'position' => '21'), 'img_dir' => array('html' => 'text_input', 'event' => 'admin', 'type' => '1', 'position' => '0'), 'rss_how_many' => array('html' => 'text_input', 'event' => 'admin', 'type' => '1', 'position' => '0'));
开发者ID:psic,项目名称:websites,代码行数:31,代码来源:_to_1.0.0.php


示例8: exit

 * 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_alter('txp_lang', 'DELAY_KEY_WRITE = 0');
if (!safe_field("name", 'txp_prefs', "name = 'lastmod_keepalive'")) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'lastmod_keepalive', val = '0', type = '1', html = 'yesnoradio'");
}
// New status field for file downloads.
$txpfile = getThings("DESCRIBE `" . PFX . "txp_file`");
if (!in_array('status', $txpfile)) {
    safe_alter('txp_file', "ADD status SMALLINT NOT NULL DEFAULT '4'");
}
$update_files = 0;
if (!in_array('modified', $txpfile)) {
    safe_alter('txp_file', "ADD modified DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
    $update_files = 1;
}
if (!in_array('created', $txpfile)) {
    safe_alter('txp_file', "ADD created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
    $update_files = 1;
}
if (!in_array('size', $txpfile)) {
    safe_alter('txp_file', "ADD size BIGINT");
    $update_files = 1;
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:31,代码来源:_to_4.0.5.php


示例9: bot_admin_tooltips_check_install

function bot_admin_tooltips_check_install()
{
    // Check if the bot_admin_tooltips table already exists
    if (getThings("Show tables like '" . PFX . "bot_admin_tooltips'")) {
        return true;
    }
    return false;
}
开发者ID:redbotxx,项目名称:bot_admin_tooltips,代码行数:8,代码来源:bot_admin_tooltips_v0.4.php


示例10: exit

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'");
}
开发者ID:scar45,项目名称:textpattern,代码行数:31,代码来源:_to_4.0.7.php


示例11: can_install

 function can_install()
 {
     global $txpcfg;
     $host = $txpcfg['host'];
     $user = $txpcfg['user'];
     $version = mysql_get_server_info();
     $matched = false;
     $debug = gps('debugwiz');
     $debug = !empty($debug);
     #
     #	Make sure we escape the MySQL special name characters...
     #
     $db_lean = $txpcfg['db'];
     $db = strtr($db_lean, array('_' => '\\_', '%' => '\\%'));
     if ($debug) {
         echo br, "Testing for privs to DB:`{$db}` on Server:{$host}, v:{$version}. Connected using user: {$user}.";
     }
     #
     #	Test the privilages of the user used to connect to the TxP DB...
     #
     if ($user === 'root') {
         if ($debug) {
             echo br, 'Using root - skipping privileges checking.';
         }
         return true;
     }
     #
     #	This should work for all versions of MySQL...
     #
     $sql = "SHOW GRANTS FOR '{$user}'@'{$host}';";
     if ($debug) {
         $rows = getThings($sql, 1);
     } else {
         $rows = @getThings($sql);
     }
     #
     #	But, if it failed then retry using a different command (if possible)...
     #
     if (empty($rows)) {
         if ($debug) {
             echo br, "Initial SHOW GRANTS query failed";
         }
         if (version_compare($version, '4.1.2', '>=')) {
             $sql = "SHOW GRANTS;";
             if ($debug) {
                 echo ', re-trying.';
                 $rows = getThings($sql, 1);
             } else {
                 $rows = @getThings($sql);
             }
         }
     }
     if (!empty($rows)) {
         $rows = $this->strip_pws($rows);
         if ($debug) {
             echo dmp($rows);
         }
         $global_row = '';
         foreach ($rows as $row) {
             if (false !== strpos($row, 'GRANT USAGE')) {
                 continue;
             }
             if (false !== strpos($row, 'ON *.*')) {
                 $global_row = $row;
                 if ($debug) {
                     echo br, "Storing global row for processing later.";
                 }
             } elseif (false !== strpos($row, "ON `{$db}`") or false !== strpos($row, "ON `{$db_lean}`")) {
                 $matched = $this->check_row($row);
                 if ($matched === true) {
                     break;
                 }
             } elseif (false !== strpos($row, '%')) {
                 #
                 #	Check for wildcard DB cases in the grants list.
                 #
                 $matches = array();
                 $pattern = "/ ON `(.*)`/";
                 #
                 #	Extract the DB name...
                 #
                 if ($debug) {
                     echo br, "Extracting DB name pattern [{$pattern}] from {$row}.";
                 }
                 $count = preg_match($pattern, $row, $matches);
                 if ($count !== 1) {
                     if ($debug) {
                         echo br, "Could not match DB name pattern.";
                     }
                     continue;
                 }
                 $name = $matches[1];
                 if ($debug) {
                     echo br, "Matched db name: [{$name}] - ";
                 }
                 #
                 #	Get start of the name...
                 #
                 $s = strpos($name, '%');
                 $name = substr($name, 0, $s);
//.........这里部分代码省略.........
开发者ID:netcarver,项目名称:mlp_pack,代码行数:101,代码来源:l10n_admin_classes.php


示例12: exit

 * 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.");
}
// Raw CSS is now the only option.
safe_delete('txp_prefs', "event = 'css' AND name = 'edit_raw_css_by_default'");
$rs = getRows("SELECT name, css FROM `" . PFX . "txp_css`");
foreach ($rs as $row) {
    if (preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $row['css'])) {
        // Data is still base64 encoded.
        safe_update('txp_css', "css = '" . doSlash(base64_decode($row['css'])) . "'", "name = '" . doSlash($row['name']) . "'");
    }
}
// Add column for file title.
$cols = getThings("DESCRIBE `" . PFX . "txp_file`");
if (!in_array('title', $cols)) {
    safe_alter('txp_file', "ADD title VARCHAR(255) NULL AFTER filename");
}
开发者ID:scar45,项目名称:textpattern,代码行数:31,代码来源:_to_4.3.0.php


示例13: safe_update

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'");
// Updates comment email length.
safe_alter('txp_discuss', "MODIFY email VARCHAR(254) NOT NULL default ''");
// Store IPv6 properly in logs.
safe_alter('txp_log', "MODIFY ip VARCHAR(45) NOT NULL default ''");
// 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, ADD INDEX 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_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");
safe_alter('txp_page', "MODIFY name VARCHAR(255) NOT NULL");
开发者ID:bgarrels,项目名称:textpattern,代码行数:31,代码来源:_to_4.6.0.php


示例14: doDiagnostics


//.........这里部分代码省略.........
            $gd_support[] = 'GIF';
        }
        // Aside: In PHP 5.3, they chose to add a previously unemployed capital "E" to the array key.
        if (!empty($gd_info['JPEG Support']) || !empty($gd_info['JPG Support'])) {
            $gd_support[] = 'JPG';
        }
        if ($gd_info['PNG Support']) {
            $gd_support[] = 'PNG';
        }
        if ($gd_support) {
            $gd_support = join(', ', $gd_support);
        } else {
            $gd_support = gTxt('none');
        }
        $gd = gTxt('gd_info', array('{version}' => $gd_info['GD Version'], '{supported}' => $gd_support));
    } else {
        $gd = gTxt('gd_unavailable');
    }
    if (realpath($prefs['tempdir']) === realpath($prefs['plugin_cache_dir'])) {
        $fail['tmp_plugin_paths_match'] = diag_msg_wrap(gTxt('tmp_plugin_paths_match'));
    }
    // Database server time.
    extract(doSpecial(getRow('select @@global.time_zone as db_global_timezone, @@session.time_zone as db_session_timezone, now() as db_server_time, unix_timestamp(now()) as db_server_timestamp')));
    $db_server_timeoffset = $db_server_timestamp - $now;
    echo pagetop(gTxt('tab_diagnostics'), '');
    echo hed(gTxt('tab_diagnostics'), 1, array('class' => 'txp-heading'));
    echo n . '<div id="' . $event . '_container" class="txp-container">' . n . '<div id="pre_flight_check">' . hed(gTxt('preflight_check'), 2);
    if ($fail) {
        foreach ($fail as $help => $message) {
            echo graf(nl2br($message) . popHelp($help));
        }
    } else {
        echo graf(diag_msg_wrap(gTxt('all_checks_passed'), 'success'));
    }
    echo '</div>';
    echo '<div id="diagnostics">', hed(gTxt('diagnostic_info'), 2);
    $fmt_date = '%Y-%m-%d %H:%M:%S';
    $out = array('<p><textarea class="code" id="diagnostics-detail" cols="' . INPUT_LARGE . '" rows="' . TEXTAREA_HEIGHT_LARGE . '" dir="ltr" readonly>', gTxt('txp_version') . cs . txp_version . ' (' . check_file_integrity(INTEGRITY_DIGEST) . ')' . n, gTxt('last_update') . cs . gmstrftime($fmt_date, $dbupdatetime) . '/' . gmstrftime($fmt_date, @filemtime(txpath . '/update/_update.php')) . n, gTxt('document_root') . cs . @$_SERVER['DOCUMENT_ROOT'] . ($real_doc_root != @$_SERVER['DOCUMENT_ROOT'] ? ' (' . $real_doc_root . ')' : '') . n, '$path_to_site' . cs . $path_to_site . n, gTxt('txp_path') . cs . txpath . n, gTxt('permlink_mode') . cs . $permlink_mode . n, ini_get('open_basedir') ? 'open_basedir: ' . ini_get('open_basedir') . n : '', ini_get('upload_tmp_dir') ? 'upload_tmp_dir: ' . ini_get('upload_tmp_dir') . n : '', gTxt('tempdir') . cs . $tempdir . n, gTxt('web_domain') . cs . $siteurl . n, gTxt('php_version') . cs . phpversion() . n, $is_register_globals ? gTxt('register_globals') . cs . $is_register_globals . n : '', gTxt('gd_library') . cs . $gd . n, gTxt('server') . ' TZ: ' . Txp::get('Textpattern_Date_Timezone')->getTimeZone() . n, gTxt('server_time') . cs . strftime('%Y-%m-%d %H:%M:%S') . n, strip_tags(gTxt('is_dst')) . cs . $is_dst . n, strip_tags(gTxt('auto_dst')) . cs . $auto_dst . n, strip_tags(gTxt('gmtoffset')) . cs . $timezone_key . sp . "({$gmtoffset})" . n, 'MySQL' . cs . mysql_get_server_info() . n, gTxt('db_server_time') . cs . $db_server_time . n, gTxt('db_server_timeoffset') . cs . $db_server_timeoffset . ' s' . n, gTxt('db_global_timezone') . cs . $db_global_timezone . n, gTxt('db_session_timezone') . cs . $db_session_timezone . n, gTxt('locale') . cs . $locale . n, isset($_SERVER['SERVER_SOFTWARE']) ? gTxt('server') . cs . $_SERVER['SERVER_SOFTWARE'] . n : '', is_callable('apache_get_version') ? gTxt('apache_version') . cs . @apache_get_version() . n : '', gTxt('php_sapi_mode') . cs . PHP_SAPI . n, gTxt('rfc2616_headers') . cs . ini_get('cgi.rfc2616_headers') . n, gTxt('os_version') . cs . php_uname('s') . ' ' . php_uname('r') . n, $active_plugins ? gTxt('active_plugins') . cs . join(', ', $active_plugins) . n : '', gTxt('theme_name') . cs . $theme_name . sp . $theme_manifest['version'] . n, $fail ? n . gTxt('preflight_check') . cs . n . ln . join("\n", doStripTags($fail)) . n . ln : '', is_readable($path_to_site . '/.htaccess') ? n . gTxt('htaccess_contents') . cs . n . ln . txpspecialchars(join('', file($path_to_site . '/.htaccess'))) . n . ln : '');
    if ($step == 'high') {
        $out[] = n . 'Charset (default/config)' . cs . $DB->default_charset . '/' . $DB->charset . n;
        $result = safe_query("SHOW variables like 'character_se%'");
        while ($row = mysql_fetch_row($result)) {
            $out[] = $row[0] . cs . $row[1] . n;
            if ($row[0] == 'character_set_connection') {
                $conn_char = $row[1];
            }
        }
        $table_names = array(PFX . 'textpattern');
        $result = safe_query("SHOW TABLES LIKE '" . PFX . "txp\\_%'");
        while ($row = mysql_fetch_row($result)) {
            $table_names[] = $row[0];
        }
        $table_msg = array();
        foreach ($table_names as $table) {
            $ctr = safe_query("SHOW CREATE TABLE " . $table . "");
            if (!$ctr) {
                unset($table_names[$table]);
                continue;
            }
            $ctcharset = preg_replace('#^CREATE TABLE.*SET=([^ ]+)[^)]*$#is', '\\1', mysql_result($ctr, 0, 'Create Table'));
            if (isset($conn_char) && !stristr($ctcharset, 'CREATE') && $conn_char != $ctcharset) {
                $table_msg[] = "{$table} is {$ctcharset}";
            }
            $ctr = safe_query("CHECK TABLE " . $table);
            if (in_array(mysql_result($ctr, 0, 'Msg_type'), array('error', 'warning'))) {
                $table_msg[] = $table . cs . mysql_result($ctr, 0, 'Msg_Text');
            }
        }
        if ($table_msg == array()) {
            $table_msg = count($table_names) < 17 ? array('-') : array('OK');
        }
        $out[] = count($table_names) . ' Tables' . cs . implode(', ', $table_msg) . n;
        $cf = preg_grep('/^custom_\\d+/', getThings('describe `' . PFX . 'textpattern`'));
        $out[] = n . get_pref('max_custom_fields', 10) . sp . gTxt('custom') . cs . implode(', ', $cf) . sp . '(' . count($cf) . ')' . n;
        $extns = get_loaded_extensions();
        $extv = array();
        foreach ($extns as $e) {
            $extv[] = $e . (phpversion($e) ? '/' . phpversion($e) : '');
        }
        $out[] = n . gTxt('php_extensions') . cs . join(', ', $extv) . n;
        if (is_callable('apache_get_modules')) {
            $out[] = n . gTxt('apache_modules') . cs . join(', ', apache_get_modules()) . n;
        }
        if (@is_array($pretext_data) and count($pretext_data) > 1) {
            $out[] = n . gTxt('pretext_data') . cs . txpspecialchars(join('', array_slice($pretext_data, 1, 20))) . n;
        }
        $out[] = n;
        if ($md5s = check_file_integrity(INTEGRITY_MD5)) {
            foreach ($md5s as $f => $checksum) {
                $out[] = $f . cs . n . t . (!$checksum ? gTxt('unknown') : $checksum) . n;
            }
        }
        $out[] = n . ln;
    }
    $out[] = callback_event('diag_results', $step) . n;
    $out[] = '</textarea></p>';
    $dets = array('low' => gTxt('low'), 'high' => gTxt('high'));
    $out[] = form(graf(eInput('diag') . n . '<label>' . gTxt('detail') . '</label>' . selectInput('step', $dets, $step, 0, 1)));
    echo join('', $out), '</div>', '</div>';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:txp_diag.php


示例15: exit

 * 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");
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:31,代码来源:_to_4.5.0.php


示例16: safe_alter

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getThumbImage函数代码示例发布时间:2022-05-15
下一篇:
PHP getThing函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap