PostfixAdmin - web based virtual user administration interface for Postfix mail servers https://postfixadmin.github.io/postfixadmin/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.3 KiB

  1. <?php
  2. /**
  3. * Postfix Admin
  4. *
  5. * LICENSE
  6. * This source file is subject to the GPL license that is bundled with
  7. * this package in the file LICENSE.TXT.
  8. *
  9. * Further details on the project are available at :
  10. * http://www.postfixadmin.com or http://postfixadmin.sf.net
  11. *
  12. * @version $Id$
  13. * @license GNU GPL v2 or later.
  14. *
  15. * File: common.php
  16. * All pages should include this file - which itself sets up the necessary
  17. * environment and ensures other functions are loaded.
  18. */
  19. if(!defined('POSTFIXADMIN')) { # already defined if called from setup.php
  20. session_start();
  21. define('POSTFIXADMIN', 1); # checked in included files
  22. if(empty($_SESSION['flash'])) {
  23. $_SESSION['flash'] = array();
  24. }
  25. }
  26. $incpath = dirname(__FILE__);
  27. (ini_get('magic_quotes_gpc') ? ini_set('magic_quotes_runtime', '0') : '1');
  28. (ini_get('magic_quotes_gpc') ? ini_set('magic_quotes_sybase', '0') : '1');
  29. if(ini_get('register_globals') == 'on') {
  30. die("Please turn off register_globals; edit your php.ini");
  31. }
  32. require_once("$incpath/variables.inc.php");
  33. if(!is_file("$incpath/config.inc.php")) {
  34. die("config.inc.php is missing!");
  35. }
  36. require_once("$incpath/config.inc.php");
  37. if(isset($CONF['configured'])) {
  38. if($CONF['configured'] == FALSE) {
  39. die("Please edit config.inc.php - change \$CONF['configured'] to true after setting your database settings");
  40. }
  41. }
  42. require_once("$incpath/languages/language.php");
  43. require_once("$incpath/functions.inc.php");
  44. $_SESSION['lang'] = $language = check_language (); # TODO: storing the language only at login instead of calling check_language() on every page would save some processor cycles ;-)
  45. require_once("$incpath/languages/" . $_SESSION['lang'] . ".lang");
  46. /**
  47. * @param string $class
  48. * __autoload implementation, for use with spl_autoload_register().
  49. */
  50. function postfixadmin_autoload($class) {
  51. $PATH = dirname(__FILE__) . '/model/' . $class . '.php';
  52. if(is_file($PATH)) {
  53. require_once($PATH);
  54. return true;
  55. }
  56. return false;
  57. }
  58. spl_autoload_register('postfixadmin_autoload');
  59. //*****
  60. if(!is_file("$incpath/smarty.inc.php")) {
  61. die("smarty.inc.php is missing! Something is wrong...");
  62. }
  63. require_once ("$incpath/smarty.inc.php");
  64. //*****
  65. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
  66. ?>