Example #1
0
    function get_one_result_html($record) {
        $p = new SiteParse();
        $sm = get_smarty();

        $record["info_keys"] = $p->detail_keys;
        if ($saved = ar_get('saved', $_SESSION)) {
            $record["is_saved"] = array_key_exists($bibid, $saved);
        }

        $sm->assign("r", $record);
        $html = $sm->fetch("pages/detail_all.html");

        return $html;
    }
Example #2
0
<?
    require_once("util.php");

    # don't want nojs return-to-search navigation in saved list items.
    clear_prev_search();

    $sm = get_smarty();
    $p = new SiteParse();
   
    try {
        $saved = ar_get('saved', $_SESSION);

        $records = array();
    
        if(!isset($_COOKIE['PHPSESSID'])) $sm->assign('cookies_disabled', true);

        if ($saved) {
            foreach (array_keys($saved) as $pos_bibid) {
                $bibid = valid_bibid($pos_bibid);

                $record  = $p->get_record($bibid);
                $record['info_keys'] = $p->detail_keys;
                $record['is_saved']  = true;

                $records[] = $record;
            }
        }

        $sm->assign("records", $records);
        
        header("Content-Type: text/html; charset=utf-8");
Example #3
0
<?
    require_once('util.php');

    $sm = get_smarty();

    try {
        $sm->assign("bibid", ar_get('bibid', $_REQUEST));
        header("Content-Type: text/html; charset=utf-8");
        $sm->display("forms/email_form.html");

    } catch (Exception $e) {
        $sm->assign("error", $e->GetMessage());
        $sm->display("responses/error.html");
    }



?> 
Example #4
0
<?
    require_once("util.php");

    $sm = get_smarty();
    $p = new SiteParse();

    try {
        if ($redirect = ar_get('redirect', $_REQUEST)) {
            $sm->assign("redirect", $redirect);
        } else {
            $sm->assign("redirect", $p->base_url);
        }

        if ($error = ar_get('error', $_REQUEST)) {
            $sm->assign("error", true);
        }

        header("Content-Type: text/html; charset=utf-8");
        $sm->display("forms/small_login.html");

    } catch (Exception $e) {
        $sm->assign("error", $e->GetMessage());
        $sm->display("responses/error.html");
    }
?>
    $sm = get_smarty();
    $p = new SiteParse();

    try {
        if (!ar_get('userid', $_SESSION)) {
            throw new Exception("Please log into your account.");

        } else {
            $sm->assign("bibid", ar_get('bibid', $_REQUEST));
            $name = $_SESSION['name'];
            $code = $_SESSION['code'];

            $url = ar_get('request_url', $_REQUEST);

            $post_params = array();
            foreach (array('radio', 'locx00', 'inst', 'submit', 'submit.x', 'submit.y', 'name', 'code', 'needby_Month', 'needby_Day', 'needby_Year') as $key) {
                $post_params[$key] = ar_get($key, $_REQUEST);
            }

            if ($p->submit_item_request($name, $code, $url, $post_params)) {
                $sm->display("responses/request_success.html");
            }
        }

    } catch (Exception $e) {
        $sm->assign("error", $e->GetMessage());
        $sm->display("responses/error.html");
    }
        
?> 
Example #6
0
<?
    require_once("util.php");

    $sm = get_smarty();
    $p = new SiteParse();

    try { 
        if (!ar_get('userid', $_SESSION)) {
            $query = http_build_query(array(
                "redirect" => $p->base_url . "my_account",
            ));
            
            header("Location: " . $p->base_url . "login?" . $query);
            
        } else {
            $url = ar_get('url', $_REQUEST);
            list($items, $holds, $fines) = $p->get_my_account_info($_SESSION['name'], $_SESSION['code'], $_SESSION['userid'], $url);

            header("Content-Type: text/html; charset=utf-8");
            $sm->assign("items", $items);
            $sm->assign("holds", $holds);
            $sm->assign("fines", $fines);
            
            $sm->display("pages/my_account.html");
        }
    } catch (Exception $e) {
        $sm->assign("error", $e->GetMessage());
        $sm->display("responses/error.html");
    }
?>
Example #7
0
    try {
        $p = new SiteParse();

        $email = valid_email($_REQUEST['email']);
        $_SESSION['email'] = $email;
        
        $headers[] = "Content-Type: text/plain; charset=utf-8";
        $headers[] = sprintf("From: %s", $email);
        $headers_str = implode("\n", $headers);

        $contents = implode("\n\n", array(
            ar_get('device', $_REQUEST),
            ar_get('browser', $_REQUEST),
            ar_get('HTTP_USER_AGENT', $_SERVER),
            ar_get('feedback', $_REQUEST),
        ));

        $subject = "[TripodMobile] Feedback";
        mail($p->feedback_email, $subject, $contents, $headers_str);

        $sm = get_smarty();

        $sm->display("responses/feedback_success.html");

    } catch (Exception $e) {
        $sm = get_smarty();
        $sm->assign("error", $e->getMessage());
        
        $sm->display("responses/error.html");
    }
Example #8
0
function blank_search() {
    $searcharg = ar_get('searcharg', $_REQUEST);

    if (!$searcharg || preg_match('/^\s*$/', $searcharg)) {
        return true;
    } else {
        return false;
    }
}
Example #9
0
<? 
    require_once("util.php");
    require_once("TricoHours.php");

    $sm = get_smarty();

    try {
        header("Content-Type: text/html; charset=utf-8");
        
        $delta = ar_get('delta', $_REQUEST);
        if (!$delta) { 
            $delta = 0;
        }

        $hours = new TricoHours($delta);
        $hours->run();

        $date   = $hours->get_date();
        $events = $hours->get_events();

        $sm->assign("date", $date);
        $sm->assign("events", $events);
        $sm->assign("delta", $delta);

        $sm->display('pages/hours.html');

    } catch (Exception $e) {
        $sm->assign("error", $e->GetMessage());
        $sm->display("responses/error.html");
    }
Example #10
0
	}

        if ($resp = $p->login($name, $code, $pin)) {
            $_SESSION['userid'] = $resp['userid'];
            header("Location: " . $_REQUEST['redirect']);

        } 

        elseif($name == 'admin' and $code == $p->admin_pass) {
            $_SESSION['userid'] = $resp['userid'];
            header("Location: settings.php");
        }
        else {
            do_logout();
          
            if (ar_get('small', $_REQUEST)) {
                throw new Exception("Invalid login.");
            } else {
                $query = http_build_query(array(
                    "error" => 1,
                    "redirect" => $_REQUEST['redirect'],
                ));

                header("Location: " . $p->base_url . "login?$query");
            }
        }

    } catch (Exception $e) {
        $sm->assign("error", $e->GetMessage());
        $sm->display("responses/error.html");
    }
