本文整理汇总了PHP中txpspecialchars函数的典型用法代码示例。如果您正苦于以下问题:PHP txpspecialchars函数的具体用法?PHP txpspecialchars怎么用?PHP txpspecialchars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了txpspecialchars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: css_edit_raw
function css_edit_raw()
{
global $event, $step;
$default_name = safe_field('css', 'txp_section', "name = 'default'");
extract(gpsa(array('name', 'newname', 'copy', 'savenew')));
if ($step == 'css_delete' || empty($name) && $step != 'pour' && !$savenew) {
$name = $default_name;
} elseif (($copy || $savenew) && trim(preg_replace('/[<>&"\']/', '', $newname))) {
$name = $newname;
}
if (empty($name)) {
$buttons = '<div class="edit-title">' . gTxt('name_for_this_style') . ': ' . fInput('text', 'newname', '', '', '', '', INPUT_REGULAR) . hInput('savenew', 'savenew') . '</div>';
$thecss = gps('css');
} else {
$buttons = '<div class="edit-title">' . gTxt('you_are_editing_css') . sp . strong(txpspecialchars($name)) . '</div>';
$thecss = fetch("css", 'txp_css', 'name', $name);
}
if (!empty($name)) {
$copy = n . '<p class="copy-as"><label for="copy-css">' . gTxt('copy_css_as') . '</label>' . n . fInput('text', 'newname', '', 'input-medium', '', '', INPUT_MEDIUM, '', 'copy-css') . n . fInput('submit', 'copy', gTxt('copy')) . '</p>';
} else {
$copy = '';
}
$right = '<div id="content_switcher">' . hed(gTxt('all_stylesheets'), 2) . graf(sLink('css', 'pour', gTxt('create_new_css')), ' class="action-create"') . css_list($name, $default_name) . '</div>';
echo '<h1 class="txp-heading">' . gTxt('tab_style') . '</h1>' . '<div id="' . $event . '_container" class="txp-container">' . startTable('', '', 'txp-columntable') . tr(td(form('<div id="main_content">' . $buttons . '<textarea id="css" class="code" name="css" cols="' . INPUT_LARGE . '" rows="' . INPUT_REGULAR . '">' . txpspecialchars($thecss) . '</textarea>' . '<p>' . fInput('submit', '', gTxt('save'), 'publish') . eInput('css') . sInput('css_save') . hInput('name', $name) . '</p>' . $copy . '</div>', '', '', 'post', 'edit-form', '', 'style_form'), '', 'column') . tdtl($right, ' class="column"')) . endTable() . '</div>';
}
示例2: footer
function footer()
{
global $txp_user;
$out[] = href('Textpattern CMS', 'http://textpattern.com', ' title="' . gTxt('go_txp_com') . '" rel="external" target="_blank"') . n . span('·', array('role' => 'separator')) . n . txp_version;
if ($txp_user) {
$out[] = graf(gTxt('logged_in_as') . ' ' . span(txpspecialchars($txp_user)) . br . href(gTxt('logout'), 'index.php?logout=1', ' onclick="return verify(\'' . gTxt('are_you_sure') . '\')"'), ' id="moniker"');
}
return join(n, $out);
}
示例3: footer
function footer()
{
global $txp_user;
$out[] = '<a id="mothership" href="http://textpattern.com/" title="' . gTxt('go_txp_com') . '" rel="external"><img src="' . $this->url . 'carver.png" width="40" height="40" alt="Textpattern" /></a>' . n . graf('Textpattern CMS · ' . txp_version);
if ($txp_user) {
$out[] = graf(gTxt('logged_in_as') . ' ' . span(txpspecialchars($txp_user)) . br . '<a href="index.php?logout=1">' . gTxt('logout') . '</a>', ' id="moniker"');
}
return join(n, $out);
}
示例4: reset_author_pass
function reset_author_pass($name)
{
$email = safe_field('email', 'txp_users', "name = '" . doSlash($name) . "'");
$new_pass = generate_password(PASSWORD_LENGTH);
$hash = doSlash(txp_hash_password($new_pass));
$rs = safe_update('txp_users', "pass = '{$hash}'", "name = '" . doSlash($name) . "'");
if ($rs) {
if (send_new_password($new_pass, $email, $name)) {
return gTxt('password_sent_to') . ' ' . $email;
} else {
return gTxt('could_not_mail') . ' ' . $email;
}
} else {
return gTxt('could_not_update_author') . ' ' . txpspecialchars($name);
}
}
示例5: page_edit
/**
* The main Page editor panel.
*
* @param string|array $message The activity message
*/
function page_edit($message = '')
{
global $event, $step;
pagetop(gTxt('edit_pages'), $message);
extract(array_map('assert_string', gpsa(array('copy', 'save_error', 'savenew'))));
$name = sanitizeForPage(assert_string(gps('name')));
$newname = sanitizeForPage(assert_string(gps('newname')));
if ($step == 'page_delete' || empty($name) && $step != 'page_new' && !$savenew) {
$name = safe_field("page", 'txp_section', "name = 'default'");
} elseif ((($copy || $savenew) && $newname || $newname && $newname != $name) && !$save_error) {
$name = $newname;
}
$titleblock = inputLabel('new_page', fInput('text', 'newname', $name, 'input-medium', '', '', INPUT_MEDIUM, '', 'new_page', false, true), 'page_name', array('', 'instructions_page_name'), array('class' => 'txp-form-field'));
if ($name === '') {
$titleblock .= hInput('savenew', 'savenew');
} else {
$titleblock .= hInput('name', $name);
}
$titleblock .= eInput('page') . sInput('page_save');
$html = !$save_error ? fetch('user_html', 'txp_page', 'name', $name) : gps('html');
// Format of each entry is popTagLink -> array ( gTxt() string, class/ID).
$tagbuild_items = array('page_article' => array('page_article_hed', 'article-tags'), 'page_article_nav' => array('page_article_nav_hed', 'article-nav-tags'), 'page_nav' => array('page_nav_hed', 'nav-tags'), 'page_xml' => array('page_xml_hed', 'xml-tags'), 'page_misc' => array('page_misc_hed', 'misc-tags'), 'page_file' => array('page_file_hed', 'file-tags'));
$tagbuild_links = '';
foreach ($tagbuild_items as $tb => $item) {
$tagbuild_links .= wrapRegion($item[1] . '_group', taglinks($tb), $item[1], $item[0], 'page_' . $item[1]);
}
// Pages code columm.
echo n . tag(hed(gTxt('tab_pages'), 1, array('class' => 'txp-heading')) . form($titleblock . inputLabel('html', '<textarea class="code" id="html" name="html" cols="' . INPUT_LARGE . '" rows="' . TEXTAREA_HEIGHT_LARGE . '" dir="ltr">' . txpspecialchars($html) . '</textarea>', 'page_code', array('', 'instructions_page_code'), array('class' => 'txp-form-field')), '', '', 'post', '', '', 'page_form'), 'div', array('class' => 'txp-layout-4col-cell-1-2-3', 'id' => 'main_content', 'role' => 'region'));
// Pages create/switcher column.
$buttonExtras = '';
if ($name) {
$buttonExtras .= href('<span class="ui-icon ui-icon-copy"></span> ' . gTxt('duplicate'), '#', array('class' => 'txp-clone', 'data-form' => 'page_form'));
}
$buttons = graf(tag_void('input', array('class' => 'publish', 'type' => 'submit', 'method' => 'post', 'value' => gTxt('save'), 'form' => 'page_form')), ' class="txp-save"') . graf(sLink('page', 'page_new', '<span class="ui-icon ui-extra-icon-new-document"></span> ' . gTxt('create_new_page'), 'txp-new') . $buttonExtras, array('class' => 'txp-actions'));
echo n . tag($buttons . page_list($name) . n, 'div', array('class' => 'txp-layout-4col-cell-4alt', 'id' => 'content_switcher', 'role' => 'region'));
// Pages tag builder column. TODO: make this a modal?
// echo n.tag(
// hed(gTxt('tagbuilder'), 2).
// $tagbuild_links
// , 'div', array(
// 'class' => '',
// 'id' => 'tagbuild_links',
// ));
}
示例6: page_edit_form
function page_edit_form($name)
{
global $step;
if ($name) {
$html = safe_field('user_html', 'txp_page', "name='" . doSlash($name) . "'");
} else {
$html = gps('html');
}
if (empty($name)) {
$buttons = '<div class="edit-title">' . gTxt('name_for_this_page') . ': ' . fInput('text', 'newname', '', '', '', '', INPUT_REGULAR) . hInput('savenew', 'savenew') . '</div>';
} else {
$buttons = '<div class="edit-title">' . gTxt('you_are_editing_page') . sp . strong(txpspecialchars($name)) . '</div>';
}
$out[] = '<div id="main_content">' . $buttons . '<textarea id="html" class="code" name="html" cols="' . INPUT_LARGE . '" rows="' . INPUT_REGULAR . '">' . txpspecialchars($html) . '</textarea>' . n . '<p>' . fInput('submit', 'save', gTxt('save'), 'publish') . n . eInput('page') . n . sInput('page_save') . n . hInput('name', $name) . '</p>';
if (!empty($name)) {
$out[] = n . '<p class="copy-as"><label for="copy-page">' . gTxt('copy_page_as') . '</label>' . n . fInput('text', 'newname', '', 'input-medium', '', '', INPUT_MEDIUM, '', 'copy-page') . n . fInput('submit', 'copy', gTxt('copy')) . '</p>';
}
$out[] = '</div>';
return form(join('', $out), '', '', 'post', '', '', 'page_form');
}
示例7: list_list
//.........这里部分代码省略.........
$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";
if ($criteria === 1) {
$total = safe_count('textpattern', $criteria);
} else {
$total = getThing("SELECT COUNT(*) FROM {$sql_from} WHERE {$criteria}");
}
echo n . tag(hed(gTxt('tab_list'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1'));
$searchBlock = n . tag($search->renderForm('list', $search_render_options), 'div', array('class' => 'txp-layout-2col-cell-2', 'id' => $event . '_control'));
$createBlock = array();
if (has_privs('article.edit')) {
$createBlock[] = n . tag(sLink('article', '', gTxt('add_new_article'), 'txp-button'), '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'));
} else {
echo $contentBlockStart . $createBlock . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_articles_recorded'), array('class' => 'alert-block information'));
}
echo n . tag_end('div');
return;
}
$limit = max($article_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo $searchBlock . $contentBlockStart . $createBlock;
$rs = safe_query("SELECT\n textpattern.ID, textpattern.Title, textpattern.url_title, textpattern.Section,\n textpattern.Category1, textpattern.Category2,\n textpattern.Status, textpattern.Annotate, textpattern.AuthorID,\n UNIX_TIMESTAMP(textpattern.Posted) AS posted,\n UNIX_TIMESTAMP(textpattern.LastMod) AS lastmod,\n UNIX_TIMESTAMP(textpattern.Expires) AS expires,\n category1.title AS category1_title,\n category2.title AS category2_title,\n section.title AS section_title,\n user.RealName AS RealName,\n (SELECT COUNT(*) FROM " . safe_pfx('txp_discuss') . " WHERE parentid = textpattern.ID) AS total_comments\n FROM {$sql_from} WHERE {$criteria} ORDER BY {$sort_sql} LIMIT {$offset}, {$limit}");
if ($rs) {
$show_authors = !has_single_author('textpattern', 'AuthorID');
echo n . tag(toggle_box('articles_detail'), 'div', array('class' => 'txp-list-options')) . n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'articles_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', 'list', true, $switch_dir, $crit, $search_method, ('id' == $sort ? "{$dir} " : '') . 'txp-list-col-id') . column_head('title', 'title', 'list', true, $switch_dir, $crit, $search_method, ('title' == $sort ? "{$dir} " : '') . 'txp-list-col-title') . column_head('posted', 'posted', 'list', true, $switch_dir, $crit, $search_method, ('posted' == $sort ? "{$dir} " : '') . 'txp-list-col-created date') . column_head('article_modified', 'lastmod', 'list', true, $switch_dir, $crit, $search_method, ('lastmod' == $sort ? "{$dir} " : '') . 'txp-list-col-lastmod date articles_detail') . column_head('expires', 'expires', 'list', true, $switch_dir, $crit, $search_method, ('expires' == $sort ? "{$dir} " : '') . 'txp-list-col-expires date articles_detail') . column_head('section', 'section', 'list', true, $switch_dir, $crit, $search_method, ('section' == $sort ? "{$dir} " : '') . 'txp-list-col-section') . column_head('category1', 'category1', 'list', true, $switch_dir, $crit, $search_method, ('category1' == $sort ? "{$dir} " : '') . 'txp-list-col-category1 category articles_detail') . column_head('category2', 'category2', 'list', true, $switch_dir, $crit, $search_method, ('category2' == $sort ? "{$dir} " : '') . 'txp-list-col-category2 category articles_detail') . column_head('status', 'status', 'list', true, $switch_dir, $crit, $search_method, ('status' == $sort ? "{$dir} " : '') . 'txp-list-col-status') . ($show_authors ? column_head('author', 'author', 'list', true, $switch_dir, $crit, $search_method, ('author' == $sort ? "{$dir} " : '') . 'txp-list-col-author name') : '') . ($use_comments == 1 ? column_head('comments', 'comments', 'list', true, $switch_dir, $crit, $search_method, ('comments' == $sort ? "{$dir} " : '') . 'txp-list-col-comments articles_detail') : '')) . n . tag_end('thead');
include_once txpath . '/publish/taghandlers.php';
echo n . tag_start('tbody');
$validator = new Validator();
while ($a = nextRow($rs)) {
extract($a);
if ($Title === '') {
$Title = '<em>' . eLink('article', 'edit', 'ID', $ID, gTxt('untitled')) . '</em>';
} else {
$Title = eLink('article', 'edit', 'ID', $ID, $Title);
}
// Valid section and categories?
$validator->setConstraints(array(new SectionConstraint($Section)));
$vs = $validator->validate() ? '' : ' error';
$validator->setConstraints(array(new CategoryConstraint($Category1, array('type' => 'article'))));
$vc[1] = $validator->validate() ? '' : ' error';
$validator->setConstraints(array(new CategoryConstraint($Category2, array('type' => 'article'))));
$vc[2] = $validator->validate() ? '' : ' error';
$Category1 = $Category1 ? span(txpspecialchars($category1_title), array('title' => $Category1)) : '';
$Category2 = $Category2 ? span(txpspecialchars($category2_title), array('title' => $Category2)) : '';
if ($Status != STATUS_LIVE and $Status != STATUS_STICKY) {
$view_url = '?txpreview=' . intval($ID) . '.' . time();
} else {
$view_url = permlinkurl($a);
}
if (isset($statuses[$Status])) {
$Status = $statuses[$Status];
}
$comments = '(' . $total_comments . ')';
if ($total_comments) {
$comments = href($comments, array('event' => 'discuss', 'step' => 'list', 'search_method' => 'parent', 'crit' => $ID), array('title' => gTxt('manage')));
}
$comment_status = $Annotate ? gTxt('on') : gTxt('off');
if ($comments_disabled_after) {
$lifespan = $comments_disabled_after * 86400;
$time_since = time() - $posted;
if ($time_since > $lifespan) {
$comment_status = gTxt('expired');
}
}
$comments = tag($comment_status, 'span', array('class' => 'comments-status')) . ' ' . tag($comments, 'span', array('class' => 'comments-manage'));
echo tr(td(($a['Status'] >= STATUS_LIVE and has_privs('article.edit.published') or $a['Status'] >= STATUS_LIVE and $AuthorID === $txp_user and has_privs('article.edit.own.published') or $a['Status'] < STATUS_LIVE and has_privs('article.edit') or $a['Status'] < STATUS_LIVE and $AuthorID === $txp_user and has_privs('article.edit.own')) ? fInput('checkbox', 'selected[]', $ID, 'checkbox') : '', '', 'txp-list-col-multi-edit') . hCell(eLink('article', 'edit', 'ID', $ID, $ID) . sp . span(span('[', array('aria-hidden' => 'true')) . href(gTxt('view'), $view_url) . span(']', array('aria-hidden' => 'true')), array('class' => 'txp-option-link articles_detail')), '', ' class="txp-list-col-id" scope="row"') . td($Title, '', 'txp-list-col-title') . td(gTime($posted), '', 'txp-list-col-created date' . ($posted < time() ? '' : ' unpublished')) . td(gTime($lastmod), '', 'txp-list-col-lastmod date articles_detail' . ($posted === $lastmod ? ' not-modified' : '')) . td($expires ? gTime($expires) : '', '', 'txp-list-col-expires date articles_detail') . td(span(txpspecialchars($section_title), array('title' => $Section)), '', 'txp-list-col-section' . $vs) . td($Category1, '', 'txp-list-col-category1 category articles_detail' . $vc[1]) . td($Category2, '', 'txp-list-col-category2 category articles_detail' . $vc[2]) . td(href($Status, $view_url, join_atts(array('title' => gTxt('view')))), '', 'txp-list-col-status') . ($show_authors ? td(span(txpspecialchars($RealName), array('title' => $AuthorID)), '', 'txp-list-col-author name') : '') . ($use_comments ? td($comments, '', 'txp-list-col-comments articles_detail') : ''));
}
echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . list_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('list', $article_list_pageby) . nav_form('list', $page, $numPages, $sort, $dir, $crit, $search_method, $total, $limit) . n . tag_end('div');
}
echo n . tag_end('div');
}
示例8: asyncHref
/**
* Render a link element to hook up txpAsyncHref() with request parameters
*
* @param string $item Link text
* @param array $parms Request parameters; array keys are 'event', 'step', 'thing', 'property'
* @param string $atts HTML attributes
* @return string HTML
* @since 4.5.0
* @see textpattern.js: txpAsyncHref
*/
function asyncHref($item, $parms, $atts = '')
{
extract(doSpecial(lAtts(array('event' => $GLOBALS['event'], 'step' => $GLOBALS['step'], 'thing' => '', 'property' => ''), $parms)));
$class = "{$step} async";
$href = "?event={$event}&step={$step}&thing={$thing}&property={$property}";
if (AJAXALLY_CHALLENGED) {
$href .= '&value=' . txpspecialchars($item) . '&_txp_token=' . form_token();
}
return href($item, $href, $atts . " class=\"{$class}\"");
}
示例9: log_list
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');
}
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 != '') {
$verbatim = preg_match('/^"(.*)"$/', $crit, $m);
$crit_escaped = doSlash($verbatim ? $m[1] : str_replace(array('\\', '%', '_', '\''), array('\\\\', '\\%', '\\_', '\\\''), $crit));
$critsql = $verbatim ? array('ip' => "ip = '{$crit_escaped}'", 'host' => "host = '{$crit_escaped}'", 'page' => "page = '{$crit_escaped}'", 'refer' => "refer = '{$crit_escaped}'", 'method' => "method = '{$crit_escaped}'", 'status' => "status = '{$crit_escaped}'") : 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 = '';
}
$criteria .= callback_event('admin_criteria', 'log_list', 0, $criteria);
$total = safe_count('txp_log', "{$criteria}");
echo '<h1 class="txp-heading">' . gTxt('tab_logs') . '</h1>';
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">';
echo n . n . '<form action="index.php" id="log_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('time', 'time', 'log', true, $switch_dir, $crit, $search_method, ('time' == $sort ? "{$dir} " : '') . 'date time') . n . column_head('IP', 'ip', 'log', true, $switch_dir, $crit, $search_method, ('ip' == $sort ? "{$dir} " : '') . 'log_detail ip') . n . column_head('host', 'host', 'log', true, $switch_dir, $crit, $search_method, ('host' == $sort ? "{$dir} " : '') . 'host') . n . column_head('page', 'page', 'log', true, $switch_dir, $crit, $search_method, ('page' == $sort ? "{$dir} " : '') . 'page') . n . column_head('referrer', 'refer', 'log', true, $switch_dir, $crit, $search_method, ('refer' == $sort ? "{$dir} " : '') . 'refer') . n . column_head('method', 'method', 'log', true, $switch_dir, $crit, $search_method, ('method' == $sort ? "{$dir} " : '') . 'log_detail method') . n . column_head('status', 'status', 'log', true, $switch_dir, $crit, $search_method, ('status' == $sort ? "{$dir} " : '') . 'log_detail status')) . n . '</thead>';
echo '<tbody>';
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'log');
if ($log_refer) {
$log_refer = 'http://' . $log_refer;
$log_refer = '<a href="' . txpspecialchars($log_refer) . '" target="_blank">' . txpspecialchars(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="' . txpspecialchars($log_page) . '" target="_blank">' . txpspecialchars($log_anchor) . '</a>';
if ($log_method == 'POST') {
$log_page = '<strong>' . $log_page . '</strong>';
}
}
echo tr(n . td(fInput('checkbox', 'selected[]', $log_id), '', 'multi-edit') . td(gTime($log_uTime), '', 'date time') . td(txpspecialchars($log_ip), '', 'log_detail ip') . td(txpspecialchars(soft_wrap($log_host, 30)), '', 'host') . td($log_page, '', 'page') . td($log_refer, '', 'refer') . td(txpspecialchars($log_method), '', 'log_detail method') . td($log_status, '', 'log_detail status'));
}
echo '</tbody>', n, endTable(), n, '</div>', n, log_multiedit_form($page, $sort, $dir, $crit, $search_method), n, tInput(), n, '</form>', n, graf(toggle_box('log_detail'), ' class="detail-toggle"'), 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>';
}
}
示例10: sec_section_list
//.........这里部分代码省略.........
$dir = get_pref('section_sort_dir', 'desc');
}
$dir = $dir == 'asc' ? 'asc' : 'desc';
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;
}
set_pref('section_sort_column', $sort, 'section', 2, '', 0, PREF_PRIVATE);
set_pref('section_sort_dir', $dir, 'section', 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('name' => "name = '{$crit_escaped}'", 'title' => "title = '{$crit_escaped}'", 'page' => "page = '{$crit_escaped}'", 'css' => "css = '{$crit_escaped}'", 'description' => "description = '{$crit_escaped}'") : array('name' => "name like '%{$crit_escaped}%'", 'title' => "title like '%{$crit_escaped}%'", 'page' => "page like '%{$crit_escaped}%'", 'css' => "css like '%{$crit_escaped}%'", 'description' => "description like '%{$crit_escaped}%'");
if ($verbatim) {
$critsql['in_rss'] = "('{$crit_escaped}' in ('" . doSlash(gTxt('yes')) . "', 1) and in_rss = 1) or\n ('{$crit_escaped}' in ('" . doSlash(gTxt('no')) . "', '0') and in_rss = 0)";
$critsql['on_frontpage'] = "('{$crit_escaped}' in ('" . doSlash(gTxt('yes')) . "', 1) and on_frontpage = 1) or\n ('{$crit_escaped}' in ('" . doSlash(gTxt('no')) . "', '0') and on_frontpage = 0)";
$critsql['searchable'] = "('{$crit_escaped}' in ('" . doSlash(gTxt('yes')) . "', 1) and searchable = 1) or\n ('{$crit_escaped}' in ('" . doSlash(gTxt('no')) . "', '0') and searchable = 0)";
} else {
$critsql['in_rss'] = "(('" . doSlash(gTxt('yes')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = 1) and in_rss = 1) or\n (('" . doSlash(gTxt('no')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = '0') and in_rss = 0)";
$critsql['on_frontpage'] = "(('" . doSlash(gTxt('yes')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = 1) and on_frontpage = 1) or\n (('" . doSlash(gTxt('no')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = '0') and on_frontpage = 0)";
$critsql['searchable'] = "(('" . doSlash(gTxt('yes')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = 1) and searchable = 1) or\n (('" . doSlash(gTxt('no')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = '0') and searchable = 0)";
}
$search_sql = array();
foreach ((array) $search_method as $method) {
if (isset($critsql[$method])) {
$search_sql[] = $critsql[$method];
}
}
if ($search_sql) {
$criteria = join(' or ', $search_sql);
$limit = 500;
} else {
$search_method = '';
$crit = '';
}
} else {
$search_method = '';
$crit = '';
}
$criteria .= callback_event('admin_criteria', 'section_list', 0, $criteria);
$total = safe_count('txp_section', $criteria);
echo hed(gTxt('tab_sections') . popHelp('section_category'), 1, array('class' => 'txp-heading')) . n . tag_start('div', array('id' => $event . '_control', 'class' => 'txp-control-panel')) . graf(sLink('section', 'section_edit', gTxt('create_section')), array('class' => 'txp-buttons')) . n . tag_start('form', array('id' => 'default_section_form', 'name' => 'default_section_form', 'method' => 'post', 'action' => 'index.php', 'class' => 'async')) . graf(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');
if ($total < 1) {
if ($criteria != 1) {
echo section_search_form($crit, $search_method) . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
}
return;
}
$limit = max($section_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo section_search_form($crit, $search_method) . '</div>';
$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_start('div', array('id' => $event . '_container', 'class' => 'txp-container')) . n . tag_start('form', array('action' => 'index.php', 'id' => 'section_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('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'))) . sp . span(span('[', array('aria-hidden' => 'true')) . href(gTxt('view'), pagelinkurl(array('s' => $sec_name))) . span(']', array('aria-hidden' => 'true')), array('class' => 'section_detail')), '', array('scope' => 'row', 'class' => 'txp-list-col-name')) . 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));
}
echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . section_multiedit_form($page, $sort, $dir, $crit, $search_method) . tInput() . n . tag_end('form') . graf(toggle_box('section_detail'), array('class' => 'detail-toggle')) . n . tag_start('div', array('id' => $event . '_navigation', 'class' => 'txp-navigation')) . pageby_form('section', $section_list_pageby) . nav_form('section', $page, $numPages, $sort, $dir, $crit, $search_method, $total, $limit) . n . tag_end('div') . n . tag_end('div');
}
}
示例11: admin_multi_edit
/**
* Processes multi-edit actions.
*
* Accessing requires 'admin.edit' privileges.
*/
function admin_multi_edit()
{
global $txp_user;
require_privs('admin.edit');
$selected = ps('selected');
$method = ps('edit_method');
$changed = array();
$msg = '';
if (!$selected or !is_array($selected)) {
return author_list();
}
$clause = '';
if ($method === 'resetpassword') {
$clause = " AND last_access IS NOT NULL";
} elseif ($method === 'resendactivation') {
$clause = " AND last_access IS NULL";
}
$names = safe_column("name", 'txp_users', "name IN (" . join(',', quote_list($selected)) . ") AND name != '" . doSlash($txp_user) . "'" . $clause);
if (!$names) {
return author_list();
}
switch ($method) {
case 'delete':
$assign_assets = ps('assign_assets');
if (!$assign_assets) {
$msg = array('must_reassign_assets', E_ERROR);
} elseif (in_array($assign_assets, $names)) {
$msg = array('cannot_assign_assets_to_deletee', E_ERROR);
} elseif (remove_user($names, $assign_assets)) {
$changed = $names;
callback_event('authors_deleted', '', 0, $changed);
$msg = 'author_deleted';
}
break;
case 'changeprivilege':
if (change_user_group($names, ps('privs'))) {
$changed = $names;
$msg = 'author_updated';
}
break;
case 'resetpassword':
foreach ($names as $name) {
send_reset_confirmation_request($name);
$changed[] = $name;
}
$msg = 'password_reset_confirmation_request_sent';
break;
case 'resendactivation':
foreach ($names as $name) {
send_account_activation($name);
$changed[] = $name;
}
$msg = 'resend_activation_request_sent';
break;
}
if ($changed) {
return author_list(gTxt($msg, array('{name}' => txpspecialchars(join(', ', $changed)))));
}
author_list($msg);
}
示例12: 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;
}
//.........这里部分代码省略.........
示例13: link_edit
function link_edit($message = '')
{
global $vars, $event, $step, $txp_user;
pagetop(gTxt('tab_link'), $message);
echo '<div id="' . $event . '_container" class="txp-container">';
extract(array_map('assert_string', gpsa($vars)));
$is_edit = $id && $step == 'link_edit';
$rs = array();
if ($is_edit) {
$id = assert_int($id);
$rs = safe_row('*', 'txp_link', "id = {$id}");
if ($rs) {
extract($rs);
if (!has_privs('link.edit') && !($author == $txp_user && has_privs('link.edit.own'))) {
link_list(gTxt('restricted_area'));
return;
}
}
}
if (has_privs('link.edit') || has_privs('link.edit.own')) {
$caption = gTxt($is_edit ? 'edit_link' : 'add_new_link');
echo form('<div class="txp-edit">' . n . hed($caption, 2) . n . inputLabel('linkname', fInput('text', 'linkname', $linkname, '', '', '', INPUT_REGULAR, '', 'linkname'), 'title') . n . inputLabel('linksort', fInput('text', 'linksort', $linksort, '', '', '', INPUT_REGULAR, '', 'linksort'), 'sort_value', 'link_sort') . n . inputLabel('url', fInput('text', 'url', $url, '', '', '', INPUT_REGULAR, '', 'url'), 'url', 'link_url', 'edit-link-url') . n . inputLabel('link_category', linkcategory_popup($category) . ' [' . eLink('category', 'list', '', '', gTxt('edit')) . ']', 'link_category', 'link_category') . n . inputLabel('link_description', '<textarea id="link_description" name="description" cols="' . INPUT_LARGE . '" rows="' . INPUT_SMALL . '">' . txpspecialchars($description) . '</textarea>', 'description', 'link_description', '', '') . n . pluggable_ui('link_ui', 'extend_detail_form', '', $rs) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . eInput('link') . sInput('link_save') . hInput('id', $id) . hInput('search_method', gps('search_method')) . hInput('crit', gps('crit')) . '</div>', '', '', 'post', 'edit-form', '', 'link_details');
}
echo '</div>';
}
示例14: doDiagnostics
//.........这里部分代码省略.........
// Running development code in live mode is not recommended.
if (preg_match('/-dev$/', txp_version) and $production_status == 'live') {
$fail['dev_version_live'] = diag_msg_wrap(gTxt('dev_version_live'), 'warning');
}
// Missing files.
if ($missing = array_merge(array_keys($cs, INTEGRITY_MISSING), array_keys($cs, INTEGRITY_NOT_FILE), array_keys($cs, INTEGRITY_NOT_READABLE))) {
$fail['missing_files'] = diag_msg_wrap(gTxt('missing_files') . cs . n . t . join(', ' . n . t, $missing));
}
// Anything might break if arbitrary functions are disabled.
if (ini_get('disable_functions')) {
$disabled_funcs = array_map('trim', explode(',', ini_get('disable_functions')));
// Commonly disabled functions that we don't need.
$disabled_funcs = array_diff($disabled_funcs, array('imagefilltoborder', 'escapeshellarg', 'escapeshellcmd', 'exec', 'passthru', 'proc_close', 'proc_get_status', 'proc_nice', 'proc_open', 'proc_terminate', 'shell_exec', 'system', 'popen', 'dl', 'chown'));
if ($disabled_funcs) {
$fail['some_php_functions_disabled'] = diag_msg_wrap(gTxt('some_php_functions_disabled') . cs . join(', ', $disabled_funcs), 'warning');
}
}
// Not sure about this one.
// if (strncmp(php_sapi_name(), 'cgi', 3) == 0 and ini_get('cgi.rfc2616_headers'))
// $fail['cgi_header_config'] = gTxt('cgi_header_config');
$guess_site_url = $_SERVER['HTTP_HOST'] . preg_replace('#[/\\\\]$#', '', dirname(dirname($_SERVER['SCRIPT_NAME'])));
if ($siteurl and strip_prefix($siteurl, 'www.') != strip_prefix($guess_site_url, 'www.')) {
$fail['site_url_mismatch'] = diag_msg_wrap(gTxt('site_url_mismatch') . cs . $guess_site_url, 'warning');
}
// Test clean URL server vars.
if (hu) {
if (ini_get('allow_url_fopen') and $permlink_mode != 'messy') {
$s = md5(uniqid(rand(), true));
ini_set('default_socket_timeout', 10);
$pretext_data = @file(hu . $s . '/?txpcleantest=1');
if ($pretext_data) {
$pretext_req = trim(@$pretext_data[0]);
if ($pretext_req != md5('/' . $s . '/?txpcleantest=1')) {
$fail['clean_url_data_failed'] = diag_msg_wrap(gTxt('clean_url_data_failed') . cs . txpspecialchars($pretext_req), 'warning');
}
} else {
$fail['clean_url_test_failed'] = diag_msg_wrap(gTxt('clean_url_test_failed'), 'warning');
}
}
}
if ($tables = list_txp_tables()) {
$table_errors = check_tables($tables);
if ($table_errors) {
$fail['mysql_table_errors'] = diag_msg_wrap(gTxt('mysql_table_errors') . cs . n . t . join(', ' . n . t, $table_errors));
}
}
$active_plugins = array();
if ($rows = safe_rows('name, version, code_md5, md5(code) as md5', 'txp_plugin', 'status > 0')) {
foreach ($rows as $row) {
$n = $row['name'] . '-' . $row['version'];
if (strtolower($row['md5']) != strtolower($row['code_md5'])) {
$n .= 'm';
}
$active_plugins[] = $n;
}
}
$theme_manifest = $theme->manifest();
// Check GD info.
if (function_exists('gd_info')) {
$gd_info = gd_info();
$gd_support = array();
if ($gd_info['GIF Create Support']) {
$gd_support[] = 'GIF';
}
// Aside: In PHP 5.3, they chose to add a previously unemployed capital "E" to the array key.
if (!empty($gd_info['JPEG Support']) || !empty($gd_info['JPG Support'])) {
示例15: form_edit
function form_edit($message = '')
{
global $event, $step, $essential_forms;
pagetop(gTxt('edit_forms'), $message);
extract(gpsa(array('Form', 'name', 'type')));
$name = trim(preg_replace('/[<>&"\']/', '', $name));
if ($step == 'form_create') {
$inputs = fInput('submit', 'savenew', gTxt('save_new'), 'publish') . eInput("form") . sInput('form_save');
} else {
$name = (!$name or $step == 'form_delete') ? 'default' : $name;
$rs = safe_row("*", "txp_form", "name='" . doSlash($name) . "'");
extract($rs);
$inputs = fInput('submit', 'save', gTxt('save'), 'publish') . eInput("form") . sInput('form_save') . hInput('oldname', $name);
}
if (!in_array($name, $essential_forms)) {
$changename = graf(gTxt('form_name') . br . fInput('text', 'name', $name, 'edit', '', '', INPUT_REGULAR));
} else {
$changename = graf(gTxt('form_name') . br . tag($name, 'em') . hInput('name', $name));
}
// Generate the tagbuilder links
// Format of each entry is popTagLink -> array ( gTxt string, class/ID )
$tagbuild_items = array('article' => array('articles', 'article-tags'), 'link' => array('links', 'link-tags'), 'comment' => array('comments', 'comment-tags'), 'comment_details' => array('comment_details', 'comment-detail-tags'), 'comment_form' => array('comment_form', 'comment-form-tags'), 'search_result' => array('search_results_form', 'search-result-tags'), 'file_download' => array('file_download_tags', 'file-tags'), 'category' => array('category_tags', 'category-tags'), 'section' => array('section_tags', 'section-tags'));
$tagbuild_links = '';
foreach ($tagbuild_items as $tb => $item) {
$tagbuild_links .= '<div class="' . $item[1] . '">' . hed('<a href="#' . $item[1] . '">' . gTxt($item[0]) . '</a>', 3, ' class="lever' . (get_pref('pane_form_' . $item[1] . '_visible') ? ' expanded' : '') . '"') . '<div id="' . $item[1] . '" class="toggle on" style="display:' . (get_pref('pane_form_' . $item[1] . '_visible') ? 'block' : 'none') . '">' . popTagLinks($tb) . '</div></div>';
}
$out = '<h1 class="txp-heading">' . gTxt('tab_forms') . sp . popHelp('forms_overview') . '</h1>' . '<div id="' . $event . '_container" class="txp-container">' . startTable('', '', 'txp-columntable') . tr(tdtl('<div id="tagbuild_links">' . hed(gTxt('tagbuilder'), 2) . $tagbuild_links . '</div>', ' class="column"') . tdtl('<form action="index.php" method="post" id="form_form">' . '<div id="main_content">' . '<div class="edit-title">' . gTxt('you_are_editing_form') . sp . strong($name ? $name : gTxt('untitled')) . '</div>' . '<textarea id="form" class="code" name="Form" cols="' . INPUT_LARGE . '" rows="' . INPUT_REGULAR . '">' . txpspecialchars($Form) . '</textarea>' . $changename . graf(gTxt('form_type') . br . formtypes($type)) . (empty($type) ? graf(gTxt('only_articles_can_be_previewed')) : '') . (empty($type) || $type == 'article' ? fInput('submit', 'form_preview', gTxt('preview')) : '') . graf($inputs) . '</div>' . n . tInput() . n . '</form>', ' class="column"') . tdtl('<div id="content_switcher">' . hed(gTxt('all_forms'), 2) . form_list($name) . '</div>', ' class="column"')) . endTable() . '</div>';
echo $out;
}