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


PHP doSlash函数代码示例

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


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

示例1: update_txp_lang

function update_txp_lang()
{
    global $txp_lang_updated, $txpcfg;
    if ($re = mysql_connect('textpattern.otherwords.net', 'textpattern_user', 'textpattern')) {
        if (mysql_select_db('textpattern_master', $re)) {
            if ($q = mysql_query("select unix_timestamp(updated) from \n\t\t\t\t\t\ttextpattern_master.update where\n\t\t\t\t\t\t`table`='txp_lang'", $re)) {
                $updated = mysql_num_rows($q) != 0 ? mysql_result($q, 0) : false;
                if ($updated > $txp_lang_updated) {
                    if ($get = mysql_query("select * from \n\t\t\t\t\t\t\t\ttextpattern_master.txp_lang order by var")) {
                        if (mysql_num_rows($get) > 0) {
                            while ($a = mysql_fetch_assoc($get)) {
                                $incoming[] = $a;
                            }
                            mysql_close($re);
                        }
                        if (!empty($incoming)) {
                            dbconnect($txpcfg['db'], $txpcfg['user'], $txpcfg['pass'], $txpcfg['host']);
                            safe_query("truncate txp_lang");
                            foreach ($incoming as $b) {
                                extract(doSlash($b));
                                safe_query("\n\t\t\t\t\t\t\t\t\t\tinsert into txp_lang set \n\t\t\t\t\t\t\t\t\t\tvar='{$var}',english='{$english}'");
                            }
                            safe_query("update txp_prefs set val= \t\n\t\t\t\t\t\t\t\t\t" . time() . "\n\t\t\t\t\t\t\t\t\twhere `name`='txp_lang_updated'", 1);
                            echo mysql_error();
                        }
                    }
                }
            }
        }
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:31,代码来源:txp_update.php

示例2: pagetop

function pagetop($pagetitle, $message = '', $msgclass = '')
{
    global $css_mode, $siteurl, $sitename, $txp_user, $event;
    $area = gps('area');
    $event = !$event ? 'article' : $event;
    $bm = gps('bm');
    $privs = safe_field('privs', 'txp_users', "name = '" . doSlash($txp_user) . "'");
    $GLOBALS['privs'] = $privs;
    $areas = areas();
    $area = false;
    foreach ($areas as $k => $v) {
        if (in_array($event, $v)) {
            $area = $k;
            break;
        }
    }
    if (gps('logout')) {
        $body_id = 'page-logout';
    } elseif (!$txp_user) {
        $body_id = 'page-login';
    } else {
        $body_id = 'page-' . $event;
    }
    $theme = 'default';
    include txpath . DS . 'theme' . DS . $theme . DS . 'header.php';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:26,代码来源:txplib_head.php

示例3: section_save

function section_save()
{
    global $txpcfg;
    $in = psa(array('name', 'title', 'page', 'css', 'is_default', 'on_frontpage', 'in_rss', 'searchable', 'old_name'));
    extract(doSlash($in));
    if (empty($title)) {
        $title = $name;
    }
    //Prevent non url chars on section names
    include_once $txpcfg['txpath'] . '/lib/classTextile.php';
    $textile = new Textile();
    $title = $textile->TextileThis($title, 1);
    $name = dumbDown($textile->TextileThis($name, 1));
    $name = preg_replace("/[^[:alnum:]\\-_]/", "", str_replace(" ", "-", $name));
    if ($name == 'default') {
        safe_update("txp_section", "page='{$page}',css='{$css}'", "name='default'");
    } else {
        if ($is_default) {
            // note this means 'selected by default' not 'default page'
            safe_update("txp_section", "is_default=0", "name!='{$old_name}'");
        }
        safe_update("txp_section", "name         = '{$name}',\n\t\t\t\ttitle        = '{$title}',\n\t\t\t\tpage         = '{$page}',\n\t\t\t\tcss          = '{$css}',\n\t\t\t\tis_default   = '{$is_default}',\n\t\t\t\ton_frontpage = '{$on_frontpage}',\n\t\t\t\tin_rss       = '{$in_rss}',\n\t\t\t\tsearchable   = '{$searchable}'", "name = '{$old_name}'");
        safe_update("textpattern", "Section='{$name}'", "Section='{$old_name}'");
    }
    sec_section_list(messenger('section', $name, 'updated'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:26,代码来源:txp_section.php

示例4: export

    /**
     * Weave the current template and show it ready to paste.
     */
    static function export()
    {
        $f = file_get_contents(txpath . self::$template);
        foreach (self::$what as $table => $columns) {
            $tick = '`';
            $cols = empty($columns) ? '*' : $tick . join('`,`', doSlash($columns)) . $tick;
            $rs = safe_rows($cols, $table, (empty($columns) ? '1=1' : $columns[0] . ' not like \'%.min%\'') . (empty($columns) ? '' : ' ORDER BY `' . $columns[0] . '`'));
            $rows = array();
            foreach ($rs as $a) {
                // Enforce *nix new-lines
                $a = str_replace("\r\n", "\n", $a);
                // Literal backslash into corresponding MySQL literal
                foreach ($a as &$v) {
                    $v = addcslashes(addcslashes($v, '\\'), '\\');
                }
                $a = "'" . join("', '", doSlash($a)) . "'";
                $rows[] = self::$where . ' = "INSERT INTO `".PFX."' . $table . '`(' . $cols . ') VALUES(' . $a . ')";';
            }
            $f = preg_replace("#(// sql:{$table}).*(// /sql:{$table})#s", '$1' . n . join(n, $rows) . n . '$2', $f);
        }
        echo text_area('code', 600, '', $f, 'code');
        echo script_js(<<<EOS
\t\t\$('#code').focus(function() {
\t\t\tthis.select();
\t\t});
EOS
);
    }
开发者ID:rwetzlmayr,项目名称:wet_sql2php,代码行数:31,代码来源:wet_sql2php.php

示例5: insert_logit

function insert_logit($in)
{
    global $DB;
    $in = doSlash($in);
    extract($in);
    safe_insert("txp_log", "`time`=now(),page='{$uri}',ip='{$ip}',host='{$host}',refer='{$ref}',status='{$status}',method='{$method}'");
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:7,代码来源:log.php

示例6: article_rows

 function article_rows($status, $time, $search, $searchsticky, $section, $category, $excerpted, $month, $author, $keywords, $custom, $frontpage, $sort)
 {
     $where = array();
     if ($status) {
         $where['status'] = $status;
     } elseif ($searchsticky) {
         $where[] = 'status >= 4';
     } else {
         $where['status'] = 4;
     }
     if ($search) {
         include_once txpath . '/publish/search.php';
         $s_filter = $searchall ? filterSearch() : '';
         $match = ", " . db_match('Title,Body', doSlash($q));
         $words = preg_split('/\\s+/', $q);
         foreach ($words as $w) {
             $where[] = "(Title " . db_rlike() . " '" . doSlash(preg_quote($w)) . "' or Body " . db_rlike() . " '" . doSlash(preg_quote($w)) . "')";
         }
         #$search = " and " . join(' and ', $rlike) . " $s_filter";
         $where[] = $s_filter;
         // searchall=0 can be used to show search results for the current section only
         if ($searchall) {
             $section = '';
         }
         if (!$sort) {
             $sort = 'score';
         }
     }
     // ..etc..
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:30,代码来源:txp_tables.php

示例7: categorySelectInput

function categorySelectInput($type, $name, $val, $id, $onchange = 0, $parent_id = NULL)
{
    $rs = tree_get('txp_category', $parent_id, "parent > 0 and type='" . doSlash($type) . "'");
    if ($rs) {
        return treeSelectInput($name, $rs, $val, $id, $onchange, 1, 'name');
    }
    return false;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:8,代码来源:txplib_forms.php

示例8: tree_rebuild

function tree_rebuild($table, $parent, $left, $where = '1=1', $sortby = 'name')
{
    $right = $left + 1;
    $result = safe_column("id", $table, "parent='" . doSlash($parent) . "' and {$where} order by {$sortby}");
    foreach ($result as $row) {
        $right = tree_rebuild($table, $row, $right, $where, $sortby);
    }
    safe_update($table, "lft={$left}, rgt={$right}", "id='{$parent}' and {$where}");
    return $right + 1;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:10,代码来源:txplib_tree.php

示例9: mentionInsert

function mentionInsert($array)
{
    extract(doSlash($array));
    $chk = fetch('article_id', 'txp_log_mention', 'refpage', $refpage);
    if (!$chk) {
        safe_insert("txp_log_mention", "article_id = '{$id}', \n\t\t\t\trefpage    = '{$refpage}', \n\t\t\t\treftitle   = '{$reftitle}', \n\t\t\t\texcerpt    = '{$excerpt}', \n\t\t\t\tcount      = 1");
    } else {
        safe_update("textpattern", "count=count+1", "refpage='{$refpage}'");
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:10,代码来源:log.php

示例10: __construct

 /**
  * Constructor.
  *
  * @param mixed $value
  * @param array $options
  */
 public function __construct($value, $options = array())
 {
     static $choices = null;
     $options = lAtts(array('allow_blank' => true, 'type' => '', 'message' => 'unknown_form'), $options, false);
     if (null === $choices) {
         $choices = safe_column('name', 'txp_form', $options['type'] !== '' ? 'type=\'' . doSlash($options['type']) . '\'' : '1=1');
     }
     $options['choices'] = $choices;
     parent::__construct($value, $options);
 }
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:16,代码来源:FormConstraint.php

示例11: section_save

function section_save()
{
    $in = psa(array('name', 'page', 'css', 'is_default', 'on_frontpage', 'in_rss', 'searchable', 'old_name'));
    extract(doSlash($in));
    if ($is_default) {
        safe_update("txp_section", "is_default=0", "name!='{$old_name}'");
    }
    safe_update("txp_section", "name         = '{$name}',\n\t\t\tpage         = '{$page}',\n\t\t\tcss          = '{$css}',\n\t\t\tis_default   = '{$is_default}',\n\t\t\ton_frontpage = '{$on_frontpage}',\n\t\t\tin_rss       = '{$in_rss}',\n\t\t\tsearchable   = '{$searchable}'", "name = '{$old_name}'");
    safe_update("textpattern", "Section='{$name}'", "Section='{$old_name}'");
    section_list(messenger('section', $name, 'updated'));
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:11,代码来源:txp_section.php

示例12: filterSearch

function filterSearch()
{
    $rs = safe_column("name", "txp_section", "searchable != '1'");
    if ($rs) {
        foreach ($rs as $name) {
            $filters[] = "and Section != '" . doSlash($name) . "'";
        }
        return join(' ', $filters);
    }
    return false;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:11,代码来源:search.php

示例13: page_save

function page_save()
{
    extract(doSlash(gpsa(array('name', 'html', 'newname', 'copy'))));
    if ($newname && $copy) {
        safe_insert("txp_page", "name='{$newname}', user_html='{$html}'");
        page_edit(messenger('page', $newname, 'created'));
    } else {
        safe_update("txp_page", "user_html='{$html}'", "name='{$name}'");
        page_edit(messenger('page', $name, 'updated'));
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:11,代码来源:txp_page.php

示例14: update_user_pref

function update_user_pref($name, $val)
{
    global $prefs, $txp_user;
    if (empty($txp_user)) {
        return;
    }
    if (empty($prefs[$name]) or $prefs[$name] != $val) {
        $GLOBALS[$name] = $prefs[$name] = $val;
        return safe_upsert('txp_prefs_user', "val='" . doSlash($val) . "'", array("user='" . doSlash($txp_user) . "'", "name='" . doSlash($name) . "'"));
    }
    return true;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:12,代码来源:txplib_prefs.php

示例15: sed_plugin_list

 function sed_plugin_list($atts)
 {
     extract(lAtts(array('debug' => 0, 'type' => '', 'link_name' => 1, 'show_author' => 1, 'link_author' => 0, 'show_description' => 1, 'descriptionwrap' => 'p', 'descriptionclass' => 'plugin-description', 'show_version' => 1, 'versionwrap' => 'span', 'versionclass' => 'plugin-version', 'hide_disabled' => 1, 'sort_dir' => 'asc', 'sort_field' => 'name', 'wraptag' => 'ul', 'wrapclass' => 'plugin-list', 'break' => 'li', 'breakclass' => 'plugin-item', 'show_count' => 0, 'exclusions' => ''), $atts));
     $exclusions = explode(',', $exclusions);
     #
     #	Create out plugin search criteria...
     #
     $where = '';
     $w = array();
     if ('' !== $type) {
         $type = 'type=\'' . doSlash($type) . '\'';
         $w[] = $type;
     }
     if ($hide_disabled) {
         $w[] = 'status=\'1\'';
     }
     $where = join(' and ', $w);
     if (empty($where)) {
         $where = '1=1';
     }
     $sort = '';
     if ('' !== $sort_field) {
         $sort = ' order by `' . doSlash($sort_field) . '` ' . doSlash($sort_dir);
     }
     #
     #	Grab the actual data...
     #
     $plugins = safe_rows('name,author,author_uri,version,description,status,type', 'txp_plugin', '(' . $where . ')' . $sort, $debug);
     #
     #	Generate the XHTML results...
     #
     if ($plugins) {
         foreach ($plugins as $plugin) {
             if (in_array($plugin['name'], $exclusions)) {
                 continue;
             }
             $item = tag($plugin['name'], 'span', ' class="plugin-name" ');
             if ($link_name) {
                 $item = tag($item, 'a', ' href="' . $plugin['author_uri'] . '" rel="nofollow" ');
             }
             if ($show_version) {
                 $item .= tag(' v' . $plugin['version'], $versionwrap, ' class="' . $versionclass . '" ');
             }
             if ($show_description) {
                 $item .= tag($plugin['description'], $descriptionwrap, ' class="' . $descriptionclass . '" ');
             }
             $o[] = tag($item, $break, ' class="' . $breakclass . '" ');
         }
     }
     $o = n . join(n, $o);
     return n . tag($o, $wraptag, ' class="' . $wrapclass . '" ') . n . n;
 }
开发者ID:netcarver,项目名称:sed_plugin_list,代码行数:52,代码来源:sed_plugin_list.php


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