Ejemplo n.º 1
0
    $PAGE->stripe_end(array(array('type' => 'nextprev'), array('type' => 'include', 'content' => "holdebates")));
} elseif (get_http_var('gid') != '') {
    $this_page = 'lordsdebate';
    $args = array('gid' => get_http_var('gid'));
    $LORDSDEBATELIST = new LORDSDEBATELIST();
    $result = $LORDSDEBATELIST->display('gid', $args);
    // If it is a redirect, change URL
    if (is_string($result)) {
        $URL = new URL('lordsdebate');
        $URL->insert(array('gid' => $result));
        header('Location: http://' . DOMAIN . $URL->generate('none'), true, 301);
        exit;
    }
    if ($LORDSDEBATELIST->htype() == '12' || $LORDSDEBATELIST->htype() == '13') {
        $PAGE->stripe_start('side', 'comments');
        $COMMENTLIST = new COMMENTLIST();
        $args['user_id'] = get_http_var('u');
        $args['epobject_id'] = $LORDSDEBATELIST->epobject_id();
        $COMMENTLIST->display('ep', $args);
        $PAGE->stripe_end();
        $PAGE->stripe_start('side', 'addcomment');
        $commendata = array('epobject_id' => $LORDSDEBATELIST->epobject_id(), 'gid' => get_http_var('gid'), 'return_page' => $this_page);
        $PAGE->comment_form($commendata);
        if ($THEUSER->isloggedin()) {
            $sidebar = array(array('type' => 'include', 'content' => 'comment'));
            $PAGE->stripe_end($sidebar);
        } else {
            $PAGE->stripe_end();
        }
        #		$TRACKBACK = new TRACKBACK;
        #		$TRACKBACK->display('epobject_id', $commendata);
Ejemplo n.º 2
0
function find_comments($args)
{
    global $PAGE, $db;
    $commentlist = new COMMENTLIST();
    $commentlist->display('search', $args);
}
Ejemplo n.º 3
0
 function display($format = 'html', $template = 'comments')
 {
     $data['comments'][0] = array('comment_id' => $this->comment_id, 'user_id' => $this->user_id, 'epobject_id' => $this->epobject_id, 'body' => $this->body, 'posted' => $this->posted, 'modflagged' => $this->modflagged, 'url' => $this->url, 'firstname' => $this->firstname, 'lastname' => $this->lastname, 'visible' => $this->visible);
     // Use the same renderer as the COMMENTLIST class.
     $COMMENTLIST = new COMMENTLIST();
     $COMMENTLIST->render($data, $format, $template);
 }
Ejemplo n.º 4
0
<?php

$this_page = "comments_recent";
include_once "../../../includes/easyparliament/init.php";
$PAGE->page_start();
$PAGE->stripe_start();
$COMMENTLIST = new COMMENTLIST();
$args = array('page' => get_http_var('p'), 'pid' => get_http_var('pid'));
$COMMENTLIST->display('recent', $args);
$PAGE->stripe_end();
$PAGE->page_end();
Ejemplo n.º 5
0
function api_getComments_pid($pid)
{
    $args = array('page' => get_http_var('p'), 'num' => get_http_var('num'), 'pid' => $pid);
    $COMMENTLIST = new COMMENTLIST();
    $COMMENTLIST->display('recent', $args, 'api');
}
Ejemplo n.º 6
0
function display_user($user_id = "")
{
    global $THEUSER, $PAGE, $DATA, $this_page, $who;
    // We're either going to be:
    //	Displaying the details of a user who's just been edited
    //		(their user_id will be in $user_id now).
    //	Viewing THEUSER's own data.
    //	Viewing someone else's data (their id will be in the GET string
    //		user_id variable).
    // We could do something cleverer so that if THEUSER has sufficient
    // privileges we display more data when they're viewing someone else's info
    // than what your average punter sees.
    // If $user_id is a user id, we've just edited that user's info.
    // FIRST: Work out whose info we're going to show.
    $edited = false;
    // Have we just edited someone's info?
    if (is_numeric($user_id) && $user_id == $THEUSER->user_id()) {
        // Display this user's just edited info.
        $display = "this user";
        $edited = true;
    } elseif (is_numeric($user_id)) {
        // Display someone else's just edited info.
        $display = "another user";
        $edited = true;
    } elseif (is_numeric(get_http_var("u"))) {
        // Display someone else's info.
        $user_id = get_http_var("u");
        $display = "another user";
    } elseif ($THEUSER->isloggedin()) {
        // Display this user's info.
        $display = "this user";
        $user_id = $THEUSER->user_id();
    } else {
        // Nothing to show!
        $URL = new URL('userlogin');
        $URL->insert(array('ret' => '/user/'));
        $loginurl = $URL->generate();
        header("Location: {$loginurl}");
        exit;
    }
    // SECOND: Get the data for whoever we're going to show.
    if ($display == "another user") {
        // Viewing someone else's info.
        $USER = new USER();
        $valid = $USER->init($user_id);
        if ($valid && $USER->confirmed() && !$USER->deleted()) {
            // Don't want to display unconfirmed or deleted users.
            $name = $USER->firstname() . " " . $USER->lastname();
            $url = $USER->url();
            if ($USER->emailpublic() == true) {
                $email = $USER->email();
            }
            $status = $USER->status();
            $registrationtime = $USER->registrationtime();
            // Change the page title to reflect whose info we're viewing.
            $DATA->set_page_metadata($this_page, "title", "{$name}");
        } else {
            // This user_id doesn't exist.
            $display = "none";
        }
    } elseif ($display == "this user") {
        // Display THEUSER's info.
        $name = $THEUSER->firstname() . " " . $THEUSER->lastname();
        $url = $THEUSER->url();
        if ($edited) {
            // We want to show all the info to the user.
            $email = $THEUSER->email();
            $emailpublic = $THEUSER->emailpublic() == true ? "Yes" : "No";
            $optin = $THEUSER->optin() == true ? "Yes" : "No";
            $postcode = $THEUSER->postcode();
        } else {
            // We're showing them how they're seen to other people.
            if ($THEUSER->emailpublic()) {
                $email = $THEUSER->email();
            }
            $registrationtime = $THEUSER->registrationtime();
            $status = $THEUSER->status();
        }
        // Change the page title to make it clear we're viewing THEUSER's
        // own info. Make them less worried about other people seeing some of the
        // info that shouldn't be public.
        $DATA->set_page_metadata($this_page, "title", "Your details");
    } else {
        // There's nothing to display!
    }
    // THIRD: Print out what we've got.
    $PAGE->page_start();
    if ($display != "none") {
        $PAGE->stripe_start();
        if (isset($registrationtime)) {
            // Make registration time more user-friendly.
            list($date, $time) = explode(' ', $registrationtime);
            $registrationtime = format_date($date, LONGDATEFORMAT);
        }
        if ($edited) {
            print "\t\t\t\t<p><strong>" . ucfirst($who) . " details have been updated:</strong></p>\n";
        }
        if ($this_page == 'userviewself' && !$edited) {
            $EDITURL = new URL('useredit');
            ?>
				<p><strong>This is how other people see you.</strong> <a href="<?php 
            echo $EDITURL->generate();
            ?>
">Edit your details</a>.</p>
<?php 
        }
        ?>
				<div class="row">
				<span class="label">Name</span>
				<span class="formw"><?php 
        if (substr($name, -3) == ' MP') {
            print '<a href="/mp/' . make_member_url(substr($name, 0, -3)) . '">';
        }
        echo htmlentities($name);
        if (substr($name, -3) == ' MP') {
            print '</a>';
        }
        ?>
</span>
				</div>

				<div class="row">
				<span class="label">Email</span>
				<span class="formw"><?php 
        if (isset($email)) {
            $escaped_email = str_replace('@', '&#64;', htmlentities($email));
            ?>
<a href="mailto:<?php 
            echo $escaped_email . "\">" . $escaped_email;
            ?>
</a><?php 
        } else {
            ?>
Not public<?php 
        }
        ?>
</span>
				</div>

<?php 
        if (isset($postcode)) {
            if ($postcode == '') {
                $postcode = 'none';
            }
            ?>
				<div class="row">&nbsp;<br>
				<span class="label">UK Postcode</span>
				<span class="formw"><?php 
            echo htmlentities($postcode);
            ?>
 <small>(not public)</small></span>
				</div>

<?php 
        }
        if (isset($url)) {
            if ($url == '') {
                $url = 'none';
            } else {
                $url = '<a href="' . htmlentities($url) . '">' . htmlentities($url) . '</a>';
            }
            ?>
				<div class="row">
				<span class="label">Website</span>
				<span class="formw"><?php 
            echo $url;
            ?>
</span>
				</div>

<?php 
        }
        if (isset($emailpublic)) {
            ?>
				<div class="row">&nbsp;<br>Let other people see your email address? <strong><?php 
            echo htmlentities($emailpublic);
            ?>
</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>&nbsp;<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 &#8212; to be given the option of turning them into alerts automatically &#8212; 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();
}
Ejemplo n.º 7
0
<?php

include_once "../../includes/easyparliament/init.php";
include_once INCLUDESPATH . "easyparliament/commentreportlist.php";
$this_page = "admin_comments";
$PAGE->page_start();
$PAGE->stripe_start();
// Most recent comments.
$COMMENTLIST = new COMMENTLIST();
$COMMENTLIST->display('recent', array('num' => 50));
$menu = $PAGE->admin_menu();
$PAGE->stripe_end(array(array('type' => 'html', 'content' => $menu)));
$PAGE->page_end();
Ejemplo n.º 8
0
function find_comments($args) {
    $commentlist = new COMMENTLIST;    
    $commentlist->display('search', $args);
}
Ejemplo n.º 9
0
        $URL->insert(array('id' => get_http_var('gid'), 'c' => $success));
        header("Location: http://" . DOMAIN . $URL->generate('none') . "#c" . $success);
        exit;
    } else {
        // Else, $COMMENT will have printed an error message.
        $PAGE->page_end();
    }
} else {
    // We're previewing a comment.
    $PAGE->page_start();
    $PAGE->stripe_start();
    if (is_numeric(get_http_var('epobject_id'))) {
        //remove any unwanted tags
        $body = get_http_var('body');
        $body = filter_user_input($body, 'comment');
        // In init.php
        // Preview the comment.
        // Mock up a data array for the comment listing template.
        $data['comments'][0] = array('body' => $body, 'firstname' => $THEUSER->firstname(), 'lastname' => $THEUSER->lastname(), 'user_id' => $THEUSER->user_id(), 'posted' => date('Y-m-d H:i:s', time()), 'modflagged' => NULL, 'visible' => 1, 'preview' => true);
        $COMMENTLIST = new COMMENTLIST();
        $COMMENTLIST->render($data, 'html');
        // Show the populated comment form.
        $commendata = array('epobject_id' => get_http_var('epobject_id'), 'gid' => get_http_var('gid'), 'body' => get_http_var('body'), 'return_page' => get_http_var('return_page'));
        $PAGE->comment_form($commendata);
        // Show all comments for this epobject.
        $args = array('epobject_id' => get_http_var('epobject_id'));
        $COMMENTLIST->display('ep', $args);
    }
    $PAGE->stripe_end();
    $PAGE->page_end();
}
Ejemplo n.º 10
0
function display_user($user_id = "")
{
    global $THEUSER, $PAGE, $DATA, $this_page, $who;
    // We're either going to be:
    //	Displaying the details of a user who's just been edited
    //		(their user_id will be in $user_id now).
    //	Viewing THEUSER's own data.
    //	Viewing someone else's data (their id will be in the GET string
    //		user_id variable).
    // We could do something cleverer so that if THEUSER has sufficient
    // privileges we display more data when they're viewing someone else's info
    // than what your average punter sees.
    // If $user_id is a user id, we've just edited that user's info.
    // FIRST: Work out whose info we're going to show.
    $edited = false;
    // Have we just edited someone's info?
    if (is_numeric($user_id) && $user_id == $THEUSER->user_id()) {
        // Display this user's just edited info.
        $display = "this user";
        $edited = true;
    } elseif (is_numeric($user_id)) {
        // Display someone else's just edited info.
        $display = "another user";
        $edited = true;
    } elseif (is_numeric(get_http_var("u"))) {
        // Display someone else's info.
        $user_id = get_http_var("u");
        $display = "another user";
    } elseif ($THEUSER->isloggedin()) {
        // Display this user's info.
        $display = "this user";
        $user_id = $THEUSER->user_id();
    } else {
        // Nothing to show!
        $URL = new URL('userlogin');
        $URL->insert(array('ret' => '/user/'));
        $loginurl = $URL->generate();
        header("Location: {$loginurl}");
        exit;
    }
    // SECOND: Get the data for whoever we're going to show.
    $db = new ParlDB();
    if ($display == "another user") {
        // Viewing someone else's info.
        $USER = new USER();
        $valid = $USER->init($user_id);
        if ($valid && $USER->confirmed() && !$USER->deleted()) {
            // Don't want to display unconfirmed or deleted users.
            $name = $USER->firstname() . " " . $USER->lastname();
            $url = $USER->url();
            if ($USER->emailpublic() == true) {
                $email = $USER->email();
            }
            $status = $USER->status();
            $registrationtime = $USER->registrationtime();
            // Change the page title to reflect whose info we're viewing.
            $DATA->set_page_metadata($this_page, "title", "{$name}");
            $q = $db->query('select count(*) as c from video_timestamps where deleted=0 and user_id= ' . $USER->user_id());
            $video = $q->field(0, 'c');
        } else {
            // This user_id doesn't exist.
            $display = "none";
        }
    } elseif ($display == "this user") {
        // Display THEUSER's info.
        $name = $THEUSER->firstname() . " " . $THEUSER->lastname();
        $url = $THEUSER->url();
        if ($edited) {
            // We want to show all the info to the user.
            $email = $THEUSER->email();
            $emailpublic = $THEUSER->emailpublic() == true ? "Yes" : "No";
            $optin = $THEUSER->optin() == true ? "Yes" : "No";
            $postcode = $THEUSER->postcode();
        } else {
            // We're showing them how they're seen to other people.
            if ($THEUSER->emailpublic()) {
                $email = $THEUSER->email();
            }
            $registrationtime = $THEUSER->registrationtime();
            $status = $THEUSER->status();
        }
        $q = $db->query('select count(*) as c from video_timestamps where deleted=0 and user_id= ' . $THEUSER->user_id());
        $video = $q->field(0, 'c');
        // Change the page title to make it clear we're viewing THEUSER's
        // own info. Make them less worried about other people seeing some of the
        // info that shouldn't be public.
        $DATA->set_page_metadata($this_page, "title", "Your details");
    } else {
        // There's nothing to display!
    }
    // THIRD: Print out what we've got.
    $PAGE->page_start();
    if ($display != "none") {
        $PAGE->stripe_start();
        if (isset($registrationtime)) {
            // Make registration time more user-friendly.
            list($date, $time) = explode(' ', $registrationtime);
            $registrationtime = format_date($date, LONGDATEFORMAT);
        }
        if ($edited) {
            print "\t\t\t\t<p><strong>" . ucfirst($who) . " details have been updated:</strong></p>\n";
        }
        if ($this_page == 'userviewself' && !$edited) {
            $EDITURL = new URL('useredit');
            ?>
				<p><strong>This is how other people see you.</strong> <a href="<?php 
            echo $EDITURL->generate();
            ?>
">Edit your details</a>.</p>
<?php 
        }
        ?>
				<div class="row">
				<span class="label">Name</span>
				<span class="formw"><?php 
        if (substr($name, -3) == ' MP') {
            print '<a href="/mp/' . make_member_url(substr($name, 0, -3)) . '">';
        }
        echo htmlentities($name);
        if (substr($name, -3) == ' MP') {
            print '</a>';
        }
        ?>
</span>
				</div>

				<div class="row">
				<span class="label">Email</span>
				<span class="formw"><?php 
        if (isset($email)) {
            $escaped_email = str_replace('@', '&#64;', htmlentities($email));
            ?>
<a href="mailto:<?php 
            echo $escaped_email . "\">" . $escaped_email;
            ?>
</a><?php 
        } else {
            ?>
Not public<?php 
        }
        ?>
</span>
				</div>

<?php 
        if (isset($postcode)) {
            if ($postcode == '') {
                $postcode = 'none';
            }
            ?>
				<div class="row">&nbsp;<br>
				<span class="label">UK Postcode</span>
				<span class="formw"><?php 
            echo htmlentities($postcode);
            ?>
 <small>(not public)</small></span>
				</div>

<?php 
        }
        if (isset($url)) {
            if ($url == '') {
                $url = 'none';
            } else {
                $url = '<a href="' . htmlentities($url) . '">' . htmlentities($url) . '</a>';
            }
            ?>
				<div class="row">
				<span class="label">Website</span>
				<span class="formw"><?php 
            echo $url;
            ?>
</span>
				</div>

<?php 
        }
        if (isset($emailpublic)) {
            ?>
				<div class="row">&nbsp;<br>Let other people see your email address? <strong><?php 
            echo htmlentities($emailpublic);
            ?>
</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 (isset($video)) {
            echo '<div class="row"><span class="label">Videos timestamped</span>
				<span class="formw">', $video, '</span></div>';
        }
        if ($edited && $this_page == 'userviewself') {
            $EDITURL = new URL('useredit');
            $VIEWURL = new URL('userviewself');
            ?>
				<p>&nbsp;<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>';
            alerts_manage($THEUSER->email());
            $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();
}