From 8e55371c6d9318af638e935e554c0a653d475f85 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 10 Feb 2013 02:12:23 +0000 Subject: [PATCH] Add ability to customize login.php and index.php. --- index.php | 15 +++-- login.php | 124 ++----------------------------------- resources/login.php | 146 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 124 deletions(-) create mode 100644 resources/login.php diff --git a/index.php b/index.php index 09c22b5662..b2e7f7e267 100644 --- a/index.php +++ b/index.php @@ -28,11 +28,14 @@ if (!file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) header("Location: ".PROJECT_PATH."/resources/install.php"); exit; } -require_once "includes/require.php"; -require_once "includes/header.php"; -echo "
"; -echo "
"; - -require_once "includes/footer.php"; +if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/index.php")){ + require_once "themes/".$_SESSION['domain']['template']['name']."/index.php"; +} +else { + require_once "includes/require.php"; + require_once "includes/header.php"; + echo "

\n"; + require_once "includes/footer.php"; +} ?> \ No newline at end of file diff --git a/login.php b/login.php index 9c28d6adce..ccac639b80 100644 --- a/login.php +++ b/login.php @@ -33,124 +33,12 @@ include "root.php"; //adds multiple includes require_once "includes/require.php"; -//add multi-lingual support - require_once "core/user_settings/app_languages.php"; - foreach($text as $key => $value) { - $text[$key] = $value[$_SESSION['domain']['language']['code']]; +//include the login + if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")){ + require_once "themes/".$_SESSION['domain']['template']['name']."/login.php"; + } + else { + require_once "resources/login.php"; } -//get the http values and set as variables - $path = check_str($_GET["path"]); - $msg = check_str($_GET["msg"]); - -//set a default login destination - if (strlen($_SESSION['login']['destination']['url']) == 0) { - $_SESSION['login']['destination']['url'] = PROJECT_PATH."/core/user_settings/user_dashboard.php"; - } - -//add the header - include "includes/header.php"; - -//show the message - if (strlen($msg) > 0) { - echo "

"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
Message
\n"; - - switch ($msg) { - case "username required": - echo "Please provide a username."; - break; - case "incorrect account information": - echo "The username or password was incorrect. Please try again."; - break; - case "install complete": - echo "
\n"; - echo "Installation is complete.
"; - echo "
"; - echo "Getting Started:
"; - echo "
  • There are two levels of admins 1. superadmin 2. admin.
    "; - echo "
    \n"; - echo "username: superadmin
    password: fusionpbx
    \n"; - echo "
    \n"; - echo "username: admin
    password: fusionpbx

    \n"; - echo "
  • \n"; - echo "
  • \n"; - echo "The database connection settings have been saved to ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/config.php.
    \n"; - echo "
  • \n"; - echo "
\n"; - echo "\n"; - break; - } - - echo "
\n"; - echo "
\n"; - echo "

\n\n"; - } - -//show the content - echo "

"; - echo "
\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - if ($_SESSION['login']['domain_name.visible']['boolean'] == "true") { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
\n"; - echo " ".$text['label-username'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['label-password'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['label-domain'].":\n"; - echo "\n"; - if (count($_SESSION['login']['domain_name']) > 0) { - echo " \n"; - } - else { - echo " \n"; - } - echo "
\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo "
"; - echo "
"; - -//add the footer - include "includes/footer.php"; ?> \ No newline at end of file diff --git a/resources/login.php b/resources/login.php new file mode 100644 index 0000000000..be76faf6d4 --- /dev/null +++ b/resources/login.php @@ -0,0 +1,146 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//add multi-lingual support + require_once "core/user_settings/app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + +//get the http values and set as variables + $path = check_str($_GET["path"]); + $msg = check_str($_GET["msg"]); + +//set a default login destination + if (strlen($_SESSION['login']['destination']['url']) == 0) { + $_SESSION['login']['destination']['url'] = PROJECT_PATH."/core/user_settings/user_dashboard.php"; + } + +//add the header + include "includes/header.php"; + +//show the message + if (strlen($msg) > 0) { + echo "

"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Message
\n"; + switch ($msg) { + case "username required": + echo "Please provide a username."; + break; + case "incorrect account information": + echo "The username or password was incorrect. Please try again."; + break; + case "install complete": + echo "
\n"; + echo "Installation is complete.
"; + echo "
"; + echo "Getting Started:
"; + echo "
  • There are two levels of admins 1. superadmin 2. admin.
    "; + echo "
    \n"; + echo "username: superadmin
    password: fusionpbx
    \n"; + echo "
    \n"; + echo "username: admin
    password: fusionpbx

    \n"; + echo "
  • \n"; + echo "
  • \n"; + echo "The database connection settings have been saved to ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/config.php.
    \n"; + echo "
  • \n"; + echo "
\n"; + echo "\n"; + break; + } + echo "
\n"; + echo "
\n"; + echo "

\n\n"; + } + +//show the content + echo "

"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($_SESSION['login']['domain_name.visible']['boolean'] == "true") { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo " ".$text['label-username'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo " ".$text['label-password'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo " ".$text['label-domain'].":\n"; + echo "\n"; + if (count($_SESSION['login']['domain_name']) > 0) { + echo " \n"; + } + else { + echo " \n"; + } + echo "
\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "
"; + echo "
"; + +//add the footer + include "includes/footer.php"; + +?> \ No newline at end of file