File: 0.01.1a/page.php (View as Code)

1: 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: header("Expires: Tue, 27 Jul 1997 01:00:00 GMT"); 35: header("Cache-Control: no-store, no-cache, must-revalidate"); 36: header("Cache-Control: post-check=0, pre-check=0", false); 37: header("Pragma: no-cache"); 38: 39: 40: if ( (!isset($_REQUEST['sid'])) || (!$DESK->ContextManager->Open(ContextType::User, $_REQUEST['sid'])) ) 41: { 42: echo $DESK->Lang->Get("login.expire"); 43: exit(); 44: } 45: 46: $page = $DESK->PluginManager->GetPage($_REQUEST['page']); 47: 48: if ($page === false) 49: { 50: if ($DESK->PluginManager->PIMPage($_REQUEST['page'])) 51: exit(); 52: 53: echo "404: ".$DESK->Lang->Get("not_found")." ".$_REQUEST['page']; 54: exit(); 55: } 56: 57: $perm = "page.".$_REQUEST['page']; 58: 59: if ($DESK->PermissionManager->PermissionExists($perm)) 60: { 61: // This page has its own permission rule 62: if (!$DESK->ContextManager->Permission($perm)) 63: { 64: echo ErrorCode::Forbidden.": ".$DESK->Lang->Get("permission_denied"); 65: exit(); 66: } 67: } 68: 69: include($page); 70: 71: 72: ?> 73: