Commit 3979bde3aadb6a0c1999d201dcd4b76e034171e4

Authored by Michael Joseph
1 parent 54c7c304

almost done session and controller handling


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@126 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 34 additions and 25 deletions
control.php
... ... @@ -13,32 +13,41 @@
13 13 *
14 14 * @version $Id$
15 15 * @Copyright (c) 1999-2002 The Owl Project Team
16   - * @author michael
  16 + * @author <a href="mailto:michael@jamwarehouse.com>Michael Joseph</a>, Jam Warehouse (Pty) Ltd, South Africa
17 17 * @package dms
18 18 */
19 19  
20 20 // main library routines and defaults
21 21 require_once("./config/dmsDefaults.php");
22   -require_once("./lib/owl.lib.php");
23   -require_once("./config/html.php");
24   -require_once("./lib/control.inc");
25   -require_once("./lib/Session.inc");
26   -require_once("./lib/SiteMap.inc");
  22 +require_once("$default->owl_fs_root/lib/owl.lib.php");
  23 +require_once("$default->owl_fs_root/config/html.php");
  24 +require_once("$default->owl_fs_root/lib/control.inc");
  25 +require_once("$default->owl_fs_root/lib/Session.inc");
  26 +require_once("$default->owl_fs_root/lib/SiteMap.inc");
27 27  
28 28 // -------------------------------
29 29 // page start
30 30 // -------------------------------
31 31  
32   -if (!checkSession()) {
33   - // no session, redirect to login
34   - $action = "LOGIN_FORM";
35   - // redirect to login page with redirect
36   - $originalRequest = urlencode($_SERVER[REQUEST_URI]);// . $_SERVER[QUERY_STRING];
37   -} else {
38   - // retrieve session array
39   - $sessionStatus = $_SESSION["sessionStatus"];
  32 +// check the session
  33 +checkSession();
  34 +
  35 +// loop through array of post params and build query string, omitting action
  36 +$queryParams = "";
  37 +foreach ($_POST as $key => $value) {
  38 + //echo "key=$key; value=$value<br>";
  39 + if ($key != "action") {
  40 + if (strlen($queryParams) > 0) {
  41 + $queryParams = "?$key=$value";
  42 + } else {
  43 + $queryParams = $queryParams . "&$key=$value";
  44 + }
  45 + }
40 46 }
41 47  
  48 +// reset authorisation flag before checking access
  49 +$_SESSION["authorised"] = false;
  50 +
42 51 // check whether this group has access to the requested page
43 52 $page = $default->siteMap->getPage($action, $_SESSION["groupID"]);
44 53  
... ... @@ -46,20 +55,20 @@ if (!$page) {
46 55 // this group doesn't have permission to access the page
47 56 // or there is no page mapping for the requested action
48 57  
49   - // TODO: build no permission page
50   - print "you do not have access to view this page! please go away, and come back when you do.";
  58 + // FIXME: redirect to no permission page
  59 + print "you do not have access to view this page! please go away, and come back when you do.<br>";
  60 + echo generateLink("LOGOUT") . "logout</a>";
  61 +
51 62 exit;
52 63 } else {
53   - // set authorised flag
54   - $sessionStatus["authorised"] = true;
  64 + // set authorised flag and redirect
  65 + $_SESSION["authorised"] = true;
55 66  
56   - //echo "about to redirect to $page<br>";
  67 + // if we have additional params to add do it
  68 + if (strlen($queryParams) > 0) {
  69 + $page = $page . "&$queryParams";
  70 + }
  71 +
57 72 redirect($page);
58   - // FIXME: append original request if necessary
59   - //if (isset($originalRequest)) {
60   - //redirect($page . "?fRedirect=$originalRequest");
61   - //} else {
62   - //redirect($page);
63   - //}
64 73 }
65 74 ?>
... ...