当前位置: 首页>>代码示例>>PHP>>正文


PHP safe_pfx函数代码示例

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


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

示例1: jmd_count

/**
 * Counts the number of rows in a table.
 *
 * @param array $atts
 * @param string $atts['table'] MySQL table name.
 * @param string $atts['where'] MySQL WHERE clause.
 */
function jmd_count($atts)
{
    extract(lAtts(array('table' => '', 'where' => ''), $atts));
    if ($where != '') {
        $where = ' where ' . $where;
    }
    return getThing("select count(*) from " . safe_pfx($table) . " {$where}");
}
开发者ID:jmdeldin,项目名称:jmd_count,代码行数:15,代码来源:count.php

示例2: jmd_admin_js

function jmd_admin_js()
{
    global $event;
    if ($rs = getRows('select name, js from ' . safe_pfx('txp_js'))) {
        foreach ($rs as $row) {
            if ($row['name'] === 'default' || $row['name'] === $event) {
                $out[] = base64_decode($row['js']);
            }
        }
        echo tag(join("\n", $out), 'script', ' type="text/javascript"');
    }
}
开发者ID:jmdeldin,项目名称:jmd_admin_js,代码行数:12,代码来源:admin_js.php

示例3: cnk_ver_do_deinstall

function cnk_ver_do_deinstall()
{
    $sql = "ALTER TABLE " . safe_pfx('txp_form') . " DROP `file_mod_time`;ALTER TABLE " . safe_pfx('txp_page') . " DROP `file_mod_time`;ALTER TABLE " . safe_pfx('txp_css') . " DROP `file_mod_time`;";
    if (!cnk_ver_batch_query($sql)) {
        return false;
    } else {
        return true;
    }
}
开发者ID:netcarver,项目名称:cnk_versioning,代码行数:9,代码来源:cnk_versioning.php

示例4: getEntry

 private function getEntry()
 {
     $row = getRow("SELECT last_mod, contents FROM " . safe_pfx('jmd_wiki_events') . " WHERE title = '{$this->day}'");
     if ($row) {
         $diff = str_replace('-', '', $this->currentDate) - str_replace('-', '', $row['last_mod']);
         // if the content is at least two months old, update
         if ($diff > 200) {
             return $this->setEntry($update = 1);
         } else {
             return $row['contents'];
         }
     }
 }
开发者ID:jmdeldin,项目名称:jmd_wiki_events,代码行数:13,代码来源:jmd_wiki_events.php

示例5: sec_section_list

function sec_section_list($message = '')
{
    global $event, $section_list_pageby;
    pagetop(gTxt('tab_sections'), $message);
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    if ($sort === '') {
        $sort = get_pref('section_sort_column', 'time');
    }
    if ($dir === '') {
        $dir = get_pref('section_sort_dir', 'desc');
    }
    $dir = $dir == 'asc' ? 'asc' : 'desc';
    switch ($sort) {
        case 'title':
            $sort_sql = 'title ' . $dir;
            break;
        case 'page':
            $sort_sql = 'page ' . $dir;
            break;
        case 'css':
            $sort_sql = 'css ' . $dir;
            break;
        case 'in_rss':
            $sort_sql = 'in_rss ' . $dir;
            break;
        case 'on_frontpage':
            $sort_sql = 'on_frontpage ' . $dir;
            break;
        case 'searchable':
            $sort_sql = 'searchable ' . $dir;
            break;
        case 'article_count':
            $sort_sql = 'article_count ' . $dir;
            break;
        default:
            $sort_sql = 'name ' . $dir;
            break;
    }
    set_pref('section_sort_column', $sort, 'section', 2, '', 0, PREF_PRIVATE);
    set_pref('section_sort_dir', $dir, 'section', 2, '', 0, PREF_PRIVATE);
    $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
    $criteria = 1;
    if ($search_method and $crit != '') {
        $verbatim = preg_match('/^"(.*)"$/', $crit, $m);
        $crit_escaped = doSlash($verbatim ? $m[1] : str_replace(array('\\', '%', '_', '\''), array('\\\\', '\\%', '\\_', '\\\''), $crit));
        $critsql = $verbatim ? array('name' => "name = '{$crit_escaped}'", 'title' => "title = '{$crit_escaped}'", 'page' => "page = '{$crit_escaped}'", 'css' => "css = '{$crit_escaped}'", 'in_rss' => "in_rss = '{$crit_escaped}'", 'on_frontpage' => "on_frontpage = '{$crit_escaped}'", 'searchable' => "searchable = '{$crit_escaped}'") : array('name' => "name like '%{$crit_escaped}%'", 'title' => "title like '%{$crit_escaped}%'", 'page' => "page like '%{$crit_escaped}%'", 'css' => "css like '%{$crit_escaped}%'", 'in_rss' => "in_rss = '{$crit_escaped}'", 'on_frontpage' => "on_frontpage = '{$crit_escaped}'", 'searchable' => "searchable = '{$crit_escaped}'");
        if (array_key_exists($search_method, $critsql)) {
            $criteria = $critsql[$search_method];
            $limit = 500;
        } else {
            $search_method = '';
            $crit = '';
        }
    } else {
        $search_method = '';
        $crit = '';
    }
    $criteria .= callback_event('admin_criteria', 'section_list', 0, $criteria);
    $total = safe_count('txp_section', "{$criteria}");
    echo '<h1 class="txp-heading">' . gTxt('tab_sections') . sp . popHelp('section_category') . '</h1>';
    echo '<div id="' . $event . '_control" class="txp-control-panel">';
    echo graf(sLink('section', 'section_edit', gTxt('create_section')), ' class="txp-buttons"');
    echo n . '<form id="default_section_form" name="default_section_form" method="post" action="index.php" class="async">';
    echo graf('<label>' . gTxt('default_write_section') . '</label>' . sp . popHelp('section_default') . n . section_select_list()) . eInput('section') . sInput('section_set_default');
    echo '</form>';
    if ($total < 1) {
        if ($criteria != 1) {
            echo n . section_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
        }
        return;
    }
    $limit = max($section_list_pageby, 15);
    list($page, $offset, $numPages) = pager($total, $limit, $page);
    echo n . section_search_form($crit, $search_method) . '</div>';
    $rs = safe_rows_start('*, (SELECT count(*) FROM ' . safe_pfx('textpattern') . ' articles WHERE articles.Section = txp_section.name) AS article_count', 'txp_section', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
    if ($rs) {
        echo n . '<div id="' . $event . '_container" class="txp-container">';
        echo n . n . '<form action="index.php" id="section_form" class="multi_edit_form" method="post" name="longform">' . n . '<div class="txp-listtables">' . n . n . startTable('', '', 'txp-list') . n . '<thead>' . n . tr(n . hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' title="' . gTxt('toggle_all_selected') . '" class="multi-edit"') . n . column_head('name', 'name', 'section', true, $switch_dir, $crit, $search_method, ('name' == $sort ? "{$dir} " : '') . 'name') . n . column_head('title', 'title', 'section', true, $switch_dir, $crit, $search_method, ('title' == $sort ? "{$dir} " : '') . 'title') . n . column_head('page', 'page', 'section', true, $switch_dir, $crit, $search_method, ('page' == $sort ? "{$dir} " : '') . 'page') . n . column_head('css', 'css', 'section', true, $switch_dir, $crit, $search_method, ('css' == $sort ? "{$dir} " : '') . 'style') . n . column_head('on_front_page', 'on_frontpage', 'section', true, $switch_dir, $crit, $search_method, ('on_frontpage' == $sort ? "{$dir} " : '') . 'section_detail frontpage') . n . column_head('syndicate', 'in_rss', 'section', true, $switch_dir, $crit, $search_method, ('in_rss' == $sort ? "{$dir} " : '') . 'section_detail syndicate') . n . column_head('include_in_search', 'searchable', 'section', true, $switch_dir, $crit, $search_method, ('searchable' == $sort ? "{$dir} " : '') . 'section_detail searchable') . n . column_head('articles', 'article_count', 'section', true, $switch_dir, $crit, $search_method, ('article_count' == $sort ? "{$dir} " : '') . 'section_detail article_count')) . n . '</thead>';
        echo '<tbody>';
        while ($a = nextRow($rs)) {
            extract($a, EXTR_PREFIX_ALL, 'sec');
            $is_default_section = $sec_name == 'default';
            $edit_url = '?event=section' . a . 'step=section_edit' . a . 'name=' . $sec_name . a . 'sort=' . $sort . a . 'dir=' . $dir . a . 'page=' . $page . a . 'search_method=' . $search_method . a . 'crit=' . $crit;
            $page_url = '?event=page' . a . 'name=' . $sec_page;
            $style_url = '?event=css' . a . 'name=' . $sec_css;
            $articles = $sec_article_count > 0 ? href($sec_article_count, '?event=list' . a . 'search_method=section' . a . 'crit=&quot;' . txpspecialchars($sec_name) . '&quot;', ' title="' . gTxt('article_count', array('{num}' => $sec_article_count)) . '"') : ($is_default_section ? '' : '0');
            //				$can_delete = ($sec_name != 'default' && $sec_article_count == 0);
            $parms = array('step' => 'section_toggle_option', 'thing' => $sec_name);
            echo tr(td(fInput('checkbox', 'selected[]', $sec_name), '', 'multi-edit') . td('<a href="' . $edit_url . '" title="' . gTxt('edit') . '">' . $sec_name . '</a>' . n . '<span class="section_detail">[<a href="' . hu . $sec_name . '">' . gTxt('view') . '</a>]</span>', '', 'name') . td(txpspecialchars($sec_title), '', 'title') . td('<a href="' . $page_url . '" title="' . gTxt('edit') . '">' . $sec_page . '</a>', '', 'page') . td('<a href="' . $style_url . '" title="' . gTxt('edit') . '">' . $sec_css . '</a>', '', 'style') . td($is_default_section ? '-' : asyncHref($sec_on_frontpage ? gTxt('yes') : gTxt('no'), $parms + array('property' => 'on_frontpage')), '', 'section_detail frontpage') . td($is_default_section ? '-' : asyncHref($sec_in_rss ? gTxt('yes') : gTxt('no'), $parms + array('property' => 'in_rss')), '', 'section_detail syndicate') . td($is_default_section ? '-' : asyncHref($sec_searchable ? gTxt('yes') : gTxt('no'), $parms + array('property' => 'searchable')), '', 'section_detail searchable') . td($is_default_section ? '' : $articles, '', 'section_detail article_count'), ' id="txp_section_' . $sec_name . '"');
        }
        echo '</tbody>', n, endTable(), n, '</div>', n, section_multiedit_form($page, $sort, $dir, $crit, $search_method), n, tInput(), n, '</form>', n, graf(toggle_box('section_detail'), ' class="detail-toggle"'), n, '<div id="' . $event . '_navigation" class="txp-navigation">', n, nav_form('section', $page, $numPages, $sort, $dir, $crit, $search_method, $total, $limit), n, pageby_form('section', $section_list_pageby), n, '</div>', n, '</div>';
        echo script_js(<<<EOS
\t\t\t\$('#default_section').change(function() {
\t\t\t\t\$('#default_section_form').submit();
\t\t\t});
EOS
);
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:99,代码来源:txp_section.php

示例6: prefs_list

/**
 * Renders the list of preferences.
 *
 * Plugins may add their own prefs, for example by using plugin lifecycle events or
 * raising a (pre) callback on event=admin / step=prefs_list so they are installed
 * or updated when accessing the Preferences panel. Access to the prefs can be
 * controlled by using add_privs() on 'prefs.your-prefs-event-name'.
 *
 * @param  string $message The feedback / error string to display
 */
function prefs_list($message = '')
{
    global $prefs, $txp_user;
    extract($prefs);
    pagetop(gTxt('tab_preferences'), $message);
    $locale = setlocale(LC_ALL, $locale);
    echo hed(gTxt('tab_preferences'), 1, array('class' => 'txp-heading'));
    echo n . '<div id="prefs_container" class="txp-container">' . n . '<form method="post" class="prefs-form" action="index.php">' . n . '<div class="txp-layout-textbox">';
    // TODO: remove 'custom' when custom fields are refactored.
    $core_events = array('site', 'admin', 'publish', 'feeds', 'comments', 'custom');
    $joined_core = join(',', quote_list($core_events));
    $sql = array();
    $sql[] = 'prefs_id = 1 and event != "" and type in(' . PREF_CORE . ', ' . PREF_PLUGIN . ')';
    $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'";
    }
    $rs = safe_rows_start("*, FIELD(event,{$joined_core}) as sort_value", 'txp_prefs', join(' and ', $sql) . " ORDER BY sort_value = 0, sort_value, event, position");
    $last_event = null;
    $out = array();
    if (numRows($rs)) {
        while ($a = nextRow($rs)) {
            if (!has_privs('prefs.' . $a['event'])) {
                continue;
            }
            if ($a['event'] !== $last_event) {
                if ($last_event !== null) {
                    echo wrapRegion('prefs_group_' . $last_event, join(n, $out), 'prefs_' . $last_event, $last_event, 'prefs_' . $last_event);
                }
                $last_event = $a['event'];
                $out = array();
            }
            $label = '';
            if (!in_array($a['html'], array('yesnoradio', 'is_dst'))) {
                $label = $a['name'];
            }
            // TODO: remove exception when custom fields move to meta store.
            $help = '';
            if (strpos($a['name'], 'custom_') === false) {
                $help = $a['name'];
            }
            if ($a['html'] == 'text_input') {
                $size = INPUT_REGULAR;
            } else {
                $size = '';
            }
            $out[] = inputLabel($a['name'], pref_func($a['html'], $a['name'], $a['val'], $size), $label, $help, array('id' => 'prefs-' . $a['name']));
        }
    }
    if ($last_event === null) {
        echo graf(gTxt('no_preferences'));
    } else {
        echo wrapRegion('prefs_group_' . $last_event, join(n, $out), 'prefs_' . $last_event, $last_event, 'prefs_' . $last_event);
    }
    echo n . '</div>' . sInput('prefs_save') . eInput('prefs') . hInput('prefs_id', '1') . tInput();
    if ($last_event !== null) {
        echo graf(fInput('submit', 'Submit', gTxt('save'), 'publish'));
    }
    echo n . '</form>' . n . '</div>';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:70,代码来源:txp_prefs.php

示例7: prefs_list

/**
 * Renders the list of preferences.
 *
 * Plugins may add their own prefs, for example by using plugin lifecycle events
 * or raising a (pre) callback on event=admin / step=prefs_list so they are
 * installed or updated when accessing the Preferences panel. Access to the
 * prefs can be controlled by using add_privs() on 'prefs.your-prefs-event-name'.
 *
 * @param string $message The feedback / error string to display
 */
function prefs_list($message = '')
{
    global $prefs, $txp_user;
    extract($prefs);
    pagetop(gTxt('tab_preferences'), $message);
    $locale = setlocale(LC_ALL, $locale);
    echo n . '<form class="prefs-form" id="prefs_form" method="post" action="index.php">';
    // TODO: remove 'custom' when custom fields are refactored.
    $core_events = array('site', 'admin', 'publish', 'feeds', 'comments', 'custom');
    $joined_core = join(',', quote_list($core_events));
    $sql = array();
    $sql[] = 'prefs_id = 1 and event != "" and type in(' . PREF_CORE . ', ' . PREF_PLUGIN . ')';
    $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'";
    }
    $rs = safe_rows_start("*, FIELD(event, {$joined_core}) AS sort_value", 'txp_prefs', join(" AND ", $sql) . " ORDER BY sort_value = 0, sort_value, event, position");
    $last_event = null;
    $out = array();
    $build = array();
    $groupOut = array();
    if (numRows($rs)) {
        while ($a = nextRow($rs)) {
            if (!has_privs('prefs.' . $a['event'])) {
                continue;
            }
            if ($a['event'] !== $last_event) {
                if ($last_event !== null) {
                    $build[] = tag(hed(gTxt($last_event), 2, array('id' => 'prefs_group_' . $last_event . '-label')) . join(n, $out), 'section', array('class' => 'txp-prefs-group', 'id' => 'prefs_group_' . $last_event, 'aria-labelledby' => 'prefs_group_' . $last_event . '-label'));
                    $groupOut[] = n . tag(href(gTxt($last_event), '#prefs_group_' . $last_event, array('data-txp-pane' => $last_event, 'data-txp-token' => form_token())), 'li');
                }
                $last_event = $a['event'];
                $out = array();
            }
            $label = '';
            if (!in_array($a['html'], array('yesnoradio', 'is_dst'))) {
                $label = $a['name'];
            }
            // TODO: remove exception when custom fields move to meta store.
            $help = '';
            if (strpos($a['name'], 'custom_') === false) {
                $help = $a['name'];
            }
            if ($a['html'] == 'text_input') {
                $size = INPUT_REGULAR;
            } else {
                $size = '';
            }
            $out[] = inputLabel($a['name'], pref_func($a['html'], $a['name'], $a['val'], $size), $label, $help, array('class' => 'txp-form-field', 'id' => 'prefs-' . $a['name']));
        }
    }
    if ($last_event === null) {
        echo graf(gTxt('no_preferences'));
    } else {
        $build[] = tag(hed(gTxt($last_event), 2, array('id' => 'prefs_group_' . $last_event . '-label')) . join(n, $out), 'section', array('class' => 'txp-prefs-group', 'id' => 'prefs_group_' . $last_event, 'aria-labelledby' => 'prefs_group_' . $last_event . '-label'));
        $groupOut[] = n . tag(href(gTxt($last_event), '#prefs_group_' . $last_event, array('data-txp-pane' => $last_event, 'data-txp-token' => form_token())), 'li') . n;
        echo hed(gTxt('tab_preferences'), 1, array('class' => 'txp-heading')) . n . '<div class="txp-layout-4col-cell-1alt">' . wrapGroup('all_preferences', n . tag(join($groupOut), 'ul', array('class' => 'switcher-list')), 'all_preferences');
        if ($last_event !== null) {
            echo graf(fInput('submit', 'Submit', gTxt('save'), 'publish'), array('class' => 'txp-save'));
        }
        echo n . '</div>' . n . '<div class="txp-layout-4col-cell-2-3-4">' . join(n, $build) . n . '</div>' . sInput('prefs_save') . eInput('prefs') . hInput('prefs_id', '1') . tInput();
    }
    echo n . '</form>';
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:74,代码来源:txp_prefs.php

示例8: section_delete

/**
 * Processes delete actions sent using the multi-edit form.
 */
function section_delete()
{
    $selectedList = ps('selected');
    $selected = join(',', quote_list($selectedList));
    $message = '';
    $sections = safe_column('name', 'txp_section', "name != 'default' and name in ({$selected}) and name not in (select Section from " . safe_pfx('textpattern') . ")");
    $sectionsNotDeleted = array_diff($selectedList, $sections);
    if ($sections && safe_delete('txp_section', 'name in (' . join(',', quote_list($sections)) . ')')) {
        callback_event('sections_deleted', '', 0, $sections);
        $message = gTxt('section_deleted', array('{name}' => join(', ', $sections)));
    }
    if ($sectionsNotDeleted) {
        $severity = $message ? E_WARNING : E_ERROR;
        $message = array(($message ? $message . n : '') . gTxt('section_delete_failure', array('{name}' => join(', ', $sectionsNotDeleted))), $severity);
    }
    sec_section_list($message);
}
开发者ID:hcgtv,项目名称:textpattern,代码行数:20,代码来源:txp_section.php

示例9: getNeighbour

function getNeighbour($Posted, $s, $type)
{
    global $prefs;
    extract($prefs);
    $expired = $publish_expired_articles ? '' : ' and (now() <= Expires or Expires = ' . NULLDATETIME . ')';
    $type = $type == '>' ? '>' : '<';
    $safe_name = safe_pfx('textpattern');
    $q = array("select ID, Title, url_title, unix_timestamp(Posted) as uposted\n\t\t\tfrom " . $safe_name . " where Posted {$type} '" . doSlash($Posted) . "'", $s != '' && $s != 'default' ? "and Section = '" . doSlash($s) . "'" : filterFrontPage(), 'and Status=4 and Posted < now()' . $expired . ' order by Posted', $type == '<' ? 'desc' : 'asc', 'limit 1');
    $out = getRow(join(' ', $q));
    return is_array($out) ? $out : '';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:11,代码来源:publish.php

示例10: send_reset_confirmation_request

/**
 * Sends a password reset link to a user's email address.
 *
 * This function will return a success message even when the specified user
 * doesn't exist. Though an error message could be thrown when a user isn't
 * found, this is done due to security, which prevents the function from
 * leaking existing account names.
 *
 * @param  string $name The login name
 * @return string A localized message string
 * @see    send_new_password()
 * @see    reset_author_pass()
 * @example
 * echo send_reset_confirmation_request('username');
 */
function send_reset_confirmation_request($name)
{
    global $sitename;
    $expiryTimestamp = time() + 60 * RESET_EXPIRY_MINUTES;
    $expiry = strftime('%Y-%m-%d %H:%M:%S', $expiryTimestamp);
    $rs = safe_query("SELECT\n            txp_users.user_id, txp_users.email,\n            txp_users.nonce, txp_users.pass,\n            txp_token.type\n        FROM " . safe_pfx('txp_users') . " txp_users\n        LEFT JOIN " . safe_pfx('txp_token') . " txp_token\n        ON txp_users.user_id = txp_token.reference_id\n        WHERE txp_users.name = '" . doSlash($name) . "'\n        AND TIMESTAMPDIFF(SECOND, txp_token.expires, '" . $expiry . "') > " . 60 * RESET_RATE_LIMIT_MINUTES . "\n        AND txp_token.type = 'password_reset'");
    $row = nextRow($rs);
    if ($row) {
        extract($row);
        $uid = assert_int($user_id);
        // The selector becomes an indirect reference to the txp_users row,
        // which does not leak information.
        $selector = Txp::get('\\Textpattern\\Password\\Random')->generate(12);
        $expiryYear = safe_strftime('%Y', $expiryTimestamp);
        $expiryMonth = safe_strftime('%B', $expiryTimestamp);
        $expiryDay = safe_strftime('%Oe', $expiryTimestamp);
        $expiryTime = safe_strftime('%H:%M', $expiryTimestamp);
        // Use a hash of the nonce, selector and password.
        // This ensures that confirmation requests expire automatically when:
        //  a) The person next logs in, or
        //  b) They successfully change their password (usually as a result of this reset request)
        // Using the selector in the hash just injects randomness, otherwise two requests
        // back-to-back would generate the same confirmation code.
        // Old requests for the same user id are purged every time a new request is made.
        $token = bin2hex(pack('H*', substr(hash(HASHING_ALGORITHM, $nonce . $selector . $pass), 0, SALT_LENGTH)));
        $confirm = $token . $selector;
        // Remove any previous reset tokens and insert the new one.
        safe_delete("txp_token", "reference_id = {$uid} AND type = 'password_reset'");
        safe_insert("txp_token", "reference_id = {$uid},\n                type = 'password_reset',\n                selector = '" . doSlash($selector) . "',\n                token = '" . doSlash($token) . "',\n                expires = '" . doSlash($expiry) . "'\n            ");
        $message = gTxt('salutation', array('{name}' => $name)) . n . n . gTxt('password_reset_confirmation') . n . hu . 'textpattern/index.php?confirm=' . $confirm . n . n . gTxt('link_expires', array('{year}' => $expiryYear, '{month}' => $expiryMonth, '{day}' => $expiryDay, '{time}' => $expiryTime));
        if (txpMail($email, "[{$sitename}] " . gTxt('password_reset_confirmation_request'), $message)) {
            return gTxt('password_reset_confirmation_request_sent');
        } else {
            return array(gTxt('could_not_mail'), E_ERROR);
        }
    } else {
        // Though 'unknown_author' could be thrown, send generic 'request_sent'
        // message instead so that (non-)existence of account names are not leaked.
        // Since this is a short circuit, there's a possibility of a timing attack
        // revealing the existence of an account, which we could defend against
        // to some degree.
        return gTxt('password_reset_confirmation_request_sent');
    }
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:59,代码来源:txplib_admin.php

示例11: _sed_cp_safe_pfx

function _sed_cp_safe_pfx($table)
{
    if (is_callable('safe_pfx')) {
        $table = safe_pfx($table);
    } else {
        $table = PFX . $table;
    }
    return $table;
}
开发者ID:netcarver,项目名称:sed_comment_pack,代码行数:9,代码来源:sed_comment_pack.php

示例12: rah_textile_bar_install

/**
	Installer
	@param $event string Admin-side event.
	@param $step string Admin-side event, plugin-lifecycle step.
*/
function rah_textile_bar_install($event = '', $step = '')
{
    if ($step == 'deleted') {
        safe_delete('txp_prefs', "name like 'rah_textile_bar_%'");
        return;
    }
    global $prefs, $event, $textarray;
    if ($event == 'prefs') {
        /*
        	Generate language strings if
        	not existing
        */
        $strings = array('rah_txtbar' => 'Textile Bar', 'rah_textile_bar_body' => 'Attach to Body field', 'rah_textile_bar_excerpt' => 'Attach to Excerpt field');
        foreach (rah_textile_bar_buttons() as $att) {
            $strings['rah_textile_bar_' . $att[0]] = 'Show ' . $att[0];
        }
        foreach ($strings as $string => $translation) {
            if (!isset($textarray[$string])) {
                $textarray[$string] = $translation;
            }
        }
    }
    $version = '0.7';
    $current = isset($prefs['rah_textile_bar_version']) ? $prefs['rah_textile_bar_version'] : '';
    if ($current == $version) {
        return;
    }
    $default = array('disable' => '', 'fields' => '');
    if (!$current) {
        /*
        	Run migration and clean-up if older version was
        	installed
        */
        @($rs = safe_rows('name, value', 'rah_textile_bar', '1=1'));
        if (!empty($rs) && is_array($rs)) {
            foreach ($rs as $a) {
                if (isset($default[$a['name']])) {
                    $default[$a['name']] = $a['value'];
                }
            }
            @safe_query('DROP TABLE IF EXISTS ' . safe_pfx('rah_textile_bar'));
        }
    }
    /*
    	Add preference strings
    */
    $disabled = explode(',', $default['disable']);
    $position = 230;
    $values = rah_textile_bar_buttons();
    foreach (array('body', 'excerpt') as $val) {
        $values[] = array($val);
    }
    foreach ($values as $att) {
        $val = $att[0] == 'body' || $att[0] == 'excerpt' ? strpos($default['fields'], $att[0]) !== false || !$default['fields'] ? 1 : 0 : (in_array('#textilebar .' . $att[0], $disabled) ? 0 : 1);
        if ($att[0] == 'body' || $att[0] == 'excerpt') {
            $position = 225;
        }
        $name = 'rah_textile_bar_' . $att[0];
        if (!isset($prefs[$name])) {
            safe_insert('txp_prefs', "prefs_id=1,\n\t\t\t\t\tname='" . doSlash($name) . "',\n\t\t\t\t\tval='" . doSlash($val) . "',\n\t\t\t\t\ttype=1,\n\t\t\t\t\tevent='rah_txtbar',\n\t\t\t\t\thtml='yesnoradio',\n\t\t\t\t\tposition=" . $position);
            $prefs[$name] = $val;
        }
        $position++;
    }
    set_pref('rah_textile_bar_version', $version, 'rah_txtbar', 2, '', 0);
    $prefs['rah_textile_bar_version'] = $version;
}
开发者ID:NicolasGraph,项目名称:oui_markdown_bar,代码行数:72,代码来源:oui_markdown_bar.php

示例13: recent_comments

function recent_comments($atts)
{
    extract(lAtts(array('break' => br, 'class' => __FUNCTION__, 'label' => '', 'labeltag' => '', 'limit' => 10, 'sort' => 'posted desc', 'wraptag' => ''), $atts));
    $sort = preg_replace('/\\bposted\\b/', 'd.posted', $sort);
    $rs = startRows('select d.name, d.discussid, t.ID as thisid, unix_timestamp(t.Posted) as posted, t.Title as title, t.Section as section, t.url_title ' . 'from ' . safe_pfx('txp_discuss') . ' as d inner join ' . safe_pfx('textpattern') . ' as t on d.parentid = t.ID ' . 'where t.Status >= 4 and d.visible = ' . VISIBLE . ' order by ' . doSlash($sort) . ' limit 0,' . intval($limit));
    if ($rs) {
        $out = array();
        while ($c = nextRow($rs)) {
            $out[] = href($c['name'] . ' (' . escape_title($c['title']) . ')', permlinkurl($c) . '#c' . $c['discussid']);
        }
        if ($out) {
            return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
        }
    }
    return '';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:16,代码来源:taghandlers.php

示例14: cat_event_category_list

function cat_event_category_list($event)
{
    $rs = getTree('root', $event);
    $parent = ps('parent_cat');
    $heading = 'tab_' . ($event == 'article' ? 'list' : $event);
    $for = $rs ? ' for="' . $event . '_category_parent"' : '';
    $out = n . n . hed(gTxt($heading) . sp . popHelp($event . '_category'), 2) . form(fInput('text', 'title', '', '', '', '', INPUT_REGULAR) . ($rs ? '<div class="parent"><label' . $for . '>' . gTxt('parent') . '</label>' . treeSelectInput('parent_cat', $rs, $parent, $event . '_category_parent') . '</div>' : '') . n . fInput('submit', '', gTxt('Create')) . n . eInput('category') . n . sInput('cat_' . $event . '_create'), '', '', 'post', 'action-create ' . $event);
    if ($rs) {
        $total_count = array();
        if ($event == 'article') {
            // Count distinct articles for both categories, avoid duplicates
            $rs2 = getRows('select category, count(*) as num from (' . 'select ID, Category1 as category from ' . safe_pfx('textpattern') . ' union ' . 'select ID, Category2 as category from ' . safe_pfx('textpattern') . ') as t where category != "" group by category');
            if ($rs2 !== false) {
                foreach ($rs2 as $a) {
                    $total_count[$a['category']] = $a['num'];
                }
            }
        } else {
            switch ($event) {
                case 'link':
                    $rs2 = safe_rows_start('category, count(*) as num', 'txp_link', "1 group by category");
                    break;
                case 'image':
                    $rs2 = safe_rows_start('category, count(*) as num', 'txp_image', "1 group by category");
                    break;
                case 'file':
                    $rs2 = safe_rows_start('category, count(*) as num', 'txp_file', "1 group by category");
                    break;
            }
            while ($a = nextRow($rs2)) {
                $name = $a['category'];
                $num = $a['num'];
                $total_count[$name] = $num;
            }
        }
        $items = array();
        foreach ($rs as $a) {
            extract($a);
            // format count
            switch ($event) {
                case 'article':
                    $url = 'index.php?event=list' . a . 'search_method=categories' . a . 'crit=' . $name;
                    break;
                case 'link':
                    $url = 'index.php?event=link' . a . 'search_method=category' . a . 'crit=' . $name;
                    break;
                case 'image':
                    $url = 'index.php?event=image' . a . 'search_method=category' . a . 'crit=' . $name;
                    break;
                case 'file':
                    $url = 'index.php?event=file' . a . 'search_method=category' . a . 'crit=' . $name;
                    break;
            }
            $count = isset($total_count[$name]) ? href('(' . $total_count[$name] . ')', $url) : '(0)';
            if (empty($title)) {
                $edit_link = '<em>' . eLink('category', 'cat_' . $event . '_edit', 'id', $id, gTxt('untitled')) . '</em>';
            } else {
                $edit_link = eLink('category', 'cat_' . $event . '_edit', 'id', $id, $title);
            }
            $items[] = graf(checkbox('selected[]', $id, 0) . sp . str_repeat(sp . sp, $level * 2) . $edit_link . sp . $count, ' class="level-' . $level . '"');
        }
        if ($items) {
            $out .= cat_article_multiedit_form($event, $items);
        }
    } else {
        $out .= graf(gTxt('no_categories_exist'));
    }
    return $out;
}
开发者ID:balcides,项目名称:Cathartic_server,代码行数:69,代码来源:txp_category.php

示例15: upsert

 /** Run the query.
  *  Runs an UPDATE query if $where is set, otherwise INSERT
  *  @return bool success or failure
  */
 public function upsert()
 {
     $this->init_query();
     if (count($this->where)) {
         return safe_upsert($this->table, $this->set_clause, $this->clause_string());
     }
     if ($this->set_clause) {
         return safe_insert($this->table, $this->set_clause);
     }
     if ($this->values_clause) {
         return safe_query('insert into ' . safe_pfx($this->table) . $this->values_clause);
     }
 }
开发者ID:jsoo,项目名称:soo_txp_obj,代码行数:17,代码来源:soo_txp_obj.php


注:本文中的safe_pfx函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。