本文整理汇总了PHP中tag_start函数的典型用法代码示例。如果您正苦于以下问题:PHP tag_start函数的具体用法?PHP tag_start怎么用?PHP tag_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tag_start函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: plugin_list
/**
* The main panel listing all installed plugins.
*
* @param string|array $message The activity message
*/
function plugin_list($message = '')
{
global $event;
pagetop(gTxt('tab_plugins'), $message);
extract(gpsa(array('sort', 'dir')));
if ($sort === '') {
$sort = get_pref('plugin_sort_column', 'name');
} else {
if (!in_array($sort, array('name', 'status', 'author', 'version', 'modified', 'load_order'))) {
$sort = 'name';
}
set_pref('plugin_sort_column', $sort, 'plugin', 2, '', 0, PREF_PRIVATE);
}
if ($dir === '') {
$dir = get_pref('plugin_sort_dir', 'asc');
} else {
$dir = $dir == 'desc' ? "desc" : "asc";
set_pref('plugin_sort_dir', $dir, 'plugin', 2, '', 0, PREF_PRIVATE);
}
$sort_sql = "{$sort} {$dir}";
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
echo n . tag(hed(gTxt('tab_plugins'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1')) . n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => $event . '_container')) . n . tag(plugin_form(), 'div', array('class' => 'txp-control-panel'));
$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 = 1 ORDER BY {$sort_sql}");
if ($rs and numRows($rs) > 0) {
echo n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'plugin_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('plugin', 'name', 'plugin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-name') . column_head('author', 'author', 'plugin', true, $switch_dir, '', '', ('author' == $sort ? "{$dir} " : '') . 'txp-list-col-author') . column_head('version', 'version', 'plugin', true, $switch_dir, '', '', ('version' == $sort ? "{$dir} " : '') . 'txp-list-col-version') . column_head('plugin_modified', 'modified', 'plugin', true, $switch_dir, '', '', ('modified' == $sort ? "{$dir} " : '') . 'txp-list-col-modified') . hCell(gTxt('description'), '', ' class="txp-list-col-description" scope="col"') . column_head('active', 'status', 'plugin', true, $switch_dir, '', '', ('status' == $sort ? "{$dir} " : '') . 'txp-list-col-status') . column_head('order', 'load_order', 'plugin', true, $switch_dir, '', '', ('load_order' == $sort ? "{$dir} " : '') . 'txp-list-col-load-order') . hCell(gTxt('manage'), '', ' class="txp-list-col-manage" scope="col"')) . n . tag_end('thead') . n . tag_start('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);
if (!empty($help)) {
$help = href(gTxt('help'), array('event' => 'plugin', 'step' => 'plugin_help', 'name' => $name), array('class' => 'plugin-help'));
}
if ($flags & PLUGIN_HAS_PREFS) {
$plugin_prefs = href(gTxt('plugin_prefs'), array('event' => 'plugin_prefs.' . $name), array('class' => 'plugin-prefs'));
} else {
$plugin_prefs = '';
}
$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(td(fInput('checkbox', 'selected[]', $name), '', 'txp-list-col-multi-edit') . hCell($edit_url, '', ' class="txp-list-col-name" scope="row"') . td(href($author, $a['author_uri'], array('rel' => 'external')), '', 'txp-list-col-author') . td($version, '', 'txp-list-col-version') . td($modified ? span(gTxt('yes'), array('class' => 'warning')) : '', '', 'txp-list-col-modified') . td($description, '', 'txp-list-col-description') . td(status_link($status, $name, yes_no($status)), '', 'txp-list-col-status') . td($load_order, '', 'txp-list-col-load-order') . td($manage_items, '', 'txp-list-col-manage'), $status ? ' class="active"' : '');
unset($name, $page, $deletelink);
}
echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . plugin_multiedit_form('', $sort, $dir, '', '') . tInput() . n . tag_end('form');
}
echo n . tag_end('div');
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:60,代码来源:txp_plugin.php
示例2: article_edit
//.........这里部分代码省略.........
// Build response script.
if ($p['mode'] == PARTIAL_VOLATILE) {
// Volatile partials replace *all* of the existing HTML
// fragment for their selector.
$response[] = '$("' . $p['selector'] . '").replaceWith("' . escape_js($p['html']) . '")';
} elseif ($p['mode'] == PARTIAL_VOLATILE_VALUE) {
// Volatile partial values replace the *value* of elements
// matching their selector.
$response[] = '$("' . $p['selector'] . '").val("' . escape_js($p['html']) . '")';
}
}
}
send_script_response(join(";\n", $response));
// Bail out.
return;
}
foreach ($partials as $k => $p) {
if ($p['mode'] == PARTIAL_STATIC) {
$cb = $p['cb'];
$partials[$k]['html'] = is_array($cb) ? call_user_func($cb, $rs, $k) : $cb($rs, $k);
}
}
$page_title = $ID ? $Title : gTxt('write');
pagetop($page_title, $message);
$class = array();
if ($Status >= STATUS_LIVE) {
$class[] = 'published';
} elseif ($ID) {
$class[] = 'saved';
}
if ($step !== 'create') {
$class[] = 'async';
}
echo n . tag_start('form', array('class' => $class, 'id' => 'article_form', 'name' => 'article_form', 'method' => 'post', 'action' => 'index.php'));
if (!empty($store_out)) {
echo hInput('store', base64_encode(serialize($store_out)));
}
echo hInput('ID', $ID) . eInput('article') . sInput($step) . hInput('sPosted', $sPosted) . hInput('sLastMod', $sLastMod) . hInput('AuthorID', $AuthorID) . hInput('LastModID', $LastModID) . n . '<input type="hidden" name="view" />';
echo n . '<div class="txp-layout-4col-cell-1-2-3">' . hed(gTxt('tab_write'), 1, array('class' => 'txp-heading'));
echo n . '<div role="region" id="main_content">';
// View mode tabs.
echo $partials['view_modes']['html'];
// Title input.
if ($view == 'preview') {
echo n . '<div class="preview">' . graf(gTxt('title'), array('class' => 'alert-block information')) . hed($Title, 1, ' class="title"');
} elseif ($view == 'html') {
echo n . '<div class="html">' . graf(gTxt('title'), array('class' => 'alert-block information')) . hed($Title, 1, ' class="title"');
} elseif ($view == 'text') {
echo n . '<div class="text">' . $partials['title']['html'];
}
// Body.
if ($view == 'preview') {
echo n . '<div class="body">' . n . graf(gTxt('body'), array('class' => 'alert-block information')) . $Body_html . '</div>';
} elseif ($view == 'html') {
echo graf(gTxt('body'), array('class' => 'alert-block information')) . n . tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), txpspecialchars($Body_html)), 'pre', ' class="body"');
} else {
echo $partials['body']['html'];
}
// Excerpt.
if ($articles_use_excerpts) {
if ($view == 'preview') {
echo n . '<div class="excerpt">' . graf(gTxt('excerpt'), array('class' => 'alert-block information')) . $Excerpt_html . '</div>';
} elseif ($view == 'html') {
echo graf(gTxt('excerpt'), array('class' => 'alert-block information')) . n . tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), txpspecialchars($Excerpt_html)), 'pre', array('class' => 'excerpt'));
} else {
echo $partials['excerpt']['html'];
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:67,代码来源:txp_article.php
示例3: file_list
function file_list($message = '')
{
global $file_base_path, $file_statuses, $file_list_pageby, $txp_user, $event;
pagetop(gTxt('tab_file'), $message);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('file_sort_column', 'filename');
}
if ($dir === '') {
$dir = get_pref('file_sort_dir', 'asc');
}
if ($dir === 'desc') {
$dir = 'desc';
} else {
$dir = 'asc';
}
echo hed(gTxt('tab_file'), 1, array('class' => 'txp-heading')) . n . tag_start('div', array('id' => $event . '_control', 'class' => 'txp-control-panel'));
if (!is_dir($file_base_path) || !is_writeable($file_base_path)) {
echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . gTxt('file_dir_not_writeable', array('{filedir}' => $file_base_path)), array('class' => 'alert-block warning'));
} elseif (has_privs('file.edit.own')) {
$existing_files = get_filenames();
if ($existing_files) {
echo form(eInput('file') . sInput('file_create') . graf(tag(gTxt('existing_file'), 'label', array('for' => 'file-existing')) . sp . selectInput('filename', $existing_files, '', 1, '', 'file-existing') . sp . fInput('submit', '', gTxt('Create')), array('class' => 'existing-file')), '', '', 'post', '', '', 'assign_file');
}
echo file_upload_form(gTxt('upload_file'), 'upload', 'file_insert');
}
switch ($sort) {
case 'id':
$sort_sql = 'txp_file.id ' . $dir;
break;
case 'description':
$sort_sql = 'txp_file.description ' . $dir . ', txp_file.filename desc';
break;
case 'category':
$sort_sql = 'txp_category.title ' . $dir . ', txp_file.filename desc';
break;
case 'title':
$sort_sql = 'txp_file.title ' . $dir . ', txp_file.filename desc';
break;
case 'downloads':
$sort_sql = 'txp_file.downloads ' . $dir . ', txp_file.filename desc';
break;
case 'author':
$sort_sql = 'txp_users.RealName ' . $dir . ', txp_file.id asc';
break;
default:
$sort = 'filename';
$sort_sql = 'txp_file.filename ' . $dir;
break;
}
set_pref('file_sort_column', $sort, 'file', PREF_HIDDEN, '', 0, PREF_PRIVATE);
set_pref('file_sort_dir', $dir, 'file', PREF_HIDDEN, '', 0, PREF_PRIVATE);
if ($dir == 'desc') {
$switch_dir = 'asc';
} else {
$switch_dir = 'desc';
}
$criteria = 1;
if ($search_method && $crit !== '') {
$verbatim = preg_match('/^"(.*)"$/', $crit, $m);
$crit_escaped = $verbatim ? doSlash($m[1]) : doLike($crit);
$critsql = $verbatim ? array('id' => "txp_file.id in ('" . join("','", do_list($crit_escaped)) . "')", 'filename' => "txp_file.filename = '{$crit_escaped}'", 'title' => "txp_file.title = '{$crit_escaped}'", 'description' => "txp_file.description = '{$crit_escaped}'", 'category' => "txp_file.category = '{$crit_escaped}' or txp_category.title = '{$crit_escaped}'", 'author' => "txp_file.author = '{$crit_escaped}' or txp_users.RealName = '{$crit_escaped}'") : array('id' => "txp_file.id in ('" . join("','", do_list($crit_escaped)) . "')", 'filename' => "txp_file.filename like '%{$crit_escaped}%'", 'title' => "txp_file.title like '%{$crit_escaped}%'", 'description' => "txp_file.description like '%{$crit_escaped}%'", 'category' => "txp_file.category like '%{$crit_escaped}%' or txp_category.title like '%{$crit_escaped}%'", 'author' => "txp_file.author like '%{$crit_escaped}%' or txp_users.RealName like '%{$crit_escaped}%'");
if (array_key_exists($search_method, $critsql)) {
$criteria = $critsql[$search_method];
$limit = 500;
} else {
$search_method = '';
$crit = '';
}
} else {
$search_method = '';
$crit = '';
}
$criteria .= callback_event('admin_criteria', 'file_list', 0, $criteria);
$sql_from = safe_pfx_j('txp_file') . "\n left join " . safe_pfx_j('txp_category') . " on txp_category.name = txp_file.category and txp_category.type = 'file'\n left join " . safe_pfx_j('txp_users') . " on txp_users.name = txp_file.author";
if ($criteria === 1) {
$total = safe_count('txp_file', $criteria);
} else {
$total = getThing('select count(*) from ' . $sql_from . ' where ' . $criteria);
}
if ($total < 1) {
if ($criteria != 1) {
echo file_search_form($crit, $search_method) . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
} else {
echo graf(gTxt('no_files_recorded'), ' class="indicator"') . '</div>';
}
return;
}
$limit = max($file_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo file_search_form($crit, $search_method) . '</div>';
$rs = safe_query("select\n txp_file.id,\n txp_file.filename,\n txp_file.title,\n txp_file.category,\n txp_file.description,\n txp_file.downloads,\n txp_file.status,\n txp_file.author,\n txp_users.RealName as realname,\n txp_category.Title as category_title\n from {$sql_from} where {$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
if ($rs && numRows($rs)) {
$show_authors = !has_single_author('txp_file');
echo n . tag_start('div', array('id' => $event . '_container', 'class' => 'txp-container')) . n . tag_start('form', array('action' => 'index.php', 'id' => 'files_form', 'class' => 'multi_edit_form', 'method' => 'post', 'name' => 'longform')) . 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'), '', ' scope="col" title="' . gTxt('toggle_all_selected') . '" class="txp-list-col-multi-edit"') . column_head('ID', 'id', 'file', true, $switch_dir, $crit, $search_method, ('id' == $sort ? "{$dir} " : '') . 'txp-list-col-id') . column_head('file_name', 'filename', 'file', true, $switch_dir, $crit, $search_method, ('filename' == $sort ? "{$dir} " : '') . 'txp-list-col-filename') . column_head('title', 'title', 'file', true, $switch_dir, $crit, $search_method, ('title' == $sort ? "{$dir} " : '') . 'txp-list-col-title') . column_head('description', 'description', 'file', true, $switch_dir, $crit, $search_method, ('description' == $sort ? "{$dir} " : '') . 'txp-list-col-description files_detail') . column_head('file_category', 'category', 'file', true, $switch_dir, $crit, $search_method, ('category' == $sort ? "{$dir} " : '') . 'txp-list-col-category category') . hCell(gTxt('tags'), '', ' scope="col" class="txp-list-col-tag-build files_detail"') . hCell(gTxt('status'), '', ' scope="col" class="txp-list-col-status"') . hCell(gTxt('condition'), '', ' scope="col" class="txp-list-col-condition"') . column_head('downloads', 'downloads', 'file', true, $switch_dir, $crit, $search_method, ('downloads' == $sort ? "{$dir} " : '') . 'txp-list-col-downloads') . ($show_authors ? column_head('author', 'author', 'file', true, $switch_dir, $crit, $search_method, ('author' == $sort ? "{$dir} " : '') . 'txp-list-col-author name') : '')) . n . tag_end('thead') . n . tag_start('tbody');
$validator = new Validator();
while ($a = nextRow($rs)) {
extract($a);
$filename = sanitizeForFile($filename);
$edit_url = array('event' => 'file', 'step' => 'file_edit', 'id' => $id, 'sort' => $sort, 'dir' => $dir, 'page' => $page, 'search_method' => $search_method, 'crit' => $crit);
//.........这里部分代码省略.........
开发者ID:hcgtv,项目名称:textpattern,代码行数:101,代码来源:txp_file.php
示例4: author_list
/**
* The main panel listing all authors.
*
* @param string|array $message The activity message
*/
function author_list($message = '')
{
global $event, $txp_user, $author_list_pageby, $levels;
pagetop(gTxt('tab_site_admin'), $message);
if (is_disabled('mail')) {
echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . gTxt('warn_mail_unavailable'), array('class' => 'alert-block warning'));
}
$buttons = array();
// Change password button.
$buttons[] = sLink('admin', 'new_pass_form', gTxt('change_password'), 'txp-button');
if (!has_privs('admin.edit')) {
// Change email address button.
$buttons[] = sLink('admin', 'change_email_form', gTxt('change_email_address'), 'txp-button');
} else {
// New author button.
$buttons[] = sLink('admin', 'author_edit', gTxt('add_new_author'), 'txp-button');
}
// User list.
if (has_privs('admin.list')) {
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('admin_sort_column', 'name');
} else {
if (!in_array($sort, array('name', 'RealName', 'email', 'privs', 'last_login'))) {
$sort = 'name';
}
set_pref('admin_sort_column', $sort, 'admin', 2, '', 0, PREF_PRIVATE);
}
if ($dir === '') {
$dir = get_pref('admin_sort_dir', 'asc');
} else {
$dir = $dir == 'desc' ? "desc" : "asc";
set_pref('admin_sort_dir', $dir, 'admin', 2, '', 0, PREF_PRIVATE);
}
$sort_sql = $sort . ' ' . $dir;
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$search = new Filter($event, array('login' => array('column' => 'txp_users.name', 'label' => gTxt('login_name')), 'RealName' => array('column' => 'txp_users.RealName', 'label' => gTxt('real_name')), 'email' => array('column' => 'txp_users.email', 'label' => gTxt('email')), 'privs' => array('column' => array('txp_users.privs'), 'label' => gTxt('privileges'), 'type' => 'boolean')));
$search->setAliases('privs', $levels);
list($criteria, $crit, $search_method) = $search->getFilter();
$search_render_options = array('placeholder' => 'search_users');
$total = getCount('txp_users', $criteria);
echo n . tag(hed(gTxt('tab_site_admin'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1'));
$searchBlock = n . tag($search->renderForm('author_list', $search_render_options), 'div', array('class' => 'txp-layout-2col-cell-2', 'id' => 'users_control'));
$createBlock = array();
$createBlock[] = n . tag(implode(n, $buttons), 'div', array('class' => 'txp-control-panel'));
$contentBlockStart = n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => 'users_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($author_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
$use_multi_edit = has_privs('admin.edit') && ($total > 1 or safe_count('txp_users', "1 = 1") > 1);
echo $searchBlock . $contentBlockStart . $createBlock;
$rs = safe_rows_start("*, UNIX_TIMESTAMP(last_access) AS last_login", 'txp_users', "{$criteria} ORDER BY {$sort_sql} LIMIT {$offset}, {$limit}");
if ($rs) {
echo n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'users_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(($use_multi_edit ? hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' class="txp-list-col-multi-edit" scope="col" title="' . gTxt('toggle_all_selected') . '"') : hCell('', '', ' class="txp-list-col-multi-edit" scope="col"')) . column_head('login_name', 'name', 'admin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-login-name name') . column_head('real_name', 'RealName', 'admin', true, $switch_dir, '', '', ('RealName' == $sort ? "{$dir} " : '') . 'txp-list-col-real-name name') . column_head('email', 'email', 'admin', true, $switch_dir, '', '', ('email' == $sort ? "{$dir} " : '') . 'txp-list-col-email') . column_head('privileges', 'privs', 'admin', true, $switch_dir, '', '', ('privs' == $sort ? "{$dir} " : '') . 'txp-list-col-privs') . column_head('last_login', 'last_login', 'admin', true, $switch_dir, '', '', ('last_login' == $sort ? "{$dir} " : '') . 'txp-list-col-last-login date')) . n . tag_end('thead') . n . tag_start('tbody');
while ($a = nextRow($rs)) {
extract(doSpecial($a));
echo tr(td((has_privs('admin.edit') and $txp_user != $a['name']) ? fInput('checkbox', 'selected[]', $a['name'], 'checkbox') : '', '', 'txp-list-col-multi-edit') . hCell(has_privs('admin.edit') ? eLink('admin', 'author_edit', 'user_id', $user_id, $name) : $name, '', ' class="txp-list-col-login-name name" scope="row"') . td($RealName, '', 'txp-list-col-real-name name') . td(href($email, 'mailto:' . $email), '', 'txp-list-col-email') . td(get_priv_level($privs), '', 'txp-list-col-privs') . td($last_login ? safe_strftime('%b %Y', $last_login) : '', '', 'txp-list-col-last-login date'));
}
echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . ($use_multi_edit ? author_multiedit_form($page, $sort, $dir, $crit, $search_method) : '') . tInput() . n . tag_end('form') . n . tag_start('div', array('class' => 'txp-navigation', 'id' => 'users_navigation')) . pageby_form('admin', $author_list_pageby) . nav_form('admin', $page, $numPages, $sort, $dir, $crit, $search_method) . n . tag_end('div');
}
echo n . tag_end('div');
} else {
echo n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => 'users_container')) . n . tag(implode(n, $buttons), 'div', array('class' => 'txp-control-panel')) . n . tag_end('div');
}
}
开发者ID:scar45,项目名称:textpattern,代码行数:76,代码来源:txp_admin.php
示例5: image_list
function image_list($message = '')
{
global $txpcfg, $extensions, $img_dir, $file_max_upload_size, $image_list_pageby, $txp_user, $event;
pagetop(gTxt('tab_image'), $message);
extract($txpcfg);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('image_sort_column', 'id');
}
if ($dir === '') {
$dir = get_pref('image_sort_dir', 'desc');
}
$dir = $dir == 'asc' ? 'asc' : 'desc';
echo hed(gTxt('tab_image'), 1, array('class' => 'txp-heading'));
echo n . '<div id="' . $event . '_control" class="txp-control-panel">';
if (!is_dir(IMPATH) or !is_writeable(IMPATH)) {
echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . gTxt('img_dir_not_writeable', array('{imgdir}' => IMPATH)), array('class' => 'alert-block warning'));
} elseif (has_privs('image.edit.own')) {
echo upload_form(gTxt('upload_image'), 'upload_image', 'image_insert', 'image', '', $file_max_upload_size);
}
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;
}
set_pref('image_sort_column', $sort, 'image', 2, '', 0, PREF_PRIVATE);
set_pref('image_sort_dir', $dir, 'image', 2, '', 0, PREF_PRIVATE);
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$criteria = 1;
if ($search_method and $crit != '') {
$verbatim = preg_match('/^"(.*)"$/', $crit, $m);
$crit_escaped = $verbatim ? doSlash($m[1]) : doLike($crit);
$critsql = $verbatim ? array('id' => "ID in ('" . join("','", do_list($crit_escaped)) . "')", 'name' => "name = '{$crit_escaped}'", 'category' => "category = '{$crit_escaped}'", 'author' => "author = '{$crit_escaped}'", 'alt' => "alt = '{$crit_escaped}'", 'caption' => "caption = '{$crit_escaped}'") : array('id' => "ID in ('" . join("','", do_list($crit_escaped)) . "')", 'name' => "name like '%{$crit_escaped}%'", 'category' => "category like '%{$crit_escaped}%'", 'author' => "author like '%{$crit_escaped}%'", 'alt' => "alt like '%{$crit_escaped}%'", 'caption' => "caption like '%{$crit_escaped}%'");
if (array_key_exists($search_method, $critsql)) {
$criteria = $critsql[$search_method];
$limit = 500;
} else {
$search_method = '';
$crit = '';
}
} else {
$search_method = '';
$crit = '';
}
$criteria .= callback_event('admin_criteria', 'image_list', 0, $criteria);
$total = safe_count('txp_image', "{$criteria}");
if ($total < 1) {
if ($criteria != 1) {
echo n . image_search_form($crit, $search_method) . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
} else {
echo graf(gTxt('no_images_recorded'), ' class="indicator"') . '</div>';
}
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 ");
echo pluggable_ui('image_ui', 'extend_controls', '', $rs);
echo '</div>';
// End txp-control-panel.
if ($rs) {
$show_authors = !has_single_author('txp_image');
echo n . tag_start('div', array('id' => $event . '_container', 'class' => 'txp-container')) . n . tag_start('form', array('action' => 'index.php', 'id' => 'images_form', 'class' => 'multi_edit_form', 'method' => 'post', 'name' => 'longform')) . 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'), '', ' scope="col" title="' . gTxt('toggle_all_selected') . '" class="txp-list-col-multi-edit"') . column_head('ID', 'id', 'image', true, $switch_dir, $crit, $search_method, ('id' == $sort ? "{$dir} " : '') . 'txp-list-col-id') . column_head('name', 'name', 'image', true, $switch_dir, $crit, $search_method, ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-name') . column_head('date', 'date', 'image', true, $switch_dir, $crit, $search_method, ('date' == $sort ? "{$dir} " : '') . 'txp-list-col-created date images_detail') . column_head('thumbnail', 'thumbnail', 'image', true, $switch_dir, $crit, $search_method, ('thumbnail' == $sort ? "{$dir} " : '') . 'txp-list-col-thumbnail') . hCell(gTxt('tags'), '', ' scope="col" class="txp-list-col-tag-build images_detail"') . column_head('image_category', 'category', 'image', true, $switch_dir, $crit, $search_method, ('category' == $sort ? "{$dir} " : '') . 'txp-list-col-category category') . ($show_authors ? column_head('author', 'author', 'image', true, $switch_dir, $crit, $search_method, ('author' == $sort ? "{$dir} " : '') . 'txp-list-col-author name') : '')) . n . tag_end('thead') . n . tag_start('tbody');
$validator = new Validator();
while ($a = nextRow($rs)) {
extract($a);
$edit_url = array('event' => 'image', 'step' => 'image_edit', 'id' => $id, 'sort' => $sort, 'dir' => $dir, 'page' => $page, 'search_method' => $search_method, 'crit' => $crit);
$name = empty($name) ? gTxt('unnamed') : txpspecialchars($name);
if ($thumbnail) {
if ($ext != '.swf') {
$thumbnail = '<img class="content-image" src="' . imagesrcurl($id, $ext, true) . "?{$uDate}" . '" alt="" ' . "title='{$id}{$ext} ({$w} × {$h})'" . ($thumb_w ? " width='{$thumb_w}' height='{$thumb_h}'" : '') . ' />';
} else {
$thumbnail = '';
}
} else {
$thumbnail = gTxt('no');
}
if ($ext != '.swf') {
$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);
$tagbuilder = href('Textile', $tag_url . a . 'type=textile', ' target="_blank" onclick="popWin(this.href); return false;"') . sp . span('|', array('role' => 'separator')) . sp . href('Textpattern', $tag_url . a . 'type=textpattern', ' target="_blank" onclick="popWin(this.href); return false;"') . sp . span('|', array('role' => 'separator')) . sp . href('HTML', $tag_url . a . 'type=html', ' target="_blank" onclick="popWin(this.href); return false;"');
} else {
$tagbuilder = sp;
}
//.........这里部分代码省略.........
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:txp_image.php
示例6: discuss_list
/**
* Outputs the main panel listing all comments.
*
* @param string|array $message The activity message
*/
function discuss_list($message = '')
{
global $event, $comment_list_pageby;
pagetop(gTxt('list_discussions'), $message);
extract(gpsa(array('sort', 'dir', 'page', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('discuss_sort_column', 'date');
} else {
if (!in_array($sort, array('id', 'ip', 'name', 'email', 'website', 'message', 'status', 'parent'))) {
$sort = 'date';
}
set_pref('discuss_sort_column', $sort, 'discuss', 2, '', 0, PREF_PRIVATE);
}
if ($dir === '') {
$dir = get_pref('discuss_sort_dir', 'desc');
} else {
$dir = $dir == 'asc' ? "asc" : "desc";
set_pref('discuss_sort_dir', $dir, 'discuss', 2, '', 0, PREF_PRIVATE);
}
switch ($sort) {
case 'id':
$sort_sql = "txp_discuss.discussid {$dir}";
break;
case 'ip':
$sort_sql = "txp_discuss.ip {$dir}";
break;
case 'name':
$sort_sql = "txp_discuss.name {$dir}";
break;
case 'email':
$sort_sql = "txp_discuss.email {$dir}";
break;
case 'website':
$sort_sql = "txp_discuss.web {$dir}";
break;
case 'message':
$sort_sql = "txp_discuss.message {$dir}";
break;
case 'status':
$sort_sql = "txp_discuss.visible {$dir}";
break;
case 'parent':
$sort_sql = "txp_discuss.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';
$search = new Filter($event, array('id' => array('column' => 'txp_discuss.discussid', 'label' => gTxt('ID'), 'type' => 'integer'), 'parent' => array('column' => array('txp_discuss.parentid', 'textpattern.Title'), 'label' => gTxt('parent')), 'name' => array('column' => 'txp_discuss.name', 'label' => gTxt('name')), 'message' => array('column' => 'txp_discuss.message', 'label' => gTxt('message')), 'email' => array('column' => 'txp_discuss.email', 'label' => gTxt('email')), 'website' => array('column' => 'txp_discuss.web', 'label' => gTxt('website')), 'ip' => array('column' => 'txp_discuss.ip', 'label' => gTxt('IP')), 'visible' => array('column' => 'txp_discuss.visible', 'label' => gTxt('visible'), 'type' => 'numeric')));
$alias_yes = VISIBLE . ', Yes';
$alias_no = MODERATE . ', No, Unmoderated, Pending';
$alias_spam = SPAM . ', Spam';
$search->setAliases('visible', array(VISIBLE => $alias_yes, MODERATE => $alias_no, SPAM => $alias_spam));
list($criteria, $crit, $search_method) = $search->getFilter(array('id' => array('can_list' => true)));
$search_render_options = array('placeholder' => 'search_comments');
$sql_from = safe_pfx_j('txp_discuss') . "\n left join " . safe_pfx_j('textpattern') . " on txp_discuss.parentid = textpattern.ID";
$counts = getRows("SELECT txp_discuss.visible, COUNT(*) AS c\n FROM " . safe_pfx_j('txp_discuss') . "\n LEFT JOIN " . safe_pfx_j('textpattern') . "\n ON txp_discuss.parentid = textpattern.ID\n WHERE {$criteria} GROUP BY txp_discuss.visible");
$count[SPAM] = $count[MODERATE] = $count[VISIBLE] = 0;
if ($counts) {
foreach ($counts as $c) {
$count[$c['visible']] = $c['c'];
}
}
// Grand total comment count.
$total = $count[SPAM] + $count[MODERATE] + $count[VISIBLE];
echo n . tag(hed(gTxt('list_discussions'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1'));
$searchBlock = n . tag($search->renderForm('discuss_list', $search_render_options), 'div', array('class' => 'txp-layout-2col-cell-2', 'id' => $event . '_control'));
$contentBlockStart = n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => $event . '_container'));
if ($total < 1) {
if ($criteria != 1) {
echo $searchBlock . $contentBlockStart . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_results_found'), array('class' => 'alert-block information'));
} else {
echo $contentBlockStart . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_comments_recorded'), array('class' => 'alert-block information'));
}
echo n . tag_end('div');
return;
}
if (!cs('toggle_show_spam')) {
$total = $count[MODERATE] + $count[VISIBLE];
$criteria = 'visible != ' . intval(SPAM) . ' and ' . $criteria;
}
$limit = max($comment_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo $searchBlock . $contentBlockStart;
$rs = safe_query("SELECT\n txp_discuss.discussid,\n txp_discuss.parentid,\n txp_discuss.name,\n txp_discuss.email,\n txp_discuss.web,\n txp_discuss.ip,\n txp_discuss.message,\n txp_discuss.visible,\n UNIX_TIMESTAMP(txp_discuss.posted) AS uPosted,\n textpattern.ID AS thisid,\n textpattern.Section AS section,\n textpattern.url_title,\n textpattern.Title AS title,\n textpattern.Status,\n UNIX_TIMESTAMP(textpattern.Posted) AS posted\n FROM " . safe_pfx_j('txp_discuss') . "\n LEFT JOIN " . safe_pfx_j('textpattern') . " ON txp_discuss.parentid = textpattern.ID\n WHERE {$criteria} ORDER BY {$sort_sql} LIMIT {$offset}, {$limit}");
if ($rs) {
echo n . tag(cookie_box('show_spam') . toggle_box('discuss_detail'), 'div', array('class' => 'txp-list-options')) . n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'discuss_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('ID', 'id', 'discuss', true, $switch_dir, $crit, $search_method, ('id' == $sort ? "{$dir} " : '') . 'txp-list-col-id') . column_head('date', 'date', 'discuss', true, $switch_dir, $crit, $search_method, ('date' == $sort ? "{$dir} " : '') . 'txp-list-col-created date') . column_head('name', 'name', 'discuss', true, $switch_dir, $crit, $search_method, ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-name') . column_head('message', 'message', 'discuss', true, $switch_dir, $crit, $search_method, 'message' == $sort ? "{$dir} " : 'txp-list-col-message') . column_head('email', 'email', 'discuss', true, $switch_dir, $crit, $search_method, ('email' == $sort ? "{$dir} " : '') . 'txp-list-col-email discuss_detail') . column_head('website', 'website', 'discuss', true, $switch_dir, $crit, $search_method, ('website' == $sort ? "{$dir} " : '') . 'txp-list-col-website discuss_detail') . column_head('IP', 'ip', 'discuss', true, $switch_dir, $crit, $search_method, ('ip' == $sort ? "{$dir} " : '') . 'txp-list-col-ip discuss_detail') . column_head('status', 'status', 'discuss', true, $switch_dir, $crit, $search_method, ('status' == $sort ? "{$dir} " : '') . 'txp-list-col-status') . column_head('parent', 'parent', 'discuss', true, $switch_dir, $crit, $search_method, ('parent' == $sort ? "{$dir} " : '') . 'txp-list-col-parent')) . n . tag_end('thead');
include_once txpath . '/publish/taghandlers.php';
echo n . tag_start('tbody');
while ($a = nextRow($rs)) {
//.........这里部分代码省略.........
开发者ID:scar45,项目名称:textpattern,代码行数:101,代码来源:txp_discuss.php
示例7: log_list
/**
* The main panel listing all log hits.
*
* @param string|array $message The activity message
*/
function log_list($message = '')
{
global $event, $log_list_pageby, $expire_logs_after;
pagetop(gTxt('tab_logs'), $message);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('log_sort_column', 'time');
} else {
if (!in_array($sort, array('ip', 'host', 'page', 'refer', 'method', 'status'))) {
$sort = 'time';
}
set_pref('log_sort_column', $sort, 'log', 2, '', 0, PREF_PRIVATE);
}
if ($dir === '') {
$dir = get_pref('log_sort_dir', 'desc');
} else {
$dir = $dir == 'asc' ? "asc" : "desc";
set_pref('log_sort_dir', $dir, 'log', 2, '', 0, PREF_PRIVATE);
}
$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;
}
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$search = new Filter($event, array('ip' => array('column' => 'txp_log.ip', 'label' => gTxt('IP')), 'host' => array('column' => 'txp_log.host', 'label' => gTxt('host')), 'page' => array('column' => 'txp_log.page', 'label' => gTxt('page')), 'refer' => array('column' => 'txp_log.refer', 'label' => gTxt('referrer')), 'method' => array('column' => 'txp_log.method', 'label' => gTxt('method')), 'status' => array('column' => 'txp_log.status', 'label' => gTxt('status'), 'type' => 'integer')));
list($criteria, $crit, $search_method) = $search->getFilter(array('status' => array('can_list' => true)));
$search_render_options = array('placeholder' => 'search_logs');
$total = safe_count('txp_log', "{$criteria}");
echo n . tag(hed(gTxt('tab_logs'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1'));
$searchBlock = n . tag($search->renderForm('log_list', $search_render_options), 'div', array('class' => 'txp-layout-2col-cell-2', 'id' => $event . '_control'));
$contentBlockStart = n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => $event . '_container'));
if ($total < 1) {
if ($criteria != 1) {
echo $searchBlock . $contentBlockStart . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_results_found'), array('class' => 'alert-block information'));
} else {
echo $contentBlockStart . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_refers_recorded'), array('class' => 'alert-block information'));
}
echo n . tag_end('div');
return;
}
$limit = max($log_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo $searchBlock . $contentBlockStart;
$rs = safe_rows_start("*, UNIX_TIMESTAMP(time) AS uTime", 'txp_log', "{$criteria} ORDER BY {$sort_sql} LIMIT {$offset}, {$limit}");
if ($rs) {
echo n . tag(toggle_box('log_detail'), 'div', array('class' => 'txp-list-options')) . n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'log_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('time', 'time', 'log', true, $switch_dir, $crit, $search_method, ('time' == $sort ? "{$dir} " : '') . 'txp-list-col-time') . column_head('IP', 'ip', 'log', true, $switch_dir, $crit, $search_method, ('ip' == $sort ? "{$dir} " : '') . 'txp-list-col-ip') . column_head('host', 'host', 'log', true, $switch_dir, $crit, $search_method, ('host' == $sort ? "{$dir} " : '') . 'txp-list-col-host log_detail') . column_head('page', 'page', 'log', true, $switch_dir, $crit, $search_method, ('page' == $sort ? "{$dir} " : '') . 'txp-list-col-page') . column_head('referrer', 'refer', 'log', true, $switch_dir, $crit, $search_method, ('refer' == $sort ? "{$dir} " : '') . 'txp-list-col-refer') . column_head('method', 'method', 'log', true, $switch_dir, $crit, $search_method, ('method' == $sort ? "{$dir} " : '') . 'txp-list-col-method log_detail') . column_head('status', 'status', 'log', true, $switch_dir, $crit, $search_method, ('status' == $sort ? "{$dir} " : '') . 'txp-list-col-status log_detail')) . n . tag_end('thead') . n . tag_start('tbody');
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'log');
if ($log_refer) {
$log_refer = href(txpspecialchars(soft_wrap(preg_replace('#^http://#', '', $log_refer), 30)), txpspecialchars($log_refer), ' target="_blank"');
}
if ($log_page) {
$log_anchor = preg_replace('/\\/$/', '', $log_page);
$log_anchor = soft_wrap(substr($log_anchor, 1), 30);
$log_page = href(txpspecialchars($log_anchor), txpspecialchars($log_page), ' target="_blank"');
if ($log_method == 'POST') {
$log_page = strong($log_page);
}
}
echo tr(td(fInput('checkbox', 'selected[]', $log_id), '', 'txp-list-col-multi-edit') . hCell(gTime($log_uTime), '', ' class="txp-list-col-time" scope="row"') . td(href(txpspecialchars($log_ip), 'https://whois.domaintools.com/' . rawurlencode($log_ip), array('rel' => 'external', 'target' => '_blank')), '', 'txp-list-col-ip') . td(txpspecialchars($log_host), '', 'txp-list-col-host log_detail') . td($log_page, '', 'txp-list-col-page') . td($log_refer, '', 'txp-list-col-refer') . td(txpspecialchars($log_method), '', 'txp-list-col-method log_detail') . td($log_status, '', 'txp-list-col-status log_detail'));
}
echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . log_multiedit_form($page, $sort, $dir, $crit, $search_method) . tInput() . n . tag_end('form') . n . tag_start('div', array('class' => 'txp-navigation', 'id' => $event . '_navigation')) . pageby_form('log', $log_list_pageby) . nav_form('log', $page, $numPages, $sort, $dir, $crit, $search_method, $total, $limit) . n . tag_end('div');
}
echo n . tag_end('div');
}
开发者ID:scar45,项目名称:textpattern,代码行数:92,代码来源:txp_log.php
示例8: list_list
/**
* The main panel listing all articles.
*
* @param string|array $message The activity message
* @param string $post Not used
*/
function list_list($message = '', $post = '')
{
global $statuses, $use_comments, $comments_disabled_after, $step, $txp_user, $article_list_pageby, $event;
pagetop(gTxt('tab_list'), $message);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('article_sort_column', 'posted');
} else {
if (!in_array($sort, array('id', 'title', 'expires', 'section', 'category1', 'category2', 'status', 'author', 'comments', 'lastmod'))) {
$sort = 'posted';
}
set_pref('article_sort_column', $sort, 'list', 2, '', 0, PREF_PRIVATE);
}
if ($dir === '') {
$dir = get_pref('article_sort_dir', 'desc');
} else {
$dir = $dir == 'asc' ? "asc" : "desc";
set_pref('article_sort_dir', $dir, 'list', 2, '', 0, PREF_PRIVATE);
}
$sesutats = array_flip($statuses);
switch ($sort) {
case 'id':
$sort_sql = "textpattern.ID {$dir}";
break;
case 'title':
$sort_sql = "textpattern.Title {$dir}, textpattern.Posted DESC";
break;
case 'expires':
$sort_sql = "textpattern.Expires {$dir}";
break;
case 'section':
$sort_sql = "section.title {$dir}, textpattern.Posted DESC";
break;
case 'category1':
$sort_sql = "category1.title {$dir}, textpattern.Posted DESC";
break;
case 'category2':
$sort_sql = "category2.title {$dir}, textpattern.Posted DESC";
break;
case 'status':
$sort_sql = "textpattern.Status {$dir}, textpattern.Posted DESC";
break;
case 'author':
$sort_sql = "user.RealName {$dir}, textpattern.Posted DESC";
break;
case 'comments':
$sort_sql = "textpattern.comments_count {$dir}, textpattern.Posted DESC";
break;
case 'lastmod':
$sort_sql = "textpattern.LastMod {$dir}, textpattern.Posted DESC";
break;
default:
$sort = 'posted';
$sort_sql = "textpattern.Posted {$dir}";
break;
}
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$search = new Filter($event, array('id' => array('column' => 'textpattern.ID', 'label' => gTxt('ID'), 'type' => 'integer'), 'title_body_excerpt' => array('column' => array('textpattern.Title', 'textpattern.Body', 'textpattern.Excerpt'), 'label' => gTxt('title_body_excerpt')), 'section' => array('column' => array('textpattern.Section', 'section.title'), 'label' => gTxt('section')), 'keywords' => array('column' => 'textpattern.Keywords', 'label' => gTxt('keywords'), 'type' => 'find_in_set'), 'categories' => array('column' => array('textpattern.Category1', 'textpattern.Category2', 'category1.title', 'category2.title'), 'label' => gTxt('categories')), 'status' => array('column' => array('textpattern.Status'), 'label' => gTxt('status'), 'type' => 'boolean'), 'author' => array('column' => array('textpattern.AuthorID', 'user.RealName'), 'label' => gTxt('author')), 'article_image' => array('column' => array('textpattern.Image'), 'label' => gTxt('article_image'), 'type' => 'integer'), 'posted' => array('column' => array('textpattern.Posted'), 'label' => gTxt('posted')), 'lastmod' => array('column' => array('textpattern.LastMod'), 'label' => gTxt('article_modified'))));
$search->setAliases('status', $statuses);
list($criteria, $crit, $search_method) = $search->getFilter(array('id' => array('can_list' => true), 'article_image' => array('can_list' => true), 'title_body_excerpt' => array('always_like' => true)));
$search_render_options = array('placeholder' => 'search_articles');
$sql_from = safe_pfx('textpattern') . " textpattern\n LEFT JOIN " . safe_pfx('txp_category') . " category1 ON category1.name = textpattern.Category1 AND category1.type = 'article'\n LEFT JOIN " . safe_pfx('txp_category') . " category2 ON category2.name = textpattern.Category2 AND category2.type = 'article'\n LEFT JOIN " . safe_pfx('txp_section') . " section ON section.name = textpattern.Section\n LEFT JOIN " . safe_pfx('txp_users') . " user ON user.name = textpattern.AuthorID";
|
请发表评论