本文整理汇总了PHP中MEMBER类的典型用法代码示例。如果您正苦于以下问题:PHP MEMBER类的具体用法?PHP MEMBER怎么用?PHP MEMBER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MEMBER类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: your_mp_bullet_point
function your_mp_bullet_point()
{
global $THEUSER, $MPURL;
print "<li>";
$pc_form = true;
if ($THEUSER->constituency_is_set()) {
// (We don't allow the user to search for a postcode if they
// already have one set in their prefs.)
$MEMBER = new MEMBER(array('constituency' => $THEUSER->constituency()));
if ($MEMBER->valid) {
$pc_form = false;
$CHANGEURL = new URL('userchangepc');
$mpname = $MEMBER->first_name() . ' ' . $MEMBER->last_name();
$former = "";
$left_house = $MEMBER->left_house();
if ($left_house[1]['date'] != '9999-12-31') {
$former = 'former';
}
?>
<p><a href="<?php
echo $MPURL->generate();
?>
"><strong>Find out more about <?php
echo $mpname;
?>
, your <?php
echo $former;
?>
Representative</strong></a>
(<a href="<?php
echo $CHANGEURL->generate();
?>
">Change</a>)</p>
<?php
}
}
if ($pc_form) {
?>
<form action="<?php
echo $MPURL->generate();
?>
" method="get">
<p><strong>Find out more about your Representative</strong><br>
<label for="pc">Enter your Australian postcode here:</label> <input type="text" name="pc" id="pc" size="8" maxlength="10" class="text"> <input type="submit" value=" GO " class="submit"></p>
</form>
<?php
}
print "</li>";
}
开发者ID:leowmjw,项目名称:twfy,代码行数:49,代码来源:index.php
示例2: fetch_mp
function fetch_mp($pc, $constituencies, $house = null)
{
global $THEUSER;
$args = array('constituency' => $constituencies['WMC']);
if ($house) {
$args['house'] = $house;
}
try {
$MEMBER = new MEMBER($args);
} catch (MySociety\TheyWorkForYou\MemberException $e) {
postcode_error($e->getMessage());
}
if ($MEMBER->person_id()) {
$THEUSER->set_postcode_cookie($pc);
}
return $MEMBER;
}
开发者ID:udp12,项目名称:theyworkforyou,代码行数:17,代码来源:index.php
示例3: load_member
function load_member($pid)
{
$member = new MEMBER(array('person_id' => $pid));
if (!$member->valid) {
output_error('Unknown ID');
}
$member->load_extra_info();
return $member;
}
开发者ID:palfrey,项目名称:twfy,代码行数:9,代码来源:index.php
示例4: manage
public static function manage($email)
{
$db = new \ParlDB();
$q = $db->query('SELECT * FROM alerts WHERE email = :email
AND deleted != 1 ORDER BY created', array(':email' => $email));
$out = '';
for ($i = 0; $i < $q->rows(); ++$i) {
$row = $q->row($i);
$criteria = explode(' ', $row['criteria']);
$ccc = array();
$current = true;
foreach ($criteria as $c) {
if (preg_match('#^speaker:(\\d+)#', $c, $m)) {
$MEMBER = new \MEMBER(array('person_id' => $m[1]));
$ccc[] = 'spoken by ' . $MEMBER->full_name();
if (!$MEMBER->current_member_anywhere()) {
$current = false;
}
} else {
$ccc[] = $c;
}
}
$criteria = join(' ', $ccc);
$token = $row['alert_id'] . '-' . $row['registrationtoken'];
$action = '<form action="/alert/" method="post"><input type="hidden" name="t" value="' . $token . '">';
if (!$row['confirmed']) {
$action .= '<input type="submit" name="action" value="Confirm">';
} elseif ($row['deleted'] == 2) {
$action .= '<input type="submit" name="action" value="Resume">';
} else {
$action .= '<input type="submit" name="action" value="Suspend"> <input type="submit" name="action" value="Delete">';
}
$action .= '</form>';
$out .= '<tr><td>' . $criteria . '</td><td align="center">' . $action . '</td></tr>';
if (!$current) {
$out .= '<tr><td colspan="2"><small> — <em>not a current member of any body covered by TheyWorkForYou</em></small></td></tr>';
}
}
if ($out) {
print '<table cellpadding="3" cellspacing="0"><tr><th>Criteria</th><th>Action</th></tr>' . $out . '</table>';
} else {
print '<p>You currently have no email alerts set up.</p>';
}
}
开发者ID:vijo,项目名称:theyworkforyou,代码行数:44,代码来源:Alert.php
示例5: meta
public static function meta($e)
{
$private = false;
if ($e['committee_name']) {
$title = $e['committee_name'];
if ($e['title'] == 'to consider the Bill') {
} elseif ($e['title'] && $e['title'] != 'This is a private meeting.') {
$title .= ': ' . $e['title'];
} else {
$private = true;
}
} else {
$title = $e['title'];
if ($pid = $e['person_id']) {
$MEMBER = new \MEMBER(array('person_id' => $pid));
$name = $MEMBER->full_name();
$title .= " – <a href='/mp/?p={$pid}'>{$name}</a>";
}
}
$meta = array();
if ($d = $e['debate_type']) {
if ($d == 'Adjournment') {
$d = 'Adjournment debate';
}
$meta[] = $d;
}
if ($e['time_start'] || $e['location']) {
if ($e['time_start']) {
$time = format_time($e['time_start'], TIMEFORMAT);
if ($e['time_end']) {
$time .= ' – ' . format_time($e['time_end'], TIMEFORMAT);
}
$meta[] = $time;
}
if ($e['location']) {
$meta[] = $e['location'];
}
}
if ($private) {
$meta[] = 'Private meeting';
}
return array($title, $meta);
}
开发者ID:vijo,项目名称:theyworkforyou,代码行数:43,代码来源:Calendar.php
示例6: _get_committee
function _get_committee($bill_id)
{
include_once INCLUDESPATH . "easyparliament/member.php";
$q = $this->db->query('select count(*) as c from hansard where major=6 and minor=' . mysql_escape_string($bill_id) . ' and htype=10');
$sittings = $q->field(0, 'c');
$q = $this->db->query('select member_id,sum(attending) as attending, sum(chairman) as chairman
from pbc_members where bill_id=' . mysql_escape_string($bill_id) . ' group by member_id');
$comm = array('sittings' => $sittings);
for ($i = 0; $i < $q->rows(); $i++) {
$member_id = $q->field($i, 'member_id');
$mp = new MEMBER(array('member_id' => $member_id));
$attending = $q->field($i, 'attending');
$chairman = $q->field($i, 'chairman');
$arr = array('name' => $mp->full_name(), 'attending' => $attending);
if ($chairman) {
$comm['chairmen'][$member_id] = $arr;
} else {
$comm['members'][$member_id] = $arr;
}
}
return $comm;
}
开发者ID:rhaleblian,项目名称:twfy,代码行数:22,代码来源:hansardlist.php
示例7: find_constituency
function find_constituency($args)
{
// We see if the user is searching for a postcode or constituency.
global $PAGE, $db;
if ($args['s'] != '') {
$searchterm = $args['s'];
} else {
$PAGE->error_message('No search string');
return false;
}
$constituencies = array();
$constituency = '';
$validpostcode = false;
if (validate_postcode($searchterm)) {
// Looks like a postcode - can we find the constituency?
$constituencies = postcode_to_constituency($searchterm);
if ($constituencies == '') {
$constituencies = array();
} else {
$validpostcode = true;
}
if (!is_array($constituencies)) {
$constituencies = array($constituencies);
}
}
if ($constituencies == array() && $searchterm) {
// No luck so far - let's see if they're searching for a constituency.
$try = strtolower($searchterm);
if (normalise_constituency_name($try)) {
$constituency = normalise_constituency_name($try);
} else {
$query = "select distinct\n (select name from constituency where cons_id = o.cons_id and main_name) as name \n from constituency AS o where name like '%" . mysql_real_escape_string($try) . "%'\n and from_date <= date(now()) and date(now()) <= to_date";
$q = $db->query($query);
for ($n = 0; $n < $q->rows(); $n++) {
$constituencies[] = $q->field($n, 'name');
}
}
}
if (count($constituencies) == 1) {
$constituency = $constituencies[0];
}
if ($constituency != '') {
// Got a match, display....
$MEMBER = new MEMBER(array('constituency' => $constituency));
$URL = new URL('mp');
if ($MEMBER->valid) {
$URL->insert(array('m' => $MEMBER->member_id()));
print '<h3>MP for ' . preg_replace("#{$searchterm}#i", '<span class="hi">$0</span>', $constituency);
if ($validpostcode) {
// Display the postcode the user searched for.
print ' (' . htmlentities(strtoupper($args['s'])) . ')';
}
?>
</h3>
<p><a href="<?php
echo $URL->generate();
?>
"><strong><?php
echo htmlentities($MEMBER->first_name()) . ' ' . htmlentities($MEMBER->last_name());
?>
</strong></a> (<?php
echo $MEMBER->party();
?>
)</p>
<?php
}
} elseif (count($constituencies)) {
print "<h3>MPs in constituencies matching '" . htmlentities($searchterm) . "'</h3><ul>";
foreach ($constituencies as $constituency) {
$MEMBER = new MEMBER(array('constituency' => $constituency));
$URL = new URL('mp');
if ($MEMBER->valid) {
$URL->insert(array('m' => $MEMBER->member_id()));
}
print '<li><a href="' . $URL->generate() . '"><strong>' . htmlentities($MEMBER->first_name()) . ' ' . htmlentities($MEMBER->last_name()) . '</strong></a> (' . preg_replace("#{$searchterm}#i", '<span class="hi">$0</span>', $constituency) . ', ' . $MEMBER->party() . ')</li>';
}
print '</ul>';
}
}
开发者ID:leowmjw,项目名称:twfy,代码行数:80,代码来源:mobile.php
示例8: addTeamMember
function addTeamMember($memberid, $admin)
{
global $manager;
$memberid = intval($memberid);
$admin = intval($admin);
// check if member is already a member
$tmem = MEMBER::createFromID($memberid);
if ($tmem->isTeamMember($this->getID())) {
return 0;
}
$manager->notify('PreAddTeamMember', array('blog' => &$this, 'member' => &$tmem, 'admin' => &$admin));
// add to team
$query = 'INSERT INTO ' . sql_table('team') . ' (TMEMBER, TBLOG, TADMIN) ' . 'VALUES (' . $memberid . ', ' . $this->getID() . ', "' . $admin . '")';
sql_query($query);
$manager->notify('PostAddTeamMember', array('blog' => &$this, 'member' => &$tmem, 'admin' => $admin));
$logMsg = sprintf(_TEAM_ADD_NEWTEAMMEMBER, $tmem->getDisplayName(), $memberid, $this->getName());
ACTIONLOG::add(INFO, $logMsg);
return 1;
}
开发者ID:hatone,项目名称:Nucleus-v3.64,代码行数:19,代码来源:BLOG.php
示例9: URL
<?php
}
?>
</form>
</div>
<div>
<h3>Your representative</h3>
<?php
$MPURL = new URL('yourmp');
global $THEUSER;
$pc_form = true;
if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) {
// User is logged in and has a postcode, or not logged in with a cookied postcode.
// (We don't allow the user to search for a postcode if they
// already have one set in their prefs.)
$MEMBER = new MEMBER(array('postcode' => $THEUSER->postcode()));
if ($MEMBER->valid) {
$pc_form = false;
if ($THEUSER->isloggedin()) {
$CHANGEURL = new URL('useredit');
} else {
$CHANGEURL = new URL('userchangepc');
}
$mpname = $MEMBER->first_name() . ' ' . $MEMBER->last_name();
$former = "";
$left_house = $MEMBER->left_house();
if ($left_house[1]['date'] != '9999-12-31') {
$former = 'former';
}
?>
开发者ID:palfrey,项目名称:twfy,代码行数:30,代码来源:index.php
示例10: htmlentities
$errors['pc'] = "Sorry, " . htmlentities($pc) . " isn't a known postcode";
} elseif (isset($constituencies['SPE']) || isset($constituencies['SPC'])) {
$MEMBER = new MEMBER(array('constituency' => $constituencies['WMC']));
if ($MEMBER->person_id()) {
$THEUSER->set_postcode_cookie($pc);
}
list($out, $sidebars) = pick_multiple($pc, $constituencies, 'SPE', 'MSP');
} elseif (isset($constituencies['NIE'])) {
$MEMBER = new MEMBER(array('constituency' => $constituencies['WMC']));
if ($MEMBER->person_id()) {
$THEUSER->set_postcode_cookie($pc);
}
list($out, $sidebars) = pick_multiple($pc, $constituencies, 'NIE', 'MLA');
} else {
# Just have an MP, redirect instantly to the canonical page
$MEMBER = new MEMBER(array('constituency' => $constituencies['WMC']));
if ($MEMBER->person_id()) {
$THEUSER->set_postcode_cookie($pc);
}
member_redirect($MEMBER);
}
} else {
$errors['pc'] = "Sorry, " . htmlentities($pc) . " isn't a valid postcode";
twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
}
$PAGE->page_start();
$PAGE->stripe_start();
if (isset($errors['pc'])) {
$PAGE->error_message($errors['pc']);
$PAGE->postcode_form();
}
开发者ID:palfrey,项目名称:twfy,代码行数:31,代码来源:index.php
示例11: MEMBER
<?php
# Compile data for MP page in Google gadget
# XXX Lots here copied from elsewhere... Damn you deadlines.
include_once 'min-init.php';
include_once INCLUDESPATH . 'easyparliament/member.php';
include_once '../api/api_functions.php';
$pid = $_GET['pid'];
if (!$pid) {
print '<error>No ID</error>';
exit;
}
$member = new MEMBER(array('person_id' => $pid));
if (!$member->valid) {
print '<error>Unknown ID</error>';
exit;
}
$member->load_extra_info();
$row = array('person_id' => $pid, 'full_name' => $member->full_name(), 'constituency' => $member->constituency(), 'party' => $member->party_text(), 'majority_in_seat' => number_format($member->extra_info['majority_in_seat']), 'swing_to_lose_seat_today' => number_format($member->extra_info['swing_to_lose_seat_today']));
list($image, $sz) = find_rep_image($pid, true);
if ($image) {
$row['image'] = $image;
}
foreach ($member->extra_info['office'] as $office) {
if ($office['to_date'] == '9999-12-31' && $office['source'] == 'chgpages/selctee') {
$row['selctee'][] = prettify_office($office['position'], $office['dept']);
}
}
$none = false;
$output = array();
$pw_keys = array_filter(array_keys($member->extra_info), create_function('$a', '
开发者ID:palfrey,项目名称:twfy,代码行数:31,代码来源:dat.php
示例12: search_form
function search_form($value = '')
{
global $SEARCHENGINE;
// Search box on the search page.
// If $value is set then it will be displayed in the form.
// Otherwise the value of 's' in the URL will be displayed.
$wtt = get_http_var('wtt');
$URL = new URL('search');
$URL->reset();
// no need to pass any query params as a form action. They are not used.
if ($value == '') {
$value = get_http_var('s');
}
echo '<div class="mainsearchbox">';
if ($wtt < 2) {
echo '<form action="', $URL->generate(), '" method="get">';
if (get_http_var('o')) {
echo '<input type="hidden" name="o" value="', htmlentities(get_http_var('o')), '">';
}
if (get_http_var('house')) {
echo '<input type="hidden" name="house" value="', htmlentities(get_http_var('house')), '">';
}
echo '<input type="text" name="s" value="', htmlentities($value), '" size="20"> ';
echo '<input type="submit" value=" ', $wtt ? 'Modify search' : 'Search', ' "><br>';
if ($wtt) {
print '<input type="hidden" name="wtt" value="1">';
}
} else {
?>
<form action="http://www.writetothem.com/lords" method="get">
<input type="hidden" name="pid" value="<?php
echo htmlentities(get_http_var('pid'));
?>
">
<input type="submit" style="font-size: 150%" value=" I want to write to this Lord "><br>
<?php
}
if (!$wtt) {
echo '<div style="margin-top: 5px">';
$orderUrl = new URL('search');
$ordering = get_http_var('o');
if ($ordering != 'r' && $ordering != 'd' && $ordering != 'p') {
$ordering = 'd';
}
if ($ordering == 'r') {
print '<strong>Most relevant results are first</strong>';
} else {
printf("<a href='%s'>Show most relevant results first</a>", $orderUrl->generate('html', array('o' => 'r')));
}
print " | ";
if ($ordering == 'd') {
print '<strong>Most recent results are first</strong>';
} else {
printf("<a href='%s'>Show most recent results first</a>", $orderUrl->generate('html', array('o' => 'd')));
}
print " | ";
if ($ordering == 'p') {
print '<strong>Use by person</strong>';
} else {
printf('<a href="%s">Show use by person</a>', $orderUrl->generate('html', array('o' => 'p')));
}
echo '</div>';
$person_id = get_http_var('pid');
if ($person_id != "") {
$member = new MEMBER(array('person_id' => $person_id));
if ($member->valid) {
$name = $member->full_name();
?>
<p>
<input type="radio" name="pid" value="<?php
echo htmlentities($person_id);
?>
" checked>Search only <?php
echo htmlentities($name);
?>
<input type="radio" name="pid" value="">Search all speeches
</p>
<?php
}
}
}
echo '</form> </div>';
}
开发者ID:archoo,项目名称:twfy,代码行数:84,代码来源:page.php
示例13: addComment
/**
* Adds a new comment to the database
* @param string $timestamp
* @param array $comment
* @return mixed
*/
function addComment($timestamp, $comment)
{
global $CONF, $member, $manager;
$blogid = getBlogIDFromItemID($this->itemid);
$settings =& $manager->getBlog($blogid);
$settings->readSettings();
// begin if: comments disabled
if (!$settings->commentsEnabled()) {
return _ERROR_COMMENTS_DISABLED;
}
// end if
// begin if: public cannot comment
if (!$settings->isPublic() && !$member->isLoggedIn()) {
return _ERROR_COMMENTS_NONPUBLIC;
}
// end if
// begin if: comment uses a protected member name
if ($CONF['ProtectMemNames'] && !$member->isLoggedIn() && MEMBER::isNameProtected($comment['user'])) {
return _ERROR_COMMENTS_MEMBERNICK;
}
// end if
// begin if: email required, but missing (doesn't apply to members)
if ($settings->emailRequired() && strlen($comment['email']) == 0 && !$member->isLoggedIn()) {
return _ERROR_EMAIL_REQUIRED;
}
// end if
## Note usage of mb_strlen() vs strlen() below ##
// begin if: commenter's name is too long
if (mb_strlen($comment['user']) > 40) {
return _ERROR_USER_TOO_LONG;
}
// end if
// begin if: commenter's email is too long
if (mb_strlen($comment['email']) > 100) {
return _ERROR_EMAIL_TOO_LONG;
}
// end if
// begin if: commenter's url is too long
if (mb_strlen($comment['userid']) > 100) {
return _ERROR_URL_TOO_LONG;
}
// end if
$comment['timestamp'] = $timestamp;
$comment['host'] = gethostbyaddr(serverVar('REMOTE_ADDR'));
$comment['ip'] = serverVar('REMOTE_ADDR');
// begin if: member is logged in, use that data
if ($member->isLoggedIn()) {
$comment['memberid'] = $member->getID();
$comment['user'] = '';
$comment['userid'] = '';
$comment['email'] = '';
} else {
$comment['memberid'] = 0;
}
// spam check
$continue = FALSE;
$plugins = array();
if (isset($manager->subscriptions['ValidateForm'])) {
$plugins = array_merge($plugins, $manager->subscriptions['ValidateForm']);
}
if (isset($manager->subscriptions['PreAddComment'])) {
$plugins = array_merge($plugins, $manager->subscriptions['PreAddComment']);
}
if (isset($manager->subscriptions['PostAddComment'])) {
$plugins = array_merge($plugins, $manager->subscriptions['PostAddComment']);
}
$plugins = array_unique($plugins);
while (list(, $plugin) = each($plugins)) {
$p = $manager->getPlugin($plugin);
$continue = $continue || $p->supportsFeature('handleSpam');
}
$spamcheck = array('type' => 'comment', 'body' => $comment['body'], 'id' => $comment['itemid'], 'live' => TRUE, 'return' => $continue);
// begin if: member logged in
if ($member->isLoggedIn()) {
$spamcheck['author'] = $member->displayname;
$spamcheck['email'] = $member->email;
} else {
$spamcheck['author'] = $comment['user'];
$spamcheck['email'] = $comment['email'];
$spamcheck['url'] = $comment['userid'];
}
// end if
$manager->notify('SpamCheck', array('spamcheck' => &$spamcheck));
if (!$continue && isset($spamcheck['result']) && $spamcheck['result'] == TRUE) {
return _ERROR_COMMENTS_SPAM;
}
// isValidComment returns either "1" or an error message
$isvalid = $this->isValidComment($comment, $spamcheck);
if ($isvalid != 1) {
return $isvalid;
}
// begin if: send email to notification address
if ($settings->getNotifyAddress() && $settings->notifyOnComment()) {
$mailto_msg = _NOTIFY_NC_MSG . ' ' . $this->itemid . "\n";
//.........这里部分代码省略.........
开发者ID:hatone,项目名称:Nucleus-v3.64,代码行数:101,代码来源:COMMENTS.php
示例14: criteria_pretty
function criteria_pretty($html = false) {
$criteria = explode(' ',$this->criteria);
$words = array(); $spokenby = '';
foreach ($criteria as $c) {
if (preg_match('#^speaker:(\d+)#',$c,$m)) {
$MEMBER = new MEMBER(array('person_id'=>$m[1]));
$spokenby = $MEMBER->full_name();
} else {
$words[] = $c;
}
}
$criteria = '';
if (count($words)) $criteria .= ($html?'<li>':'* ') . 'Containing the ' . make_plural('word', count($words)) . ': ' . join(' ', $words) . ($html?'</li>':'') . "\n";
if ($spokenby) $criteria .= ($html?'<li>':'* ') . "Spoken by $spokenby" . ($html?'</li>':'') . "\n";
return $criteria;
}
开发者ID:henare,项目名称:theyworkforyou,代码行数:16,代码来源:alert.php
示例15: _getItem
/**
* Returns one item (Nucleus version)
*/
function _getItem($itemid, $username, $password)
{
global $manager;
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// 2. check if allowed
if (!$manager->existsItem($itemid, 1, 1)) {
return _error(6, "No such item ({$itemid})");
}
$blogid = getBlogIDFromItemID($itemid);
if (!$mem->teamRights($blogid)) {
return _error(3, "Not a team member");
}
// 3. return the item
// Structure returned has dateCreated, userid, blogid and content
$item =& $manager->getItem($itemid, 1, 1);
// (also allow drafts and future items)
$blog = new BLOG($blogid);
if ($blog->convertBreaks()) {
$item['body'] = removeBreaks($item['body']);
}
$newstruct = new xmlrpcval(array("publishDate" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "title" => new xmlrpcval($item['title'], "string"), "body" => new xmlrpcval($item['body'], "string"), "more" => new xmlrpcval($item['more'], "string"), "draft" => new xmlrpcval($item['draft'], "boolean"), "closed" => new xmlrpcval($item['closed'], "boolean")), 'struct');
return new xmlrpcresp($newstruct);
}
开发者ID:hatone,项目名称:Nucleus-v3.64,代码行数:30,代码来源:api_nucleus.inc.php
示例16: postcode_to_constituency
if ($cconstituency == "") {
$constituency = postcode_to_constituency($pc);
} else {
$constituency = $cconstituency;
}
if ($constituency == "connection_timed_out") {
$errors['pc'] = "Sorry, we couldn't check your postcode right now, as our postcode lookup server is under quite a lot of load. Please use the 'All MPs' link above to browse all the MPs.";
} elseif ($constituency == "") {
$errors['pc'] = "Sorry, " . htmlentities($pc) . " isn't a known postcode";
twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency");
} elseif (is_array($constituency)) {
$PAGE->page_start_mobile();
$PAGE->stripe_start();
print '<p>There are several electoral divisions within your postcode. Please select from the following:</p><ul>';
foreach ($constituency as $c) {
$member = new MEMBER(array('constituency' => $c));
print '<li><a href="' . WEBPATH . 'mp/?pc=' . $pc . '&c=' . $c . '">' . ucwords(strtolower($member->full_name())) . ', ' . $member->constituency() . '</a></li>';
}
print '</ul>';
$MPSURL = new URL('mps');
$sidebar = array('type' => 'html', 'content' => '<div class="block">
<h4><a href="' . $MPSURL->generate() . '">Browse all MPs</a></h4>
</div>');
//$PAGE->stripe_end(array($sidebar));
} else {
// Redirect to the canonical MP page, with a person id.
$MEMBER = new MEMBER(array('constituency' => $constituency));
if ($MEMBER->person_id()) {
if ($THEUSER->isloggedin()) {
# Updates too much in the database to make one change
$details = array('firstname' => $THEUSER->firstname(), 'lastname' => $THEUSER->lastname(), 'email' => $THEUSER->email(), 'emailpublic' => $THEUSER->emailpublic(), 'postcode' => $pc, 'constituency' => $constituency, 'url' => $THEUSER->url(), 'optin' => $THEUSER->optin());
开发者ID:leowmjw,项目名称:twfy,代码行数:31,代码来源:mobile.php
示例17: display_user
//.........这里部分代码省略.........
?>
</strong></div>
<?php
}
if (isset($optin)) {
?>
<div class="row">Receive TheyWorkForYou.com emails? <strong><?php
echo htmlentities($optin);
?>
</strong></div>
<?php
}
if (isset($status)) {
?>
<div class="row">
<span class="label">Status</span>
<span class="formw"><?php
echo htmlentities($status);
?>
</span>
</div>
<?php
}
if (isset($registrationtime)) {
?>
<div class="row">
<span class="label">Joined</span>
<span class="formw"><?php
echo htmlentities($registrationtime);
?>
</span>
</div>
<?php
}
if ($edited && $this_page == 'userviewself') {
$EDITURL = new URL('useredit');
$VIEWURL = new URL('userviewself');
?>
<p> <br><a href="<?php
echo $EDITURL->generate();
?>
">Edit again</a> or <a href="<?php
echo $VIEWURL->generate();
?>
">see how others see you</a>.</p>
<?php
}
$PAGE->stripe_end();
# Email alerts
if ($this_page == 'userviewself') {
$PAGE->stripe_start();
print '<h3>Your email alerts</h3>';
$db = new ParlDB();
$q = $db->query('SELECT * FROM alerts WHERE email = "' . mysql_escape_string($THEUSER->email()) . '" ORDER BY confirmed,deleted,alert_id');
$out = '';
for ($i = 0; $i < $q->rows(); ++$i) {
$row = $q->row($i);
$criteria = explode(' ', $row['criteria']);
$ccc = array();
foreach ($criteria as $c) {
if (preg_match('#^speaker:(\\d+)#', $c, $m)) {
$MEMBER = new MEMBER(array('person_id' => $m[1]));
$ccc[] = 'spoken by ' . $MEMBER->full_name();
} else {
$ccc[] = $c;
}
}
$criteria = join(' ', $ccc);
$token = $row['alert_id'] . '-' . $row['registrationtoken'];
if (!$row['confirmed']) {
$action = '<a href="/A/' . $token . '">Confirm</a>';
} elseif ($row['deleted']) {
$action = '<form action="/alert/undelete/" method="post"><input type="hidden" name="t" value="' . $token . '"><input type="submit" value="Undelete"></form>';
} else {
$action = '<form action="/alert/delete/" method="post"><input type="hidden" name="t" value="' . $token . '"><input type="submit" value="Delete"></form>';
}
$out .= '<tr><td>' . $criteria . '</td><td>' . $action . '</td></tr>';
}
print '<p>To add a new alert, simply visit an MP or Peer\'s page or conduct a search — to be given the option of turning them into alerts automatically — or visit <a href="/alert/">the manual addition page</a>.</p>';
if ($out) {
print '<p>Here are your email alerts:</p>';
print '<table cellpadding="3" cellspacing="0"><tr><th>Criteria</th><th>Action</th></tr>' . $out . '</table>';
} else {
print '<p>You currently have no email alerts set up.</p>';
}
$PAGE->stripe_end();
}
if (!$edited) {
$args = array('user_id' => $user_id, 'page' => get_http_var('p'));
$COMMENTLIST = new COMMENTLIST();
$COMMENTLIST->display('user', $args);
}
} else {
$message = array('title' => 'Sorry...', 'text' => "We don't have a user ID, so we can't show you anyone's details.");
$PAGE->message($message);
}
$PAGE->page_end();
}
开发者ID:bruno,项目名称:openaustralia-app,代码行数:101,代码来源:index.php
示例18: activate
/**
* Inidicates that an activation link has been clicked and any forms displayed
* there have been successfully filled out.
* @author dekarma
*/
function activate($key)
{
// get activate info
$info = MEMBER::getActivationInfo($key);
// no active key
if (!$info) {
return false;
}
switch ($info->vtype) {
case 'forgot':
// nothing to do
break;
case 'register':
// set canlogin value
global $CONF;
sql_query('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($CONF['NewMemberCanLogon']) . ' WHERE mnumber=' . intval($info->vmember));
break;
case 'addresschange':
// reset old 'canlogin' value
list($oldEmail, $oldCanLogin) = explode('/', $info->vextra);
sql_query('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($oldCanLogin) . ' WHERE mnumber=' . intval($info->vmember));
break;
}
// delete from activation table
sql_query('DELETE FROM ' . sql_table('activation') . ' WHERE vkey=\'' . sql_real_escape_string($key) . '\'');
// success!
return true;
}
开发者ID:hatone,项目名称:Nucleus-v3.64,代码行数:33,代码来源:MEMBER.php
示例19: umask
umask(02);
$HANSARDLIST = new HANSARDLIST();
$db = $HANSARDLIST->db;
// Get all the person ids we need feeds for...
$q = $db->query("SELECT person_id, group_concat(member_id order by member_id separator ',') as member_ids\n\t\t\tFROM member GROUP BY person_id HAVING max(left_house)='9999-12-31'");
if ($q->rows() <= 0) {
exit;
}
$starttime = time();
for ($personrow = 0; $personrow < $q->rows(); $personrow++) {
$person_id = $q->field($personrow, 'person_id');
$member_ids = $q->field($personrow, 'member_ids');
$args = array('member_ids' => $member_ids);
$speeches = $HANSARDLIST->display('person', $args, 'none');
// Some data about this person that we'll need for the feed.
$MEMBER = new MEMBER(array('person_id' => $person_id));
$MPURL = new URL('mp');
$MPURL->insert(array('pid' => $person_id));
$mpurl = $MPURL->generate();
$date = gmdate('Y-m-d');
$time = gmdate('H:i:s');
$datenow = $date . 'T' . $time . '+00:00';
// Prepare the meat of the RSS file.
$items = '';
$entries = '';
if (isset($speeches['rows']) && count($speeches['rows']) > 0) {
foreach ($speeches['rows'] as $n => $row) {
// While we're linking to individual speeches,
// the text is the body of the parent, ie (sub)section.
$title = htmlentities(str_replace('—', '-', $row['parent']['body']));
$link = isset($row['listurl']) ? $row['listurl'] : '';
开发者ID:NathanaelB,项目名称:twfy,代码行数:31,代码来源:mprss.php
示例20: confirm
function confirm($token)
{
// The user has clicked the link in their confirmation email
// and the confirm page has passed the token from the URL to here.
// If all goes well they'll be confirmed and then logged in.
// Split the token into its parts.
$arg = '';
if (strstr($token, '::')) {
$arg = '::';
}
if (strstr($token, '-')) {
$arg = '-';
}
list($user_id, $registrationtoken) = explode($arg, $token);
if (!is_numeric($user_id) || $registrationtoken == '') {
return false;
}
$q = $this->db->query("SELECT email, password, postcode\n\t\t\t\t\t\tFROM\tusers\n\t\t\t\t\t\tWHERE\tuser_id = '" . mysql_escape_string($user_id) . "'\n\t\t\t\t\t\tAND\t\tregistrationtoken = '" . mysql_escape_string($registrationtoken) . "'\n\t\
|
请发表评论