<commit_before><?php include "cache-begin.inc"; ?>
<?php 
    # $Id: mp.php,v 1.37 2004/06/23 18:56:11 frabcus Exp $

    # The Public Whip, Copyright (C) 2003 <NAME> and <NAME>
    # 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.

    include "db.inc";
    include "parliaments.inc";
    include "constituencies.inc";
    $db = new DB(); 

    $first_name = db_scrub($_GET["firstname"]);
    $last_name = db_scrub($_GET["lastname"]);
    # The consmatch converts constituency to canonical form as it comes in
    $constituency = $_GET["constituency"];
    $constituency = $consnames[$consmatch[strtolower(stripslashes(html_entity_decode($constituency)))]];
    $constituency = db_scrub($constituency);
    $id = db_scrub($_GET["id"]);
    if ($constituency == "" and $id == "") {
        print "Error, constituency " . $_GET["constituency"] . " not found";
        exit;
    }

    $show_all = false;
    if ($_GET["showall"] == "yes")
        $show_all = true;
    $all_friends = false;
    if ($_GET["allfriends"] == "yes")
        $all_friends = true;
    $expand = false;
    if ($_GET["expand"] == "yes")
        $expand = true;

    if ($last_name == "" && $first_name =="")
    {
		if ($constituency == "")
		{
			$id = str_replace("uk.org.publicwhip/member/", "", $id);
			$query = "select first_name, last_name, constituency
				from pw_mp where mp_id = '$id'
				order by entered_house desc limit 1";
			$row = $db->query_one_row($query);
			$first_name = db_scrub($row[0]);
			$last_name = db_scrub($row[1]);
			$constituency = db_scrub($row[2]);
		}
		else
		{
            $constituency = $constituency;
			$query = "select first_name, last_name
				from pw_mp where constituency = '$constituency' 
				order by entered_house desc limit 1";
			$row = $db->query_one_row($query);
			$first_name = db_scrub($row[0]);
			$last_name = db_scrub($row[1]);
		}
    }

    $this_anchor = "mp.php?firstname=" . urlencode($first_name) .
        "&lastname=" . urlencode($last_name) . "&constituency=" .
        urlencode($constituency);

    $title = html_scrub("Voting Record - $first_name $last_name MP, $constituency");
    include "header.inc";

	print '<p><a href="#divisions">Interesting Divisions</a>';
	print ' | ';
	print '<a href="#friends">Possible Friends</a>';
	print ' | ';
	print '<a href="#wrans">Written Answers</a>'; 
	
	$query = "select first_name, last_name, title, constituency,
        party, pw_mp.mp_id, round(100*rebellions/votes_attended,1),
        round(100*votes_attended/votes_possible,1), 
        rebellions, votes_attended, votes_possible,
        entered_house, left_house,
        entered_reason, left_reason,
        tells, person from pw_mp,
        pw_cache_mpinfo where
        pw_mp.mp_id = pw_cache_mpinfo.mp_id and ";
    $query .= "first_name = '$first_name' and last_name='$last_name' and";
    $query .= " constituency = '$constituency' order by entered_house desc";
    $db->query($query);

    print "<h2><a name=\"general\">General Information</a></h2>";

 	print "<p>$first_name $last_name has been MP for $constituency during
        the following periods of time during the last two parliaments.
        <br>Read a <a href=\"faq.php#clarify\">clear explanation</a> of attendance
        and rebellions, as they may not have the meanings you expect.";

    print "<p>Want to contact your MP?
    <a href=\"http://www.faxyourmp.com\">Fax Your MP</a> for free.";

    $prettyrow = 0;
    $mp_ids = array();
    $parties = array();
    $dates = array();
    $enter_reason = array();
    $left_reason = array();
    $person = 0;
    print "<table><tr class=\"headings\">";
    print "<td>Party</td>
            <td>From</td><td>To</td>
            <td>Rebellions (estimate)</td><td>Attendance (divisions)</td>
            <td>Teller</td></tr>";
    while ($row = $db->fetch_row())
    {
        $prettyrow = pretty_row_start($prettyrow);
        $row[6] = percentise($row[6]);
        $row[7] = percentise($row[7]);
        if ($row[12] == "9999-12-31") { $row[12] = "still in office"; }
        print "
            <td>" . pretty_party($row[4]) . "</td>
            <td>$row[11]</td>
            <td>$row[12]</td>
            <td class=\"percent\">$row[8] votes out of $row[9], $row[6]</td>
            <td class=\"percent\">$row[9] votes out of $row[10], $row[7]</td>
            <td>$row[15] times</td>
            ";
        print "</tr>\n";
        array_push($mp_ids, $row[5]);
        array_push($parties, $row[4]);
        array_push($dates, $row[11]);
        array_push($enter_reason, $row[13]);
        array_push($left_reason, $row[14]);
        $person = $row[16];
    }
    print "</table>";
