本文整理汇总了PHP中doWrap函数的典型用法代码示例。如果您正苦于以下问题:PHP doWrap函数的具体用法?PHP doWrap怎么用?PHP doWrap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doWrap函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file_download_list
function file_download_list($atts)
{
global $thisfile;
extract(lAtts(array('break' => br, 'category' => '', 'class' => __FUNCTION__, 'form' => 'files', 'label' => '', 'labeltag' => '', 'limit' => '10', 'offset' => '0', 'sort' => 'filename asc', 'wraptag' => '', 'status' => '4'), $atts));
if (!is_numeric($status)) {
$status = getStatusNum($status);
}
$where = array('1=1');
if ($category) {
$where[] = "category IN ('" . join("','", doSlash(do_list($category))) . "')";
}
if ($status) {
$where[] = "status = '" . doSlash($status) . "'";
}
$qparts = array('order by ' . doSlash($sort), $limit ? 'limit ' . intval($offset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', join(' and ', $where) . ' ' . join(' ', $qparts));
if ($rs) {
$out = array();
while ($thisfile = nextRow($rs)) {
$out[] = parse_form($form);
$thisfile = '';
}
if ($out) {
if ($wraptag == 'ul' or $wraptag == 'ol') {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
return $wraptag ? tag(join($break, $out), $wraptag) : join(n, $out);
}
}
return '';
}
示例2: row
function row($row)
{
$tr = array();
foreach ($row as $v) {
$tr[] = $v;
}
if ($this->edit_actions and isset($row['id'])) {
$tr[] = fInput('checkbox', 'selected[]', $row['id']);
}
return doWrap($tr, 'tr', 'td', 'row-' . (++$this->count % 2 ? 'odd' : 'even'));
}
示例3: renderAuthors
/**
* Generates a list of authors.
*
* @param array $atts
* @param string $thing
* @return string
*/
public static function renderAuthors($atts, $thing = null)
{
global $thisauthor, $txp_groups;
extract(lAtts(array('break' => '', 'class' => '', 'form' => '', 'group' => '', 'label' => '', 'labeltag' => '', 'limit' => '', 'name' => '', 'offset' => '', 'sort' => 'name ASC', 'wraptag' => ''), $atts));
$sql = array('1 = 1');
$sql_limit = '';
$sql_sort = " ORDER BY " . doSlash($sort);
if ($name) {
$sql[] = "name IN (" . join(', ', quote_list(do_list($name))) . ")";
}
if ($group !== '') {
$privs = do_list($group);
$groups = array_flip($txp_groups);
foreach ($privs as &$priv) {
if (isset($groups[$priv])) {
$priv = $groups[$priv];
}
}
$sql[] = 'convert(privs, char) in (' . join(', ', quote_list($privs)) . ')';
}
if ($limit !== '' || $offset) {
$sql_limit = " LIMIT " . intval($offset) . ", " . ($limit === '' ? PHP_INT_MAX : intval($limit));
}
$rs = safe_rows_start("user_id as id, name, RealName as realname, email, privs, last_access", 'txp_users', join(" AND ", $sql) . " {$sql_sort} {$sql_limit}");
if ($rs && numRows($rs)) {
$out = array();
if ($thing === null && $form !== '') {
$thing = fetch_form($form);
}
while ($a = nextRow($rs)) {
$oldauthor = $thisauthor;
$thisauthor = $a;
$out[] = parse($thing);
$thisauthor = $oldauthor;
}
unset($thisauthor);
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
return '';
}
示例4: row
function row($row)
{
global $prefs;
extract($prefs);
if (!$this->controller) {
return;
}
extract($this->controller->context);
extract($row);
$event = $this->controller->event;
$edit_url = "?event={$event}" . a . 'step=edit' . a . 'id=' . $id . a . 'sort=' . $sort . a . 'dir=' . $dir . a . 'page=' . $page . a . 'search_method=' . $search_method . a . 'crit=' . $crit;
$name = empty($name) ? gTxt('unnamed') : htmlspecialchars($name);
if ($thumbnail) {
if ($ext != '.swf') {
$thumbnail = '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />';
} else {
$thumbnail = '';
}
}
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 = '<ul>' . '<li><a target="_blank" href="' . $tag_url . a . 'type=textile" onclick="popWin(this.href); return false;">Textile</a></li>' . '<li><a target="_blank" href="' . $tag_url . a . 'type=textpattern" onclick="popWin(this.href); return false;">Textpattern</a></li>' . '<li><a target="_blank" href="' . $tag_url . a . 'type=xhtml" onclick="popWin(this.href); return false;">XHTML</a></li>' . '</ul>';
} else {
$tagbuilder = sp;
}
$category = $category ? '<span title="' . htmlspecialchars(fetch_category_title($category, 'image')) . '">' . $category . '</span>' : '';
$tr = array();
$tr[] = $id;
$tr[] = n . '<ul>' . n . t . '<li>' . href(gTxt('edit'), $edit_url) . '</li>' . n . t . '<li><a href="' . hu . $img_dir . '/' . $id . $ext . '">' . gTxt('view') . '</a></li>' . n . '</ul>';
$tr[] = gTime($uDate);
$tr[] = href($name, $edit_url);
$tr[] = $thumbnail;
$tr[] = $tagbuilder;
$tr[] = $category;
$tr[] = '<span title="' . htmlspecialchars(get_author_name($author)) . '">' . $author . '</span>';
$tr[] = dLink($this->controller->event, 'delete', 'id', $id, '', '', '', false, array($page, $sort, $dir, $crit, $search_method));
if ($this->edit_actions and isset($row['id'])) {
$tr[] = fInput('checkbox', 'selected[]', $row['id']);
}
return doWrap($tr, 'tr', 'td', 'row-' . (++$this->count % 2 ? 'odd' : 'even'));
}
示例5: adi_menu
function adi_menu($atts)
{
global $s, $out, $sort, $menu_id, $parent_class, $active_class, $exclude, $sections, $default_title, $default_first, $clone_title, $include_default, $class, $link_span, $list_id, $list_id_prefix, $active_li_class;
extract(lAtts(array('active_class' => 'active_class', 'active_li_class' => '', 'class' => 'section_list', 'include_default' => '1', 'default_title' => 'Home', 'exclude' => '', 'sections' => '', 'sort' => 'NULL', 'menu_id' => 'mainmenu', 'parent_class' => 'menuparent', 'default_first' => '1', 'clone_title' => 'Summary', 'link_span' => '0', 'list_id' => '0', 'list_id_prefix' => 'menu_', 'debug' => '0'), $atts));
$default_title = trim($default_title);
$clone_title = trim($clone_title);
if (empty($clone_title)) {
// don't want it to be empty
$clone_title = 'Summary';
}
$sections = trim($sections);
// menu not output if sections = " "
$sort = trim($sort);
// MySQL error if sort = " "
// set sort to database order by default
empty($sort) ? $sort = 'NULL' : ($sort = doSlash($sort));
/* adi_menu - main procedure */
$section_list = adi_menu_section_list(FALSE);
$hierarchy = adi_menu_hierarchy($section_list, '', 0);
if ($debug) {
echo "SECTION LIST<br/>";
dmp($section_list);
echo "HIERARCHY<br/>";
dmp($hierarchy);
}
$out = adi_menu_markup($hierarchy, 0);
return doWrap($out, '', '');
}
示例6: file_download_list
function file_download_list($atts, $thing = NULL)
{
global $s, $c, $context, $thisfile, $thispage, $pretext;
extract(lAtts(array('break' => br, 'category' => '', 'author' => '', 'realname' => '', 'auto_detect' => 'category, author', 'class' => __FUNCTION__, 'form' => 'files', 'id' => '', 'label' => '', 'labeltag' => '', 'pageby' => '', 'limit' => 10, 'offset' => 0, 'sort' => 'filename asc', 'wraptag' => '', 'status' => '4'), $atts));
if (!is_numeric($status)) {
$status = getStatusNum($status);
}
// N.B. status treated slightly differently
$where = $statwhere = array();
$filters = isset($atts['id']) || isset($atts['category']) || isset($atts['author']) || isset($atts['realname']) || isset($atts['status']);
$context_list = empty($auto_detect) || $filters ? array() : do_list($auto_detect);
$pageby = $pageby == 'limit' ? $limit : $pageby;
if ($category) {
$where[] = "category IN ('" . join("','", doSlash(do_list($category))) . "')";
}
$ids = array_map('intval', do_list($id));
if ($id) {
$where[] = "id IN ('" . join("','", $ids) . "')";
}
if ($status) {
$statwhere[] = "status = '" . doSlash($status) . "'";
}
if ($author) {
$where[] = "author IN ('" . join("','", doSlash(do_list($author))) . "')";
}
if ($realname) {
$authorlist = safe_column('name', 'txp_users', "RealName IN ('" . join("','", doArray(doSlash(do_list($realname)), 'urldecode')) . "')");
$where[] = "author IN ('" . join("','", doSlash($authorlist)) . "')";
}
// If no files are selected, try...
if (!$where && !$filters) {
foreach ($context_list as $ctxt) {
switch ($ctxt) {
case 'category':
// ... the global category in the URL
if ($context == 'file' && !empty($c)) {
$where[] = "category = '" . doSlash($c) . "'";
}
break;
case 'author':
// ... the global author in the URL
if ($context == 'file' && !empty($pretext['author'])) {
$where[] = "author = '" . doSlash($pretext['author']) . "'";
}
break;
}
// Only one context can be processed
if ($where) {
break;
}
}
}
if (!$where && !$statwhere && $filters) {
return '';
// If nothing matches, output nothing
}
if (!$where) {
$where[] = "1=1";
// If nothing matches, start with all files
}
$where = join(' AND ', array_merge($where, $statwhere));
// Set up paging if required
if ($limit && $pageby) {
$grand_total = safe_count('txp_file', $where);
$total = $grand_total - $offset;
$numPages = $pageby > 0 ? ceil($total / $pageby) : 1;
$pg = !$pretext['pg'] ? 1 : $pretext['pg'];
$pgoffset = $offset + ($pg - 1) * $pageby;
// send paging info to txp:newer and txp:older
$pageout['pg'] = $pg;
$pageout['numPages'] = $numPages;
$pageout['s'] = $s;
$pageout['c'] = $c;
$pageout['context'] = 'file';
$pageout['grand_total'] = $grand_total;
$pageout['total'] = $total;
if (empty($thispage)) {
$thispage = $pageout;
}
} else {
$pgoffset = $offset;
}
// preserve order of custom file ids unless 'sort' attribute is set
if (!empty($atts['id']) && empty($atts['sort'])) {
$safe_sort = 'field(id, ' . join(',', $ids) . ')';
} else {
$safe_sort = doSlash($sort);
}
$qparts = array('order by ' . $safe_sort, $limit ? 'limit ' . intval($pgoffset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('*', 'txp_file', $where . ' ' . join(' ', $qparts));
if ($rs) {
$out = array();
while ($a = nextRow($rs)) {
$thisfile = file_download_format_info($a);
$out[] = $thing ? parse($thing) : parse_form($form);
$thisfile = '';
}
if ($out) {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
//.........这里部分代码省略.........
示例7: doHomeArticles
function doHomeArticles($atts, $thing = NULL)
{
global $pretext, $prefs;
extract($pretext);
extract($prefs);
$customFields = getCustomFields();
$customlAtts = array_null(array_flip($customFields));
//getting attributes
$theAtts = lAtts(array('form' => 'default', 'listform' => '', 'searchform' => '', 'limit' => 10, 'category' => '', 'section' => '', 'excerpted' => '', 'author' => '', 'sort' => '', 'month' => '', 'keywords' => '', 'frontpage' => '', 'time' => 'past', 'pgonly' => 0, 'searchall' => 1, 'allowoverride' => true, 'offset' => 0, 'wraptag' => '', 'break' => '', 'label' => '', 'labeltag' => '', 'class' => '') + $customlAtts, $atts);
$theAtts['category'] = $c ? $c : '';
$theAtts['section'] = $s && $s != 'default' && $s != 'home' ? $s : '';
$theAtts['author'] = !empty($author) ? $author : '';
$theAtts['month'] = !empty($month) ? $month : '';
$theAtts['frontpage'] = $s && $s == 'home' ? true : false;
$theAtts['excerpted'] = '';
extract($theAtts);
// if a listform is specified, $thing is for doArticle() - hence ignore here.
if (!empty($listform)) {
$thing = '';
}
$pageby = empty($pageby) ? $limit : $pageby;
$match = $search = '';
if (!$sort) {
$sort = 'Posted desc';
}
//Building query parts
$frontpage = filterFrontPage();
$category = join("','", doSlash(do_list($category)));
$category = !$category ? '' : " and (Category1 IN ('" . $category . "') or Category2 IN ('" . $category . "'))";
$section = !$section ? '' : " and Section IN ('" . join("','", doSlash(do_list($section))) . "')";
$excerpted = $excerpted == 'y' ? " and Excerpt !=''" : '';
$author = !$author ? '' : " and AuthorID IN ('" . join("','", doSlash(do_list($author))) . "')";
$month = !$month ? '' : " and Posted like '" . doSlash($month) . "%'";
$id = !$id ? '' : " and ID IN (" . join(',', array_map('intval', do_list($id))) . ")";
switch ($time) {
case 'any':
$time = "";
break;
case 'future':
$time = " and Posted > now()";
break;
default:
$time = " and Posted <= now()";
}
if (!$publish_expired_articles) {
$time .= " and (now() <= Expires or Expires = " . NULLDATETIME . ")";
}
$custom = '';
if ($customFields) {
foreach ($customFields as $cField) {
if (isset($atts[$cField])) {
$customPairs[$cField] = $atts[$cField];
}
}
if (!empty($customPairs)) {
$custom = buildCustomSql($customFields, $customPairs);
}
}
$statusq = ' and Status = 5';
$where = "1=1" . $statusq . $time . $search . $category . $section . $excerpted . $month . $author . $keywords . $custom . $frontpage;
$rs = safe_rows_start("*, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod" . $match, 'textpattern', $where . ' order by ' . doSlash($sort) . ' limit 0' . intval($limit));
// get the form name
$fname = $listform ? $listform : $form;
if ($rs) {
$count = 0;
$last = numRows($rs);
$articles = array();
while ($a = nextRow($rs)) {
++$count;
populateArticleData($a);
global $thisarticle, $uPosted, $limit;
$thisarticle['is_first'] = $count == 1;
$thisarticle['is_last'] = $count == $last;
if (@constant('txpinterface') === 'admin' and gps('Form')) {
$articles[] = parse(gps('Form'));
} elseif ($allowoverride and $a['override_form']) {
$articles[] = parse_form($a['override_form']);
} else {
$articles[] = $thing ? parse($thing) : parse_form($fname);
}
// sending these to paging_link(); Required?
$uPosted = $a['uPosted'];
unset($GLOBALS['thisarticle']);
}
return doLabel($label, $labeltag) . doWrap($articles, $wraptag, $break, $class);
}
}
示例8: sed_comments
function sed_comments($atts)
{
global $thisarticle, $prefs, $comment_preview, $pretext;
extract($prefs);
extract(lAtts(array('id' => @$pretext['id'], 'form' => 'comments', 'wraptag' => $comments_are_ol ? 'ol' : '', 'break' => $comments_are_ol ? 'li' : 'div', 'class' => __FUNCTION__, 'breakclass' => '', 'sort' => 'posted ASC'), $atts));
assert_article();
if (is_array($thisarticle)) {
extract($thisarticle);
}
if (@$thisid) {
$id = $thisid;
}
#
# Extract the sed article overrides...
# Access the custom field that houses the vars and explode the string on ';' boundaries.
#
$sed_vars = _sed_cp_get_sed_vars(@$thisarticle['sed per-article vars']);
$sed_vars = lAtts(array('sed_delay' => '0', 'sed_ttl' => '', 'sed_on_cull' => 'hide', 'sed_ttl_grace' => ''), $sed_vars);
extract($sed_vars);
if (!empty($comment_preview)) {
$preview = psas(array('name', 'email', 'web', 'message', 'parentid', 'remember'));
$preview['time'] = time();
$preview['discussid'] = 0;
$preview['message'] = markup_comment($preview['message']);
$GLOBALS['thiscomment'] = $preview;
$comments[] = parse_form($form) . n;
unset($GLOBALS['thiscomment']);
$out = doWrap($comments, $wraptag, $break, $class, $breakclass);
} else {
$rs = safe_rows_start("*, unix_timestamp(posted) as time", "txp_discuss", 'parentid=' . intval($id) . ' and visible=' . VISIBLE . ' order by ' . doSlash($sort));
$out = '';
if ($rs) {
$comments = array();
$culled_comments = array();
while ($vars = nextRow($rs)) {
$culled = false;
$show = true;
$extra = '';
$now = time();
$remaining = '';
#
# If the comment is in a deleting page then check if it is to be culled...
#
if (!empty($sed_ttl)) {
$do_cull_check = true;
#
# Are we in any grace period???
#
if (!empty($sed_ttl_grace) && 0 != $sed_ttl_grace) {
$do_cull_check = _sed_cp_if_outside_period($thisarticle['posted'], $sed_ttl_grace, $vars['time'], $remaining);
}
#
# If not then do the cull checking...
#
if ($do_cull_check) {
$culled = _sed_cp_if_outside_period($vars['time'], $sed_ttl, $now, $remaining);
}
#
# Display how long to go before culling.
#
if ($do_cull_check && !$culled) {
$vars['message'] .= "<br/><br/><strong>[MARKED FOR DELETION IN {$remaining}.]</strong>";
}
}
if ($culled) {
$extra .= ' culled';
$culled_comments[] = $vars;
$vars['time'] = $now;
$vars['message'] .= "<br/><br/><strong>[DELETED.]</strong>";
} else {
#
# See if the comment is in its "hidden" period.
# This is to try and discourage spam-robots that immediately see if their posts appear live.
#
if (!empty($sed_delay) && $sed_delay > '0') {
$show = _sed_cp_if_outside_period($vars['time'], $sed_delay, $now, $remaining);
}
#
# Still hidden so show a place-holder comment instead.
#
if (!$show) {
$extra .= ' delay_queue';
$vars['name'] = "[DELAYED]";
$vars['time'] = $now;
$vars['message'] = "A comment has been recorded and is in the delay queue.";
$vars['message'] .= "<br/><br/><strong>[REVEALED IN {$remaining}.]</strong>";
}
}
#
# Save the additional css class markup for this comment in the vars before parsing the comment form.
#
$vars['sed_class_extra'] = $extra;
$GLOBALS['thiscomment'] = $vars;
$comments[] = parse_form($form) . n;
unset($GLOBALS['thiscomment']);
}
$out .= doWrap($comments, $wraptag, $break, $class, $breakclass);
#
# Process the culled list...
#
//.........这里部分代码省略.........
示例9: zem_event_search_input
function zem_event_search_input($atts)
{
global $pretext, $zem_event_has_js;
extract(lAtts(array('class' => __FUNCTION__, 'break' => 'br', 'wraptag' => 'div', 'class' => __FUNCTION__, 'breakclass' => '', 'sep' => ' ', 'method' => 'post', 'section' => @$pretext['s']), $atts));
$out[] = '<label for="date_from">From:</label>' . $sep . '<input type="text" name="date_from" id="date_from" class="zem_date_select" value="' . htmlspecialchars(gps('date_from')) . '" />';
$out[] = '<label for="date_to">To:</label>' . $sep . '<input type="text" name="date_to" id="date_to" class="zem_date_select" value="' . htmlspecialchars(gps('date_to')) . '" />';
$out[] = '<label for="q">Search:</label>' . $sep . '<input type="text" name="q" id="q" value="' . htmlspecialchars(gps('q')) . '" />';
$cats = getTree('root', 'event');
$fs_c = '<legend>Category</legend>';
$fs_c .= '<input type="checkbox" name="all_categories" id="all_categories" value="1"' . (gps('all_categories') ? ' checked="checked"' : '') . ' />' . $sep . '<label for="all_categories">All Categories</label>' . br . n;
$gps_c = gps('c') ? gps('c') : array();
foreach ($cats as $c) {
$fs_c .= '<input type="checkbox" name="c[' . $c['name'] . ']" id="c[' . $c['name'] . ']" value="' . $c['name'] . '"' . (in_array($c['name'], $gps_c) ? ' checked="checked"' : '') . ' />' . $sep . '<label for="c[' . $c['name'] . ']">' . htmlspecialchars($c['title']) . '</label>' . br . n;
}
$out[] = '<fieldset id="category">' . $fs_c . '</fieldset>';
$locs = safe_column('distinct location as l', 'zem_event_calendar', '1=1 order by location asc');
$fs_l = '<legend>Location</legend>';
$fs_l .= '<input type="checkbox" name="all_locations" id="all_locations" value="1"' . (gps('all_locations') ? ' checked="checked"' : '') . ' />' . $sep . '<label for="all_locations">All Locations</label>' . br . n;
$gps_l = gps('location') ? gps('location') : array();
foreach ($locs as $l) {
$fs_l .= '<input type="checkbox" name="location[' . $l . ']" id="location[' . $l . ']" value="' . $l . '"' . (in_array($l, $gps_l) ? ' checked="checked"' : '') . ' />' . $sep . '<label for="location[' . $l . ']">' . htmlspecialchars($l) . '</label>' . br . n;
}
$out[] = '<fieldset id="location">' . $fs_l . '</fieldset>';
$out[] = '<input type="submit" name="search" value="Search" />';
$js = '';
if ($zem_event_has_js) {
if (zem_event_date_format() == 'MM/dd/yyyy') {
$format = 'mdy';
$ds = '/';
} else {
$format = 'ymd';
$ds = '-';
}
$js = script_js('$.datePicker.setDateFormat(\'' . $format . '\',\'' . $ds . '\');
$(\'input.zem_date_select\').datePicker();');
}
$url = pagelinkurl(array('s' => $section));
return '<form action="' . $url . '" method="post">' . doWrap($out, $wraptag, $break, $class, $breakclass) . '</form>' . n . $js;
}
示例10: doArticles
//.........这里部分代码省略.........
$time = " AND Posted <= " . now('posted');
}
if (!$expired) {
$time .= " AND (" . now('expires') . " <= Expires OR Expires = " . NULLDATETIME . ")";
}
$custom = '';
if ($customFields) {
foreach ($customFields as $cField) {
if (isset($atts[$cField])) {
$customPairs[$cField] = $atts[$cField];
}
}
if (!empty($customPairs)) {
$custom = buildCustomSql($customFields, $customPairs);
}
}
// Allow keywords for no-custom articles. That tagging mode, you know.
if ($keywords) {
$keys = doSlash(do_list_unique($keywords));
foreach ($keys as $key) {
$keyparts[] = "FIND_IN_SET('" . $key . "', Keywords)";
}
$keywords = " AND (" . join(' or ', $keyparts) . ")";
}
if ($q and $searchsticky) {
$statusq = " AND Status >= " . STATUS_LIVE;
} elseif ($id) {
$statusq = " AND Status >= " . STATUS_LIVE;
} else {
$statusq = " AND Status = " . intval($status);
}
$where = "1 = 1" . $statusq . $time . $search . $id . $category . $section . $excerpted . $month . $author . $keywords . $custom . $frontpage;
// Do not paginate if we are on a custom list.
if (!$iscustom and !$issticky) {
$grand_total = safe_count('textpattern', $where);
$total = $grand_total - $offset;
$numPages = ceil($total / $pageby);
$pg = !$pg ? 1 : $pg;
$pgoffset = $offset + ($pg - 1) * $pageby;
// Send paging info to txp:newer and txp:older.
$pageout['pg'] = $pg;
$pageout['numPages'] = $numPages;
$pageout['s'] = $s;
$pageout['c'] = $c;
$pageout['context'] = 'article';
$pageout['grand_total'] = $grand_total;
$pageout['total'] = $total;
global $thispage;
if (empty($thispage)) {
$thispage = $pageout;
}
if ($pgonly) {
return;
}
} else {
$pgoffset = $offset;
}
// Preserve order of custom article ids unless 'sort' attribute is set.
if (!empty($atts['id']) && empty($atts['sort'])) {
$safe_sort = "FIELD(id, " . join(',', $ids) . ")";
} else {
$safe_sort = doSlash($sort);
}
$rs = safe_rows_start("*, UNIX_TIMESTAMP(Posted) AS uPosted, UNIX_TIMESTAMP(Expires) AS uExpires, UNIX_TIMESTAMP(LastMod) AS uLastMod" . $match, 'textpattern', "{$where} ORDER BY {$safe_sort} LIMIT " . intval($pgoffset) . ", " . intval($limit));
// Get the form name.
if ($q and !$iscustom and !$issticky) {
$fname = $searchform ? $searchform : 'search_results';
} else {
$fname = !empty($listform) ? $listform : $form;
}
if ($rs) {
$count = 0;
$last = numRows($rs);
$articles = array();
while ($a = nextRow($rs)) {
++$count;
populateArticleData($a);
global $thisarticle, $uPosted, $limit;
$thisarticle['is_first'] = $count == 1;
$thisarticle['is_last'] = $count == $last;
// Article form preview.
if (txpinterface === 'admin' && ps('Form')) {
doAuth();
if (!has_privs('form')) {
txp_status_header('401 Unauthorized');
exit(hed('401 Unauthorized', 1) . graf(gTxt('restricted_area')));
}
$articles[] = parse(gps('Form'));
} elseif ($allowoverride and $a['override_form']) {
$articles[] = parse_form($a['override_form']);
} else {
$articles[] = $thing ? parse($thing) : parse_form($fname);
}
// Sending these to paging_link(); Required?
$uPosted = $a['uPosted'];
unset($GLOBALS['thisarticle']);
}
return doLabel($label, $labeltag) . doWrap($articles, $wraptag, $break, $class);
}
}
示例11: sed_pcf_for_each_value
function sed_pcf_for_each_value($atts, $thing)
{
global $thisarticle;
assert_article();
$def_custom_name = 'custom1';
extract($merged = lAtts(array('debug' => 0, 'name' => $def_custom_name, 'id' => '', 'form' => '', 'label' => '', 'labeltag' => '', 'wraptag' => 'ul', 'break' => 'li', 'class' => ''), $atts));
if ($debug) {
echo dmp($merged);
}
$field = @$thisarticle[$name];
if (empty($field)) {
if ($debug) {
echo "Returning early - nothing to do in CF[{$name}].";
}
return '';
}
if (empty($class)) {
$class = $name;
}
if (!empty($form)) {
# grab the form (if any)
$thing = fetch_form($form);
}
if (empty($thing)) {
# if no form, and no enclosed thing, use built-in formula...
$thing = '{value}';
}
$out = array();
$field = do_list($field);
foreach ($field as $value) {
$out[] = parse(str_replace('{value}', $value, $thing));
}
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class, '', '', '', $id);
}
示例12: file_download_list
function file_download_list($atts, $thing = NULL)
{
global $thisfile;
extract(lAtts(array('break' => br, 'category' => '', 'class' => __FUNCTION__, 'form' => 'files', 'label' => '', 'labeltag' => '', 'limit' => 10, 'offset' => 0, 'sort' => 'filename asc', 'wraptag' => '', 'status' => '4'), $atts));
if (!is_numeric($status)) {
$status = getStatusNum($status);
}
$where = array('1=1');
if ($category) {
$where[] = "category IN ('" . join("','", doSlash(do_list($category))) . "')";
}
if ($status) {
$where[] = "status = '" . doSlash($status) . "'";
}
$qparts = array('order by ' . doSlash($sort), $limit ? 'limit ' . intval($offset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('*', 'txp_file', join(' and ', $where) . ' ' . join(' ', $qparts));
if ($rs) {
$out = array();
while ($a = nextRow($rs)) {
$thisfile = file_download_format_info($a);
$out[] = $thing ? parse($thing) : parse_form($form);
$thisfile = '';
}
if ($out) {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
}
return '';
}
示例13: mem_self_register_install
//.........这里部分代码省略.........
}
if (!($rs = safe_field('val', 'txp_prefs', "name='mem_self_admin_email'"))) {
if (set_pref('mem_self_admin_email', $admin_email, 'self_reg', 1)) {
$log[] = mem_self_gTxt('log_added_pref', array('{name}' => 'mem_self_admin_email'));
} else {
$log[] = mem_self_gTxt('log_pref_failed', array('{name}' => 'mem_self_admin_email', '{error}' => mysql_error()));
}
} else {
$log[] = mem_self_gTxt('log_pref_exists', array('{name}' => 'mem_self_admin_email', '{value}' => $rs));
}
if (!($rs = safe_field('val', 'txp_prefs', "name='mem_self_admin_name'"))) {
if (set_pref('mem_self_admin_name', $admin_name, 'self_reg', 1)) {
$log[] = mem_self_gTxt('log_added_pref', array('{name}' => 'mem_self_admin_name'));
} else {
$log[] = mem_self_gTxt('log_pref_failed', array('{name}' => 'mem_self_admin_name', '{error}' => mysql_error()));
}
} else {
$log[] = mem_self_gTxt('log_pref_exists', array('{name}' => 'mem_self_admin_name', '{value}' => $rs));
}
if (!($rs = safe_row('val,html', 'txp_prefs', "name='mem_self_new_user_priv'"))) {
if (set_pref('mem_self_new_user_priv', $new_user_priv, 'self_reg', 1, 0, 'priv_levels')) {
$log[] = mem_self_gTxt('log_added_pref', array('{name}' => 'mem_self_new_user_priv'));
$mem_self['new_user_priv'] = $new_user_priv;
} else {
$log[] = mem_self_gTxt('log_pref_failed', array('{name}' => 'mem_self_newuser_priv', '{error}' => mysql_error()));
}
} else {
safe_update('txp_prefs', "html='priv_levels'", "name='mem_self_new_user_priv'");
$log[] = mem_self_gTxt('log_pref_exists', array('{name}' => 'mem_self_new_user_priv', '{value}' => $rs));
}
// create default registration form
$form_html = <<<EOF
\t<fieldset>
\t<legend>Register</legend>
\t\t<txp:mem_form_text name="RealName" label="Full Name" /><br />
\t\t<br />
\t\t
\t\t<txp:mem_form_text name="name" label="Username" /><br />
\t\t<br />
\t\t
\t\t<txp:mem_form_email name="email" label="E-Mail" /><br />
\t\t<br />
\t\t<txp:mem_form_submit />
\t</fieldset>
EOF;
$form = fetch('Form', 'txp_form', 'name', 'self_register_form');
if (!$form) {
if (safe_insert('txp_form', "name='self_register_form',type='misc',Form='{$form_html}'")) {
$log[] = mem_self_gTxt('log_form_added', array('{name}' => 'self_register_form'));
} else {
$log[] = mem_self_gTxt('log_form_failed', array('{name}' => 'self_register_form', '{error}' => mysql_error())) . br . '<textpattern style="width:300px;height:150px;">' . htmlspecialchars($form_html) . '</textarea>';
}
} else {
$log[] = mem_self_gTxt('log_form_found', array('{name}' => 'self_register_form'));
}
// create default successful registration form to show the user
$form_html = <<<EOF
<h3>Account Created</h3>
<p>An email containing your password has been sent to <txp:mem_profile var="email" />.</p>
EOF;
$form = fetch('Form', 'txp_form', 'name', 'self_register_success');
if (!$form) {
if (safe_insert('txp_form', "name='self_register_success',type='misc',Form='{$form_html}'")) {
$log[] = mem_self_gTxt('log_form_added', array('{name}' => 'self_register_success'));
} else {
$log[] = mem_self_gTxt('log_form_failed', array('{name}' => 'self_register_success', '{error}' => mysql_error())) . br . '<textpattern style="width:300px;height:150px;">' . htmlspecialchars($form_html) . '</textarea>';
}
} else {
$log[] = mem_self_gTxt('log_form_found', array('{name}' => 'self_register_success'));
}
// create default successful registration email form
$form_html = <<<EOF
Dear <txp:mem_name />,
Thank you for registering at <txp:mem_siteurl />.
Your login name: <txp:mem_username />
Your password: <txp:mem_password />
If you have any questions please reply to this email address.
Sincerely,
<txp:mem_admin_name />
<txp:mem_admin_email />
EOF;
$form = fetch('Form', 'txp_form', 'name', 'self_register_email');
if (!$form) {
if (safe_insert('txp_form', "name='self_register_email',type='misc',Form='{$form_html}'")) {
$log[] = mem_self_gTxt('log_form_added', array('{name}' => 'self_register_email'));
} else {
$log[] = mem_self_gTxt('log_form_failed', array('{name}' => 'self_register_email', '{error}' => mysql_error())) . br . '<textpattern style="width:300px;height:150px;">' . htmlspecialchars($form_html) . '</textarea>';
}
} else {
$log[] = mem_self_gTxt('log_form_found', array('{name}' => 'self_register_email'));
}
$tag_help = '<txp:mem_self_register_form form="self_register_form" />';
$log[] = mem_self_gTxt('log_xmpl_tag') . br . '<textarea style="width:400px;height:40px;">' . htmlspecialchars($tag_help) . '</textarea>';
return doWrap($log, 'ul', 'li');
}
示例14: image_index
function image_index($atts)
{
global $s, $c, $p, $img_dir, $path_to_site;
extract(lAtts(array('label' => '', 'break' => br, 'wraptag' => '', 'class' => __FUNCTION__, 'labeltag' => '', 'c' => $c, 'limit' => 0, 'offset' => 0, 'sort' => 'name ASC'), $atts));
$qparts = array("category = '" . doSlash($c) . "' and thumbnail = 1", 'order by ' . doSlash($sort), $limit ? 'limit ' . intval($offset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('*', 'txp_image', join(' ', $qparts));
if ($rs) {
$out = array();
while ($a = nextRow($rs)) {
extract($a);
$impath = $img_dir . '/' . $id . 't' . $ext;
$imginfo = getimagesize($path_to_site . '/' . $impath);
$dims = !empty($imginfo[3]) ? ' ' . $imginfo[3] : '';
$url = pagelinkurl(array('c' => $c, 's' => $s, 'p' => $id));
$out[] = '<a href="' . $url . '">' . '<img src="' . hu . $impath . '"' . $dims . ' alt="' . $alt . '" />' . '</a>';
}
if (count($out)) {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
}
return '';
}
示例15: peg_comments
function peg_comments($atts)
{
global $thisarticle, $thiscomment, $prefs;
extract(lAtts(array('form' => 'comments', 'wraptag' => $prefs['comments_are_ol'] ? 'ol' : '', 'break' => $prefs['comments_are_ol'] ? 'li' : 'div', 'class' => 'comments', 'breakclass' => '', 'limit' => 0, 'offset' => 0, 'sort' => 'posted ASC'), $atts));
assert_article();
// extract($thisarticle);
if (!$thisarticle['comments_count']) {
return '';
}
$thisid = intval($thisarticle['thisid']);
// $txp_discuss = safe_pfx('txp_discuss');
// $peg_discuss = safe_pfx('peg_discuss');
if (!empty($thiscomment)) {
$peg_children = $thiscomment['peg_children'];
} else {
// safe_query("CREATE TEMPORARY TABLE $peg_discuss (SELECT * FROM $txp_discuss WHERE parentid=$thisid AND visible=".VISIBLE.")");
$rs = safe_rows('discussid, peg_children', 'txp_discuss', "parentid={$thisid} AND visible=" . VISIBLE);
$peg_children = $rows = array();
foreach ($rs as $vars) {
$rows[] = $vars['discussid'];
if ($vars['peg_children']) {
$peg_children = array_merge($peg_children, explode(',', $vars['peg_children']));
}
}
$peg_children = implode(',', $peg_children ? array_diff($rows, $peg_children) : $rows);
}
if (empty($peg_children)) {
return '';
}
$qparts = "discussid IN({$peg_children}) AND parentid={$thisid} AND visible=" . VISIBLE . ($sort ? " ORDER BY {$sort}" : '') . ($limit || $offset ? ' LIMIT ' . intval($offset) . ', ' . intval($limit) : '');
$rs = safe_rows('*, unix_timestamp(posted) as time', 'txp_discuss', $qparts);
$out = '';
if ($rs) {
foreach ($rs as $vars) {
$GLOBALS['thiscomment'] = $vars;
$comments[] = peg_parse_form_recursively($form) . n;
unset($GLOBALS['thiscomment']);
}
$out .= doWrap($comments, $wraptag, $break, $class, $breakclass);
}
return $out;
}