本文整理汇总了PHP中serendipity_fetchUsers函数的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_fetchUsers函数的具体用法?PHP serendipity_fetchUsers怎么用?PHP serendipity_fetchUsers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serendipity_fetchUsers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$sort = $this->get_config('sort_order');
if ($sort == 'none') {
$sort = '';
} else {
$sort .= ' ' . $this->get_config('sort_method');
}
$is_form = serendipity_db_bool($this->get_config('allow_select'));
$is_count = serendipity_db_bool($this->get_config('showartcount'));
$mincount = (int) $this->get_config('mincount');
$authors = serendipity_fetchUsers(null, 'hidden', $is_count);
$html = '';
if ($is_form) {
$html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '?frontpage" method="post">';
}
$image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
$image = $image == "'none'" || $image == 'none' ? '' : $image;
$html .= '<ul class="plainList">' . "\n";
if (is_array($authors) && count($authors)) {
foreach ($authors as $auth) {
if ($is_count) {
if ($auth['artcount'] < $mincount) {
continue;
}
$entrycount = " ({$auth['artcount']})";
} else {
$entrycount = "";
}
$html .= '<li>';
if ($is_form) {
$html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiAuth][]" value="' . $auth['authorid'] . '" />';
}
if (!empty($image)) {
$html .= '<a class="serendipity_xml_icon" href="' . serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') . '"><img src="' . $image . '" alt="XML" style="border: 0px" /></a> ';
}
$html .= '<a href="' . serendipity_authorURL($auth, 'serendipityHTTPPath') . '" title="' . serendipity_specialchars($auth['realname']) . '">' . serendipity_specialchars($auth['realname']) . $entrycount . '</a>';
$html .= '</li>' . "\n";
}
}
$html .= '</ul>' . "\n";
if ($is_form) {
$html .= '<div><input type="submit" name="serendipity[isMultiAuth]" value="' . GO . '" /></div>';
}
$html .= sprintf('<div><a href="%s" title="%s">%s</a></div>', $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'], ALL_AUTHORS, ALL_AUTHORS);
if ($is_form) {
$html .= '</form>';
}
print $html;
}
示例2: getAuthors
function getAuthors()
{
global $serendipity;
$html = '<strong>' . PLUGIN_EVENT_XSSTRUST_AUTHORS . '</strong><br />';
$users = (array) serendipity_fetchUsers();
$valid =& $this->trusted_authors;
$html .= '<select name="serendipity[plugin][trusted_authors][]" multiple="true">';
foreach ($users as $user) {
$html .= '<option value="' . $user['authorid'] . '" ' . (isset($valid[$user['authorid']]) ? 'selected="selected"' : '') . '>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($user['realname']) : htmlspecialchars($user['realname'], ENT_COMPAT, LANG_CHARSET)) . '</option>' . "\n";
}
$html .= '</select>';
return $html;
}
示例3: displayUserList
function displayUserList()
{
global $serendipity;
$userlist = serendipity_fetchUsers();
$content = "";
foreach ($userlist as $user) {
if (function_exists('serendipity_authorURL')) {
$entryLink = serendipity_authorURL($user);
} else {
$entryLink = serendipity_rewriteURL(PATH_AUTHORS . '/' . serendipity_makePermalink(PERM_AUTHORS, array('id' => $user['authorid'], 'title' => $user['realname'])));
}
$content .= sprintf("<a href=\"%s\" title=\"%s\">%s</a><br />\n", $entryLink, function_exists('serendipity_specialchars') ? serendipity_specialchars($user['realname']) : htmlspecialchars($user['realname'], ENT_COMPAT, LANG_CHARSET), function_exists('serendipity_specialchars') ? serendipity_specialchars($user['realname']) : htmlspecialchars($user['realname'], ENT_COMPAT, LANG_CHARSET));
}
return $content;
}
示例4: introspect_config_item
function introspect_config_item($name, &$propbag)
{
global $serendipity;
switch ($name) {
case 'author':
$propbag->add('type', 'select');
$propbag->add('name', AUTHOR);
$propbag->add('description', PLUGIN_SUGGEST_AUTHOR);
$propbag->add('default', '');
$users = serendipity_fetchUsers();
$vals = array();
foreach ($users as $user) {
$vals[$user['authorid']] = $user['realname'];
}
$propbag->add('select_values', $vals);
break;
case 'permalink':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SUGGEST_PERMALINK);
$propbag->add('description', PLUGIN_SUGGEST_PERMALINK_DESC);
$propbag->add('default', $serendipity['rewrite'] != 'none' ? $serendipity['serendipityHTTPPath'] . 'pages/suggest.html' : $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?/pages/suggest.html');
break;
case 'pagetitle':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SUGGEST_PAGETITLE);
$propbag->add('description', PLUGIN_SUGGEST_PAGETITLE_DESC);
$propbag->add('default', 'suggest');
break;
case 'email':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SUGGEST_EMAIL);
$propbag->add('description', '');
$propbag->add('default', $serendipity['blogMail']);
break;
default:
return false;
}
return true;
}
示例5: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$sort = $this->get_config('sort_order');
if ($sort == 'none') {
$sort = '';
} else {
$sort .= ' ' . $this->get_config('sort_method');
}
$is_count = serendipity_db_bool($this->get_config('showartcount', 'false'));
$mincount = (int) $this->get_config('mincount');
$authors = serendipity_fetchUsers(null, 'hidden', $is_count);
$html = '';
$image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
$image = $image == "'none'" || $image == 'none' ? '' : $image;
$html .= '<ul class="plainList">' . "\n";
if (is_array($authors) && count($authors)) {
foreach ($authors as $auth) {
if ($is_count) {
if ($auth['artcount'] < $mincount) {
continue;
}
$entrycount = " ({$auth['artcount']})";
} else {
$entrycount = "";
}
$html .= '<li>';
if (!empty($image)) {
$html .= ' <a class="serendipity_xml_icon" href="' . serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') . '"><img src="' . $image . '" alt="XML" style="border: 0px" /></a> ';
}
$html .= ' <a href="' . serendipity_authorURL($auth, 'serendipityHTTPPath') . '" title="' . serendipity_specialchars($auth['realname']) . '">' . serendipity_specialchars($auth['realname']) . $entrycount . '</a>';
$html .= '</li>' . "\n";
}
}
$html .= '</ul>' . "\n";
$html .= sprintf('<div><a href="%s" title="%s">%s</a></div>' . "\n", $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'], ALL_AUTHORS, ALL_AUTHORS);
print $html;
}
示例6: displayBirthdayList
function displayBirthdayList()
{
global $serendipity;
$userlist = serendipity_fetchUsers();
$birthdays = $this->getBirthdays();
foreach ($userlist as $user) {
if (isset($birthdays[$user['authorid']])) {
$res = $this->date_diff_days(time(), $birthdays[$user['authorid']]);
$bdays[$res][] = array('name' => $user['realname'], 'date' => date("d.m.", $birthdays[$user['authorid']]));
}
}
ksort($bdays);
$max_running = (int) $this->get_config('number');
$running = 0;
foreach ($bdays as $key => $bday) {
if ($key > 0 && $max_running > 0 && $running > $max_running) {
continue;
}
if ($key == 0) {
echo '<strong>' . PLUGIN_USERPROFILES_BIRTHDAYTODAY . '</strong>';
} else {
echo '<strong>' . sprintf(PLUGIN_USERPROFILES_BIRTHDAYIN, $key) . '</strong>';
}
echo '<div>';
for ($i = 0, $ii = count($bday); $i < $ii; $i++) {
if (strlen($content)) {
$content .= '<br />';
}
$content .= $bday[$i]['name'] . ' ' . $bday[$i]['date'];
}
echo $content;
echo '</div>';
$content = '';
$running++;
}
}
示例7: showUsersInterface
function showUsersInterface()
{
global $serendipity;
if (isset($_POST[submitusersedit])) {
foreach ($_POST as $key => $val) {
// Pick out the "userchoose-" values
if (strpos($key, "userchoose-") !== FALSE) {
$pbuserid = substr($key, 11);
$this->set_config("phoneblogz_usermap_{$pbuserid}", $val);
}
}
}
$arr = getUsersForAccount($this->get_config('phoneblogz_accesscode'), $this->get_config('phoneblogz_password'));
if (!empty($arr["error"])) {
echo "ERROR: " . $arr["error"];
} else {
echo "<center>";
echo '<h3 style="text-align:center;">' . PLUGIN_EVENT_PHONEBLOGZ_USERS_HEADING . '</h3>';
echo "<form name='users' method='post' action=''>";
echo "<table border='1'><tr><th>PhoneBlogz Name</th><th>PIN code</th><th>WordPress User</th></tr>";
$users = serendipity_fetchUsers();
$vals = array();
$vals['empty'] = MF_MYSELF;
for ($i = 0; $i < count($arr); ++$i) {
echo "<tr><td>" . $arr[$i]["name"] . "</td><td>" . $arr[$i]["pin"] . "</td>";
echo "<td><select name='userchoose-" . $arr[$i]["id"] . "'>";
echo "<option value='-1'>Please choose...</option>";
foreach ($users as $user) {
$selected = $this->get_config("phoneblogz_usermap_" . $arr[$i]["id"]) == $user['authorid'] ? " SELECTED " : "";
echo "<option {$selected} value='" . $user['authorid'] . "'>" . $user['realname'] . " (" . $user['realname'] . ")</option>";
}
echo "</select></td>";
echo "</tr>";
}
echo "</table>";
echo "<br/>";
echo "<input class='serendipityPrettyButton input_button' type='submit' name='submitusersedit' value='Update Users' />";
echo "</form>";
echo "</center>";
}
}
示例8: serveAuthorPage
function serveAuthorPage($matches)
{
global $serendipity;
$serendipity['view'] = 'authors';
$serendipity['GET']['viewAuthor'] = $matches[1];
$serendipity['GET']['action'] = 'read';
locateHiddenVariables($serendipity['uriArguments']);
$matches[1] = serendipity_searchPermalink($serendipity['permalinkAuthorStructure'], implode('/', $serendipity['uriArguments']), $matches[1], 'author');
$serendipity['GET']['viewAuthor'] = $matches[1];
$serendipity['GET']['action'] = 'read';
$uInfo = serendipity_fetchUsers($serendipity['GET']['viewAuthor']);
if (!is_array($uInfo)) {
$serendipity['view'] = '404';
$serendipity['viewtype'] = '404_3';
header('HTTP/1.0 404 Not found');
header('Status: 404 Not found');
} else {
$serendipity['head_title'] = sprintf(ENTRIES_BY, $uInfo[0]['realname']);
$serendipity['head_subtitle'] = $serendipity['blogTitle'];
}
include S9Y_INCLUDE_PATH . 'include/genpage.inc.php';
}
示例9: show_plugins
/**
* Show the list of plugins
*
* Shows a HTML list of all installed plugins, complete with config/delete/sort order options
*
* @access public
* @param boolean Indicates if event plugins (TRUE) or sidebar plugins (FALSE) shall be shown
* @return null
*/
function show_plugins($event_only = false, $sidebars = null)
{
global $serendipity;
$sql_filter = '';
if (is_array($sidebars)) {
foreach ($sidebars as $sidebar) {
$up = strtoupper($sidebar);
if ($sidebar == 'hide') {
$opts[$sidebar] = HIDDEN;
} elseif (defined('SIDEBAR_' . $up)) {
$opts[$sidebar] = constant('SIDEBAR_' . $up);
} elseif (defined($up)) {
$opts[$sidebar] = constant($up);
} else {
$opts[$sidebar] = $up;
}
$sql_filter .= "AND placement != '" . serendipity_db_escape_string($sidebar) . "' ";
}
}
if (!$event_only) {
$sql = "SELECT * from {$serendipity['dbPrefix']}plugins\n WHERE placement != 'event'\n AND placement != 'eventh'\n " . $sql_filter;
$invisible_plugins = serendipity_db_query($sql);
if (is_array($invisible_plugins)) {
$sidebars[] = 'NONE';
$opts['NONE'] = NONE;
}
}
$opts['event'] = PLUGIN_ACTIVE;
$opts['eventh'] = PLUGIN_INACTIVE;
$data['event_only'] = $event_only;
if (!$event_only) {
$data['is_first'] = true;
}
$data['serendipity_setFormToken'] = serendipity_setFormToken();
$data['serendipity_setFormTokenUrl'] = serendipity_setFormToken('url');
/* Block display the plugins per placement location. */
if ($event_only) {
$plugin_placements = array('event', 'eventh');
} else {
$plugin_placements = $sidebars;
}
$data['plugin_placements'] = $plugin_placements;
static $users = array();
if (empty($users)) {
$users = serendipity_fetchUsers('', 'hidden');
}
$data['users'] = $users;
$i = 0;
foreach ($plugin_placements as $plugin_placement) {
if (!$event_only && $plugin_placement == 'NONE') {
$is_invisible = true;
} else {
$is_invisible = false;
}
$data['placement'][$plugin_placement]['ptitle'] = $ptitle = $opts[$plugin_placement];
$data['placement'][$plugin_placement]['pid'] = $pid = $plugin_placement;
if ($is_invisible) {
$plugins = $invisible_plugins;
} else {
$plugins = serendipity_plugin_api::enum_plugins($plugin_placement);
}
if (!is_array($plugins)) {
continue;
}
$sort_idx = 0;
foreach ($plugins as $plugin_data) {
$i++;
$plugin =& serendipity_plugin_api::load_plugin($plugin_data['name'], $plugin_data['authorid']);
$key = urlencode($plugin_data['name']);
$css_key = 's9ycid' . str_replace('%', '-', $key);
$is_plugin_owner = $plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers');
$is_plugin_editable = $is_plugin_owner || $plugin_data['authorid'] == '0';
$cname = explode(':', $plugin_data['name']);
if (!is_object($plugin)) {
$name = $title = ERROR . '!';
$desc = ERROR . ': ' . $plugin_data['name'];
$can_configure = false;
} else {
/* query for its name, description and configuration data */
$bag = new serendipity_property_bag();
$plugin->introspect($bag);
$name = serendipity_specialchars($bag->get('name'));
$desc = '<details class="plugin_data">';
$desc .= '<summary><var class="perm_name">' . $cname[0] . '</var></summary>';
$desc .= '<div class="plugin_desc clearfix">' . serendipity_specialchars($bag->get('description')) . '</div>';
$desc .= '<span class="block_level">' . VERSION . ': ' . $bag->get('version') . '</span>';
$desc .= '</details>';
$title = serendipity_plugin_api::get_plugin_title($plugin, '[' . $name . ']');
if ($bag->is_set('configuration') && ($plugin->protected === FALSE || $plugin_data['authorid'] == '0' || $plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers'))) {
$can_configure = true;
} else {
//.........这里部分代码省略.........
示例10: checkPageUser
/**
*
* check if the user have the needed rights to do something by userid
*
* @see checkUser
* @access private
* @return boolean
*
*/
function checkPageUser($authorid)
{
global $serendipity;
if (empty($authorid) || (int) $authorid === 0) {
return true;
}
$user = (array) serendipity_fetchUsers($authorid);
return $this->checkUser($user[0]);
}
示例11: import
function import()
{
global $serendipity;
// Force user to select a blog to act on
if (empty($this->data['bId']) || $this->data['bId'] == 0) {
echo 'Please select a blog to import!';
return false;
}
// Save this so we can return it to its original value at the end of this method.
$noautodiscovery = isset($serendipity['noautodiscovery']) ? $serendipity['noautodiscovery'] : false;
if ($this->data['autodiscovery'] == 'false') {
$serendipity['noautodiscovery'] = 1;
}
$this->getTransTable();
// Prepare export request
$req = new HTTP_Request('http://www.blogger.com/feeds/' . $this->data['bId'] . '/archive');
$req->addHeader('GData-Version', 2);
$req->addHeader('Authorization', 'AuthSub token="' . $this->data['bAuthToken'] . '"');
// Attempt fetch blog export
$req->sendRequest();
// Handle errors
if ($req->getResponseCode() != '200') {
echo "Error occured while trying to export the blog.";
return false;
}
// Export success
echo '<span class="block_level">Successfully exported entries from Blogger</span>';
// Get Serendipity authors list
$authorList = array();
$s9y_users = serendipity_fetchUsers();
foreach ($s9y_users as $user) {
$authorList[$user['authorid']] = $user['username'];
}
unset($s9y_users);
// Load export
$bXml = simplexml_load_string($req->getResponseBody());
// Process entries
$entryList = $entryFailList = array();
foreach ($bXml->entry as $bEntry) {
// Check entry type
switch ($bEntry->category['term']) {
case 'http://schemas.google.com/blogger/2008/kind#post':
// Process posts:
// Create author if not in serendipity
$author = (string) $bEntry->author->name;
if (!array_search($author, $authorList)) {
serendipity_db_insert('authors', array('right_publish' => 1, 'realname' => $author, 'username' => $author, 'userlevel' => 0, 'password' => md5($this->data['defaultpass'])));
$authorid = serendipity_db_insert_id('authors', 'authorid');
$authorList[$authorid] = $author;
}
$sEntry = array('title' => $this->decode((string) $bEntry->title), 'isdraft' => $bEntry->children('http://purl.org/atom/app#')->control->draft == 'yes' ? 'true' : 'false', 'allow_comments' => count($bEntry->xpath("*[@rel='replies']")) > 0 ? 'true' : 'false', 'timestamp' => strtotime($bEntry->published), 'body' => $this->strtr((string) $bEntry->content), 'extended' => '', 'categories' => $this->data['bCategory'], 'author' => $author, 'authorid' => $authorid);
// Add entry to s9y
echo '..~.. ';
if (is_int($id = serendipity_updertEntry($sEntry))) {
// Add entry id to processed table for later lookups
$entryList[(string) $bEntry->id] = array($id, $sEntry['title'], 0);
} else {
// Add to fail list
$entryFailList[] = $sEntry['title'];
}
break;
case 'http://schemas.google.com/blogger/2008/kind#comment':
// Process comments:
// Extract entry id for comment
$cEntryId = $bEntry->xpath("thr:in-reply-to[@ref]");
$cEntryId = (string) $cEntryId[0]['ref'];
// Check to make sure the related entry has been added to s9y
if (array_key_exists($cEntryId, $entryList)) {
// Add to s9y
$sComment = array('entry_id ' => $entryList[$cEntryId][0], 'parent_id' => 0, 'timestamp' => strtotime($bEntry->published), 'author' => (string) $bEntry->author->name, 'email' => (string) $bEntry->author->email, 'url' => (string) isset($bEntry->author->uri) ? $bEntry->author->uri : '', 'ip' => '', 'status' => 'approved', 'body' => $this->strtr((string) $bEntry->content), 'subscribed' => 'false', 'type' => 'NORMAL');
serendipity_db_insert('comments', $sComment);
// Update entry list with comment count
$entryList[$cEntryId][2]++;
}
break;
}
}
// Report on resultant authors
echo '<span class="block_level">Current list of authors: </span>' . join(', ', array_values($authorList));
// Do cleanup and report on entries
echo '<span class="block_level">The following entries were successfully imported:</span>';
echo '<ul>';
foreach ($entryList as $eId => $eDetails) {
// Update comment count for entry in s9y
serendipity_db_query("UPDATE " . $serendipity['dbPrefix'] . "entries SET comments = " . $eDetails[2] . " WHERE id = " . $eDetails[0]);
echo '<li>' . $eDetails[1] . ' comments(' . $eDetails[2] . ')</li>';
}
echo '</ul>';
// Report fails
echo '<span class="block_level">The following entries ran into trouble and was not imported:</span>';
echo '<ul>';
foreach ($entryFailList as $eId => $eDetails) {
echo '<li>' . $eDetails . '</li>';
}
echo '</ul>';
// Reset autodiscovery
$serendipity['noautodiscovery'] = $noautodiscovery;
// All done!
echo '<span class="msg_notice">Import finished.</span>';
return true;
//.........这里部分代码省略.........
示例12: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
if ($event == 'frontend_header') {
$start_url = $serendipity['baseURL'];
$start_title = $serendipity['blogTitle'];
echo '<link rel="start" href="' . $start_url . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($start_title) : htmlspecialchars($start_title, ENT_COMPAT, LANG_CHARSET)) . '" />' . "\n";
if ($serendipity['GET']['action'] == 'read' && !empty($serendipity['GET']['id'])) {
// Article detail view
echo '<link rel="up" href="' . $start_url . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($start_title) : htmlspecialchars($start_title, ENT_COMPAT, LANG_CHARSET)) . '" />' . "\n";
$this->backAndForth($this->showPaging($serendipity['GET']['id']));
// END article detail view
echo '<link rel="canonical" href="' . $this->getEntry($serendipity['GET']['id']) . '" />' . "\n";
} elseif ($serendipity['GET']['action'] == 'read' && is_array($serendipity['range'])) {
// Specific Date Archives view
echo '<link rel="up" href="' . serendipity_rewriteURL(PATH_ARCHIVE) . '" title="' . ARCHIVES . '" />' . "\n";
echo '<link rel="canonical" href="' . $this->getArchiveParameters() . '" />' . "\n";
$links = array();
$add_query = '';
$year = date('Y', $serendipity['range'][0]);
$month = date('m', $serendipity['range'][0]);
$day = date('d', $serendipity['range'][0]);
$pageMonthNext = array('day' => '1', 'month' => $month + 1, 'year' => $year);
$pageMonthPrev = array('day' => '1', 'month' => $month - 1, 'year' => $year);
$pageDayNext = array('day' => $day + 1, 'month' => $month, 'year' => $year);
$pageDayPrev = array('day' => $day - 1, 'month' => $month, 'year' => $year);
$diff = $serendipity['range'][1] - $serendipity['range'][0];
if (isset($serendipity['GET']['category'])) {
$categoryid = (int) serendipity_db_escape_string($serendipity['GET']['category']);
$add_query = '/C' . $categoryid;
}
if ($diff < 86400) {
// Paging day by day
$ts = mktime(0, 0, 0, $pageDayPrev['month'], $pageDayPrev['day'], $pageDayPrev['year']);
$links['prev'] = array('link' => serendipity_archiveDateUrl(sprintf('%4d/%02d/%02d', date('Y', $ts), date('m', $ts), date('d', $ts))), 'title' => sprintf(ENTRIES_FOR, serendipity_formatTime(DATE_FORMAT_ENTRY, $ts, false)));
$ts = mktime(0, 0, 0, $pageDayNext['month'], $pageDayNext['day'], $pageDayNext['year']);
$links['next'] = array('link' => serendipity_archiveDateUrl(sprintf('%4d/%02d/%02d', date('Y', $ts), date('m', $ts), date('d', $ts))), 'title' => sprintf(ENTRIES_FOR, serendipity_formatTime(DATE_FORMAT_ENTRY, $ts, false)));
} elseif ($diff < 86400 * 28) {
// Paging by week
// TODO - Don't know :-)
} else {
// Paging by month
$ts = mktime(0, 0, 0, $pageMonthPrev['month'], $pageMonthPrev['day'], $pageMonthPrev['year']);
$links['prev'] = array('link' => serendipity_archiveDateUrl(sprintf('%4d/%02d', date('Y', $ts), date('m', $ts))), 'title' => sprintf(ENTRIES_FOR, serendipity_formatTime('%B %Y', $ts, false)));
$ts = mktime(0, 0, 0, $pageMonthNext['month'], $pageMonthNext['day'], $pageMonthNext['year']);
$links['next'] = array('link' => serendipity_archiveDateUrl(sprintf('%4d/%02d', date('Y', $ts), date('m', $ts))), 'title' => sprintf(ENTRIES_FOR, serendipity_formatTime('%B %Y', $ts, false)));
}
$this->backAndForth($links);
// END Specific Date Archives view
} elseif ($serendipity['GET']['action'] == 'archives') {
// Full month/year archives overview
echo '<link rel="up" href="' . serendipity_rewriteURL(PATH_ARCHIVE) . '" title="' . ARCHIVES . '" />' . "\n";
// END Full month/year archives overview
echo '<link rel="canonical" href="' . $this->getArchiveParameters() . '" />' . "\n";
} elseif (!empty($serendipity['GET']['category'])) {
// Category based view
$cInfo = serendipity_fetchCategoryInfo($serendipity['GET']['category']);
if (function_exists('serendipity_categoryURL')) {
$categories_url = serendipity_categoryURL($cInfo, 'serendipityHTTPPath');
} else {
$categories_url = serendipity_rewriteURL(PATH_CATEGORIES . '/' . serendipity_makePermalink(PERM_CATEGORIES, array('id' => $cInfo['categoryid'], 'title' => $cInfo['category_name'])), 'serendipityHTTPPath');
}
echo '<link rel="up" href="' . $categories_url . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($cInfo['category_name']) : htmlspecialchars($cInfo['category_name'], ENT_COMPAT, LANG_CHARSET)) . '" />' . "\n";
echo '<link rel="canonical" href="' . $categories_url . '" />' . "\n";
$categories = serendipity_fetchCategories('all');
$links = array();
if (is_array($categories) && count($categories)) {
$categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
$capture_next = false;
foreach ($categories as $cat) {
if ($capture_next) {
$links['next'] = $this->getCat($cat);
break;
}
if (is_array($prev_cat) && $cat['categoryid'] == $serendipity['GET']['category']) {
$links['prev'] = $this->getCat($prev_cat);
$capture_next = true;
}
$prev_cat = $cat;
}
}
$this->backAndForth($links);
// END Category based view
} elseif (!empty($serendipity['GET']['viewAuthor'])) {
// User view
$uInfo = serendipity_fetchUsers();
$links = array();
if (is_array($uInfo)) {
$capture_next = false;
foreach ($uInfo as $user) {
if ($capture_next) {
$links['next'] = $this->getUser($user);
break;
}
if ($user['authorid'] == $serendipity['GET']['viewAuthor']) {
$authors_url = $this->getUser($user);
echo '<link rel="up" href="' . $authors_url['link'] . '" title="' . $authors_url['title'] . '" />' . "\n";
echo '<link rel="canonical" href="' . $authors_url['link'] . '" />' . "\n";
if (is_array($prev_user)) {
$links['prev'] = $this->getUser($prev_user);
//.........这里部分代码省略.........
示例13: elseif
<?php
} else {
?>
<input type="submit" name="SAVE_NEW" value="<?php
echo CREATE_NEW_USER;
?>
" class="serendipityPrettyButton input_button" />
<?php
}
?>
</div>
</form>
<?php
} elseif ($serendipity['GET']['adminAction'] == 'delete' && serendipity_checkPermission('adminUsersDelete')) {
$user = serendipity_fetchUsers($serendipity['GET']['userid']);
$group_intersect = serendipity_intersectGroup($user[0]['authorid']);
if (serendipity_checkPermission('adminUsersMaintainOthers') || serendipity_checkPermission('adminUsersMaintainSame') && $group_intersect) {
?>
<form action="?serendipity[adminModule]=users" method="post">
<div>
<?php
printf(DELETE_USER, (int) $serendipity['GET']['userid'], htmlspecialchars($user[0]['realname']));
?>
<br /><br />
<?php
echo serendipity_setFormToken();
?>
<input type="hidden" name="serendipity[user]" value="<?php
echo (int) $serendipity['GET']['userid'];
?>
示例14: showUsers
function showUsers()
{
global $serendipity;
if (!empty($serendipity['POST']['submitProfile'])) {
echo '<div class="serendipityAdminMsgSuccess">' . DONE . ': ' . sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) . '</div>';
}
if (!empty($serendipity['POST']['submitProfileOptions'])) {
echo '<div class="serendipityAdminMsgSuccess">' . DONE . ': ' . sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) . '</div>';
}
if (!empty($serendipity['POST']['createVcard'])) {
if ($this->createVCard($serendipity['POST']['profileUser'])) {
echo '<div class="serendipityAdminMsgSuccess">' . DONE . ': ' . sprintf(PLUGIN_EVENT_USERPROFILES_VCARDCREATED_AT, serendipity_strftime('%H:%M:%S')) . '</div>';
echo '<div class="serendipityAdminMsgNote"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_note.png') . '" alt="" />' . IMPORT_NOTES . ': ' . PLUGIN_EVENT_USERPROFILES_VCARDCREATED_NOTE . '</div>';
} else {
echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . ERROR . ': ' . PLUGIN_EVENT_USERPROFILES_VCARDNOTCREATED . '</div>';
}
}
echo '<form action="?" method="post" class="userprofileform">' . "\n";
echo '<input type="hidden" name="serendipity[adminModule]" value="event_display" />' . "\n";
echo '<input type="hidden" name="serendipity[adminAction]" value="profiles" />' . "\n";
echo "<div>\n";
echo '<strong>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars(PLUGIN_EVENT_USERPROFILES_SELECT) : htmlspecialchars(PLUGIN_EVENT_USERPROFILES_SELECT, ENT_COMPAT, LANG_CHARSET)) . '</strong><br /><br />' . "\n";
echo USER . ' <select name="serendipity[profileUser]">' . "\n";
$users = serendipity_fetchUsers();
foreach ($users as $user) {
echo '<option value="' . $user['authorid'] . '" ' . (empty($serendipity['POST']['profileUser']) && $serendipity['authorid'] == $user['authorid'] || $serendipity['POST']['profileUser'] == $user['authorid'] ? 'selected="selected"' : '') . '>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($user['realname']) : htmlspecialchars($user['realname'], ENT_COMPAT, LANG_CHARSET)) . '</option>' . "\n";
}
echo '</select>' . "\n";
echo ' <input class="serendipityPrettyButton input_button" type="submit" name="serendipity[viewUser]" value="' . VIEW . '" />' . "\n";
if ($this->checkUser($user)) {
echo ' <input class="serendipityPrettyButton input_button" type="submit" name="submit" value="' . EDIT . '" />' . "\n";
echo ' <input class="serendipityPrettyButton input_button" type="submit" name="serendipity[editOptions]" value="' . ADVANCED_OPTIONS . '" />' . "\n";
## very very bad the next line (show only when edit the local_properties)
if (!empty($serendipity['POST']['profileUser']) && empty($serendipity['POST']['editOptions']) && empty($serendipity['POST']['viewUser'])) {
echo ' <input class="serendipityPrettyButton input_button" type="submit" name="serendipity[createVcard]" value="' . PLUGIN_EVENT_USERPROFILES_VCARD . '" />' . "\n";
}
}
echo "</div><br />\n<hr />\n";
if (!empty($serendipity['POST']['profileUser'])) {
$user = serendipity_fetchUsers($serendipity['POST']['profileUser']);
if ($this->checkUser($user[0])) {
if (!empty($serendipity['POST']['viewUser']) && $serendipity['POST']['profileUser'] != $serendipity['authorid']) {
$this->showUser($user[0]);
} elseif (!empty($serendipity['POST']['editOptions']) || !empty($serendipity['POST']['submitProfileOptions'])) {
$this->editOptions($user[0]);
} else {
$this->editUser($user[0]);
}
} else {
$this->showUser($user[0]);
}
} else {
$user = serendipity_fetchUsers($serendipity['authorid']);
$this->editUser($user[0]);
}
echo "</form>\n\n";
}
示例15: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
$links = array();
if (isset($hooks[$event])) {
$sort_order = array('timestamp' => DATE, 'isdraft' => PUBLISH . '/' . DRAFT, 'a.realname' => AUTHOR, 'category_name' => CATEGORY, 'last_modified' => LAST_UPDATED, 'title' => TITLE);
$per_page_max = 50;
$per_page = array('12', '16', '25', $per_page_max);
switch ($event) {
case 'frontend_fetchentries':
if ($this->fetchLimit > 0) {
$serendipity['fetchLimit'] = $this->fetchLimit;
}
break;
case 'frontend_configure':
$_SERVER['REQUEST_URI'] = str_replace('%2Fplugin%2Ffilter%2F', '/plugin/filter/', $_SERVER['REQUEST_URI']);
break;
case 'entries_footer':
$link = $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'plugin/filter/';
?>
<div id="filter_entries_container">
<br />
<hr />
<form action="<?php
echo $link;
?>
" method="get">
<?php
if ($serendipity['rewrite'] == 'none') {
?>
<input type="hidden" name="/plugin/filter/" value="" />
<?php
}
?>
<table width="100%">
<tr>
<td colspan="6" style="text-align: left"><strong><?php
echo FILTERS;
?>
</strong> - <?php
echo FIND_ENTRIES;
?>
</td>
</tr>
<tr>
<td width="80"><?php
echo AUTHOR;
?>
</td>
<td>
<select name="filter[author]">
<option value="">--</option>
<?php
$users = serendipity_fetchUsers();
if (is_array($users)) {
foreach ($users as $user) {
echo '<option value="' . $user['authorid'] . '" ' . (isset($_SESSION['filter']['author']) && $_SESSION['filter']['author'] == $user['authorid'] ? 'selected="selected"' : '') . '>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($user['realname']) : htmlspecialchars($user['realname'], ENT_COMPAT, LANG_CHARSET)) . '</option>' . "\n";
}
}
?>
</select>
</td>
<td width="80"><?php
echo CATEGORY;
?>
</td>
<td>
<select name="filter[category]">
<option value="">--</option>
<?php
$categories = serendipity_fetchCategories();
$categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
foreach ($categories as $cat) {
echo '<option value="' . $cat['categoryid'] . '"' . ($_SESSION['filter']['category'] == $cat['categoryid'] ? ' selected="selected"' : '') . '>' . str_repeat(' ', $cat['depth']) . $cat['category_name'] . '</option>' . "\n";
}
?>
</select>
</td>
<td width="80"><?php
echo CONTENT;
?>
</td>
<td><input size="10" type="text" name="filter[body]" value="<?php
echo isset($_SESSION['filter']['body']) ? function_exists('serendipity_specialchars') ? serendipity_specialchars($_SESSION['filter']['body']) : htmlspecialchars($_SESSION['filter']['body'], ENT_COMPAT, LANG_CHARSET) : '';
?>
" /></td>
</tr>
<tr>
<td colspan="6" style="text-align: left"><strong><?php
echo SORT_ORDER;
?>
</strong></td>
</tr>
<tr>
<td><?php
echo SORT_BY;
?>
</td>
//.........这里部分代码省略.........