?><commit_msg>Link to TheyWorkForYou MP page<commit_after><?php include "cache-begin.inc"; ?>
<?php 
    # $Id: mp.php,v 1.38 2004/07/22 10:11:35 frabcus Exp $

    # The Public Whip, Copyright (C) 2003 <NAME> and <NAME>
    # 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.

    include "db.inc";
    include "parliaments.inc";
    include "constituencies.inc";
    $db = new DB(); 

    $first_name = db_scrub($_GET["firstname"]);
    $last_name = db_scrub($_GET["lastname"]);
    # The consmatch converts constituency to canonical form as it comes in
    $constituency = $_GET["constituency"];
    $constituency = $consnames[$consmatch[strtolower(stripslashes(html_entity_decode($constituency)))]];
    $constituency = db_scrub($constituency);
    $id = db_scrub($_GET["id"]);
    if ($constituency == "" and $id == "") {
        print "Error, constituency " . $_GET["constituency"] . " not found";
        exit;
    }

    $show_all = false;
    if ($_GET["showall"] == "yes")
        $show_all = true;
    $all_friends = false;
    if ($_GET["allfriends"] == "yes")
        $all_friends = true;
    $expand = false;
    if ($_GET["expand"] == "yes")
        $expand = true;

    if ($last_name == "" && $first_name =="")
    {
		if ($constituency == "")
		{
			$id = str_replace("uk.org.publicwhip/member/", "", $id);
			$query = "select first_name, last_name, constituency
				from pw_mp where mp_id = '$id'
				order by entered_house desc limit 1";
			$row = $db->query_one_row($query);
			$first_name = db_scrub($row[0]);
			$last_name = db_scrub($row[1]);
			$constituency = db_scrub($row[2]);
		}
		else
		{
            $constituency = $constituency;
			$query = "select first_name, last_name
				from pw_mp where constituency = '$constituency' 
				order by entered_house desc limit 1";
			$row = $db->query_one_row($query);
			$first_name = db_scrub($row[0]);
			$last_name = db_scrub($row[1]);
		}
    }

    $this_anchor = "mp.php?firstname=" . urlencode($first_name) .
        "&lastname=" . urlencode($last_name) . "&constituency=" .
        urlencode($constituency);

    $title = html_scrub("Voting Record - $first_name $last_name MP, $constituency");
    include "header.inc";

	print '<p><a href="#divisions">Interesting Divisions</a>';
	print ' | ';
	print '<a href="#friends">Possible Friends</a>';
	print ' | ';
	print '<a href="#wrans">Written Answers</a>'; 
	
	$query = "select first_name, last_name, title, constituency,
        party, pw_mp.mp_id, round(100*rebellions/votes_attended,1),
        round(100*votes_attended/votes_possible,1), 
        rebellions, votes_attended, votes_possible,
        entered_house, left_house,
        entered_reason, left_reason,
        tells, person from pw_mp,
        pw_cache_mpinfo where
        pw_mp.mp_id = pw_cache_mpinfo.mp_id and ";
    $query .= "first_name = '$first_name' and last_name='$last_name' and";
    $query .= " constituency = '$constituency' order by entered_house desc";
    $db->query($query);

    print "<h2><a name=\"general\">General Information</a></h2>";

 	print "<p>$first_name $last_name has been MP for $constituency during
        the following periods of time during the last two parliaments.
        <br>Read a <a href=\"faq.php#clarify\">clear explanation</a> of attendance
        and rebellions, as they may not have the meanings you expect.";

    $prettyrow = 0;
    $mp_ids = array();
    $parties = array();
    $dates = array();
    $enter_reason = array();
    $left_reason = array();
    $person = 0;
    print "<table><tr class=\"headings\">";
    print "<td>Party</td>
            <td>From</td><td>To</td>
            <td>Rebellions (estimate)</td><td>Attendance (divisions)</td>
            <td>Teller</td></tr>";
    while ($row = $db->fetch_row())
    {
        $prettyrow = pretty_row_start($prettyrow);
        $row[6] = percentise($row[6]);
        $row[7] = percentise($row[7]);
        if ($row[12] == "9999-12-31") { $row[12] = "still in office"; }
        print "
            <td>" . pretty_party($row[4]) . "</td>
            <td>$row[11]</td>
            <td>$row[12]</td>
            <td class=\"percent\">$row[8] votes out of $row[9], $row[6]</td>
            <td class=\"percent\">$row[9] votes out of $row[10], $row[7]</td>
            <td>$row[15] times</td>
            ";
        print "</tr>\n";
        array_push($mp_ids, $row[5]);
        array_push($parties, $row[4]);
        array_push($dates, $row[11]);
        array_push($enter_reason, $row[13]);
        array_push($left_reason, $row[14]);
        $person = $row[16];
    }
    print "</table>";

    print "<p>";
    print "Performance data, recent speeches, and biographical links at ";
    print "<a href=\"http://www.theyworkforyou.com/mp/?m=" .  $mp_ids[0]. "\">";
    print "TheyWorkForYou.com</a>";
    print "<br>Contact your MP with 
    <a href=\"http://www.faxyourmp.com\">Fax Your MP</a> for free.  Find
    the <a
    href=\"http://www.parliament.uk/directories/hciolists/alms.cfm\">email
    address</a> of some MPs.";

?>
{'fraction_non_alphanumeric': 0.17195292240175544, 'fraction_numerical': 0.016058248553760222, 'mean_word_length': 2.972662440570523, 'pattern_counts': {'":': 0, '<': 110, '<?xml version=': 0, '>': 118, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '602694', 'n_tokens_mistral': 3662, 'n_tokens_neox': 3464, 'n_words': 778}