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


PHP safe_rows函数代码示例

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


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

示例1: section_list

function section_list($message = '')
{
    pagetop(gTxt('sections'), $message);
    global $url_mode, $txpac, $wlink;
    $out[] = tr(tdcs(strong(gTxt('section_head')) . popHelp('section_category'), 3));
    $out[] = tr(tdcs(form(fInput('text', 'name', '', 'edit', '', '', 10) . fInput('submit', '', gTxt('Create'), 'smallerbox') . eInput('section') . sInput('section_create')), 3));
    $pageslist = safe_column("name", "txp_page", "1");
    $styleslist = safe_column("name", "txp_css", "1");
    $rs = safe_rows("*", "txp_section", "name!='' order by name");
    if ($rs) {
        foreach ($rs as $a) {
            extract($a);
            if ($name == 'default') {
                continue;
            }
            if ($url_mode) {
                $wlink = !check_sections($name) ? sp . wLink('section', 'missing_section_file', 'name', $name) : '';
            }
            $deletelink = dLink('section', 'section_delete', 'name', $name, '', 'type', 'section');
            $form = startTable('edit') . stackRows(fLabelCell(gTxt('section_name') . ':') . fInputCell('name', $name, 1, 20), fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pageslist, $page) . popHelp('section_uses_page'), '', 'noline'), fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styleslist, $css) . popHelp('section_uses_css'), '', 'noline'), fLabelCell(gTxt('selected_by_default') . '?') . td(yesnoradio('is_default', $is_default) . popHelp('section_is_default'), '', 'noline'), fLabelCell(gTxt('on_front_page') . '?') . td(yesnoradio('on_frontpage', $on_frontpage) . popHelp('section_on_frontpage'), '', 'noline'), fLabelCell(gTxt('syndicate') . '?') . td(yesnoradio('in_rss', $in_rss) . popHelp('section_syndicate'), '', 'noline'), fLabelCell(gTxt('include_in_search') . '?') . td(yesnoradio('searchable', $searchable) . popHelp('section_searchable'), '', 'noline'), tda(fInput('submit', '', gTxt('save_button'), 'smallerbox'), ' colspan="2" style="border:0"')) . endTable() . eInput('section') . sInput('section_save') . hInput('old_name', $name);
            $form = form($form);
            $out[] = tr(td($name . $wlink) . td($form) . td($deletelink));
        }
    }
    echo startTable('list') . join('', $out) . endTable();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:26,代码来源:txp_section.php

示例2: 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

示例3: fetchComments

/**
 * Gets comments as an array from the given article.
 *
 * @param  int $id The article ID
 * @return array|null An array of comments, or NULL on error
 * @example
 * if ($comments = fetchComments(12))
 * {
 *     print_r($comments);
 * }
 */
function fetchComments($id)
{
    $rs = safe_rows("*, UNIX_TIMESTAMP(posted) AS time", 'txp_discuss', "parentid = " . intval($id) . " AND visible = " . VISIBLE . " ORDER BY posted ASC");
    if ($rs) {
        return $rs;
    }
}
开发者ID:scar45,项目名称:textpattern,代码行数:18,代码来源:comment.php

示例4: fetchComments

function fetchComments($id)
{
    $rs = safe_rows("*, unix_timestamp(posted) as time", "txp_discuss", 'parentid=' . intval($id) . ' and visible=' . VISIBLE . ' order by posted asc');
    if ($rs) {
        return $rs;
    }
}
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:7,代码来源:comment.php

示例5: fetchComments

function fetchComments($id)
{
    $rs = safe_rows("*, unix_timestamp(posted) as time", "txp_discuss", "parentid='{$id}' and visible='1' order by posted asc");
    if ($rs) {
        return $rs;
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:7,代码来源:comment.php

示例6: export

 function export($dir = '')
 {
     if (!$this->checkdir($dir, TEMPLATES_EXPORT)) {
         return;
     }
     foreach ($this->exportTypes as $type => $config) {
         print "\n                <h1>Exporting " . $config['nice_name'] . "</h1>\n                <ul class='results'>\n            ";
         $rows = safe_rows($config['fields'], $config['table'], '1=1');
         foreach ($rows as $row) {
             $filename = sprintf("%s/%s/%s/%s%s", $this->_config['full_base_path'], $dir, $config['subdir'], $row['name'] . (isset($row['type']) ? "." . $row['type'] : ""), $config['ext']);
             $nicefilename = sprintf(".../%s/%s/%s%s", $dir, $config['subdir'], $row['name'] . (isset($row['type']) ? "." . $row['type'] : ""), $config['ext']);
             if (isset($row['css'])) {
                 $row['css'] = base64_decode($row['css']);
             }
             $f = @fopen($filename, "w+");
             if ($f) {
                 fwrite($f, $row[$config['data']]);
                 fclose($f);
                 print "\n                    <li><span class='success'>Successfully exported</span> " . $config['nice_name'] . " '" . $row['name'] . "' to '" . $nicefilename . "'</li>\n                    ";
             } else {
                 print "\n                    <li><span class='failure'>Failure exporting</span> " . $config['nice_name'] . " '" . $row['name'] . "' to '" . $nicefilename . "'</li>\n                    ";
             }
         }
         print "\n                </ul>\n            ";
     }
 }
开发者ID:nope,项目名称:Tipattern,代码行数:26,代码来源:txplib_template.php

示例7: list_list

function list_list($message = "", $post = '')
{
    extract(get_prefs());
    $lvars = array("page", "sort", "dir", "crit", 'method');
    extract(gpsa($lvars));
    global $statuses, $step;
    pagetop("Textpattern", $message);
    $total = getCount('textpattern', "1");
    $limit = $article_list_pageby ? $article_list_pageby : 25;
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    if (!$sort) {
        $sort = "Posted";
    }
    if (!$dir) {
        $dir = "desc";
    }
    if ($dir == "desc") {
        $linkdir = "asc";
    } else {
        $linkdir = "desc";
    }
    if ($crit) {
        $critsql = array('title_body' => "Title rlike '{$crit}' or Body rlike '{$crit}'", 'author' => "AuthorID rlike '{$crit}'", 'categories' => "Category1 rlike '{$crit}' or Category2 rlike '{$crit}'", 'section' => "Section rlike '{$crit}'", 'status' => "Status rlike '{$crit}'");
        $criteria = $critsql[$method];
        $limit = 500;
    } else {
        $criteria = 1;
    }
    $rs = safe_rows("*, unix_timestamp(Posted) as uPosted", "textpattern", "{$criteria} order by {$sort} {$dir} limit {$offset},{$limit}");
    echo !$crit ? list_nav_form($page, $numPages, $sort, $dir) : '', list_searching_form($crit, $method);
    if ($rs) {
        echo '<form action="index.php" method="post" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), '<tr>', column_head('posted', 'Posted', 'list', 1, $linkdir), column_head('title', 'Title', 'list', 1, $linkdir), $use_sections ? column_head('section', 'Section', 'list', 1, $linkdir) : '', $use_categories ? column_head('category1', 'Category1', 'list', 1, $linkdir) . column_head('category2', 'Category2', 'list', 1, $linkdir) : '', hCell(gTxt('Author')), column_head(gTxt('status'), 'Status', 'list', 1, $linkdir), td(), '</tr>';
        foreach ($rs as $a) {
            extract($a);
            if ($use_categories == 1) {
                $cat1 = $Category1;
                $cat2 = $Category2;
            }
            $stat = !empty($Status) ? $statuses[$Status] : '';
            if ($use_sections == 1) {
                $sect = $Section;
            }
            $adate = date("d M y", $uPosted + $timeoffset);
            $alink = eLink('article', 'edit', 'ID', $ID, $adate);
            $tlink = eLink('article', 'edit', 'ID', $ID, $Title);
            $modbox = fInput('checkbox', 'selected[]', $ID);
            echo "<tr>" . n, td($alink), td($tlink, 200), $use_sections ? td($sect, 75) : '', $use_categories ? td($cat1, 75) . td($cat2, 75) : '', td($AuthorID), td($stat, 45), td($modbox), '</tr>' . n;
        }
        echo tr(tda(list_multiedit_form(), ' colspan="8" style="text-align:right;border:0px"'));
        echo "</table></form>";
        echo pageby_form('list', $article_list_pageby);
        unset($sort);
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:56,代码来源:txp_list.php

示例8: page_list

function page_list($current)
{
    $rs = safe_rows("name", "txp_page", "name != '' order by name");
    foreach ($rs as $a) {
        extract($a);
        $dlink = $name != 'default' ? dLink('page', 'page_delete', 'name', $name) : '';
        $link = '<a href="?event=page' . a . 'name=' . $name . '">' . $name . '</a>';
        $out[] = $current == $name ? tr(td($name) . td($dlink)) : tr(td($link) . td($dlink));
    }
    return startTable('list') . join(n, $out) . endTable();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:11,代码来源:txp_page.php

示例9: oui_prefs_custom_field_list

function oui_prefs_custom_field_list($name, $val)
{
    $custom_fields = safe_rows("name, val", 'txp_prefs', "name LIKE 'custom_%_set' AND val<>'' ORDER BY name");
    if ($custom_fields) {
        $vals = array();
        foreach ($custom_fields as $row) {
            $vals[$row['val']] = $row['val'];
        }
        return selectInput($name, $vals, $val, 'true');
    }
    return gtxt('no_custom_fields_recorded');
}
开发者ID:NicolasGraph,项目名称:oui_prefs_functions,代码行数:12,代码来源:custom_field_list.php

示例10: oui_prefs_style_list

function oui_prefs_style_list($name, $val)
{
    $styles = safe_rows("name", 'txp_css', "name != 'default' ORDER BY name");
    if ($styles) {
        $vals = array();
        foreach ($styles as $row) {
            $vals[$row['name']] = $row['name'];
        }
        return selectInput($name, $vals, $val, 'true');
    }
    return gtxt('no_styles_recorded');
}
开发者ID:NicolasGraph,项目名称:oui_prefs_functions,代码行数:12,代码来源:style_list.php

示例11: oui_prefs_section_list

function oui_prefs_section_list($name, $val)
{
    $sections = safe_rows("name, title", 'txp_section', "name != 'default' ORDER BY title, name");
    if ($sections) {
        $vals = array();
        foreach ($sections as $row) {
            $vals[$row['name']] = $row['title'];
        }
        return selectInput($name, $vals, $val, 'true');
    }
    return gtxt('no_sections_available');
}
开发者ID:NicolasGraph,项目名称:oui_prefs_functions,代码行数:12,代码来源:section_list.php

示例12: oui_prefs_file_list

function oui_prefs_file_list($name, $val)
{
    $files = safe_rows("name, id", 'txp_image', "name != 'default' ORDER BY id, name");
    if ($files) {
        $vals = array();
        foreach ($files as $row) {
            $vals[$row['id']] = $row['name'];
        }
        return selectInput($name, $vals, $val, 'true');
    }
    return gtxt('no_images_recorded');
}
开发者ID:NicolasGraph,项目名称:oui_prefs_functions,代码行数:12,代码来源:file_list.php

示例13: oui_prefs_article_list

function oui_prefs_article_list($name, $val)
{
    $articles = safe_rows("title, id", 'textpattern', "title != 'default' ORDER BY id, title");
    if ($articles) {
        $vals = array();
        foreach ($articles as $row) {
            $vals[$row['id']] = $row['title'];
        }
        return selectInput($name, $vals, $val, 'true');
    }
    return gtxt('no_articles_recorded');
}
开发者ID:NicolasGraph,项目名称:oui_prefs_functions,代码行数:12,代码来源:article_list.php

示例14: 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

示例15: list_plugins

function list_plugins($message = '')
{
    pagetop(gTxt('edit_plugins'), $message);
    echo startTable('list') . tr(tda(plugin_form() . plugin_form_old(), ' colspan="5" style="border:0;height:50px"')) . assHead('plugin', 'author', 'version', 'description', 'active', '');
    $rs = safe_rows("*", "txp_plugin", "1 order by name");
    foreach ($rs as $a) {
        extract($a);
        // nice to have eval() do a syntax check on the plugin here
        echo tr(td(eLink('plugin', 'edit', 'name', $name, $name), 150) . td('<a href="' . $author_uri . '">' . $author . '</a>', 100) . td($version, 10) . td($description, 260) . td(status_link($status, $name, yes_no($status)), 30) . td(dLink('plugin', 'delete', 'name', $name), 30));
        unset($name, $page, $deletelink);
    }
    echo endTable();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:13,代码来源:txp_plugin.php


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