Пример #1
0
 function SKIN()
 {
     global $this_page;
     if ($this_page == "skin" && get_http_var("newskin") != "") {
         // We only allow the reskinning on the "skin" page.
         $this->new_skin(get_http_var("newskin"));
     } else {
         $this->set_skin(get_cookie_var("skin"));
     }
 }
Пример #2
0
 function logout($returl)
 {
     // $returl is the URL to redirect the user to after log in, generally the
     // page they were on before. But if it doesn't exist, they'll just go to
     // the front page.
     if ($returl == '') {
         $URL = new URL("home");
         $returl = $URL->generate();
     }
     // get_cookie_var() is in includes/utility.php
     if (get_cookie_var("epuser_id") != "") {
         // They're logged in, so set the cookie to empty.
         header("Location: {$returl}");
         setcookie('epuser_id', '', time() - 86400, '/', COOKIEDOMAIN);
     }
 }
Пример #3
0
     voteerror("You are not allowed to rate Hansard items");
 }
 // Make sure the vote is a valid format.
 if ($vote != '1' && $vote != '0') {
     voteerror("That is not a valid vote.");
 }
 // Make sure it's a valid epobject_id.
 $q = $db->query("SELECT epobject_id FROM epobject WHERE epobject_id='" . addslashes($epobject_id) . "'");
 if ($q->rows() != 1) {
     voteerror("We need a valid epobject id.");
 }
 // Check the user hasn't voted on this before.
 if (!$THEUSER->isloggedin()) {
     // User isn't logged in, so try to get the user's previously
     // voted on epobjects from their cookie.
     $votecookie = get_cookie_var("epvotes");
     // $votecookie will be a string of integers (epobject_ids) separated
     // by '+' symbols.
     if ($votecookie != '') {
         // We're not checking the validity of the contents of $votecookie,
         // just doing it.
         $prev_epvotes = explode('+', $votecookie);
     } else {
         $prev_epvotes = array();
     }
     if (in_array($epobject_id, $prev_epvotes)) {
         voteerror("You have already rated this item. You can only rate something once.");
     }
     // Vote!
     $q = $db->query("SELECT epobject_id FROM anonvotes WHERE epobject_id = '" . addslashes($epobject_id) . "'");
     if ($q->rows() == 1) {