Esempio n. 1
0
 private function spwrans_redirect($spid)
 {
     global $PAGE;
     # We have a Scottish Parliament ID, need to find the date
     $SPWRANSLIST = new \SPWRANSLIST();
     $gid = $SPWRANSLIST->get_gid_from_spid($spid);
     if ($gid) {
         if (preg_match('/uk\\.org\\.publicwhip\\/spwa\\/(\\d{4}-\\d\\d-\\d\\d\\.(.*))/', $gid, $m)) {
             $URL = new \URL('spwrans');
             $URL->reset();
             $URL->insert(array('id' => $m[1]));
             $fragment_identifier = '#g' . $m[2];
             header('Location: http://' . DOMAIN . $URL->generate('none') . $fragment_identifier, true, 303);
             exit;
         } elseif (preg_match('/uk\\.org\\.publicwhip\\/spor\\/(\\d{4}-\\d\\d-\\d\\d\\.(.*))/', $gid, $m)) {
             $URL = new \URL('spdebates');
             $URL->reset();
             $URL->insert(array('id' => $m[1]));
             $fragment_identifier = '#g' . $m[2];
             header('Location: http://' . DOMAIN . $URL->generate('none') . $fragment_identifier, true, 303);
             exit;
         } else {
             $PAGE->error_message("Strange GID ({$gid}) for that Scottish Parliament ID.");
         }
     }
     $PAGE->error_message("Couldn't match that Scottish Parliament ID to a GID.");
 }
Esempio n. 2
0
include_once "../../includes/easyparliament/init.php";
include_once INCLUDESPATH . "easyparliament/glossary.php";
include_once INCLUDESPATH . "easyparliament/member.php";
// For displaying written answers
if (get_http_var('d')) {
    // We have a date. so show all wrans on this day.
    $this_page = "spwransday";
    $args = array('date' => get_http_var('d'));
    $LIST = new SPWRANSLIST();
    $LIST->display('date', $args);
} elseif (get_http_var('spid')) {
    # We have a Scottish Parliament ID, need to find the date
    $spid = get_http_var('spid');
    $SPWRANSLIST = new SPWRANSLIST();
    $gid = $SPWRANSLIST->get_gid_from_spid($spid);
    if ($gid) {
        if (preg_match('/uk\\.org\\.publicwhip\\/spwa\\/(\\d{4}-\\d\\d-\\d\\d\\.(.*))/', $gid, $m)) {
            $URL = new URL('spwrans');
            $URL->reset();
            $URL->insert(array('id' => $m[1]));
            $fragment_identifier = '#g' . $m[2];
            header('Location: http://' . DOMAIN . $URL->generate('none') . $fragment_identifier, true, 303);
            exit;
        } elseif (preg_match('/uk\\.org\\.publicwhip\\/spor\\/(\\d{4}-\\d\\d-\\d\\d\\.(.*))/', $gid, $m)) {
            $URL = new URL('spdebates');
            $URL->reset();
            $URL->insert(array('id' => $m[1]));
            $fragment_identifier = '#g' . $m[2];
            header('Location: http://' . DOMAIN . $URL->generate('none') . $fragment_identifier, true, 303);
            exit;