File: 0.00.3a/index.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:  * Main index (web interface) file
 25: **/
 26: 
 27: // First check for the existance of setup.php and go there if it exists
 28: if (file_exists("setup.php"))
 29: {
 30: 	header("Location: setup.php");
 31: 	exit();
 32: }
 33: 
 34: // Output buffer on and start FreeDESK then discard startup whitespace-spam
 35: ob_start();
 36: include("core/FreeDESK.php");
 37: $DESK = new FreeDESK("./");
 38: $DESK->Start();
 39: ob_end_clean();
 40: 
 41: 
 42: if (!isset($_REQUEST['sid']))
 43: {
 44: 	if (!isset($_REQUEST['mobileoverride']))
 45: 	{
 46: 		if (BrowserDetect::isMobile())
 47: 		{
 48: 			header("Location: mobile/");
 49: 			exit();
 50: 		}
 51: 	}
 52: 	$data=array("title"=>$DESK->Lang->Get("welcome"));
 53: 	$DESK->Skin->IncludeFile("header.php",$data);
 54: 
 55: 	echo "\n<noscript>\n";
 56: 	echo "<h1>Sorry you must have Javascript enabled to use FreeDESK analyst portal</h1>\n";
 57: 	echo "</noscript>\n";
 58: 
 59: 	echo "<h3>".$DESK->Lang->Get("select_portal").":</h3>\n";
 60: 	
 61: 	echo "<a href=\"#\" onclick=\"DESK.show_login();\">".$DESK->Lang->Get("select_analyst")."</a><br /><br />\n";
 62: 	echo "<a href=\"customer/\">".$DESK->Lang->Get("select_customer")."</a><br /><br />\n";
 63: 
 64: 	
 65: 	$DESK->Skin->IncludeFile("footer.php");
 66: 	exit();
 67: }
 68: 
 69: // So we have a SID - check if it authenticates
 70: if (!$DESK->ContextManager->Open(ContextType::User, $_REQUEST['sid']))
 71: {
 72: 	header("Location: ./"); // login page redirect on failure
 73: 	exit();
 74: }
 75: 
 76: // So we're authenticated let's view the main page
 77: $data=array("title"=>"FreeDESK");
 78: $DESK->Skin->IncludeFile("header.php",$data);
 79: 
 80: echo "<div id=\"mainpage\">\n";
 81: $DESK->Include->IncludeFile("pages/main.php");
 82: echo "</div>\n";
 83: echo "<div id=\"subpage\"></div>\n";
 84: 
 85: $DESK->Skin->IncludeFile("footer.php");
 86: 
 87: 
 88: ?>
 89: