} # second division (which we can compare against) $divattr2 = get_division_attr_decode("2"); $singlemotionpage = $divattr2 == "none"; $div_id = $divattr["division_id"]; # current motion text from the database $motion_data = get_wiki_current_value("motion", array($divattr["division_date"], $divattr["division_number"], $divattr['house'])); $name = extract_title_from_wiki_text($motion_data['text_body']); $source = $divattr["source_url"]; $rebellions = $divattr["rebellions"]; $turnout = $divattr["turnout"]; $original_motion = $divattr["original_motion"]; $debate_url = $divattr["debate_url"]; $source_gid = $divattr["source_gid"]; $debate_gid = $divattr["debate_gid"]; $div_no = html_scrub($divattr["division_number"]); $this_anchor = $divattr["divhref"]; $house = $divattr["house"]; $clock_time = $divattr["clock_time"]; $clock_time = preg_replace("/:00\$/", "", $clock_time); $clock_time = preg_replace("/^0/", "", $clock_time); $colour_scheme = $house; $showhits = preg_match("/.*?house=z/", $referrer); # designated voter on this division $votertype = ""; $voter = ""; $voterattr = get_mpid_attr_decode($db, $db2, "", null); if ($voterattr != null) { $votertype = "mp"; $voter = $voterattr['mpprop']; # brutally find which of the set did the vote
} ?> <P> <FORM ACTION="<?php echo $PHP_SELF; ?> " METHOD="POST"> <B>Title of policy</B><BR> <INPUT TYPE="TEXT" NAME="name" VALUE="<?php echo html_scrub($name); ?> " SIZE="40" MAXLENGTH="50"> <P> <B>Someone who believes that...</B><BR> <textarea name="description" rows="6" cols="80"><?php echo html_scrub($description); ?> </textarea></p> <p><span class="ptitle">Privacy notes:</span> By creating a policy you are making your user name <b><?php echo user_getname(); ?> </b> and the policy's voting record public. <p><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Make Policy"> </FORM> <p>If you like you can <a href="/forum/viewforum.php?f=1">discuss policies on our forum</a>.
$db->query($query); $rows = array(); while ($row = $db->fetch_row_assoc()) { // print "<p><pre>";print_r($previous);print "</pre></p>"; $row['previous'] = $previous[$row['division_date'] . "-" . $row['division_number'] . "-" . $row['house']]; array_unshift($rows, $row); $previous[$row['division_date'] . "-" . $row['division_number'] . "-" . $row['house']] = $row['text_body']; } // print "<p><pre>";print_r($previous);print "</pre></p>"; $prettyrow = 0; foreach ($rows as $row) { $prettyrow = pretty_row_start($prettyrow); print "<td valign=\"top\" width=\"16%\">"; if ($type == 'motion') { print "<a href=\"division.php?date=" . $row['division_date'] . "&number=" . $row['division_number'] . "&house=" . $row['house'] . "\">" . $row['house'] . " vote " . $row['division_date'] . "#" . $row['division_number'] . "</a>"; } else { print "wikiid" . $row['wiki_id']; } print "<p>Edited by " . pretty_user_name($db, html_scrub($row['user_name'])); print "<p>on " . $row['edit_date'] . "\n"; print "</td>"; $marked_text_diff = format_linediff(extract_motion_text_from_wiki_text($row['previous']), extract_motion_text_from_wiki_text($row['text_body']), true); $marked_title_diff = format_linediff(extract_title_from_wiki_text($row['previous']), extract_title_from_wiki_text($row['text_body']), false); print "<td>" . "<b>" . $marked_title_diff . "</b><br>" . $marked_text_diff . "</td>"; print "</td></tr>"; } print "</table>\n"; ?> <?php pw_footer();
print "<p style=\"font-size: 89%\">See also <a href=\"{$thispage}&display=everyvote#divisions\">all votes possible</a></p>\n"; } else { if ($dismode["votelist"] == "every" and $voter2type == "party") { print "<p>All votes this MP could have attended. \n"; } else { if ($voter2type == "dreammp") { # list of all MPs being displayed if ($dismode["multimpterms"]) { print "<p>These MPs for " . $mpprop['constituency']; print " are compared to the policy, according to which held the seat at the time of each vote."; seat_summary_table($voter1attr['mpprops'], $voter1attr['bmultiperson'], $all_same_cons ? false : true, false, $thispagesettings); print "</p>\n"; } if ($dismode["votedisplay"] == "fullmotion") { print "<p>Someone who believes that "; print "<span class=\"policytext\">" . str_replace("\n", "<br>", html_scrub($voter2attr["description"])) . "</span> "; if ($dismode["votedisplay"] != "fullmotion") { print "would cast votes as in the 'Policy vote' column."; } else { print "would cast votes described by the policy."; } print "</p>\n"; } } } } } #if ($dismode["eventsinfo"]) # print " Also shows when this MP became or stopped being a paid minister. </p>"; # convert the view for the table selection depending on who are the voting actors if ($dismode["votelist"] == "every") {
<table border="0" width="100%"> <tr> <td width="64%" valign="top"> <P> <FORM ACTION="<?php echo $REQUEST_URI; ?> " METHOD="POST"> <B>Division title:</b> <BR><INPUT TYPE="TEXT" NAME="newtitle" style="width: 100%" VALUE="<?php echo html_scrub(str_replace("—", "-", $prev_name)); ?> " SIZE="50" MAXLENGTH="250"> <P><B>Division description:</b> <textarea name="newdescription" style="width: 100%" rows="25" cols="45"><?php echo html_scrub($prev_description_editable); ?> </textarea> <p> <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Save" accesskey="S"> <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Cancel"> </FORM> </P> <p><a href="<?php echo get_wiki_history_link($type, $params); ?> ">View change history</a> <?php } else { trigger_error("Unknown type for wiki", E_USER_ERROR); }
print "<p>This is currently your active policy; <b>to change its votes,\n go to the <a href=\"/divisions.php\">division page</a> for the vote you want to change</b>.\n You can use the <a href=\"search.php\">search facility</a> to find divisions."; print " If you haven't edited a policy before please \n <a href=\"faq.php#policies\">read about how policies work</a>."; print "</p>"; print "<h2>Policy title and text</h2>"; if ($feedback && !$just_logged_in) { print "<div class=\"error\"><h2>Modifying the policy not complete, please try again\n </h2><p>{$feedback}</div>"; } if (!$ok) { ?> <P> <FORM ACTION="policy.php?id=<?php echo $dreamid; ?> &display=editdefinition" METHOD="POST"> <p><span class="ptitle">Title:</span> <INPUT TYPE="TEXT" NAME="name" VALUE="<?php echo html_scrub($name); ?> " SIZE="40" MAXLENGTH="50"> <P> <span class="ptitle">Text:</span> Someone who believes that<BR> <textarea class="policytext" name="description" rows="2" cols="80"><?php echo htmlspecialchars($description); ?> </textarea> <br> would vote according to this policy. (<em>From the text, everyone should be able to agree which way the policy votes in each division</em>.) <?php if (!$legacy_dream) { ?>
<FORM ACTION="' . $PHP_SELF . '" METHOD="POST"> <h2>Newsletter subscription</h2> <INPUT TYPE="checkbox" NAME="newsletter" ' . $newsletter . '>Email newsletter (at most once a month) <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Update"> </FORM> <P>'; print '<h2>Forum profile</h2>'; print '<p>'; print pretty_user_name($db, $user_name, 'View your forum profile, including posts you\'ve made'); print "<h2>Policies which you made</h2>"; $query = "select dream_id, name, description, private from pw_dyn_dreammp where user_id = '" . user_getid() . "' order by private, name"; $db->query($query); $rowarray = $db->fetch_rows_assoc(); foreach ($rowarray as $row) { print '<br><a href="../policy.php?id=' . $row['dream_id'] . '">' . html_scrub($row['name']) . "</a>\n"; if ($row['private'] == 0) { print " (public)"; } if ($row['private'] == 1) { print " (legacy Dream MP)"; } if ($row['private'] == 2) { print " (provisional)"; } } print '<p>(<a href="addpolicy.php">make a new policy</a>)</p>'; pw_footer(); } else { login_screen(); }
<?php require_once "common.inc"; # $Id: wrans.php,v 1.21 2011/05/10 17:17:27 publicwhip Exp $ # The Public Whip, Copyright (C) 2003 Francis Irving and Julian Todd # This is free software, and you are welcome to redistribute it under # certain conditions. However, it comes with ABSOLUTELY NO WARRANTY. # For details see the file LICENSE.html in the top level of the source. require_once "db.inc"; require_once "parliaments.inc"; $db = new DB(); $prettysearch = html_scrub(trim($_GET["search"])); $shellid = html_scrub(trim($_GET["id"])); $expand = false; if ($_GET["expand"] == "yes") { $expand = true; } if ($prettysearch != "") { // Search query header("Location: http://www.theyworkforyou.com/search?s=" . urlencode($prettysearch) . "&maj=wrans"); exit; } else { if ($shellid != "") { $shellid = str_replace("uk.org.publicwhip/wrans/", "", $shellid); $handle = fopen("legacy/wransmap.txt", "r"); $urls = array(); while (!feof($handle)) { $line = trim(fgets($handle)); list($from, $to) = explode(" ", $line); if ($from == $shellid) { $tourl = "http://www.theyworkforyou.com/wrans?id=" . urlencode($to);
function opinion_value($value, $curr) { $ret = "value=\"" . html_scrub($value) . "\" "; if ($value === $curr) { $ret .= "selected "; } return $ret; }
$maxfh = (int) (($maxf + $hundred - 1) / $hundred) * $hundred; # find height of bar $bheight = (int) (16 / count($words)); $twidth = 800; # print the key print "<table>"; for ($i = 0; $i < count($words); $i++) { $width = 100; print "<tr><td>\"" . html_scrub($words[$i]) . "\"</td>"; print "<td><img src=\"row{$i}.png\" width=\"{$width}\" height=\"{$bheight}\"/></td></tr>"; } print "</table>"; # print the headings of the table. print "<table><tr class=\"headings\"><td>Date</td><td>Chart</td>"; for ($i = 0; $i < count($words); $i++) { print "<td>" . html_scrub($words[$i]) . "</td>"; } print "</tr>\n"; $c = 0; $prettyrow = 0; foreach ($barchart as $date => $chart) { $c++; $prettyrow = pretty_row_start($prettyrow); # this should be hyperlinked print "<td><a href=\"{$chart[$ref]}\">{$date}</a></td>"; print "<td><table class=\"bars\">"; for ($i = 0; $i < count($words); $i++) { $width = (int) ($chart[$i] * $twidth / $maxfh); print "<tr><td><img src=\"row{$i}.png\" width=\"{$width}\" height=\"{$bheight}\"/></td></tr>"; } print "</table></td>";
# FIXME: should probably do this with mp_table instead: $rows = $pwpdo->fetch_all_rows('SELECT * FROM pw_mp WHERE house = ? AND constituency = ? AND CURDATE() >= entered_house and CURDATE() <= left_house ORDER BY house, last_name', array($house, $scrubbed_constituency)); foreach ($rows as $row) { $mp_url = "mp.php?" . link_to_mp($row); $constituency_url = "mp.php?mpc=" . urlencode(str_replace(" ", "_", $row['constituency'])) . "&" . "house=" . urlencode($row['house']); print "<tr class=\"" . ($odd ? 'odd' : 'even') . "\">\n"; # Print out house, full name, constituency print '<td class="' . $row['house'] . '">'; print $pretty_house[$row['house']]; print '</td>' . "\n"; print '<td><a href="' . $mp_url . '">' . $row['first_name'] . ' ' . $row['last_name'] . '</a></td>' . "\n"; print "<td>" . html_scrub($row['party']) . "</td>"; print '<td><a href="' . $constituency_url . '">' . $constituency . '</a></td>' . "\n"; print "</tr>\n"; $odd = !$odd; } } print "</table>"; pw_footer(); exit; } } if ($query != "") { $found = false; if (!$postcode) { $header = true; pw_header();