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

PHP get_prefs函数代码示例

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

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



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

示例1: discuss_list

function discuss_list($message = '')
{
    pagetop(gTxt('list_discussions'), $message);
    extract(doSlash(gpsa(array('page', 'crit'))));
    extract(get_prefs());
    $total = safe_count('txp_discuss', "1=1");
    $limit = max(@$comment_list_pageby, 25);
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    $nav[] = $page > 1 ? PrevNextLink("discuss", $page - 1, gTxt('prev'), 'prev') : '';
    $nav[] = sp . small($page . '/' . $numPages) . sp;
    $nav[] = $page != $numPages ? PrevNextLink("discuss", $page + 1, gTxt('next'), 'next') : '';
    $criteria = $crit ? "message like '%{$crit}%'" : '1=1';
    $rs = safe_rows_start("*, unix_timestamp(posted) as uPosted", "txp_discuss", "{$criteria} order by posted desc limit {$offset}, {$limit}");
    echo pageby_form('discuss', $comment_list_pageby);
    if ($rs) {
        echo '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), assHead('date', 'name', 'message', 'parent', '');
        while ($a = nextRow($rs)) {
            extract($a);
            $dmessage = $visible == SPAM ? short_preview($message) : $message;
            $date = "" . date("M d, g:ia", $uPosted + tz_offset()) . "";
            $editlink = eLink('discuss', 'discuss_edit', 'discussid', $discussid, $date);
            $cbox = fInput('checkbox', 'selected[]', $discussid);
            $tq = fetch('Title', 'textpattern', 'ID', $parentid);
            $parent = !$tq ? gTxt('article_deleted') : $tq;
            echo assRow(array($editlink => 100, $name => 100, $dmessage => 250, $parent => 100, $cbox => 20), ' class="' . ($visible == VISIBLE ? 'visible' : ($visible == SPAM ? 'spam' : 'moderate')) . '"');
        }
        echo tr(tda(select_buttons() . discuss_multiedit_form(), ' colspan="5" style="text-align:right;border:0px"'));
        echo endTable() . '</form>';
        echo startTable('edit'), tr(td(form(fInput('text', 'crit', '', 'edit') . fInput('submit', 'search', gTxt('search'), 'smallbox') . eInput("discuss") . sInput("list"))) . td(graf(join('', $nav)))) . tr(tda(graf('<a href="index.php?event=discuss' . a . 'step=ipban_list">' . gTxt('list_banned_ips') . '</a>'), ' colspan="2" align="center" valign="middle"')), endTable();
    } else {
        echo graf(gTxt('no_comments_recorded'), ' align="center"');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:35,代码来源:txp_discuss.php


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


示例3: prefs_list

function prefs_list($message = '')
{
    global $textarray;
    echo pagetop(gTxt('edit_preferences'), $message);
    extract(get_prefs());
    $locale = setlocale(LC_ALL, $locale);
    $textarray = load_lang($language);
    echo n . n . '<form method="post" action="index.php">' . n . n . startTable('list') . n . n . tr(tdcs(hed(gTxt('site_prefs'), 1), 3)) . n . n . tr(tdcs(sLink('prefs', 'prefs_list', gTxt('site_prefs'), 'navlink-active') . sp . sLink('prefs', 'advanced_prefs', gTxt('advanced_preferences'), 'navlink') . sp . sLink('prefs', 'list_languages', gTxt('manage_languages'), 'navlink'), '3'));
    $evt_list = safe_column('event', 'txp_prefs', "type = 0 and prefs_id = 1 group by event order by event desc");
    foreach ($evt_list as $event) {
        $rs = safe_rows_start('*', 'txp_prefs', "type = 0 and prefs_id = 1 and event = '" . doSlash($event) . "' order by position");
        $cur_evt = '';
        while ($a = nextRow($rs)) {
            if ($a['event'] != $cur_evt) {
                $cur_evt = $a['event'];
                if ($cur_evt == 'comments' && !$use_comments) {
                    continue;
                }
                echo n . n . tr(tdcs(hed(gTxt($a['event']), 2, ' class="pref-heading"'), 3));
            }
            if ($cur_evt == 'comments' && !$use_comments) {
                continue;
            }
            // Skip old settings that don't have an input type
            if (!is_callable($a['html'])) {
                continue;
            }
            $label = $a['html'] != 'yesnoradio' ? '<label for="' . $a['name'] . '">' . gTxt($a['name']) . '</label>' : gTxt($a['name']);
            $out = tda($label, ' style="text-align: right; vertical-align: middle;"');
            if ($a['html'] == 'text_input') {
                $out .= td(pref_func('text_input', $a['name'], $a['val'], 20));
            } else {
                $out .= td(pref_func($a['html'], $a['name'], $a['val']));
            }
            $out .= tda(popHelp($a['name']), ' style="vertical-align: middle;"');
            echo tr($out);
        }
    }
    echo n . n . tr(tda(fInput('submit', 'Submit', gTxt('save_button'), 'publish') . n . sInput('prefs_save') . n . eInput('prefs') . n . hInput('prefs_id', '1'), ' colspan="3" class="noline"')) . n . n . endTable() . n . n . '</form>';
    $check_updates = gps('check_updates');
    if ($check_updates) {
        $updates = checkUpdates();
        if (is_array($updates)) {
            $out = join(br, $updates);
        } else {
            $out = $updates;
        }
        echo n . n . startTable('edit') . n . n . tr(tda($out)) . n . n . endTable();
    } else {
        echo form(graf('<strong>' . gTxt('check_for_txp_updates') . '</strong>' . sp . n . '<input type="submit" name="check_updates" value="' . gTxt('go') . '" class="publish" />' . n . eInput('prefs') . n . sInput('prefs_list')), 'text-align: center;');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:52,代码来源:txp_prefs.php


示例4: prefs_list

function prefs_list($message = '')
{
    global $textarray;
    extract(get_prefs());
    $locale = setlocale(LC_ALL, $locale);
    $textarray = load_lang($language);
    echo pagetop(gTxt('edit_preferences'), $message), '<form action="index.php" method="post">', startTable('list'), tr(tdcs(hed(gTxt('site_prefs'), 1), 3)), tr(tdcs(sLink('prefs', 'advanced_prefs', gTxt('advanced_preferences'), 'navlink') . sp . sLink('prefs', 'list_languages', gTxt('install_language'), 'navlink'), '3'));
    $evt_list = safe_column('event', 'txp_prefs', "type='0' AND prefs_id='1' GROUP BY 'event' ORDER BY 'event' DESC");
    foreach ($evt_list as $event) {
        $rs = safe_rows_start('*', 'txp_prefs', "type='0' AND prefs_id='1' AND event='{$event}' ORDER BY 'position'");
        $cur_evt = '';
        while ($a = nextRow($rs)) {
            if ($a['event'] != $cur_evt) {
                $cur_evt = $a['event'];
                if ($cur_evt == 'comments' && !$use_comments) {
                    continue;
                }
                echo tr(tdcs(hed(ucfirst(gTxt($a['event'])), 1), 3));
            }
            if ($cur_evt == 'comments' && !$use_comments) {
                continue;
            }
            # Skip old settings that don't have an input type
            if (!is_callable($a['html'])) {
                continue;
            }
            $out = tda(gTxt($a['name']), ' style="text-align:right;vertical-align:middle"');
            if ($a['html'] == 'text_input') {
                $size = 20;
                $out .= td(call_user_func('text_input', $a['name'], $a['val'], $size));
            } else {
                $out .= td(call_user_func($a['html'], $a['name'], $a['val']));
            }
            $out .= tda(popHelp($a['name']), ' style="vertical-align:middle"');
            echo tr($out);
        }
    }
    echo tr(tda(fInput('submit', 'Submit', gTxt('save_button'), 'publish'), ' colspan="3" class="noline"')), endTable(), sInput('prefs_save'), eInput('prefs'), hInput('prefs_id', "1"), hInput('lastmod', "now()"), '</form>';
    $check_updates = gps('check_updates');
    if (!empty($check_updates)) {
        include_once txpath . '/lib/txplib_update.php';
        $updates = checkUpdates();
        if (is_array($updates)) {
            $out = join(br, $updates);
        } else {
            $out = $updates;
        }
        echo startTable('edit'), tr(tda($out)), endTable();
    } else {
        echo startTable('edit'), form(tr(tda(tag(gTxt('check_for_txp_updates'), 'strong'), ' style="text-align:right;vertical-align:middle"') . tda('<input type="submit" value="' . gTxt('go') . '" name="check_updates" class="publish" />')) . eInput('prefs') . sInput('prefs_list')), endTable();
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:52,代码来源:txp_prefs.php


示例5: log_list

function log_list()
{
    pagetop(gTxt('visitor_logs'));
    extract(get_prefs());
    safe_delete("txp_log", "`time` < date_sub(now(),interval " . $expire_logs_after . " day)");
    safe_optimize("txp_log");
    safe_repair("txp_log");
    $page = gps('page');
    $total = getCount('txp_log', "1");
    $limit = 50;
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    $nav[] = $page > 1 ? PrevNextLink("log", $page - 1, gTxt('prev'), 'prev') : '';
    $nav[] = sp . small($page . '/' . $numPages) . sp;
    $nav[] = $page != $numPages ? PrevNextLink("log", $page + 1, gTxt('next'), 'next') : '';
    $rs = safe_rows_start("*, unix_timestamp(time) as stamp", "txp_log", "1 order by time desc limit {$offset},{$limit}");
    if ($rs) {
        echo startTable('list'), assHead('time', 'host', 'page', 'referrer');
        $stamp = '';
        while ($a = nextRow($rs)) {
            extract($a);
            if ($refer) {
                $referprint = preg_replace("/^www\\./", "", chunk(htmlspecialchars($refer), 50));
                $referprint = '<a href="http://' . htmlspecialchars($refer) . '">' . $referprint . '</a>';
            } else {
                $referprint = '&#160;';
            }
            $pageprint = preg_replace('/\\/$/', '', htmlspecialchars(substr($page, 1)));
            $pageprint = $pageprint == '' ? '' : '<a href="' . htmlspecialchars($page) . '" target="_blank">' . chunk($pageprint, 50) . '</a>';
            if ($method == 'POST') {
                $pageprint = '<b>' . $pageprint . '</b>';
            }
            $fstamp = date("n/j g:i a", $stamp + tz_offset());
            $hostprint = chunk($host, 40);
            echo tr(td($fstamp) . td($hostprint) . td($pageprint) . td($referprint));
            unset($refer, $referprint, $page, $pageprint);
        }
        echo '<tr><td colspan="4" align="right" style="padding:10px">', join('', $nav), "</td></tr>", endTable();
    } else {
        echo graf(gTxt('no_refers_recorded'), ' align="center"');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:43,代码来源:txp_log.php


示例6: image_list

function image_list($message = '')
{
    global $txpcfg, $extensions, $path_from_root, $img_dir;
    $pfr = $path_from_root;
    extract($txpcfg);
    extract(get_prefs());
    pagetop(gTxt('image'), $message);
    echo pageby_form('image', $article_list_pageby);
    echo startTable('list'), tr(tda(upload_form(gTxt('upload_file'), gTxt('upload'), 'image_insert'), ' colspan="4" style="border:0"')), tr(hCell(ucfirst(gTxt('name'))) . hCell(gTxt('image_category')) . hCell(gTxt('tags')) . hCell(gTxt('author')) . hCell(gTxt('thumbnail')) . hCell());
    $page = gps('page');
    $total = getCount('txp_image', "1");
    $limit = 15;
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    $nav[] = $page > 1 ? PrevNextLink("image", $page - 1, gTxt('prev'), 'prev') : '';
    $nav[] = sp . small($page . '/' . $numPages) . sp;
    $nav[] = $page != $numPages ? PrevNextLink("image", $page + 1, gTxt('next'), 'next') : '';
    $rs = safe_rows("*", "txp_image", "1 order by category,name limit {$offset},{$limit}");
    if ($rs) {
        foreach ($rs as $a) {
            extract($a);
            $thumbnail = $thumbnail ? '<img src="' . $pfr . $img_dir . '/' . $id . 't' . $ext . '" />' : gTxt('no');
            $elink = eLink('image', 'image_edit', 'id', $id, $name);
            $txtilelink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'alt=' . $alt . a . 'h=' . $h . a . 'w=' . $w . a . 'type=textile" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textile</a>';
            $txplink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'type=textpattern" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textpattern</a>';
            $xhtmlink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'h=' . $h . a . 'w=' . $w . a . 'type=xhtml" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">XHTML</a>';
            $dlink = dLink('image', 'image_delete', 'id', $id);
            echo tr(td($elink) . td($category) . td($txtilelink . ' / ' . $txplink . ' / ' . $xhtmlink) . td($author) . td($thumbnail) . td($dlink, 10));
        }
        echo tr(tdcs(graf(join('', $nav)), 4));
    }
    echo endTable();
    $imgdir = $doc_root . $path_from_root . $img_dir;
    if (!is_dir($imgdir) or !is_writeable($imgdir)) {
        echo graf(str_replace("{imgdir}", $imgdir, gTxt('img_dir_not_writeable')), ' style="text-align:center;color:red"');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:38,代码来源:txp_image.php


示例7: link_list

function link_list($message = "")
{
    global $step, $link_list_pageby;
    extract(get_prefs());
    $page = gps('page');
    $total = getCount('txp_link', "1");
    $limit = $link_list_pageby;
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    $sort = gps('sort');
    $dir = gps('dir');
    $sort = $sort ? $sort : 'linksort';
    $dir = $dir ? $dir : 'asc';
    if ($dir == "desc") {
        $dir = "asc";
    } else {
        $dir = "desc";
    }
    $nav[] = $page > 1 ? PrevNextLink("link", $page - 1, gTxt('prev'), 'prev') : '';
    $nav[] = sp . small($page . '/' . $numPages) . sp;
    $nav[] = $page != $numPages ? PrevNextLink("link", $page + 1, gTxt('next'), 'next') : '';
    $rs = safe_rows("*", "txp_link", "1 order by {$sort} {$dir} limit {$offset},{$limit}");
    if ($rs) {
        echo '<form action="index.php" method="post" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), tr(column_head('link_name', 'linksort', 'link', 1, $dir) . column_head('description', 'description', 'link', 1, $dir) . column_head('link_category', 'category', 'link', 1, $dir) . td());
        foreach ($rs as $a) {
            extract($a);
            $elink = eLink('link', 'link_edit', 'id', $id, $linkname);
            $cbox = fInput('checkbox', 'selected[]', $id);
            echo tr(td($elink) . td($description) . td($category) . td($cbox));
        }
        echo tr(tda(link_multiedit_form(), ' colspan="4" style="border:0px;text-align:right"'));
        echo endTable(), '</form>';
        echo pageby_form('link', $link_list_pageby);
        echo graf(join('', $nav), ' align="center"');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:37,代码来源:txp_link.php


示例8: discuss_list

function discuss_list($message = '')
{
    pagetop(gTxt('list_discussions'), $message);
    echo graf('<a href="index.php?event=discuss' . a . 'step=ipban_list">' . gTxt('list_banned_ips') . '</a>', ' style="text-align: center;"');
    extract(get_prefs());
    extract(gpsa(array('sort', 'dir', 'page', 'crit', 'search_method')));
    $dir = $dir == 'asc' ? 'asc' : 'desc';
    switch ($sort) {
        case 'id':
            $sort_sql = 'discussid ' . $dir;
            break;
        case 'ip':
            $sort_sql = 'ip ' . $dir;
            break;
        case 'name':
            $sort_sql = 'name ' . $dir;
            break;
        case 'email':
            $sort_sql = 'email ' . $dir;
            break;
        case 'website':
            $sort_sql = 'web ' . $dir;
            break;
        case 'message':
            $sort_sql = 'message ' . $dir;
            break;
        case 'status':
            $sort_sql = 'visible ' . $dir;
            break;
        case 'parent':
            $sort_sql = 'parentid ' . $dir;
            break;
        default:
            $sort = 'date';
            $sort_sql = 'txp_discuss.posted ' . $dir;
            break;
    }
    if ($sort != 'date') {
        $sort_sql .= ', txp_discuss.posted asc';
    }
    $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
    $criteria = 1;
    if ($search_method and $crit) {
        $crit_escaped = doSlash($crit);
        $critsql = array('id' => "discussid = '{$crit_escaped}'", 'parent' => "parentid = '{$crit_escaped}' OR title like '%{$crit_escaped}%'", 'name' => "name like '%{$crit_escaped}%'", 'message' => "message like '%{$crit_escaped}%'", 'email' => "email like '%{$crit_escaped}%'", 'website' => "web like '%{$crit_escaped}%'", 'ip' => "ip like '%{$crit_escaped}%'");
        if (array_key_exists($search_method, $critsql)) {
            $criteria = $critsql[$search_method];
            $limit = 500;
        } else {
            $search_method = '';
            $crit = '';
        }
    } else {
        $search_method = '';
        $crit = '';
    }
    $spamq = cs('toggle_show_spam') ? '1=1' : 'visible != ' . intval(SPAM);
    $total = getThing('SELECT COUNT(*)' . ' FROM ' . safe_pfx_j('txp_discuss') . ' LEFT JOIN ' . safe_pfx_j('textpattern') . ' ON txp_discuss.parentid = textpattern.ID' . ' WHERE ' . $spamq . ' AND ' . $criteria);
    if ($total < 1) {
        if ($criteria != 1) {
            echo n . discuss_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' style="text-align: center;"');
        } else {
            echo graf(gTxt('no_comments_recorded'), ' style="text-align: center;"');
        }
        return;
    }
    $limit = max(@$comment_list_pageby, 15);
    list($page, $offset, $numPages) = pager($total, $limit, $page);
    echo discuss_search_form($crit, $search_method);
    $rs = safe_query('SELECT txp_discuss.*, unix_timestamp(txp_discuss.posted) as uPosted, ID as thisid, Section as section, url_title, Title as title, Status, unix_timestamp(textpattern.Posted) as posted' . ' FROM ' . safe_pfx_j('txp_discuss') . ' LEFT JOIN ' . safe_pfx_j('textpattern') . ' ON txp_discuss.parentid = textpattern.ID' . ' WHERE ' . $spamq . ' AND ' . $criteria . ' ORDER BY ' . $sort_sql . ' LIMIT ' . $offset . ', ' . $limit);
    if ($rs) {
        echo n . n . '<form name="longform" method="post" action="index.php" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . n . startTable('list', '', '', '', '90%') . n . n . tr(column_head('ID', 'id', 'discuss', true, $switch_dir, $crit, $search_method, 'id' == $sort ? $dir : '') . column_head('date', 'date', 'discuss', true, $switch_dir, $crit, $search_method, 'date' == $sort ? $dir : '') . column_head('name', 'name', 'discuss', true, $switch_dir, $crit, $search_method, 'name' == $sort ? $dir : '') . column_head('message', 'message', 'discuss', true, $switch_dir, $crit, $search_method, 'message' == $sort ? $dir : '') . column_head('email', 'email', 'discuss', true, $switch_dir, $crit, $search_method, ('email' == $sort ? "{$dir} " : '') . 'discuss_detail') . column_head('website', 'website', 'discuss', true, $switch_dir, $crit, $search_method, ('website' == $sort ? "{$dir} " : '') . 'discuss_detail') . column_head('IP', 'ip', 'discuss', true, $switch_dir, $crit, $search_method, ('ip' == $sort ? "{$dir} " : '') . 'discuss_detail') . column_head('status', 'status', 'discuss', true, $switch_dir, $crit, $search_method, ('status' == $sort ? "{$dir} " : '') . 'discuss_detail') . column_head('parent', 'parent', 'discuss', true, $switch_dir, $crit, $search_method, 'parent' == $sort ? $dir : '') . hCell());
        include_once txpath . '/publish/taghandlers.php';
        while ($a = nextRow($rs)) {
            extract($a);
            $parentid = assert_int($parentid);
            $edit_url = '?event=discuss' . a . 'step=discuss_edit' . a . 'discussid=' . $discussid . a . 'sort=' . $sort . a . 'dir=' . $dir . a . 'page=' . $page . a . 'search_method=' . $search_method . a . 'crit=' . $crit;
            $dmessage = $visible == SPAM ? short_preview($message) : $message;
            switch ($visible) {
                case VISIBLE:
                    $comment_status = gTxt('visible');
                    $row_class = 'visible';
                    break;
                case SPAM:
                    $comment_status = gTxt('spam');
                    $row_class = 'spam';
                    break;
                case MODERATE:
                    $comment_status = gTxt('unmoderated');
                    $row_class = 'moderate';
                    break;
                default:
                    break;
            }
            if (empty($thisid)) {
                $parent = gTxt('article_deleted') . ' (' . $parentid . ')';
                $view = '';
            } else {
                $parent_title = empty($title) ? '<em>' . gTxt('untitled') . '</em>' : escape_title($title);
                $parent = href($parent_title, '?event=list' . a . 'step=list' . a . 'search_method=id' . a . 'crit=' . $parentid);
//.........这里部分代码省略.........
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:txp_discuss.php


示例9: _sed_si_inject_section_admin

function _sed_si_inject_section_admin($page)
{
    global $DB, $prefs, $_sed_si_l18n, $step, $mlp;
    if (!isset($DB)) {
        $DB = new db();
    }
    if (!isset($prefs)) {
        $prefs = get_prefs();
    }
    $mlp = new sed_lib_mlp('sed_section_fields', $_sed_si_l18n, '', 'admin');
    $section_index = '';
    $rows = safe_rows_start('*', 'txp_section', "name != 'default' order by name");
    $c = @mysql_num_rows($rows);
    if ($rows && $c > 0) {
        while ($row = nextRow($rows)) {
            $name = $row['name'];
            #$title = $row['title'];
            #$title = strtr( $title , array( "'"=>'&#39;' , '"'=>'&#34;' ) );
            # Build the list of sections for the section-tab index
            $section_index .= '<li id="sed_section-' . $name . '"><a href="#section-' . $name . '" class="sed_si_hide_all_but_one">' . $name . '</a></li>';
        }
        #
        #	Insert a JS variable holding the index of sections...
        #
        $newsection = '';
        if ($step == 'section_create' || $step == 'section_save') {
            $newsection = ps('name');
        }
        $filter = '';
        $limit = $prefs[_sed_si_prefix_key('filter_limit')];
        if (!is_numeric($limit)) {
            $limit = 18;
        }
        if ($c >= $limit) {
            $filter = '<label for="sed_si_section_index_filter">' . $mlp->gTxt('filter_label') . '</label><br /><input id="sed_si_section_index_filter" type="text" class="edit" />';
        }
        $section_index = '<div id="sed_si_section_index_div">' . '<form id="sed_si_filter_form">' . $filter . '</form>' . '<ol id="sed_si_section_index" class="sed_si_section_index">' . '<li  id="sed_section-default"><a href="#section-default" class="sed_si_hide_all_but_one">default</a></li>' . $section_index . '</ol>' . '</div>';
        $section_index = str_replace('"', '\\"', $section_index);
        $r = '<script type=\'text/javascript\'> var sed_si_new_section = "#section-' . $newsection . '"; var sed_si_section_index = "' . $section_index . '";</script>';
        $f = '<script src=\'' . hu . 'textpattern/index.php?sed_resources=sed_si_section_js\' type=\'text/javascript\'></script>';
        $page = str_replace($f, $r . n . $f, $page);
    }
    return $page;
}
开发者ID:netcarver,项目名称:sed_section_index,代码行数:44,代码来源:sed_section_index.php


示例10: products_list

function products_list($event = '', $step = '', $message = '')
{
    global $statuses, $comments_disabled_after, $step, $txp_user;
    $message = '';
    pagetop(gTxt('tab_list'), $message);
    echo poweredit_products();
    //echo the poweredit js
    extract(get_prefs());
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    $sesutats = array_flip($statuses);
    $dir = $dir == 'desc' ? 'desc' : 'asc';
    echo '<script type="text/javascript" src="http://' . $siteurl . '/js/prototype.js"></script>';
    echo '<script type="text/javascript" src="http://' . $siteurl . '/js/scriptaculous.js"></script>';
    switch ($sort) {
        case 'id':
            $sort_sql = 'ID ' . $dir;
            break;
        case 'posted':
            $sort_sql = 'Posted ' . $dir;
            break;
        case 'title':
            $sort_sql = 'Title ' . $dir . ', Posted desc';
            break;
        case 'section':
            $sort_sql = 'Section ' . $dir . ', Posted desc';
            break;
        case 'category1':
            $sort_sql = 'Category1 ' . $dir . ', Posted desc';
            break;
        case 'category2':
            $sort_sql = 'Category2 ' . $dir . ', Posted desc';
            break;
        case 'status':
            $sort_sql = 'Status ' . $dir . ', Posted desc';
            break;
        case 'author':
            $sort_sql = 'AuthorID ' . $dir . ', Posted desc';
            break;
        case 'comments':
            $sort_sql = 'comments_count ' . $dir . ', Posted desc';
            break;
        default:
            $dir = 'desc';
            $sort_sql = 'Posted ' . $dir;
            break;
    }
    $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
    $criteria = "section = 'store'";
    if ($search_method and $crit) {
        $crit_escaped = doSlash($crit);
        $critsql = array('id' => "ID = '{$crit_escaped}'", 'title_body' => "Title rlike '{$crit_escaped}' or Body rlike '{$crit_escaped}'", 'section' => "Section rlike '{$crit_escaped}'", 'categories' => "Category1 rlike '{$crit_escaped}' or Category2 rlike '{$crit_escaped}'", 'status' => "Status = '" . @$sesutats[gTxt($crit_escaped)] . "'", 'author' => "AuthorID rlike '{$crit_escaped}'");
        if (array_key_exists($search_method, $critsql)) {
            $criteria = $critsql[$search_method];
            $limit = 500;
        } else {
            $search_method = '';
            $crit = '';
        }
    } else {
        $search_method = '';
        $crit = '';
    }
    $total = safe_count('textpattern', "{$criteria}");
    if ($total < 1) {
        if ($criteria != 1) {
            echo n . list_search_form_products($crit, $search_method) . n . graf("No products found", ' style="text-align: center;"');
        } else {
            echo graf("No products found", ' style="text-align: center;"');
        }
        return;
    }
    $limit = max(@$article_list_pageby, 15);
    list($page, $offset, $numPages) = pager($total, $limit, $page);
    echo n . list_search_form_products($crit, $search_method);
    $rs = safe_rows_start('*, unix_timestamp(Posted) as posted', 'textpattern', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
    if ($rs) {
        $total_comments = array();
        // fetch true comment count, not the public comment count
        // maybe we should have another row in the db?
        $rs2 = safe_rows_start('parentid, count(*) as num', 'txp_discuss', "1 group by parentid order by parentid");
        if ($rs2) {
            while ($a = nextRow($rs2)) {
                $pid = $a['parentid'];
                $num = $a['num'];
                $total_comments[$pid] = $num;
            }
        }
        echo n . n . '<form name="longform" method="post" action="index.php" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . n . startTable('list', '', '', '', '700') . n . tr(hCell() . n . column_head('ID', 'id', 'products', true, $switch_dir, $crit, $search_method) . column_head('title', 'title', 'products', true, $switch_dir, $crit, $search_method) . column_head('category1', 'category1', 'products', true, $switch_dir, $crit, $search_method) . column_head('category2', 'category2', 'products', true, $switch_dir, $crit, $search_method) . column_head('status', 'status', 'products', true, $switch_dir, $crit, $search_method) . hCell());
        include_once txpath . '/publish/taghandlers.php';
        while ($a = nextRow($rs)) {
            extract($a);
            if (empty($Title)) {
                $Title = '<em>' . eLink('product', 'edit', 'ID', $ID, gTxt('untitled')) . '</em>';
            } else {
                $Title = eLink('product', 'edit', 'ID', $ID, $Title);
            }
            if (!empty($Image)) {
                $Image = "<img src='{$Image}' alt='Product Image' width='15' height='15'/>";
            }
            $Category1 = '<span title="' . htmlspecialchars(fetch_category_title($Category1)) . '">' . $Category1 . '&nbsp;</span>';
//.........这里部分代码省略.........
开发者ID:duongcuong96,项目名称:textcommerce,代码行数:101,代码来源:ln_txp_commerce.php


示例11: image_list

function image_list($message = '')
{
    global $txpcfg, $extensions, $img_dir, $file_max_upload_size;
    pagetop(gTxt('images'), $message);
    extract($txpcfg);
    extract(get_prefs());
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    if (!is_dir(IMPATH) or !is_writeable(IMPATH)) {
        echo graf(gTxt('img_dir_not_writeable', array('{imgdir}' => IMPATH)), ' id="warning"');
    } else {
        echo upload_form(gTxt('upload_image'), 'upload', 'image_insert', 'image', '', $file_max_upload_size);
    }
    $dir = $dir == 'asc' ? 'asc' : 'desc';
    switch ($sort) {
        case 'name':
            $sort_sql = 'name ' . $dir;
            break;
        case 'thumbnail':
            $sort_sql = 'thumbnail ' . $dir . ', id asc';
            break;
        case 'category':
            $sort_sql = 'category ' . $dir . ', id asc';
            break;
        case 'date':
            $sort_sql = 'date ' . $dir . ', id asc';
            break;
        case 'author':
            $sort_sql = 'author ' . $dir . ', id asc';
            break;
        default:
            $sort = 'id';
            $sort_sql = 'id ' . $dir;
            break;
    }
    $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
    $criteria = 1;
    if ($search_method and $crit) {
        $crit_escaped = doSlash($crit);
        $critsql = array('id' => "id = '{$crit_escaped}'", 'name' => "name like '%{$crit_escaped}%'", 'category' => "category like '%{$crit_escaped}%'", 'author' => "author like '%{$crit_escaped}%'");
        if (array_key_exists($search_method, $critsql)) {
            $criteria = $critsql[$search_method];
            $limit = 500;
        } else {
            $search_method = '';
            $crit = '';
        }
    } else {
        $search_method = '';
        $crit = '';
    }
    $total = safe_count('txp_image', "{$criteria}");
    if ($total < 1) {
        if ($criteria != 1) {
            echo n . image_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' style="text-align: center;"');
        } else {
            echo n . graf(gTxt('no_images_recorded'), ' style="text-align: center;"');
        }
        return;
    }
    $limit = max(@$image_list_pageby, 15);
    list($page, $offset, $numPages) = pager($total, $limit, $page);
    echo image_search_form($crit, $search_method);
    $rs = safe_rows_start('*, unix_timestamp(date) as uDate', 'txp_image', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}\n\t\t");
    if ($rs) {
        echo n . n . startTable('list') . n . tr(column_head('ID', 'id', 'image', true, $switch_dir, $crit, $search_method, 'id' == $sort ? $dir : '') . hCell() . column_head('date', 'date', 'image', true, $switch_dir, $crit, $search_method, 'date' == $sort ? $dir : '') . column_head('name', 'name', 'image', true, $switch_dir, $crit, $search_method, 'name' == $sort ? $dir : '') . column_head('thumbnail', 'thumbnail', 'image', true, $switch_dir, $crit, $search_method, 'thumbnail' == $sort ? $dir : '') . hCell(gTxt('tags')) . column_head('image_category', 'category', 'image', true, $switch_dir, $crit, $search_method, 'category' == $sort ? $dir : '') . column_head('author', 'author', 'image', true, $switch_dir, $crit, $search_method, 'author' == $sort ? $dir : '') . hCell());
        while ($a = nextRow($rs)) {
            extract($a);
            $edit_url = '?event=image' . a . 'step=image_edit' . a . 'id=' . $id . a . 'sort=' . $sort . a . 'dir=' . $dir . a . 'page=' . $page . a . 'search_method=' . $search_method . a . 'crit=' . $crit;
            $name = empty($name) ? gTxt('unnamed') : htmlspecialchars($name);
            $thumbnail = $thumbnail ? '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />' : gTxt('no');
            $tag_url = '?event=tag' . a . 'tag_name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'w=' . $w . a . 'h=' . $h . a . 'alt=' . urlencode($alt) . a . 'caption=' . urlencode($caption);
            $category = $category ? '<span title="' . htmlspecialchars(fetch_category_title($category, 'image')) . '">' . $category . '</span>' : '';
            echo n . n . tr(n . td($id, 20) . td(n . '<ul>' . n . t . '<li>' . href(gTxt('edit'), $edit_url) . '</li>' . n . t . '<li><a href="' . hu . $img_dir . '/' . $id . $ext . '">' . gTxt('view') . '</a></li>' . n . '</ul>', 35) . td(gTime($uDate), 75) . td(href($name, $edit_url), 75) . td(href($thumbnail, $edit_url), 80) . td('<ul>' . '<li><a target="_blank" href="' . $tag_url . a . 'type=textile" onclick="popWin(this.href); return false;">Textile</a></li>' . '<li><a target="_blank" href="' . $tag_url . a . 'type=textpattern" onclick="popWin(this.href); return false;">Textpattern</a></li>' . '<li><a target="_blank" href="' . $tag_url . a . 'type=xhtml" onclick="popWin(this.href); return false;">XHTML</a></li>' . '</ul>', 85) . td($category, 75) . td('<span title="' . htmlspecialchars(get_author_name($author)) . '">' . htmlspecialchars($author) . '</span>', 75) . td(dLink('image', 'image_delete', 'id', $id, '', '', '', false, array($page, $sort, $dir, $crit, $search_method)), 10));
        }
        echo endTable() . nav_form('image', $page, $numPages, $sort, $dir, $crit, $search_method) . pageby_form('image', $image_list_pageby);
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:77,代码来源:txp_image.php


示例12: article_edit

function article_edit($message = "")
{
    global $txpcfg, $txp_user, $vars;
    extract(get_prefs());
    extract(gpsa(array('view', 'from_view', 'step')));
    if (!empty($GLOBALS['ID'])) {
        // newly-saved article
        $ID = intval($GLOBALS['ID']);
        $step = 'edit';
    } else {
        $ID = gps('ID');
    }
    include_once $txpcfg['txpath'] . '/lib/classTextile.php';
    $textile = new Textile();
    if (!$view) {
        $view = "text";
    }
    if (!$step) {
        $step = "create";
    }
    if ($step == "edit" && $view == "text" && !empty($ID) && $from_view != "preview" && $from_view != 'html') {
        $pull = true;
        //-- it's an existing article - off we go to the db
        $rs = safe_row("*, unix_timestamp(Posted) as sPosted,\n\t\t\t\tunix_timestamp(LastMod) as sLastMod", "textpattern", "ID={$ID}");
        extract($rs);
        if ($AnnotateInvite != $comments_default_invite) {
            $AnnotateInvite = $AnnotateInvite;
        } else {
            $AnnotateInvite = $comments_default_invite;
        }
    } else {
        $pull = false;
        //-- assume they came from post
        if (!$from_view or $from_view == 'text') {
            extract(gpsa($vars));
        } elseif ($from_view == 'preview' or $from_view == 'html') {
            // coming from either html or preview
            if (isset($_POST['store'])) {
                $store = unserialize(base64_decode($_POST['store']));
                extract($store);
            }
        }
        foreach ($vars as $var) {
            if (isset(${$var})) {
                $store_out[$var] = ${$var};
            }
        }
    }
    $GLOBALS['step'] = $step;
    if ($step == 'create') {
        $textile_body = 1;
        $textile_excerpt = 1;
    }
    if ($step != 'create') {
        // Previous record?
        $prev_id = checkIfNeighbour('prev', $sPosted);
        // Next record?
        $next_id = checkIfNeighbour('next', $sPosted);
    }
    pagetop($Title, $message);
    echo '<form action="index.php" method="post" name="article">';
    if (!empty($store_out)) {
        echo hInput('store', base64_encode(serialize($store_out)));
    }
    echo hInput('ID', $ID), eInput('article'), sInput($step);
    echo '<input type="hidden" name="view" />', startTable('edit');
    echo '<tr><td>&nbsp;</td><td colspan="3">', $view == 'preview' ? hed(ucfirst(gTxt('preview')), 2) . graf($Title) : '', $view == 'html' ? hed('XHTML', 2) . graf($Title) : '', $view == 'text' ? br . '<input type="text" name="Title" value="' . cleanfInput($Title) . '" class="edit" size="40" tabindex="1" />' : '', '</td></tr>';
    //-- article input --------------
    echo '<tr>
  		<td valign="top">', $view == 'text' && $use_textile == 2 ? '<p><a href="#" onclick="toggleDisplay(\'textile_help\');">' . gTxt('textile_help') . '</a></p>
		<div id="textile_help" style="display:none;">' . sidehelp() . '</div>' : sp;
    if ($view == 'text') {
        echo '<p><a href="#" onclick="toggleDisplay(\'advanced\');">' . gTxt('advanced_options') . '</a></p>', '<div id="advanced" style="display:none;">', graf(gTxt('use_textile') . br . tag(checkbox2('textile_body', $textile_body) . gTxt('article'), 'label') . br . tag(checkbox2('textile_excerpt', $textile_excerpt) . gTxt('excerpt'), 'label')), $allow_form_override ? graf(gTxt('override_default_form') . br . form_pop($override_form) . popHelp('override_form')) : '', $custom_1_set ? custField(1, $custom_1_set, $custom_1) : '', $custom_2_set ? custField(2, $custom_2_set, $custom_2) : '', $custom_3_set ? custField(3, $custom_3_set, $custom_3) : '', $custom_4_set ? custField(4, $custom_4_set, $custom_4) : '', $custom_5_set ? custField(5, $custom_5_set, $custom_5) : '', $custom_6_set ? custField(6, $custom_6_set, $custom_6) : '', $custom_7_set ? custField(7, $custom_7_set, $custom_7) : '', $custom_8_set ? custField(8, $custom_8_set, $custom_8) : '', $custom_9_set ? custField(9, $custom_9_set, $custom_9) : '', $custom_10_set ? custField(10, $custom_10_set, $custom_10) : '', graf(gTxt('keywords') . popHelp('keywords') . br . '<textarea name="Keywords" style="width:100px;height:80px" rows="1" cols="1">' . $Keywords . '</textarea>'), graf(gTxt('article_image') . popHelp('article_image') . br . fInput('text', 'Image', $Image, 'edit')), graf(gTxt('url_title') . popHelp('url_title') . br . fInput('text', 'url_title', $url_title, 'edit')) . '</div>
			
			<p><a href="#" onclick="toggleDisplay(\'recent\');">' . gTxt('recent_articles') . '</a>' . '</p>' . '<div id="recent" style="display:none;">';
        $recents = safe_rows_start("Title, ID", 'textpattern', "1 order by LastMod desc limit 10");
        if ($recents) {
            echo '<p>';
            while ($recent = nextRow($recents)) {
                extract($recent);
                if (!$Title) {
                    $Title = gTxt('untitled') . sp . $ID;
                }
                echo '<a href="?event=article' . a . 'step=edit' . a . 'ID=' . $ID . '">' . $Title . '</a>' . br . n;
            }
            echo '</p>';
        }
        echo '</div>';
    } else {
        echo sp;
    }
    echo '</td>
    	<td valign="top" style="width:400px">';
    if ($view == "preview") {
        if ($use_textile == 2) {
            echo $textile->TextileThis($Body);
        } else {
            if ($use_textile == 1) {
                echo nl2br($Body);
            } else {
//.........这里部分代码省略.........
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:txp_article.php


示例13: safe_delete

    if ((include txpath . DS . 'update' . DS . '_to_4.3.0.php') !== false) {
        $dbversion = '4.3.0';
    }
}
if (version_compare($dbversion, '4.4.0', '<')) {
    if ((include txpath . DS . 'update' . DS . '_to_4.4.0.php') !== false) {
        $dbversion = '4.4.0';
    }
}
if (version_compare($dbversion, '4.4.1', '<')) {
    if ((include txpath . DS . 'update' . DS . '_to_4.4.1.php') !== false) {
        $dbversion = '4.4.1';
    }
}
if (version_compare($dbversion, '4.4.2', '<')) {
    if ((include txpath . DS . 'update' . DS . '_to_4.4.2.php') !== false) {
        $dbversion = '4.4.2';
    }
}
// keep track of updates for svn users
safe_delete('txp_prefs', "name = 'dbupdatetime'");
safe_insert('txp_prefs', "prefs_id=1, name='dbupdatetime',val 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_preg_expression函数代码示例发布时间:2022-05-15
下一篇:
PHP get_preferred_from_update_core函数代码示例发布时间: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