File: 0.00.0a/page.php (View as HTML)

  1: <?php 
  2: /* -------------------------------------------------------------
  3: This file is part of FreeDESK
  4: 
  5: FreeDESK is (C) Copyright 2012 David Cutting
  6: 
  7: FreeDESK is free software: you can redistribute it and/or modify
  8: it under the terms of the GNU General Public License as published by
  9: the Free Software Foundation, either version 3 of the License, or
 10: (at your option) any later version.
 11: 
 12: FreeDESK is distributed in the hope that it will be useful,
 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15: GNU General Public License for more details.
 16: 
 17: You should have received a copy of the GNU General Public License
 18: along with FreeDESK.  If not, see www.gnu.org/licenses
 19: 
 20: For more information see www.purplepixie.org/freedesk/
 21: -------------------------------------------------------------- */
 22: 
 23: /**
 24:  * Display HTML page components
 25: **/
 26: 
 27: 
 28: // Output buffer on and start FreeDESK then discard startup whitespace-spam
 29: ob_start();
 30: include("core/FreeDESK.php");
 31: $DESK = new FreeDESK("./");
 32: $DESK->Start();
 33: ob_end_clean();
 34: 
 35: 
 36: if ( (!isset($_REQUEST['sid'])) || (!$DESK->ContextManager->Open(ContextType::User, $_REQUEST['sid'])) )
 37: {
 38: 	echo $DESK->Lang->Get("login.expire");
 39: 	exit();
 40: }
 41: 
 42: $page = $DESK->PluginManager->GetPage($_REQUEST['page']);
 43: 
 44: if ($page === false)
 45: {
 46: 	if ($DESK->PluginManager->PIMPage($_REQUEST['page']))
 47: 		exit();
 48: 		
 49: 	echo "404: ".$DESK->Lang->Get("not_found")." ".$_REQUEST['page'];
 50: 	exit();
 51: }
 52: 
 53: $perm = "page.".$_REQUEST['page'];
 54: 
 55: if ($DESK->PermissionManager->PermissionExists($perm))
 56: {
 57: 	// This page has its own permission rule
 58: 	if (!$DESK->ContextManager->Permission($perm))
 59: 	{
 60: 		echo ErrorCode::Forbidden.": ".$DESK->Lang->Get("permission_denied");
 61: 		exit();
 62: 	}
 63: }
 64: 
 65: include($page);
 66: 
 67: 
 68: ?>
 69: