本文整理汇总了PHP中user::info方法的典型用法代码示例。如果您正苦于以下问题:PHP user::info方法的具体用法?PHP user::info怎么用?PHP user::info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user
的用法示例。
在下文中一共展示了user::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: favorite_list
function favorite_list($vars = null)
{
$maxperpage = isset($vars['row']) ? (int) $vars['row'] : "10";
$where_sql = "WHERE 1=1 ";
isset($vars['userid']) && ($where_sql .= " AND `uid`='" . (int) $vars['userid'] . "' ");
isset($vars['fid']) && ($where_sql .= " AND `fid`='" . (int) $vars['fid'] . "' ");
isset($vars['mode']) && ($where_sql .= " AND `mode`='" . (int) $vars['mode'] . "'");
isset($vars['appid']) && ($where_sql .= " AND `appid`='" . (int) $vars['appid'] . "' ");
$cache_time = isset($vars['time']) ? (int) $vars['time'] : -1;
$by = $vars['by'] == "ASC" ? "ASC" : "DESC";
switch ($vars['orderby']) {
case 'hot':
$order_sql = " ORDER BY `count` {$by}";
break;
default:
$order_sql = " ORDER BY `id` {$by}";
}
$md5 = md5($where_sql . $order_sql);
$offset = 0;
if ($vars['page']) {
$total = iPHP::total($md5, "SELECT count(*) FROM `#iCMS@__favorite` {$where_sql} ");
iPHP::assign("fav_total", $total);
$multi = iCMS::page(array('total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:list'), 'nowindex' => $GLOBALS['page']));
$offset = $multi->offset;
}
if ($vars['cache']) {
$cache_name = iPHP_DEVICE . '/favorite/' . $md5 . "/" . (int) $GLOBALS['page'];
$resource = iCache::get($cache_name);
}
if (empty($resource)) {
$rs = iDB::all("SELECT * FROM `#iCMS@__favorite` {$where_sql} {$order_sql} LIMIT {$offset},{$maxperpage}");
iPHP_SQL_DEBUG && iDB::debug(1);
$resource = array();
$vars['user'] && iPHP::app('user.class', 'static');
if ($rs) {
foreach ($rs as $key => $value) {
$value['url'] = iPHP::router(array('/favorite/{id}/', $value['id']), iPHP_ROUTER_REWRITE);
$vars['user'] && ($value['user'] = user::info($value['uid'], $value['nickname']));
if (isset($vars['loop'])) {
$resource[$key] = $value;
} else {
$resource[$value['id']] = $value;
}
}
}
$vars['cache'] && iCache::set($cache_name, $resource, $cache_time);
}
return $resource;
}
示例2: confirmRequest
function confirmRequest($salt)
{
if (!$this->find($salt)) {
return PEAR::raiseError('cannot find request');
}
// activate the handle and grant karma
// implicitly without human intervention
// copied from the user class and Damblan_Karma
include_once 'pear-database-user.php';
$user = user::info($this->handle, null, 0);
if (!isset($user['registered'])) {
return PEAR::raiseError('Error - user request was deleted, please try again');
}
include_once 'pear-database-note.php';
note::removeAll($this->handle);
$data = array();
$data['handle'] = $user['handle'];
$data['registered'] = 1;
$data['created'] = gmdate('Y-m-d');
$data['createdby'] = SITE . 'web';
$e = user::update($data, true);
if (PEAR::isError($e) || !$e) {
return $e;
}
$query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())';
$id = $this->dbh->nextId('karma');
$sth = $this->dbh->query($query, array($id, $this->handle, 'pear.voter', SITE . 'web'));
$id = $this->dbh->nextId('karma');
$sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', SITE . 'web'));
if (!DB::isError($sth)) {
note::add($this->handle, 'Account opened', SITE . 'web');
$msg = "Your PEAR voter account has been opened.\n" . "You can now participate in the elections by going to\n" . " http://" . PEAR_CHANNELNAME . "/election/";
$xhdr = "From: " . PEAR_WEBMASTER_EMAIL;
if (!DEVBOX) {
mail($user['email'], "Your PEAR Account Request", $msg, $xhdr, "-f " . PEAR_BOUNCE_EMAIL);
}
$this->deleteRequest();
return true;
}
return false;
}
示例3: resetPassword
/**
* Mark a user for password resetting
*
* @param string $user
* @param string $pass1
* @param string $pass2
* @return array
*/
function resetPassword($user, $pass1, $pass2)
{
require_once 'Damblan/Mailer.php';
$errors = array();
$salt = md5(mt_rand(4, 13) . $user . time() . $pass1);
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$this->_dbh->query('DELETE FROM lostpassword WHERE handle=?', array($user));
$e = $this->_dbh->query('INSERT INTO lostpassword
(handle, newpassword, salt, requested)
VALUES(?,?,?,NOW())', array($user, md5($pass1), $salt));
PEAR::staticPopErrorHandling();
if (PEAR::isError($e)) {
$errors[] = 'Could not change password: ' . $e->getMessage();
} else {
include_once 'pear-database-user.php';
$info = user::info($user);
$this->_mailer = Damblan_mailer::create(array('To' => array($info['name'] . ' <' . $info['email'] . '>'), 'Reply-To' => array('PEAR QA <' . PEAR_QA_EMAIL . '>'), 'Subject' => '[PEAR-ACCOUNT-PASSWORD] Your password reset request : %username%', 'Body' => 'A request has been made to reset your password for %username%
at pear.php.net.
If you intended to reset the password, please navigate to this page:
https://' . PEAR_CHANNELNAME . '/account/password-confirm-change.php
and follow the instructions. Your password reset code is:
%salt%
If you have received this email by mistake or did not request a
password change, no further action is necessary. Your password
will NOT change until you confirm the change, and it cannot be changed
without the password reset code. Password change requests are automatically
purged after 24 hours.
PEAR Quality Assurance.'), array('username' => $user, 'salt' => $salt));
$this->_mailer->send();
}
return $errors;
}
示例4: getMaintainers
/**
* Get maintainers
*
* Get maintainers to inform of a trackback (the
* lead maintainers of a package).
*
* @since
* @access public
* @param boolean $activeOnly To get only active leads
* is set to false by default so there's
* no bc problems.
*
* @return array(string) The list of maintainer emails.
*/
function getMaintainers($id, $leadOnly = false, $activeOnly = true)
{
include_once 'pear-database-maintainer.php';
$maintainers = maintainer::get($id, $leadOnly, $activeOnly);
$res = array();
include_once 'pear-database-user.php';
foreach ($maintainers as $maintainer => $data) {
$tmpUser = user::info($maintainer, 'email');
if (!is_array($tmpUser) || !isset($tmpUser['email'])) {
continue;
}
$res[] = $tmpUser['email'];
}
return $res;
}
示例5: PEAR_Bugs
require_once 'HTTP.php';
require 'bugs/pear-bugs.php';
include_once 'pear-database-user.php';
$bugs = new PEAR_Bugs();
$site = new Damblan_URL();
$karma = new Damblan_Karma($dbh);
$params = array('handle' => '', 'action' => '');
$site->getElements($params);
$handle = htmlspecialchars(strtolower($params['handle']));
// Redirect to the accounts list if no handle was specified
if (empty($handle)) {
localRedirect('/accounts.php');
}
$dbh->setFetchmode(DB_FETCHMODE_ASSOC);
$permissions = $karma->get($handle);
$row = user::info($handle);
if ($row === null) {
error_handler($handle . ' is not a valid account name.', 'Invalid Account');
}
switch ($params['action']) {
case 'wishlist':
if (!empty($row['wishlist'])) {
HTTP::redirect($row['wishlist']);
} else {
PEAR::raiseError(htmlspecialchars($row['name']) . ' has not registered a wishlist');
}
break;
case 'bugs':
HTTP::redirect('/bugs/search.php?handle=' . $handle . '&cmd=display');
break;
case 'rss':
示例6: foreach
echo ' </select>';
echo ' </td>';
echo ' <td>';
echo ' <input type="button" onClick="addMaintainer(); return false" name="add" value="Add as" />';
echo ' <select name="role" size="1">';
echo ' <option value="lead">lead</option>';
echo ' <option value="developer">developer</option>';
echo ' <option value="helper">helper</option>';
echo ' </select><br /><br />';
echo ' <input type="button" onClick="removeMaintainer(); return false" name="remove" value="Remove" />';
echo ' </td>';
echo ' <td>';
echo ' <select multiple="yes" name="maintainers[]" onChange="activateRemove();" size="10">';
$maintainers = maintainer::get($id);
foreach ($maintainers as $handle => $role) {
$info = user::info($handle, "name");
// XXX: This sucks
printf('<option value="%s||%s">%s (%s, %s)</option>', $handle, $role['role'], $info['name'], $handle, $role['role']);
}
echo ' </select>';
echo ' </td>';
echo '</tr>';
echo '<tr>';
echo ' <td colspan="3"><input type="submit" /></td>';
echo '</tr>';
echo '</table>';
echo '</form>';
echo '<script language="JavaScript" type="text/javascript">';
echo 'document.form.remove.disabled = true;';
echo 'document.form.add.disabled = true;';
echo 'document.form.role.disabled = true;';
示例7: email
function email($election, $votes, $salt)
{
include_once 'pear-database-user.php';
$info = user::info($this->user);
$email = '"' . $info['name'] . '" <' . $info['email'] . '>';
$headers = "From: bounce-no-user@php.net\n";
$headers .= "X-Mailer: PEAR election voting interface\n";
$headers .= "X-PEAR-Election: " . $election['id'] . "\n";
$subject = '[PEAR-ELECTION] Your vote in election ' . $election['purpose'];
if ($votes) {
$votes = $this->prettifyVotes($election, $votes);
$text = 'Your vote for the election: ' . $election['purpose'] . "\n" . 'has been registered. You voted for:
';
$text .= $votes . "\n";
$text .= 'Your vote salt is ' . $salt . "\n";
$text .= 'this is your only record of the vote salt, without it your vote ' . 'cannot be retrieved. Thank you for voting';
} else {
$text = 'Your abstaining vote for the election: ' . $election['purpose'] . "\n" . 'has been registered.' . "\n";
$text .= 'Your vote salt is ' . $salt . "\n";
$text .= 'this is your only record of the vote salt, without it your vote ' . 'cannot be retrieved. Thank you for voting';
}
$text .= "\nVisit http://pear.php.net/election/ to retrieve your vote";
$res = mail($email, $subject, $text, $headers, '-f bounce-no-user@php.net');
return $res;
}
示例8: confirmRequest
function confirmRequest($handle, $password, $name)
{
$sql = 'SELECT handle FROM users WHERE handle = ?';
if ($handle == $this->dbh->getOne($sql, array($handle))) {
$id = $this->dbh->nextId("karma");
$query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())';
$sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', 'pearweb'));
return true;
}
list($firstname, $lastname) = explode(' ', $name, 2);
$data = array('handle' => $handle, 'firstname' => $firstname, 'lastname' => $lastname, 'email' => $this->email, 'purpose' => 'bug tracker', 'password' => $password, 'password2' => $password, 'purpose' => 'Open/Comment on bugs', 'moreinfo' => 'Automatic Account Request', 'homepage' => '');
include_once 'pear-database-user.php';
$useradd = user::add($data, true, true);
if ($useradd !== true) {
return $useradd;
}
$sql = 'SELECT handle from bug_account_request WHERE salt = ?';
$temphandle = $this->dbh->getOne($sql, array($this->salt));
// update all relevant records to the new handle
$this->dbh->query('UPDATE bugdb_comments set reporter_name = ? WHERE handle = ?', array($name, $temphandle));
$this->dbh->query('UPDATE bugdb set reporter_name = ? WHERE handle = ?', array($name, $temphandle));
$this->dbh->query('UPDATE users set handle = ? WHERE handle = ?', array($handle, $temphandle));
$this->dbh->query('UPDATE bugdb set registered = 1, handle = ? WHERE handle = ?', array($handle, $temphandle));
$this->dbh->query('UPDATE bugdb_comments set handle = ? WHERE handle = ?', array($handle, $temphandle));
$this->dbh->query('UPDATE bugdb_patchtracker set developer = ? WHERE developer = ?', array($handle, $temphandle));
$this->handle = $handle;
// activate the handle and grant karma
// implicitly without human intervention
// copied from the user class and Damblan_Karma
include_once 'pear-database-user.php';
$user = user::info($handle, null, 0);
if (!isset($user['registered'])) {
return false;
}
@($arr = unserialize($user['userinfo']));
include_once 'pear-database-note.php';
note::removeAll($handle);
$data = array();
$data['registered'] = 1;
$data['password'] = $password;
$data['name'] = $name;
if (is_array($arr)) {
$data['userinfo'] = $arr[1];
}
$data['create'] = gmdate('Y-m-d');
$data['createBy'] = SITE . 'web';
$data['handle'] = $handle;
user::update($data, true);
$query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())';
$id = $this->dbh->nextId('karma');
$sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', SITE . 'web'));
$id = $this->dbh->nextId('karma');
$sth = $this->dbh->query($query, array($id, $this->handle, 'pear.voter', SITE . 'web'));
if (!DB::isError($sth)) {
require_once 'bugs/pear-bugs-utils.php';
$pbu = new PEAR_Bugs_Utils();
note::add($this->handle, 'Account opened', SITE . 'web');
$bugs = $this->dbh->getAll('SELECT * FROM bugdb WHERE handle = ?', array($this->handle), DB_FETCHMODE_ASSOC);
foreach ($bugs as $bug) {
$this->sendBugEmail($bug);
}
$patches = $this->dbh->getAll('SELECT bugdb.package_name, bugdb_patchtracker.*
FROM bugdb_patchtracker, bugdb
WHERE bugdb_patchtracker.developer = ?
AND bugdb.id = bugdb_patchtracker.bugdb_id', array($this->handle), DB_FETCHMODE_ASSOC);
foreach ($patches as $patch) {
$pbu->sendPatchEmail($patch);
}
$bugs = $this->dbh->getAll('SELECT bugdb_comments.email,bugdb_comments.comment,
bugdb_comments.reporter_name, bugdb.id,
bugdb.bug_type,bugdb.package_name,bugdb.sdesc,
bugdb.ldesc,bugdb.php_version, bugdb.php_os,bugdb.status,
bugdb.assign,bugdb.package_version
FROM bugdb_comments, bugdb
WHERE bugdb.id = bugdb_comments.bug AND
bugdb_comments.handle = ?', array($this->handle), DB_FETCHMODE_ASSOC);
foreach ($bugs as $bug) {
$this->sendBugCommentEmail($bug);
}
$msg = "Your PEAR bug tracker account has been opened.\n" . "Bugs you have opened will now be displayed, and you can\n" . "add new comments to existing bugs";
$xhdr = "From: " . PEAR_WEBMASTER_EMAIL;
if (!DEVBOX) {
mail($user['email'], "Your PEAR Bug Tracker Account Request", $msg, $xhdr, "-f " . PEAR_BOUNCE_EMAIL);
}
$this->deleteRequest();
return true;
}
return false;
}
示例9: init_auth_user
/**
* setup the $auth_user object
*/
function init_auth_user()
{
global $auth_user, $dbh;
if (empty($_COOKIE['PEAR_USER']) || empty($_COOKIE['PEAR_PW'])) {
$auth_user = null;
return false;
}
if (!empty($auth_user)) {
return true;
}
require_once 'pear-database-user.php';
$data = user::info($_COOKIE['PEAR_USER'], null, true, false);
$auth_user = new PEAR_Auth();
$auth_user->data($data);
if (md5($_COOKIE['PEAR_PW']) == @$auth_user->password) {
return true;
}
$auth_user = null;
return false;
}
示例10: value
//.........这里部分代码省略.........
unset($body, $art_data);
$pageArray = array();
if ($total > 1) {
iPHP::loadClass("Pages");
$_GLOBALS_iPage = $GLOBALS['iPage'];
$category['mode'] && iCMS::set_html_url($article['iurl']);
$pageconf = array('page_name' => 'p', 'url' => $pageurl, 'total' => $total, 'perpage' => 1, 'nowindex' => (int) $_GET['p'], 'lang' => iPHP::lang(iPHP_APP . ':page'));
if ($article['chapter']) {
foreach ((array) $chapterArray as $key => $value) {
$pageconf['titles'][$key + 1] = $value['subtitle'];
}
}
$iPages = new iPages($pageconf);
unset($GLOBALS['iPage']);
$GLOBALS['iPage'] = $_GLOBALS_iPage;
unset($_GLOBALS_iPage);
$pageArray['list'] = $iPages->list_page();
$pageArray['index'] = $iPages->first_page('array');
$pageArray['prev'] = $iPages->prev_page('array');
$pageArray['next'] = $iPages->next_page('array');
$pageArray['endof'] = $iPages->last_page('array');
$pagenav = $iPages->show(0);
$pagetext = $iPages->show(10);
}
$article['page'] = array('pn' => $page, 'total' => $total, 'count' => $count, 'current' => $page, 'nav' => $pagenav, 'pageurl' => $pageurl, 'text' => $pagetext, 'PAGES' => $iPages, 'args' => iS::escapeStr($_GET['pageargs']), 'first' => $page == "1" ? true : false, 'last' => $page == $count ? true : false, 'end' => $page == $total ? true : false) + $pageArray;
$next_url = $pageArray['next']['url'];
unset($pagenav, $pagetext, $iPages, $pageArray);
if ($pic_array[0]) {
$img_array = array_unique($pic_array[0]);
foreach ($img_array as $key => $img) {
$img = str_replace('<img', '<img title="' . $article['title'] . '" alt="' . $article['title'] . '"', $img);
if (iCMS::$config['article']['pic_center']) {
$img_replace[$key] = '<p align="center">' . $img . '</p>';
} else {
$img_replace[$key] = $img;
}
if (iCMS::$config['article']['pic_next'] && $count > 1) {
$clicknext = '<a href="' . $next_url . '"><b>' . iPHP::lang('iCMS:article:clicknext') . '</b></a>';
$clickimg = '<a href="' . $next_url . '" title="' . $article['title'] . '" class="img">' . $img . '</a>';
if (iCMS::$config['article']['pic_center']) {
$img_replace[$key] = '<p align="center">' . $clicknext . '</p>';
$img_replace[$key] .= '<p align="center">' . $clickimg . '</p>';
} else {
$img_replace[$key] = '<p>' . $clicknext . '</p>';
$img_replace[$key] .= '<p>' . $clickimg . '</p>';
}
}
}
$article['body'] = str_replace($img_array, $img_replace, $article['body']);
}
}
if ($vars['tags']) {
$article['tags_fname'] = $category['name'];
if ($article['tags']) {
$tagApp = iPHP::app("tag");
$tagArray = $tagApp->get_array($article['tags']);
$article['tag_array'] = array();
foreach ((array) $tagArray as $tk => $tag) {
$article['tag_array'][$tk] = $tag;
$article['tags_link'] .= $tag['link'];
$tag_name_array[] = $tag['name'];
}
$tag_name_array && ($article['tags_fname'] = $tag_name_array[0]);
unset($tagApp, $tagArray, $tag_name_array);
}
}
if ($vars['meta']) {
if ($article['metadata']) {
$article['meta'] = unserialize($article['metadata']);
unset($article['metadata']);
}
}
if ($vars['user']) {
iPHP::app('user.class', 'static');
if ($article['postype']) {
$article['user'] = user::empty_info($article['userid'], '#' . $article['editor']);
} else {
$article['user'] = user::info($article['userid'], $article['author']);
}
}
if (strstr($article['source'], '||')) {
list($s_name, $s_url) = explode('||', $article['source']);
$article['source'] = '<a href="' . $s_url . '" target="_blank">' . $s_name . '</a>';
}
if (strstr($article['author'], '||')) {
list($a_name, $a_url) = explode('||', $article['author']);
$article['author'] = '<a href="' . $a_url . '" target="_blank">' . $a_name . '</a>';
}
$article['hits'] = array('script' => iCMS_API . '?app=article&do=hits&cid=' . $article['cid'] . '&id=' . $article['id'], 'count' => $article['hits'], 'today' => $article['hits_today'], 'yday' => $article['hits_yday'], 'week' => $article['hits_week'], 'month' => $article['hits_month']);
$article['comment'] = array('url' => iCMS_API . "?app=article&do=comment&appid={$article['appid']}&iid={$article['id']}&cid={$article['cid']}", 'count' => $article['comments']);
if ($article['picdata']) {
$picdata = unserialize($article['picdata']);
}
unset($article['picdata']);
$article['pic'] = get_pic($article['pic'], $picdata['b'], get_twh($vars['btw'], $vars['bth']));
$article['mpic'] = get_pic($article['mpic'], $picdata['m'], get_twh($vars['mtw'], $vars['mth']));
$article['spic'] = get_pic($article['spic'], $picdata['s'], get_twh($vars['stw'], $vars['sth']));
$article['param'] = array("appid" => $article['appid'], "iid" => $article['id'], "cid" => $article['cid'], "suid" => $article['userid'], "title" => $article['title'], "url" => $article['url']);
return $article;
}
示例11: array
echo ' <td class="textcell" valign="top">';
echo 'Voting has not started yet.';
break;
default:
$proposal->getVotes($dbh);
if (count($proposal->votes) == 0) {
echo ' <td class="textcell" valign="top">';
echo 'No votes have been cast yet.';
} else {
$users = array();
$head = true;
echo ' <td class="ulcell" valign="top">' . "\n<ul>\n";
include_once 'pear-database-user.php';
foreach ($proposal->votes as $vote) {
if (!isset($users[$vote->user_handle])) {
$users[$vote->user_handle] =& user::info($vote->user_handle);
}
if ($vote->value > 0) {
$vote->value = '+' . $vote->value;
}
echo ' <li><strong>';
echo make_link('pepr-vote-show.php?id=' . $proposal->id . '&handle=' . htmlspecialchars($vote->user_handle), $vote->value);
echo '</strong>';
if ($vote->is_conditional) {
echo '^';
} elseif (!empty($vote->comment)) {
echo '*';
}
echo ' (';
echo make_link('/user/' . htmlspecialchars($vote->user_handle), htmlspecialchars($users[$vote->user_handle]['name']));
echo ') ' . format_date($vote->timestamp);
示例12: report_success
include_once 'pear-database-user.php';
$result = user::update($user_post);
if (DB::isError($result)) {
PEAR::raiseError('Could not update the user profile, please notify ' . PEAR_WEBMASTER_EMAIL);
break;
}
report_success('Your information was successfully updated.');
}
if ($command == 'change_password') {
if (!validate_csrf_token($csrf_token_name)) {
report_error('Invalid token.');
response_footer();
exit;
}
include_once 'pear-database-user.php';
$user = user::info($handle, 'password', true, false);
// If it's an admin we can change ones password without knowing {{{
// it's old password.
if (!$auth_user->isAdmin()) {
if (empty($_POST['password_old']) || empty($_POST['password']) || empty($_POST['password2'])) {
PEAR::raiseError('Please fill out all password fields.');
break;
}
if ($user['password'] != md5($_POST['password_old'])) {
PEAR::raiseError('You provided a wrong old password.');
break;
}
}
if ($_POST['password'] != $_POST['password2']) {
PEAR::raiseError('The new passwords do not match.');
break;
示例13: display_overview_nav
if (empty($selectStatus)) {
echo "<p>";
echo "PEPr is PEAR's system for managing the process of submitting ";
echo "new packages. If you would like to submit your own package, ";
echo "please have a look at the <a href=\"/manual/en/developers-newmaint.php\">New Maintainers' Guide</a>.";
echo "</p>";
echo "<p>";
echo "<a href=\"/feeds/pepr{$searchPostfix}.rss\"><img src=\"/gifs/feed.png\" width=\"16\" height=\"16\" alt=\"Aggregate this\" border=\"0\" /></a>";
echo "</p>";
}
display_overview_nav();
$users = array();
foreach ($proposals as $proposal) {
include_once 'pear-database-user.php';
if (!isset($users[$proposal->user_handle])) {
$users[$proposal->user_handle] = user::info($proposal->user_handle);
}
}
$statuses = $proposalStatiMap;
$proposals_by_status = array();
foreach ($statuses as $status => $status_description) {
$proposals_by_status[$status] = array();
}
foreach ($proposals as $proposal) {
//Only show 10 finished proposals unless we're specifically looking at everything
if ($selectStatus != 'finished' && $proposal->getStatus() == 'finished' && count($proposals_by_status[$proposal->getStatus()]) >= 10) {
continue;
}
$proposals_by_status[$proposal->getStatus()][] = $proposal;
}
foreach ($statuses as $status => $status_description) {
示例14: update
/**
* Update user information
*
* @access public
* @param array User information
* @return object|boolean DB error object on failure, true on success
*/
static function update($data, $admin = false)
{
global $dbh;
if (!isset($data['handle'])) {
return false;
}
$fields = array('name', 'email', 'homepage', 'showemail', 'userinfo', 'pgpkeyid', 'wishlist', 'latitude', 'longitude', 'active', 'password', 'from_site');
if ($admin) {
$fields[] = 'registered';
$fields[] = 'created';
$fields[] = 'createdby';
}
$info = user::info($data['handle'], null, 'any');
// In case a active value isn't passed in
$active = isset($info['active']) ? $info['active'] : true;
$change_k = $change_v = array();
foreach ($data as $key => $value) {
if (!in_array($key, $fields)) {
continue;
}
$change_k[] = $key;
$change_v[] = $value;
}
$sql = 'UPDATE users SET ' . "\n";
foreach ($change_k as $k) {
$sql .= $k . ' = ?,' . "\n";
}
$sql = substr($sql, 0, -2);
$sql .= ' WHERE handle = ?';
$change_v[] = $data['handle'];
$err = $dbh->query($sql, $change_v);
if (DB::isError($err)) {
return $err;
}
if (isset($data['active']) && $data['active'] === 0 && $active) {
// this user is completely inactive, so mark all maintains as not active.
$dbh->query('UPDATE maintains SET active = 0 WHERE handle = ?', array($info['handle']));
}
return true;
}
示例15: format_date
echo 'Voting Extended: ' . format_date($proposal->longened_date, 'Y-m-d');
echo "</li>\n";
}
?>
</ul>
</td>
<td class="ulcell" valign="top">
<?php
if ($changelog = @ppComment::getAll($proposal->id, 'package_proposal_changelog')) {
echo "<ul>\n";
include_once 'pear-database-user.php';
foreach ($changelog as $comment) {
if (!isset($userinfos[$comment->user_handle])) {
$userinfo[$comment->user_handle] = user::info($comment->user_handle);
}
echo '<li><p style="margin: 0em 0em 0.3em 0em; font-size: 90%;">';
echo htmlspecialchars($userinfo[$comment->user_handle]['name']);
echo '<br />[' . format_date($comment->timestamp) . ']</p>';
switch ($proposal->markup) {
case 'wiki':
require_once 'Text/Wiki.php';
$wiki =& new Text_Wiki();
$wiki->disableRule('wikilink');
echo $wiki->transform($comment->comment);
break;
case 'bbcode':
default:
require_once 'HTML/BBCodeParser.php';
$bbparser = new HTML_BBCodeParser(array('filters' => 'Basic,Images,Links,Lists,Extended'));