Example #11
0
    protected function get_record_from_html($html, $bibid=null) {
        # Basic info such as author, title, etc.
        $info = $this->find_bib_details($html);
        $info_all = $this->get_info_all($info);

        if (empty($info)) {
            throw new Exception("Invalid bibid");
        }

        # Book locations (if available)
        $locs = $this->find_locs($html);

        # Links to click on (if available)
        $links  = $this->find_links($html);
        $orders = $this->find_orders($html);

        # Request button
        $request_url = $this->find_request_url($html);

        $img = null;
        if (($isbn = starting_digits(ar_get('ISBN', $info)))) {
            $img = $this->find_cover_image($isbn);
        } else {
            $img = $this->base_url . "static/nocover.jpg";  #is this conditional redundant now? worth hunting to find out?
        }

        if (!$bibid) {
            $bibid = $this->find_bibid($html);
        }

        return array(
            "info"        => $info, 
            "info_all"    => $info_all, 
            "locations"   => $locs, 
            "links"       => $links, 
            "orders"      => $orders, 
            "cover_image" => $img,
            "bibid"       => $bibid,
            "request_url" => $request_url,
        );

    }
Example #12
0
<?
    require_once("util.php");

    $sm = get_smarty();

    try {
        $bibid = ar_get('bibid', $_REQUEST);

        if ($bibid == "all") {
            unset($_SESSION['saved']);
            $page = "responses/delete_all.html"; 
        } else {
            $bibid = valid_bibid($bibid);
            $sm->assign("bibid", $bibid);
            unset($_SESSION['saved'][$bibid]);
            $page = "responses/delete_one.html"; 
        }

        header("Content-Type: text/html; charset=utf-8");
        $sm->display($page);

    } catch (Exception $e) {
        $sm->assign("error", $e->GetMessage());
        $sm->display("responses/error.html");
    }
?>