Commit d634e53000018b83243306d07cbe3e90cad4fe1b
1 parent
dba89e7a
added session handling and authorisation check
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@142 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
40 additions
and
35 deletions
dashboard.php
| ... | ... | @@ -31,43 +31,48 @@ require_once("$default->owl_fs_root/lib/visualpatterns/PatternTableSqlQuery.inc" |
| 31 | 31 | // page start |
| 32 | 32 | // ------------------------------- |
| 33 | 33 | |
| 34 | -checkSession(); | |
| 34 | +if (checkSession()) { | |
| 35 | 35 | |
| 36 | -// check if this page is authorised, ie. has come from control.php | |
| 37 | -if ($_SESSION["authorised"]) { | |
| 38 | - // create a page | |
| 39 | - | |
| 40 | - // logo | |
| 41 | - $img = new PatternImage("$default->owl_root_url/locale/$default->owl_lang/graphics/$default->logo"); | |
| 42 | - | |
| 43 | - // build the top menu of links | |
| 44 | - $aTopMenuLinks = array(0=>generateControllerUrl("LOGOUT")); | |
| 45 | - $aTopMenuText = array(0=>"logout"); | |
| 46 | - $oPatternTableLinks = new PatternTableLinks($aTopMenuLinks, $aTopMenuText, 3, 1); | |
| 47 | - | |
| 48 | - // build the central dashboard | |
| 49 | - /* | |
| 50 | - $aCentralPageColumns = array(0=>"name",1=>"parent",2=>"security"); | |
| 51 | - $aColumnTypes = array(0=>1,1=>2,2=>1); | |
| 52 | - $oTableSqlQuery = & new PatternTableSqlQuery("Folders", $aCentralPageColumns, $aColumnTypes); | |
| 53 | - ($HTTP_GET_VARS["fStartIndex"]) ? $oTableSqlQuery->setStartIndex($HTTP_GET_VARS["fStartIndex"]) : $oTableSqlQuery->setStartIndex(0); | |
| 54 | - $oTableSqlQuery->setLinkType(1); | |
| 55 | - */ | |
| 56 | - | |
| 57 | - /* get a page */ | |
| 58 | - $tmp = new PatternMainPage(); | |
| 59 | - | |
| 60 | - /* put the page together */ | |
| 61 | - $tmp->setNorthWestPayload($img); | |
| 62 | - $tmp->setNorthPayload($oPatternTableLinks); | |
| 63 | - //$tmp->setCentralPayload($oTableSqlQuery); | |
| 64 | - $tmp->setFormAction("dashboard.php"); | |
| 65 | - $tmp->render(); | |
| 66 | - | |
| 36 | + // check if this page is authorised, ie. has come from control.php | |
| 37 | + if ($_SESSION["authorised"]) { | |
| 38 | + // create a page | |
| 39 | + | |
| 40 | + // logo | |
| 41 | + $img = new PatternImage("$default->owl_root_url/locale/$default->owl_lang/graphics/$default->logo"); | |
| 42 | + | |
| 43 | + // build the top menu of links | |
| 44 | + $aTopMenuLinks = array(0=>generateControllerUrl("logout"), 1=>generateControllerUrl("scratchPad")); | |
| 45 | + $aTopMenuText = array(0=>"logout", 1=>"scratchPad"); | |
| 46 | + $oPatternTableLinks = new PatternTableLinks($aTopMenuLinks, $aTopMenuText, 3, 1); | |
| 47 | + | |
| 48 | + // build the central dashboard | |
| 49 | + /* | |
| 50 | + $aCentralPageColumns = array(0=>"name",1=>"parent",2=>"security"); | |
| 51 | + $aColumnTypes = array(0=>1,1=>2,2=>1); | |
| 52 | + $oTableSqlQuery = & new PatternTableSqlQuery("Folders", $aCentralPageColumns, $aColumnTypes); | |
| 53 | + ($HTTP_GET_VARS["fStartIndex"]) ? $oTableSqlQuery->setStartIndex($HTTP_GET_VARS["fStartIndex"]) : $oTableSqlQuery->setStartIndex(0); | |
| 54 | + $oTableSqlQuery->setLinkType(1); | |
| 55 | + */ | |
| 56 | + | |
| 57 | + /* get a page */ | |
| 58 | + $tmp = new PatternMainPage(); | |
| 59 | + | |
| 60 | + /* put the page together */ | |
| 61 | + $tmp->setNorthWestPayload($img); | |
| 62 | + $tmp->setNorthPayload($oPatternTableLinks); | |
| 63 | + //$tmp->setCentralPayload($oTableSqlQuery); | |
| 64 | + $tmp->setFormAction("dashboard.php"); | |
| 65 | + $tmp->render(); | |
| 66 | + | |
| 67 | + } else { | |
| 68 | + // FIXME: redirect to no permission page | |
| 69 | + print "you do not have access to view this page! please go away, and come back when you do.<br>"; | |
| 70 | + echo generateLink("logout") . "logout</a>"; | |
| 71 | + } | |
| 67 | 72 | } else { |
| 68 | - // FIXME: redirect to no permission page | |
| 69 | - print "you do not have access to view this page! please go away, and come back when you do.<br>"; | |
| 70 | - echo generateLink("LOGOUT") . "logout</a>"; | |
| 73 | + // no session, should have been redirected | |
| 74 | + echo "no session<br>"; | |
| 75 | + print_r($_SESSION); | |
| 71 | 76 | } |
| 72 | 77 | ?> |
| 73 | 78 | ... | ... |