File: 0.00.0a/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: 	$data=array("title"=>$DESK->Lang->Get("welcome"));
 45: 	$DESK->Skin->IncludeFile("header.php",$data);
 46: 
 47: 	echo "\n<noscript>\n";
 48: 	echo "<h1>Sorry you must have Javascript enabled to use FreeDESK analyst portal</h1>\n";
 49: 	echo "</noscript>\n";
 50: 
 51: 	echo "<h3>".$DESK->Lang->Get("select_portal").":</h3>\n";
 52: 	
 53: 	echo "<a href=\"#\" onclick=\"DESK.show_login();\">".$DESK->Lang->Get("select_analyst")."</a><br /><br />\n";
 54: 	echo "<a href=\"customer/\">".$DESK->Lang->Get("select_customer")."</a><br /><br />\n";
 55: 
 56: 	
 57: 	$DESK->Skin->IncludeFile("footer.php");
 58: 	exit();
 59: }
 60: 
 61: // So we have a SID - check if it authenticates
 62: if (!$DESK->ContextManager->Open(ContextType::User, $_REQUEST['sid']))
 63: {
 64: 	header("Location: ./"); // login page redirect on failure
 65: 	exit();
 66: }
 67: 
 68: // So we're authenticated let's view the main page
 69: $data=array("title"=>"FreeDESK");
 70: $DESK->Skin->IncludeFile("header.php",$data);
 71: 
 72: echo "<div id=\"mainpage\">\n";
 73: $DESK->Include->IncludeFile("pages/main.php");
 74: echo "</div>\n";
 75: echo "<div id=\"subpage\"></div>\n";
 76: 
 77: $DESK->Skin->IncludeFile("footer.php");
 78: 
 79: 
 80: ?>
 81: