本文整理汇总了PHP中hCell函数的典型用法代码示例。如果您正苦于以下问题:PHP hCell函数的具体用法?PHP hCell怎么用?PHP hCell使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hCell函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_list
function plugin_list($message = '')
{
pagetop(gTxt('edit_plugins'), $message);
echo n . n . startTable('edit') . tr(tda(plugin_form(), ' colspan="8" style="height: 30px; border: none;"')) . endTable();
extract(gpsa(array('sort', 'dir')));
$dir = $dir == 'desc' ? 'desc' : 'asc';
if (!in_array($sort, array('name', 'status', 'author', 'version', 'modified', 'load_order'))) {
$sort = 'name';
}
$sort_sql = $sort . ' ' . $dir;
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$rs = safe_rows_start('name, status, author, author_uri, version, description, length(help) as help, abs(strcmp(md5(code),code_md5)) as modified, load_order, flags', 'txp_plugin', '1 order by ' . $sort_sql);
if ($rs and numRows($rs) > 0) {
echo '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . startTable('list') . tr(column_head('plugin', 'name', 'plugin', true, $switch_dir, '', '', 'name' == $sort ? $dir : '') . column_head('author', 'author', 'plugin', true, $switch_dir, '', '', 'author' == $sort ? $dir : '') . column_head('version', 'version', 'plugin', true, $switch_dir, '', '', 'version' == $sort ? $dir : '') . column_head('plugin_modified', 'modified', 'plugin', true, $switch_dir, '', '', 'modified' == $sort ? $dir : '') . hCell(gTxt('description')) . column_head('active', 'status', 'plugin', true, $switch_dir, '', '', 'status' == $sort ? $dir : '') . column_head('order', 'load_order', 'plugin', true, $switch_dir, '', '', 'load_order' == $sort ? $dir : '') . hCell(gTxt('manage'), '', ' class="manage"') . hCell());
while ($a = nextRow($rs)) {
foreach ($a as $key => $value) {
${$key} = htmlspecialchars($value);
}
// Fix up the description for clean cases
$description = preg_replace(array('#<br />#', '#<(/?(a|b|i|em|strong))>#', '#<a href="(https?|\\.|\\/|ftp)([A-Za-z0-9:/?.=_]+?)">#'), array('<br />', '<$1>', '<a href="$1$2">'), $description);
$help = !empty($help) ? n . t . '<li><a href="?event=plugin' . a . 'step=plugin_help' . a . 'name=' . urlencode($name) . '">' . gTxt('help') . '</a></li>' : '';
$plugin_prefs = $flags & PLUGIN_HAS_PREFS && $status ? n . t . '<li><a href="?event=plugin_prefs.' . urlencode($name) . '">' . gTxt('plugin_prefs') . '</a></li>' : '';
echo tr(n . td($name) . td(href($author, $author_uri)) . td($version, 10) . td($modified ? gTxt('yes') : '') . td($description, 260) . td(status_link($status, $name, yes_no($status)), 30) . td($load_order) . td(n . '<ul class="plugin_manage">' . $help . n . t . '<li>' . eLink('plugin', 'plugin_edit', 'name', $name, gTxt('edit')) . '</li>' . $plugin_prefs . n . '</ul>') . td(fInput('checkbox', 'selected[]', $name), 30));
unset($name, $page, $deletelink);
}
echo tr(tda(select_buttons() . plugin_multiedit_form('', $sort, $dir, '', ''), ' colspan="10" style="text-align: right; border: none;"')) . n . endTable() . n . '</form>';
}
}
示例2: plugin_list
function plugin_list($message = '')
{
global $event;
pagetop(gTxt('tab_plugins'), $message);
echo '<h1 class="txp-heading">' . gTxt('tab_plugins') . '</h1>';
echo '<div id="' . $event . '_control" class="txp-control-panel">';
echo n . plugin_form() . n . '</div>';
extract(gpsa(array('sort', 'dir')));
if ($sort === '') {
$sort = get_pref('plugin_sort_column', 'name');
}
if ($dir === '') {
$dir = get_pref('plugin_sort_dir', 'asc');
}
$dir = $dir == 'desc' ? 'desc' : 'asc';
if (!in_array($sort, array('name', 'status', 'author', 'version', 'modified', 'load_order'))) {
$sort = 'name';
}
$sort_sql = $sort . ' ' . $dir;
set_pref('plugin_sort_column', $sort, 'plugin', 2, '', 0, PREF_PRIVATE);
set_pref('plugin_sort_dir', $dir, 'plugin', 2, '', 0, PREF_PRIVATE);
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$rs = safe_rows_start('name, status, author, author_uri, version, description, length(help) as help, abs(strcmp(md5(code),code_md5)) as modified, load_order, flags', 'txp_plugin', '1 order by ' . $sort_sql);
if ($rs and numRows($rs) > 0) {
echo n . '<div id="' . $event . '_container" class="txp-container">';
echo '<form action="index.php" id="plugin_form" class="multi_edit_form" method="post" name="longform">' . n . '<div class="txp-listtables">' . n . startTable('', '', 'txp-list') . n . '<thead>' . tr(n . hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' title="' . gTxt('toggle_all_selected') . '" class="multi-edit"') . n . column_head('plugin', 'name', 'plugin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'name') . n . column_head('author', 'author', 'plugin', true, $switch_dir, '', '', ('author' == $sort ? "{$dir} " : '') . 'author') . n . column_head('version', 'version', 'plugin', true, $switch_dir, '', '', ('version' == $sort ? "{$dir} " : '') . 'version') . n . column_head('plugin_modified', 'modified', 'plugin', true, $switch_dir, '', '', ('modified' == $sort ? "{$dir} " : '') . 'modified') . n . hCell(gTxt('description'), '', ' class="description"') . n . column_head('active', 'status', 'plugin', true, $switch_dir, '', '', ('status' == $sort ? "{$dir} " : '') . 'status') . n . column_head('order', 'load_order', 'plugin', true, $switch_dir, '', '', ('load_order' == $sort ? "{$dir} " : '') . 'load-order') . n . hCell(gTxt('manage'), '', ' class="manage actions"')) . n . '</thead>';
echo '<tbody>';
while ($a = nextRow($rs)) {
foreach ($a as $key => $value) {
${$key} = txpspecialchars($value);
}
// Fix up the description for clean cases
$description = preg_replace(array('#<br />#', '#<(/?(a|b|i|em|strong))>#', '#<a href="(https?|\\.|\\/|ftp)([A-Za-z0-9:/?.=_]+?)">#'), array('<br />', '<$1>', '<a href="$1$2">'), $description);
$help = !empty($help) ? '<a class="plugin-help" href="?event=plugin' . a . 'step=plugin_help' . a . 'name=' . urlencode($name) . '">' . gTxt('help') . '</a>' : '';
$plugin_prefs = $flags & PLUGIN_HAS_PREFS ? '<a class="plugin-prefs" href="?event=plugin_prefs.' . urlencode($name) . '">' . gTxt('plugin_prefs') . '</a>' : '';
$manage = array();
if ($help) {
$manage[] = $help;
}
if ($plugin_prefs) {
$manage[] = $plugin_prefs;
}
$manage_items = $manage ? join(tag(sp . '|' . sp, 'span'), $manage) : '-';
$edit_url = eLink('plugin', 'plugin_edit', 'name', $name, $name);
echo tr(n . td(fInput('checkbox', 'selected[]', $name), '', 'multi-edit') . td($edit_url, '', 'name') . td(href($author, $author_uri, ' rel="external"'), '', 'author') . td($version, '', 'version') . td($modified ? '<span class="warning">' . gTxt('yes') . '</span>' : '', '', 'modified') . td($description, '', 'description') . td(status_link($status, $name, yes_no($status)), '', 'status') . td($load_order, '', 'load-order') . td($manage_items, '', 'manage'), $status ? ' class="active"' : '');
unset($name, $page, $deletelink);
}
echo '</tbody>', n, endTable(), n, '</div>', n, plugin_multiedit_form('', $sort, $dir, '', ''), n, tInput(), n, '</form>', n, '</div>';
// Show/hide "Options" link by setting the appropriate class on the plugins TR
echo script_js(<<<EOS
textpattern.Relay.register('txpAsyncHref.success', function(event, data) {
\t\$(data['this']).closest('tr').toggleClass('active');
});
EOS
);
}
}
示例3: 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);
}
}
示例4: tc_shopping_cart_detail
function tc_shopping_cart_detail($atts)
{
session_start();
extract(lAtts(array('checkout_section' => 'checkout'), $atts));
$cart = $_SESSION['cart'];
if (empty($cart)) {
$cart = new bckCart();
}
if (isset($_REQUEST['empty_cart'])) {
$cart->empty_cart();
$_SESSION['cart'] = $cart;
}
$cartHTML = startTable("shopping_cart") . tr(n . hCell("Item") . n . hCell("Quantity") . n . hCell("Price") . n . hCell("Subtotal"));
foreach ($cart->items as $product) {
$image = '<img src="' . product_image_display($product['image'], "small") . '" alt="Product Detail" class="thumb"/>';
$link = "<a href='" . permlinkurl_id($product['ID']) . "' title='View product detail'>" . $product['name'] . "</a>";
$cartHTML .= tr(n . td($image . $link) . n . td($product['qty']) . n . td(_tc_price_format($product['price'])) . n . td(_tc_price_format($product['price'])));
}
$cartHTML .= endTable();
$cartHTML .= tag(tag(tag("Empty Cart", "a", " href='?empty_cart=true' class='cartAction' id='emptyCart'"), "li") . tag(tag("Continue Shopping", "a", " href='#' class='cartAction' id='continueShopping'"), "li") . tag(tag("Checkout", "a", " href='/{$checkout_section}/' class='cartAction' id='checkout'"), "li") . tag(tag(_tc_price_format($cart->total), "span", " class='cartTotal'"), "li"), "ul");
return $cartHTML;
}
示例5: 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"');
}
}
示例6: link_list
function link_list($message = '')
{
global $event, $step, $link_list_pageby, $txp_user;
pagetop(gTxt('tab_link'), $message);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('link_sort_column', 'name');
}
if ($dir === '') {
$dir = get_pref('link_sort_dir', 'asc');
}
$dir = $dir == 'desc' ? 'desc' : 'asc';
switch ($sort) {
case 'id':
$sort_sql = 'id ' . $dir;
break;
case 'description':
$sort_sql = 'description ' . $dir . ', id asc';
break;
case 'url':
$sort_sql = 'url ' . $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 = 'name';
$sort_sql = 'linksort ' . $dir . ', id asc';
break;
}
set_pref('link_sort_column', $sort, 'link', 2, '', 0, PREF_PRIVATE);
set_pref('link_sort_dir', $dir, 'link', 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('id' => "ID in ('" . join("','", do_list($crit_escaped)) . "')", 'name' => "linkname = '{$crit_escaped}'", 'description' => "description = '{$crit_escaped}'", 'url' => "url = '{$crit_escaped}'", 'category' => "category = '{$crit_escaped}'", 'author' => "author = '{$crit_escaped}'") : array('id' => "ID in ('" . join("','", do_list($crit_escaped)) . "')", 'name' => "linkname like '%{$crit_escaped}%'", 'description' => "description like '%{$crit_escaped}%'", 'url' => "url like '%{$crit_escaped}%'", 'category' => "category like '%{$crit_escaped}%'", 'author' => "author like '%{$crit_escaped}%'");
if (array_key_exists($search_method, $critsql)) {
$criteria = $critsql[$search_method];
} else {
$search_method = '';
$crit = '';
}
} else {
$search_method = '';
$crit = '';
}
$criteria .= callback_event('admin_criteria', 'link_list', 0, $criteria);
$total = getCount('txp_link', $criteria);
echo '<h1 class="txp-heading">' . gTxt('tab_link') . '</h1>';
echo '<div id="' . $event . '_control" class="txp-control-panel">';
if (has_privs('link.edit')) {
echo graf(sLink('link', 'link_edit', gTxt('add_new_link')), ' class="txp-buttons"');
}
if ($total < 1) {
if ($criteria != 1) {
echo n . link_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
} else {
echo n . graf(gTxt('no_links_recorded'), ' class="indicator"') . '</div>';
}
return;
}
$limit = max($link_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo link_search_form($crit, $search_method) . '</div>';
$rs = safe_rows_start('*, unix_timestamp(date) as uDate', 'txp_link', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
if ($rs) {
$show_authors = !has_single_author('txp_link');
echo n . '<div id="' . $event . '_container" class="txp-container">';
echo n . n . '<form action="index.php" id="links_form" class="multi_edit_form" method="post" name="longform">', n . '<div class="txp-listtables">' . 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('ID', 'id', 'link', true, $switch_dir, $crit, $search_method, ('id' == $sort ? "{$dir} " : '') . 'id') . n . column_head('link_name', 'name', 'link', true, $switch_dir, $crit, $search_method, ('name' == $sort ? "{$dir} " : '') . 'name') . n . column_head('description', 'description', 'link', true, $switch_dir, $crit, $search_method, ('description' == $sort ? "{$dir} " : '') . 'links_detail description') . n . column_head('link_category', 'category', 'link', true, $switch_dir, $crit, $search_method, ('category' == $sort ? "{$dir} " : '') . 'category') . n . column_head('url', 'url', 'link', true, $switch_dir, $crit, $search_method, ('url' == $sort ? "{$dir} " : '') . 'url') . n . column_head('date', 'date', 'link', true, $switch_dir, $crit, $search_method, ('date' == $sort ? "{$dir} " : '') . 'links_detail date created') . ($show_authors ? n . column_head('author', 'author', 'link', true, $switch_dir, $crit, $search_method, ('author' == $sort ? "{$dir} " : '') . 'author') : '')) . n . '</thead>';
echo '<tbody>';
$validator = new Validator();
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'link');
$edit_url = '?event=link' . a . 'step=link_edit' . a . 'id=' . $link_id . a . 'sort=' . $sort . a . 'dir=' . $dir . a . 'page=' . $page . a . 'search_method=' . $search_method . a . 'crit=' . $crit;
$validator->setConstraints(array(new CategoryConstraint($link_category, array('type' => 'link'))));
$vc = $validator->validate() ? '' : ' error';
$can_edit = has_privs('link.edit') || $link_author == $txp_user && has_privs('link.edit.own');
$view_url = txpspecialchars($link_url);
echo tr(n . td(fInput('checkbox', 'selected[]', $link_id), '', 'multi-edit') . n . td($can_edit ? href($link_id, $edit_url, ' title="' . gTxt('edit') . '"') : $link_id, '', 'id') . td($can_edit ? href(txpspecialchars($link_linkname), $edit_url, ' title="' . gTxt('edit') . '"') : txpspecialchars($link_linkname), '', 'name') . td(txpspecialchars($link_description), '', 'links_detail description') . td('<span title="' . txpspecialchars(fetch_category_title($link_category, 'link')) . '">' . $link_category . '</span>', '', 'category' . $vc) . td('<a rel="external" target="_blank" href="' . $view_url . '">' . $view_url . '</a>', '', 'url') . td(gTime($link_uDate), '', 'links_detail date created') . ($show_authors ? td('<span title="' . txpspecialchars(get_author_name($link_author)) . '">' . txpspecialchars($link_author) . '</span>', '', 'author') : ''));
}
echo '</tbody>', n, endTable(), n, '</div>', n, link_multiedit_form($page, $sort, $dir, $crit, $search_method), n, tInput(), n, '</form>', n, graf(toggle_box('links_detail'), ' class="detail-toggle"'), n, '<div id="' . $event . '_navigation" class="txp-navigation">', n, nav_form('link', $page, $numPages, $sort, $dir, $crit, $search_method, $total, $limit), n, pageby_form('link', $link_list_pageby), n, '</div>', n, '</div>';
}
}
示例7: sec_section_list
/**
* The main panel listing all sections.
*
* So-named to avoid clashing with the <txp:section_list /> tag.
*
* @param string|array $message The activity message
*/
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', 'name');
} else {
if (!in_array($sort, array('title', 'page', 'css', 'in_rss', 'on_frontpage', 'searchable', 'article_count'))) {
$sort = 'name';
}
set_pref('section_sort_column', $sort, 'section', 2, '', 0, PREF_PRIVATE);
}
if ($dir === '') {
$dir = get_pref('section_sort_dir', 'desc');
} else {
$dir = $dir == 'asc' ? "asc" : "desc";
set_pref('section_sort_dir', $dir, 'section', 2, '', 0, PREF_PRIVATE);
}
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;
}
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$search = new Filter($event, array('name' => array('column' => 'txp_section.name', 'label' => gTxt('name')), 'title' => array('column' => 'txp_section.title', 'label' => gTxt('title')), 'page' => array('column' => 'txp_section.page', 'label' => gTxt('page')), 'css' => array('column' => 'txp_section.css', 'label' => gTxt('css')), 'on_frontpage' => array('column' => 'txp_section.on_frontpage', 'label' => gTxt('on_front_page'), 'type' => 'boolean'), 'in_rss' => array('column' => 'txp_section.in_rss', 'label' => gTxt('syndicate'), 'type' => 'boolean'), 'searchable' => array('column' => 'txp_section.searchable', 'label' => gTxt('include_in_search'), 'type' => 'boolean')));
$alias_yes = '1, Yes';
$alias_no = '0, No';
$search->setAliases('on_frontpage', array($alias_no, $alias_yes));
$search->setAliases('in_rss', array($alias_no, $alias_yes));
$search->setAliases('searchable', array($alias_no, $alias_yes));
list($criteria, $crit, $search_method) = $search->getFilter();
$search_render_options = array('placeholder' => 'search_sections');
$total = safe_count('txp_section', $criteria);
echo n . tag(hed(gTxt('tab_sections'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1'));
$searchBlock = n . tag($search->renderForm('sec_section', $search_render_options), 'div', array('class' => 'txp-layout-2col-cell-2', 'id' => $event . '_control'));
$createBlock = array();
if (has_privs('section.edit')) {
$createBlock[] = n . tag(sLink('section', 'section_edit', gTxt('create_section'), 'txp-button') . n . tag_start('form', array('class' => 'async', 'id' => 'default_section_form', 'name' => 'default_section_form', 'method' => 'post', 'action' => 'index.php')) . tag(gTxt('default_write_section'), 'label', array('for' => 'default_section')) . popHelp('section_default') . section_select_list() . eInput('section') . sInput('section_set_default') . n . tag_end('form'), 'div', array('class' => 'txp-control-panel'));
}
$contentBlockStart = n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => $event . '_container'));
$createBlock = implode(n, $createBlock);
if ($total < 1) {
if ($criteria != 1) {
echo $searchBlock . $contentBlockStart . $createBlock . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_results_found'), array('class' => 'alert-block information')) . n . tag_end('div');
}
return;
}
$limit = max($section_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo $searchBlock . $contentBlockStart . $createBlock;
$rs = safe_rows_start("*, (SELECT COUNT(*) FROM " . safe_pfx_j('textpattern') . " WHERE textpattern.Section = txp_section.name) AS article_count", 'txp_section', "{$criteria} ORDER BY {$sort_sql} LIMIT {$offset}, {$limit}");
if ($rs) {
echo n . tag(toggle_box('section_detail'), 'div', array('class' => 'txp-list-options')) . n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'section_form', 'name' => 'longform', 'method' => 'post', 'action' => 'index.php')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' class="txp-list-col-multi-edit" scope="col" title="' . gTxt('toggle_all_selected') . '"') . column_head('name', 'name', 'section', true, $switch_dir, $crit, $search_method, ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-name') . column_head('title', 'title', 'section', true, $switch_dir, $crit, $search_method, ('title' == $sort ? "{$dir} " : '') . 'txp-list-col-title') . column_head('page', 'page', 'section', true, $switch_dir, $crit, $search_method, ('page' == $sort ? "{$dir} " : '') . 'txp-list-col-page') . column_head('css', 'css', 'section', true, $switch_dir, $crit, $search_method, ('css' == $sort ? "{$dir} " : '') . 'txp-list-col-style') . column_head('on_front_page', 'on_frontpage', 'section', true, $switch_dir, $crit, $search_method, ('on_frontpage' == $sort ? "{$dir} " : '') . 'txp-list-col-frontpage section_detail') . column_head('syndicate', 'in_rss', 'section', true, $switch_dir, $crit, $search_method, ('in_rss' == $sort ? "{$dir} " : '') . 'txp-list-col-syndicate section_detail') . column_head('include_in_search', 'searchable', 'section', true, $switch_dir, $crit, $search_method, ('searchable' == $sort ? "{$dir} " : '') . 'txp-list-col-searchable section_detail') . column_head('articles', 'article_count', 'section', true, $switch_dir, $crit, $search_method, ('article_count' == $sort ? "{$dir} " : '') . 'txp-list-col-article_count section_detail')) . n . tag_end('thead') . n . tag_start('tbody');
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'sec');
$edit_url = array('event' => 'section', 'step' => 'section_edit', 'name' => $sec_name, 'sort' => $sort, 'dir' => $dir, 'page' => $page, 'search_method' => $search_method, 'crit' => $crit);
if ($sec_name == 'default') {
$articles = $sec_searchable = $sec_in_rss = $sec_on_frontpage = '-';
} else {
$sec_on_frontpage = asyncHref(yes_no($sec_on_frontpage), array('step' => 'section_toggle_option', 'thing' => $sec_name, 'property' => 'on_frontpage'));
$sec_in_rss = asyncHref(yes_no($sec_in_rss), array('step' => 'section_toggle_option', 'thing' => $sec_name, 'property' => 'in_rss'));
$sec_searchable = asyncHref(yes_no($sec_searchable), array('step' => 'section_toggle_option', 'thing' => $sec_name, 'property' => 'searchable'));
if ($sec_article_count > 0) {
$articles = href($sec_article_count, array('event' => 'list', 'search_method' => 'section', 'crit' => '"' . $sec_name . '"'), array('title' => gTxt('article_count', array('{num}' => $sec_article_count))));
} else {
$articles = 0;
}
}
$sec_page = href(txpspecialchars($sec_page), array('event' => 'page', 'name' => $sec_page), array('title' => gTxt('edit')));
$sec_css = href(txpspecialchars($sec_css), array('event' => 'css', 'name' => $sec_css), array('title' => gTxt('edit')));
echo tr(td(fInput('checkbox', 'selected[]', $sec_name), '', 'txp-list-col-multi-edit') . hCell(href(txpspecialchars($sec_name), $edit_url, array('title' => gTxt('edit'))) . span(sp . span('|', array('role' => 'separator')) . sp . href(gTxt('view'), pagelinkurl(array('s' => $sec_name))), array('class' => 'txp-option-link section_detail')), '', array('class' => 'txp-list-col-name', 'scope' => 'row')) . td(txpspecialchars($sec_title), '', 'txp-list-col-title') . td($sec_page, '', 'txp-list-col-page') . td($sec_css, '', 'txp-list-col-style') . td($sec_on_frontpage, '', 'txp-list-col-frontpage section_detail') . td($sec_in_rss, '', 'txp-list-col-syndicate section_detail') . td($sec_searchable, '', 'txp-list-col-searchable section_detail') . td($articles, '', 'txp-list-col-article_count section_detail'), array('id' => 'txp_section_' . $sec_name));
//.........这里部分代码省略.........
示例8: ipban_list
function ipban_list($message = '')
{
pageTop(gTxt('list_banned_ips'), $message);
$rs = safe_rows_start("*", "txp_discuss_ipban", "1 order by date_banned desc");
if ($rs) {
echo startTable('list'), tr(hCell('Date banned') . hCell('ip') . hCell('Name used') . hCell('Banned for') . td());
while ($a = nextRow($rs)) {
extract($a);
$unbanlink = '<a href="?event=discuss' . a . 'step=ipban_unban' . a . 'ip=' . $ip . '">unban</a>';
$datebanned = date("Y-m-d", strtotime($date_banned));
$messagelink = '<a href="?event=discuss' . a . 'step=discuss_edit' . a . 'discussid=' . $banned_on_message . '">' . $banned_on_message . '</a>';
echo tr(td($datebanned) . td($ip) . td($name_used) . td($messagelink) . td($unbanlink));
}
echo endTable();
} else {
echo graf(gTxt('no_ips_banned'), ' align="center"');
}
}
示例9: file_list
function file_list($message = '')
{
global $txpcfg, $extensions, $file_base_path, $file_statuses, $file_list_pageby;
pagetop(gTxt('file'), $message);
extract($txpcfg);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if (!is_dir($file_base_path) or !is_writeable($file_base_path)) {
echo graf(gTxt('file_dir_not_writeable', array('{filedir}' => $file_base_path)), ' id="warning"');
} else {
$existing_files = get_filenames();
if (count($existing_files) > 0) {
echo form(eInput('file') . sInput('file_create') . graf(gTxt('existing_file') . sp . selectInput('filename', $existing_files, '', 1) . sp . fInput('submit', '', gTxt('Create'), 'smallerbox')), 'text-align: center;');
}
echo file_upload_form(gTxt('upload_file'), 'upload', 'file_insert');
}
$dir = $dir == 'desc' ? 'desc' : 'asc';
switch ($sort) {
case 'id':
$sort_sql = 'id ' . $dir;
break;
case 'description':
$sort_sql = 'description ' . $dir . ', filename desc';
break;
case 'category':
$sort_sql = 'category ' . $dir . ', filename desc';
break;
case 'downloads':
$sort_sql = 'downloads ' . $dir . ', filename desc';
break;
default:
$sort = 'filename';
$sort_sql = 'filename ' . $dir;
break;
}
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$criteria = 1;
if ($search_method and $crit) {
$crit_escaped = doSlash($crit);
$critsql = array('id' => "ID in ('" . join("','", do_list($crit_escaped)) . "')", 'filename' => "filename like '%{$crit_escaped}%'", 'description' => "description like '%{$crit_escaped}%'", 'category' => "category 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_file', "{$criteria}");
if ($total < 1) {
if ($criteria != 1) {
echo n . file_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' class="indicator"');
} else {
echo n . graf(gTxt('no_files_recorded'), ' class="indicator"');
}
return;
}
$limit = max($file_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo file_search_form($crit, $search_method);
$rs = safe_rows_start('*', 'txp_file', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
if ($rs) {
echo '<form name="longform" method="post" action="index.php" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . startTable('list') . tr(column_head('ID', 'id', 'file', true, $switch_dir, $crit, $search_method, 'id' == $sort ? $dir : '') . hCell() . column_head('file_name', 'filename', 'file', true, $switch_dir, $crit, $search_method, 'filename' == $sort ? $dir : '') . column_head('description', 'description', 'file', true, $switch_dir, $crit, $search_method, 'description' == $sort ? $dir : '') . column_head('file_category', 'category', 'file', true, $switch_dir, $crit, $search_method, 'category' == $sort ? $dir : '') . hCell(gTxt('tags')) . hCell(gTxt('status')) . hCell(gTxt('condition')) . column_head('downloads', 'downloads', 'file', true, $switch_dir, $crit, $search_method, 'downloads' == $sort ? $dir : '') . hCell());
while ($a = nextRow($rs)) {
extract($a);
$edit_url = '?event=file' . a . 'step=file_edit' . a . 'id=' . $id . a . 'sort=' . $sort . a . 'dir=' . $dir . a . 'page=' . $page . a . 'search_method=' . $search_method . a . 'crit=' . $crit;
$file_exists = file_exists(build_file_path($file_base_path, $filename));
$download_link = $file_exists ? '<li>' . make_download_link($id, '', $filename) . '</li>' : '';
$category = $category ? '<span title="' . htmlspecialchars(fetch_category_title($category, 'file')) . '">' . $category . '</span>' : '';
$tag_url = '?event=tag' . a . 'tag_name=file_download_link' . a . 'id=' . $id . a . 'description=' . urlencode($description) . a . 'filename=' . urlencode($filename);
$condition = '<span class="';
$condition .= $file_exists ? 'ok' : 'not-ok';
$condition .= '">';
$condition .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
$condition .= '</span>';
echo tr(n . td($id) . td('<ul>' . '<li>' . href(gTxt('edit'), $edit_url) . '</li>' . $download_link . '</ul>', 65) . td(href(htmlspecialchars($filename), $edit_url), 125) . td(htmlspecialchars($description), 150) . td($category, 90) . td(n . '<ul>' . n . t . '<li><a target="_blank" href="' . $tag_url . a . 'type=textile" onclick="popWin(this.href, 400, 250); return false;">Textile</a></li>' . n . t . '<li><a target="_blank" href="' . $tag_url . a . 'type=textpattern" onclick="popWin(this.href, 400, 250); return false;">Textpattern</a></li>' . n . t . '<li><a target="_blank" href="' . $tag_url . a . 'type=xhtml" onclick="popWin(this.href, 400, 250); return false;">XHTML</a></li>' . n . '</ul>', 75) . td($file_statuses[$status], 45) . td($condition, 45) . td($downloads == '0' ? gTxt('none') : $downloads, 25) . td(fInput('checkbox', 'selected[]', $id), 10));
}
echo tr(tda(select_buttons() . file_multiedit_form($page, $sort, $dir, $crit, $search_method), ' colspan="10" style="text-align: right; border: none;"')) . endTable() . '</form>' . nav_form('file', $page, $numPages, $sort, $dir, $crit, $search_method) . pageby_form('file', $file_list_pageby);
}
}
示例10: log_list
function log_list($message = '')
{
global $event, $log_list_pageby, $expire_logs_after;
pagetop(gTxt('visitor_logs'), $message);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('log_sort_column', 'time');
}
if ($dir === '') {
$dir = get_pref('log_sort_dir', 'desc');
}
$dir = $dir == 'asc' ? 'asc' : 'desc';
$expire_logs_after = assert_int($expire_logs_after);
safe_delete('txp_log', "time < date_sub(now(), interval {$expire_logs_after} day)");
switch ($sort) {
case 'ip':
$sort_sql = 'ip ' . $dir;
break;
case 'host':
$sort_sql = 'host ' . $dir;
break;
case 'page':
$sort_sql = 'page ' . $dir;
break;
case 'refer':
$sort_sql = 'refer ' . $dir;
break;
case 'method':
$sort_sql = 'method ' . $dir;
break;
case 'status':
$sort_sql = 'status ' . $dir;
break;
default:
$sort = 'time';
$sort_sql = 'time ' . $dir;
break;
}
set_pref('log_sort_column', $sort, 'log', 2, '', 0, PREF_PRIVATE);
set_pref('log_sort_dir', $dir, 'log', 2, '', 0, PREF_PRIVATE);
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$criteria = 1;
if ($search_method and $crit) {
$crit_escaped = doSlash(str_replace(array('\\', '%', '_', '\''), array('\\\\', '\\%', '\\_', '\\\''), $crit));
$critsql = array('ip' => "ip like '%{$crit_escaped}%'", 'host' => "host like '%{$crit_escaped}%'", 'page' => "page like '%{$crit_escaped}%'", 'refer' => "refer like '%{$crit_escaped}%'", 'method' => "method like '%{$crit_escaped}%'", 'status' => "status 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_log', "{$criteria}");
echo '<div id="' . $event . '_control" class="txp-control-panel">';
if ($total < 1) {
if ($criteria != 1) {
echo n . log_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
} else {
echo graf(gTxt('no_refers_recorded'), ' class="indicator"') . '</div>';
}
return;
}
$limit = max($log_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo n . log_search_form($crit, $search_method) . '</div>';
$rs = safe_rows_start('*, unix_timestamp(time) as uTime', 'txp_log', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
if ($rs) {
echo n . '<div id="' . $event . '_container" class="txp-container txp-list">';
echo n . n . '<form action="index.php" id="log_form" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . startTable('list', '', 'list', '', '90%') . n . '<thead>' . n . tr(n . column_head('time', 'time', 'log', true, $switch_dir, $crit, $search_method, ('time' == $sort ? "{$dir} " : '') . 'date time') . column_head('IP', 'ip', 'log', true, $switch_dir, $crit, $search_method, ('ip' == $sort ? "{$dir} " : '') . 'log_detail ip') . column_head('host', 'host', 'log', true, $switch_dir, $crit, $search_method, ('host' == $sort ? "{$dir} " : '') . 'host') . column_head('page', 'page', 'log', true, $switch_dir, $crit, $search_method, ('page' == $sort ? "{$dir} " : '') . 'page') . column_head('referrer', 'refer', 'log', true, $switch_dir, $crit, $search_method, ('refer' == $sort ? "{$dir} " : '') . 'refer') . column_head('method', 'method', 'log', true, $switch_dir, $crit, $search_method, ('method' == $sort ? "{$dir} " : '') . 'log_detail method') . column_head('status', 'status', 'log', true, $switch_dir, $crit, $search_method, ('status' == $sort ? "{$dir} " : '') . 'log_detail status') . hCell('', '', ' class="multi-edit"')) . n . '</thead>';
$tfoot = n . '<tfoot>' . tr(tda(toggle_box('log_detail'), ' class="detail-toggle" colspan="2" style="text-align: left; border: none;"') . tda(select_buttons() . log_multiedit_form($page, $sort, $dir, $crit, $search_method), ' class="multi-edit" colspan="6" style="text-align: right; border: none;"')) . n . '</tfoot>';
echo $tfoot;
echo '<tbody>';
$ctr = 1;
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'log');
if ($log_refer) {
$log_refer = 'http://' . $log_refer;
$log_refer = '<a href="' . htmlspecialchars($log_refer) . '" target="_blank">' . htmlspecialchars(soft_wrap($log_refer, 30)) . '</a>';
}
if ($log_page) {
$log_anchor = preg_replace('/\\/$/', '', $log_page);
$log_anchor = soft_wrap(substr($log_anchor, 1), 30);
$log_page = '<a href="' . htmlspecialchars($log_page) . '" target="_blank">' . htmlspecialchars($log_anchor) . '</a>';
if ($log_method == 'POST') {
$log_page = '<strong>' . $log_page . '</strong>';
}
}
echo tr(n . td(gTime($log_uTime), 85, 'date time') . td($log_ip, 20, 'log_detail ip') . td(soft_wrap($log_host, 30), '', 'host') . td($log_page, '', 'page') . td($log_refer, '', 'refer') . td(htmlspecialchars($log_method), 60, 'log_detail method') . td($log_status, 60, 'log_detail status') . td(fInput('checkbox', 'selected[]', $log_id), '', 'multi-edit'), ' class="' . ($ctr % 2 == 0 ? 'even' : 'odd') . '"');
$ctr++;
}
echo '</tbody>' . n . endTable() . n . '</form>' . n . '<div id="' . $event . '_navigation" class="txp-navigation">' . n . nav_form('log', $page, $numPages, $sort, $dir, $crit, $search_method, $total, $limit) . n . pageby_form('log', $log_list_pageby) . n . '</div>' . n . '</div>';
}
}
示例11: log_list
function log_list($message = '')
{
pagetop(gTxt('visitor_logs'), $message);
extract(get_prefs());
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
$expire_logs_after = assert_int($expire_logs_after);
safe_delete('txp_log', "time < date_sub(now(), interval {$expire_logs_after} day)");
$dir = $dir == 'asc' ? 'asc' : 'desc';
switch ($sort) {
case 'ip':
$sort_sql = 'ip ' . $dir;
break;
case 'host':
$sort_sql = 'host ' . $dir;
break;
case 'page':
$sort_sql = 'page ' . $dir;
break;
case 'refer':
$sort_sql = 'refer ' . $dir;
break;
case 'method':
$sort_sql = 'method ' . $dir;
break;
case 'status':
$sort_sql = 'status ' . $dir;
break;
default:
$sort = 'time';
$sort_sql = 'time ' . $dir;
break;
}
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$criteria = 1;
if ($search_method and $crit) {
$crit_escaped = doSlash($crit);
$critsql = array('ip' => "ip like '%{$crit_escaped}%'", 'host' => "host like '%{$crit_escaped}%'", 'page' => "page like '%{$crit_escaped}%'", 'refer' => "refer like '%{$crit_escaped}%'", 'method' => "method like '%{$crit_escaped}%'", 'status' => "status 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_log', "{$criteria}");
if ($total < 1) {
if ($criteria != 1) {
echo n . log_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' style="text-align: center;"');
} else {
echo graf(gTxt('no_refers_recorded'), ' style="text-align: center;"');
}
return;
}
$limit = max(@$log_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo n . log_search_form($crit, $search_method);
$rs = safe_rows_start('*, unix_timestamp(time) as uTime', 'txp_log', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
if ($rs) {
echo n . n . '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . startTable('list', '', '', '', '90%') . n . tr(n . column_head('time', 'time', 'log', true, $switch_dir, $crit, $search_method, 'time' == $sort ? $dir : '') . column_head('IP', 'ip', 'log', true, $switch_dir, $crit, $search_method, ('ip' == $sort ? "{$dir} " : '') . 'log_detail') . column_head('host', 'host', 'log', true, $switch_dir, $crit, $search_method, 'host' == $sort ? $dir : '') . column_head('page', 'page', 'log', true, $switch_dir, $crit, $search_method, 'page' == $sort ? $dir : '') . column_head('referrer', 'refer', 'log', true, $switch_dir, $crit, $search_method, 'refer' == $sort ? $dir : '') . column_head('method', 'method', 'log', true, $switch_dir, $crit, $search_method, ('method' == $sort ? "{$dir} " : '') . 'log_detail') . column_head('status', 'status', 'log', true, $switch_dir, $crit, $search_method, ('status' == $sort ? "{$dir} " : '') . 'log_detail') . hCell());
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'log');
if ($log_refer) {
$log_refer = htmlspecialchars('http://' . $log_refer);
$log_refer = '<a href="' . $log_refer . '" target="_blank">' . soft_wrap($log_refer, 30) . '</a>';
}
if ($log_page) {
$log_page = htmlspecialchars($log_page);
$log_page = '<a href="' . $log_page . '" target="_blank">' . soft_wrap(preg_replace('/\\/$/', '', substr($log_page, 1)), 30) . '</a>';
if ($log_method == 'POST') {
$log_page = '<strong>' . $log_page . '</strong>';
}
}
echo tr(n . td(gTime($log_uTime), 85) . td($log_ip, 20, 'log_detail') . td(soft_wrap($log_host, 30)) . td($log_page) . td($log_refer) . td($log_method, 60, 'log_detail') . td($log_status, 60, 'log_detail') . td(fInput('checkbox', 'selected[]', $log_id)));
}
echo n . n . tr(tda(toggle_box('log_detail'), ' colspan="2" style="text-align: left; border: none;"') . tda(select_buttons() . log_multiedit_form($page, $sort, $dir, $crit, $search_method), ' colspan="6" style="text-align: right; border: none;"')) . n . endTable() . '</form>' . n . nav_form('log', $page, $numPages, $sort, $dir, $crit, $search_method) . n . pageby_form('log', $log_list_pageby);
}
}
示例12: ign_userList
function ign_userList()
{
global $myprivs, $ign_user, $ign_user_db, $prefs, $ign_privs;
$allow_edit = in_array($myprivs, explode(',', $ign_privs['edit_users'])) ? true : false;
if (version_compare($prefs['version'], '4.0.4') < 0) {
ign_add_paging();
}
//pagination code
$total = safe_count($ign_user_db, '1');
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method', 'last_access')));
$limit = 25;
$dir = $dir == 'desc' ? 'desc' : 'asc';
switch ($sort) {
case 'name':
$sort_by = 'name';
break;
case 'email':
$sort_by = 'email';
break;
case 'privs':
$sort_by = 'privs';
break;
case 'last_access':
$sort_by = 'last_access';
break;
case 'realname':
default:
$sort_by = 'realname';
break;
}
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$criteria = 1;
list($page, $offset, $numPages) = pager($total, $limit, $page);
//build search here
//TODO: Implement search on user name / real name
$rs = safe_rows_start("*", $ign_user_db, "{$criteria} order by {$sort_by} {$dir} limit {$offset}, {$limit}");
$out[] = hed(ign_gTxt('users'), 3, ' align="center"');
$out[] = startTable('list');
$out[] = tr(hCell(href(gTxt('real_name'), "index.php?event=ign_user_mgmt&step=list&page={$page}&dir={$switch_dir}&sort=real_name")) . hCell(href(gTxt('login_name'), "index.php?event=ign_user_mgmt&step=list&page={$page}&dir={$switch_dir}&sort=name")) . hCell(href(ucfirst(gTxt('email')), "index.php?event=ign_user_mgmt&step=list&page={$page}&dir={$switch_dir}&sort=email")) . hCell(href(gTxt('privileges'), "index.php?event=ign_user_mgmt&step=list&page={$page}&dir={$switch_dir}&sort=privs")) . td() . td() . hCell(href(gTxt('last_access'), "index.php?event=ign_user_mgmt&step=list&page={$page}&dir={$switch_dir}&sort=last_access")));
if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
if ($name == $ign_user) {
$deletelink = '';
} else {
$deletelink = dLink('ign_user_mgmt', 'ign_user_delete', 'user_id', $user_id);
}
$savelink = fInput("submit", 'save', gTxt('save'), 'smallerbox');
$emailhref = '<a href="mailto:' . $email . '">' . $email . '</a>';
$RealNameInput = fInput('text', 'RealName', $RealName, 'edit');
$emailInput = fInput('text', 'email', $email, 'edit');
$row[] = '<form action="index.php" method="post">';
$row[] = $allow_edit ? td($RealNameInput) : td($RealName);
$row[] = td($name);
$row[] = $allow_edit ? td($emailInput) : td($emailhref);
$row[] = $allow_edit ? td(ign_privList($privs) . popHelp("about_privileges")) : td(ign_getPrivLevel($privs) . popHelp("about_privileges"));
$row[] = $allow_edit ? td($savelink) : '';
$row[] = $allow_edit ? hInput("user_id", $user_id) . eInput("ign_user_mgmt") . sInput('ign_userSave') : td();
$row[] = '</form>';
$row[] = $allow_edit ? td($deletelink, 10) : td();
//clean up last_access
if ($last_access == 0) {
$last_access = 'Never';
}
$row[] = td($last_access);
$out[] = tr(join('', $row));
unset($row);
}
$out[] = endTable();
$out[] = nav_form('ign_user_mgmt', $page, $numPages, $sort, 'asc', '1', '1');
return join('', $out);
}
}
示例13: author_list
function author_list()
{
global $txp_user;
echo n . n . hed(gTxt('authors'), 3, ' style="text-align: center;"') . n . n . startTable('list') . n . tr(n . hCell(gTxt('real_name')) . n . hCell(gTxt('login_name')) . n . hCell(gTxt('email')) . n . hCell(gTxt('privileges')) . n . hCell() . n . hCell());
$rs = safe_rows_start('*', 'txp_users', '1 = 1 order by name asc');
if ($rs) {
if (has_privs('admin.edit')) {
while ($a = nextRow($rs)) {
extract($a);
echo n . n . '<tr>' . n . '<form method="post" action="index.php">' . n . td(fInput('text', 'RealName', $RealName, 'edit')) . td(htmlspecialchars($name)) . td(fInput('text', 'email', $email, 'edit'));
if ($name != $txp_user) {
echo td(privs($privs) . sp . popHelp('about_privileges'));
} else {
echo td(get_priv_level($privs) . sp . popHelp('about_privileges') . hInput('privs', $privs));
}
echo td(fInput('submit', 'save', gTxt('save'), 'smallerbox')) . n . hInput('user_id', $user_id) . n . eInput('admin') . n . sInput('author_save') . n . '</form>';
if ($name != $txp_user) {
echo td(dLink('admin', 'author_delete', 'user_id', $user_id));
} else {
echo td();
}
echo n . '</tr>';
}
} else {
while ($a = nextRow($rs)) {
extract(doSpecial($a));
echo tr(td($RealName) . td($name) . td('<a href="mailto:' . $email . '">' . $email . '</a>') . td(get_priv_level($privs) . sp . popHelp('about_privileges') . hInput('privs', $privs)) . td() . td());
}
}
echo n . endTable();
}
}
示例14: link_list
function link_list($message = '')
{
global $step, $link_list_pageby;
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
$dir = $dir == 'desc' ? 'desc' : 'asc';
switch ($sort) {
case 'id':
$sort_sql = 'id ' . $dir;
break;
case 'description':
$sort_sql = 'description ' . $dir . ', id asc';
break;
case 'category':
$sort_sql = 'category ' . $dir . ', id asc';
break;
case 'date':
$sort_sql = 'date ' . $dir . ', id asc';
break;
default:
$sort = 'name';
$sort_sql = 'linksort ' . $dir . ', id asc';
break;
}
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$criteria = 1;
if ($search_method and $crit) {
$crit_escaped = doSlash($crit);
$critsql = array('id' => "ID in ('" . join("','", do_list($crit_escaped)) . "')", 'name' => "linkname like '%{$crit_escaped}%'", 'description' => "description like '%{$crit_escaped}%'", 'category' => "category like '%{$crit_escaped}%'");
if (array_key_exists($search_method, $critsql)) {
$criteria = $critsql[$search_method];
} else {
$search_method = '';
$crit = '';
}
} else {
$search_method = '';
$crit = '';
}
$total = getCount('txp_link', $criteria);
if ($total < 1) {
if ($criteria != 1) {
echo n . link_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' class="indicator"');
} else {
echo n . graf(gTxt('no_links_recorded'), ' class="indicator"');
}
return;
}
$limit = max($link_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo link_search_form($crit, $search_method);
$rs = safe_rows_start('*, unix_timestamp(date) as uDate', 'txp_link', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
if ($rs) {
echo n . n . '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list') . n . tr(column_head('ID', 'id', 'link', true, $switch_dir, $crit, $search_method, 'id' == $sort ? $dir : '') . hCell() . column_head('link_name', 'name', 'link', true, $switch_dir, $crit, $search_method, 'name' == $sort ? $dir : '') . column_head('description', 'description', 'link', true, $switch_dir, $crit, $search_method, 'description' == $sort ? $dir : '') . column_head('link_category', 'category', 'link', true, $switch_dir, $crit, $search_method, 'category' == $sort ? $dir : '') . column_head('date', 'date', 'link', true, $switch_dir, $crit, $search_method, 'date' == $sort ? $dir : '') . hCell());
while ($a = nextRow($rs)) {
extract($a);
$edit_url = '?event=link' . a . 'step=link_edit' . a . 'id=' . $id . a . 'sort=' . $sort . a . 'dir=' . $dir . a . 'page=' . $page . a . 'search_method=' . $search_method . a . 'crit=' . $crit;
echo tr(n . td($id, 20) . td(n . '<ul>' . n . t . '<li>' . href(gTxt('edit'), $edit_url) . '</li>' . n . t . '<li>' . href(gTxt('view'), $url) . '</li>' . n . '</ul>', 35) . td(href(htmlspecialchars($linkname), $edit_url), 125) . td(htmlspecialchars($description), 150) . td('<span title="' . htmlspecialchars(fetch_category_title($category, 'link')) . '">' . $category . '</span>', 125) . td(gTime($uDate), 75) . td(fInput('checkbox', 'selected[]', $id)));
}
echo n . n . tr(tda(select_buttons() . link_multiedit_form($page, $sort, $dir, $crit, $search_method), ' colspan="7" style="text-align: right; border: none;"')) . endTable() . '</form>' . n . nav_form('link', $page, $numPages, $sort, $dir, $crit, $search_method, $total, $limit) . pageby_form('link', $link_list_pageby);
}
}
示例15: author_list
function author_list()
{
global $txp_user, $author_list_pageby;
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if (!in_array($sort, array('name', 'RealName', 'email', 'privs', 'last_login'))) {
$sort = 'name';
}
$dir = $dir == 'desc' ? 'desc' : 'asc';
$sort_sql = $sort . ' ' . $dir;
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$total = getCount('txp_users', '1=1');
$limit = max($author_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
$rs = safe_rows_start('*, unix_timestamp(last_access) as last_login', 'txp_users', '1 = 1 order by ' . $sort_sql . ' limit ' . $offset . ', ' . $limit);
if ($rs) {
echo '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . startTable('list') . tr(column_head('login_name', 'name', 'admin', true, $switch_dir, '', '', 'name' == $sort ? $dir : '') . column_head('real_name', 'RealName', 'admin', true, $switch_dir, '', '', 'RealName' == $sort ? $dir : '') . column_head('email', 'email', 'admin', true, $switch_dir, '', '', 'email' == $sort ? $dir : '') . column_head('privileges', 'privs', 'admin', true, $switch_dir, '', '', 'privs' == $sort ? $dir : '') . column_head('last_login', 'last_login', 'admin', true, $switch_dir, '', '', 'last_login' == $sort ? $dir : '') . hCell() . hCell());
while ($a = nextRow($rs)) {
extract(doSpecial($a));
echo tr(td($name) . td($RealName) . td('<a href="mailto:' . $email . '">' . $email . '</a>') . td(get_priv_level($privs)) . td($last_login ? safe_strftime('%b %Y', $last_login) : '') . td(has_privs('admin.edit') ? eLink('admin', 'author_edit', 'user_id', $user_id, gTxt('edit')) : '') . td((has_privs('admin.edit') and $txp_user != $a['name']) ? fInput('checkbox', 'selected[]', $a['name']) : ''));
}
echo n . n . tr(tda(select_buttons() . author_multiedit_form($page, $sort, $dir, $crit, $search_method), ' colspan="6" style="text-align: right; border: none;"')) . endTable() . '</form>' . nav_form('admin', $page, $numPages, $sort, $dir, $crit, $search_method) . pageby_form('admin', $author_list_pageby);
}
}