Grima  2018-08
Whispering into Alma's ear
Functions | Variables
grima.php File Reference

Go to the source code of this file.

Functions

 do_redirect ($url)
 

Variables

 $msg = isset($_REQUEST["msg"]) ? $_REQUEST["msg"] : ""
 

Function Documentation

◆ do_redirect()

do_redirect (   $url)

Definition at line 11 of file grima.php.

11  {
12  if(!headers_sent()) header("Location: $url");
13  $url_html = htmlspecialchars($url);
14  echo "<!DOCTYPE html><html><head><title>Redirect</title><meta http-equiv=refresh content='1; url=$url'></head><body><a href='$url_html'>Go here: $url_html</a></body></html>\n";
15  exit;
16 }
17 
18 $msg = isset($_REQUEST["msg"]) ? $_REQUEST["msg"] : "";
19 
20 #
21 # print <mms_id>
22 #
23 if (preg_match("/^print( .*)/",$msg,$m)) {
24  do_redirect("print.php?mms_id=" . ltrim($m[1]));
25 }
26 
27 #
28 # hierarchy <mms_id>
29 #
30 if (preg_match("/^hierarchy( .*)/",$msg,$m)) {
31  do_redirect("hierarchy.php?mms_id=" . ltrim($m[1]));
32 }
33 
34 #
35 # filter <mms_id> with <filter>
36 #
37 if (preg_match("/(norm|normalize|filter) (\d+) (with (.*))/",$msg,$m)) {
38  if (is_mmsid($m[2])) {
39  do_redirect("zf.php?mms_id=" . $m[2] . "&filter=" . $m[4]);
40  } else {
41  # MMS ID form
42  }
43 }
44 
45 #
46 # add mfhd <template> to <mms_id>
47 #
48 #
49 if (preg_match("/^add mfhd(.*)/",$msg,$m)) {
50  do_redirect("add_mfhd.php?query=" . ltrim($m[1]));
51 }
52 
53 #
54 # add tree <template> to <mms_id> with barcode <barcode>
55 #
56 #
57 
58 #
59 # insert oclcnum <number> into <mms_id>
60 #
61 if (preg_match("/insert oclcnum(.*)/",$msg,$m)) {
62  do_redirect("insert-oclcnum.php?query=" . urlencode(ltrim($m[1])));
63 }
$msg
Definition: grima.php:18
do_redirect($url)
Definition: grima.php:11

Variable Documentation

◆ $msg

$msg = isset($_REQUEST["msg"]) ? $_REQUEST["msg"] : ""

Definition at line 18 of file grima.php.