Login Changes:

If visiting /index.php and /themes/[theme]/index.php exists, will load it.
If visiting /index.php and /themes/[theme]/login.php exists, will load it.
If NEITHER exist, will load /resources/login.php.

If visiting /login.php and /themes/[theme]/login.php exists, will load it.
If DOESN'T exist, will load /resources/login.php/

/resources/login.php reworked, Enhanced theme reworked.
This commit is contained in:
Nate Jones 2014-07-27 00:13:52 +00:00
parent 5e13986a2b
commit b244cd2c91
6 changed files with 206 additions and 188 deletions

View File

@ -194,4 +194,19 @@
$text['login-message_dismiss']['es-cl'] = "Despedir"; $text['login-message_dismiss']['es-cl'] = "Despedir";
$text['login-message_dismiss']['pt-pt'] = "Demitir"; $text['login-message_dismiss']['pt-pt'] = "Demitir";
$text['login-message_dismiss']['fr-fr'] = "Rejeter"; $text['login-message_dismiss']['fr-fr'] = "Rejeter";
$text['label-username']['en-us'] = "Username";
$text['label-username']['es-cl'] = "Nombre de Usuario";
$text['label-username']['pt-pt'] = "Nome de Utilizador";
$text['label-username']['fr-fr'] = "Nom d'Utilisateur";
$text['label-password']['en-us'] = "Password";
$text['label-password']['es-cl'] = "Contraseña";
$text['label-password']['pt-pt'] = "Password";
$text['label-password']['fr-fr'] = "Mot de Passe";
$text['label-domain']['en-us'] = "Domain";
$text['label-domain']['es-cl'] = "Dominio";
$text['label-domain']['pt-pt'] = "Domínio";
$text['label-domain']['fr-fr'] = "Domaine";
?> ?>

View File

@ -25,6 +25,9 @@
*/ */
include "root.php"; include "root.php";
//clear the session variables
session_start();
//if config.php file does not exist then redirect to the install page //if config.php file does not exist then redirect to the install page
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
//do nothing //do nothing
@ -33,9 +36,9 @@ include "root.php";
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) { } elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
//move config.php from the includes to resources directory. //move config.php from the includes to resources directory.
rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php"); rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php");
} elseif (file_exists("/etc/fusionpbx/config.php")){ } elseif (file_exists("/etc/fusionpbx/config.php")) {
//linux //linux
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")){ } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
//bsd //bsd
} else { } else {
header("Location: ".PROJECT_PATH."/resources/install.php"); header("Location: ".PROJECT_PATH."/resources/install.php");
@ -45,14 +48,20 @@ include "root.php";
//adds multiple includes //adds multiple includes
require_once "resources/require.php"; require_once "resources/require.php";
//show the index page // if logged in, redirect to login destination
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/index.php")){ if (strlen($_SESSION["username"]) > 0) {
header("Location: ".$_SESSION['login']['destination']['url']);
}
else {
//use custom index, if present, otherwise use custom login, if present, otherwise use default login
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/index.php")) {
require_once "themes/".$_SESSION['domain']['template']['name']."/index.php"; require_once "themes/".$_SESSION['domain']['template']['name']."/index.php";
} }
else { else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")) {
require_once "resources/require.php"; require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
require_once "resources/header.php";
echo "<br /><br />\n";
require_once "resources/footer.php";
} }
else {
require_once "resources/login.php";
}
}
?> ?>

View File

@ -21,7 +21,7 @@
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com> Mark J. Crane <markjcrane@fusionpbx.com>
*/ */
include "root.php"; include "root.php";
@ -35,6 +35,9 @@ include "root.php";
//do nothing //do nothing
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { } elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
//original directory //original directory
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
//move config.php from the includes to resources directory.
rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php");
} elseif (file_exists("/etc/fusionpbx/config.php")){ } elseif (file_exists("/etc/fusionpbx/config.php")){
//linux //linux
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")){ } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")){
@ -47,7 +50,7 @@ include "root.php";
//adds multiple includes //adds multiple includes
require_once "resources/require.php"; require_once "resources/require.php";
//include the login //use custom login, if present, otherwise use default login
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")){ if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")){
require_once "themes/".$_SESSION['domain']['template']['name']."/login.php"; require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
} }

View File

@ -85,62 +85,32 @@
} }
//show the content //show the content
echo "<br><br>"; echo "<br />\n";
echo "<div align='center'>\n"; echo "<form name='login' method='post' action='".$_SESSION['login']['destination']['url']."'>\n";
echo "<form name='login' METHOD=\"POST\" action=\"".$_SESSION['login']['destination']['url']."\">\n"; echo "<input type='hidden' name='path' value='".$path."'>\n";
echo "<input type='hidden' name='path' value='$path'>\n"; echo "<input type='text' class='formfld' style='text-align: center; min-width: 200px; width: 200px; margin-bottom: 8px;' name='username' id='username' placeholder=\"".$text['label-username']."\"><br />\n";
echo "<table width='200' border='0'>\n"; echo "<input type='password' class='formfld' style='text-align: center; min-width: 200px; width: 200px; margin-bottom: 8px;' name='password' placeholder=\"".$text['label-password']."\"><br />\n";
echo "<tr>\n";
echo "<td align='left'>\n";
echo " <strong>".$text['label-username'].":</strong>\n";
echo "</td>\n";
echo "<td>\n";
echo " <input type=\"text\" style='width: 150px;' class='formfld' name=\"username\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left'>\n";
echo " <strong>".$text['label-password'].":</strong>\n";
echo "</td>\n";
echo "<td align='left'>\n";
echo " <input type=\"password\" style='width: 150px;' class='formfld' name=\"password\">\n";
echo "</td>\n";
echo "</tr>\n";
if ($_SESSION['login']['domain_name.visible']['boolean'] == "true") { if ($_SESSION['login']['domain_name.visible']['boolean'] == "true") {
echo "<tr>\n";
echo "<td align='left'>\n";
echo " <strong>".$text['label-domain'].":</strong>\n";
echo "</td>\n";
echo "<td>\n";
if (count($_SESSION['login']['domain_name']) > 0) { if (count($_SESSION['login']['domain_name']) > 0) {
echo " <select style='width: 150px;' class='formfld' name='domain_name'>\n"; echo "<select style='width: 200px; margin-bottom: 8px;' class='formfld' name='domain_name'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
foreach ($_SESSION['login']['domain_name'] as &$row) { foreach ($_SESSION['login']['domain_name'] as &$row) {
echo " <option value='$row'>$row</option>\n"; echo " <option value='$row'>$row</option>\n";
} }
echo " </select>\n"; echo "</select>\n";
echo "<br />";
} }
else { else {
echo " <input type=\"text\" style='width: 150px;' class='formfld' name=\"domain_name\">\n"; echo "<input type='text' class='formfld' style='text-align: center; min-width: 200px; width: 200px; margin-bottom: 8px;' name='domain_name' placeholder=\"".$text['label-domain']."\"><br />\n";
} }
echo "</td>\n";
echo "</tr>\n";
} }
echo "<br />";
echo "<tr>\n"; echo "<input type='submit' class='btn' style='width: 100px; margin-top: 15px;' value='".$text['button-login']."'>\n";
echo "<td>\n";
echo "</td>\n";
echo "<td align=\"right\">\n";
echo " <input type=\"submit\" class='btn' value=\"".$text['button-login']."\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>"; echo "</form>";
echo "</div>"; echo "<script>document.getElementById('username').focus();</script>";
//add the footer //add the footer
$default_login = true;
include "resources/footer.php"; include "resources/footer.php";
?> ?>

View File

@ -1,38 +0,0 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J. Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//show the index page
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 "resources/require.php";
require_once "resources/header.php";
echo "<br /><br />\n";
require_once "resources/footer.php";
}
?>

View File

@ -55,7 +55,7 @@ DIV#page {
left: 0px; left: 0px;
right: 0px; right: 0px;
bottom: 0px; bottom: 0px;
padding: 10px; padding: 0px;
overflow: auto; overflow: auto;
} }
@ -95,6 +95,30 @@ if (
?> ?>
<?php } ?> <?php } ?>
DIV#copyright {
background-color: #000;
bottom: 0px;
left: 0px;
right: 0px;
height: 20px;
-khtml-opacity: 0.2;
-moz-opacity: 0.2;
-ms-filter: "alpha(opacity=20)";
filter: alpha(opacity=20);
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.2);
opacity: 0.2;
text-align: center;
vertical-align: middle;
padding-bottom: 0px;
padding-top: 8px;
}
.copyright {
font-size: 11px;
font-family: arial;
color: #fff;
}
img { img {
border: none; border: none;
} }
@ -378,9 +402,6 @@ table.tr_hover tr:hover td a {
/*background-color: #FFFFFF;*/ /*background-color: #FFFFFF;*/
} }
.headermain {
/*background-color: #7FAEDE;*/
}
.frm { .frm {
border: solid 1px #CCCCCC; border: solid 1px #CCCCCC;
@ -1108,49 +1129,52 @@ legend {
?> ?>
<div id="page" align='center'> <div id="page" align='center'>
<table width='90%' class='border.disabled' border='0' cellpadding='0' cellspacing='0'> <?php if (!$default_login) { ?>
<tr> <table width='90%' border='0' cellpadding='0' cellspacing='0'>
<td align='left' valign='top' class='headermain' height='70px;'> <tr>
<table border='0' cellpadding='0' cellspacing='0' width='100%'> <td align='left' valign='top'>
<tr> <table border='0' cellpadding='0' cellspacing='0' width='100%' style='margin-top: 10px;'>
<td> <tr>
<?php <td>
if ($_SERVER['PHP_SELF'] != PROJECT_PATH."/resources/install.php") { <?php
if (strlen(PROJECT_PATH) > 0) { if ($_SERVER['PHP_SELF'] != PROJECT_PATH."/resources/install.php") {
echo "<a href='".PROJECT_PATH."'><img src='".PROJECT_PATH."/themes/enhanced/images/logo.png' /></a>"; if (strlen(PROJECT_PATH) > 0) {
} echo "<a href='".PROJECT_PATH."'><img src='".PROJECT_PATH."/themes/enhanced/images/logo.png' /></a>";
else { }
echo "<a href='/'><img src='/themes/enhanced/images/logo.png' /></a>"; else {
} if (!$default_login) {
} echo "<a href='/'><img src='/themes/enhanced/images/logo.png' /></a>";
?> }
</td> }
<td width='100%' style='padding-right: 15px;' align='right' valign='middle'> }
<?php ?>
if ($_SESSION['username'] != '') { </td>
echo "<span style='white-space: nowrap;'>"; <td width='100%' style='padding-right: 15px;' align='right' valign='middle'>
echo " <span style='color: black; font-size: 10px; font-weight: bold;'>".$text['theme-label-user']."</span>&nbsp;"; <?php
echo " <a href='".PROJECT_PATH."/core/user_settings/user_dashboard.php'>"; if ($_SESSION['username'] != '') {
echo $_SESSION['username']; echo "<span style='white-space: nowrap;'>";
if (count($_SESSION['domains']) > 1) { echo " <span style='color: black; font-size: 10px; font-weight: bold;'>".$text['theme-label-user']."</span>&nbsp;";
echo "@".$_SESSION["user_context"]; echo " <a href='".PROJECT_PATH."/core/user_settings/user_dashboard.php'>";
} echo $_SESSION['username'];
echo "</a>"; if (count($_SESSION['domains']) > 1) {
echo "</span>\n"; echo "@".$_SESSION["user_context"];
} }
echo "</a>";
echo "</span>\n";
}
//logged in show the domains block //logged in show the domains block
if (strlen($_SESSION["username"]) > 0 && permission_exists("domain_select") && count($_SESSION['domains']) > 1) { if (strlen($_SESSION["username"]) > 0 && permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
echo "<span style='white-space: nowrap; line-height: 45px;'>"; echo "<span style='white-space: nowrap; line-height: 45px;'>";
echo " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='color: black; font-size: 10px; font-weight: bold;'>".$text['theme-label-domain']."</span>&nbsp;"; echo " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='color: black; font-size: 10px; font-weight: bold;'>".$text['theme-label-domain']."</span>&nbsp;";
echo " <a href='javascript:void(0);' id='domains_show_text'>".$_SESSION['domain_name']."</a>"; echo " <a href='javascript:void(0);' id='domains_show_text'>".$_SESSION['domain_name']."</a>";
echo " <img id='domains_show_icon' src='".PROJECT_PATH."/themes/enhanced/images/icon_domains_show.png' style='width: 23px; height: 16px; border: none;' title='".$text['theme-label-open_selector']."' align='absmiddle'>"; echo " <img id='domains_show_icon' src='".PROJECT_PATH."/themes/enhanced/images/icon_domains_show.png' style='width: 23px; height: 16px; border: none;' title='".$text['theme-label-open_selector']."' align='absmiddle'>";
echo "</span>"; echo "</span>";
} }
//logged out show the login // login form
if ($_SERVER['PHP_SELF'] != PROJECT_PATH."/resources/install.php") { if ($_SERVER['PHP_SELF'] != PROJECT_PATH."/resources/install.php" && !$default_login) {
if (strlen($_SESSION["username"]) == 0) { if (strlen($_SESSION["username"]) == 0) {
//add multi-lingual support //add multi-lingual support
require_once "core/user_settings/app_languages.php"; require_once "core/user_settings/app_languages.php";
foreach($text as $key => $value) { foreach($text as $key => $value) {
@ -1167,10 +1191,10 @@ legend {
echo " <table width='200' border='0'>\n"; echo " <table width='200' border='0'>\n";
echo " <tr>\n"; echo " <tr>\n";
echo " <td>\n"; echo " <td>\n";
echo " <input type='text' class='formfld' style='min-width: 105px; width: 105px; text-align: center;' name='username' placeholder=\"".$text['label-username']."\">\n"; echo " <input type='text' class='formfld' style='min-width: 150px; width: 105px; text-align: center;' name='username' placeholder=\"".$text['label-username']."\">\n";
echo " </td>\n"; echo " </td>\n";
echo " <td align='left'>\n"; echo " <td align='left'>\n";
echo " <input type='password' class='formfld' style='min-width: 105px; width: 105px; text-align: center;' name='password' placeholder=\"".$text['label-password']."\">\n"; echo " <input type='password' class='formfld' style='min-width: 150px; width: 105px; text-align: center;' name='password' placeholder=\"".$text['label-password']."\">\n";
echo " </td>\n"; echo " </td>\n";
if ($_SESSION['login']['domain_name.visible']['boolean'] == "true") { if ($_SESSION['login']['domain_name.visible']['boolean'] == "true") {
@ -1187,7 +1211,7 @@ legend {
echo " </select>\n"; echo " </select>\n";
} }
else { else {
echo " <input type='text' style='width: 150px;' class='formfld' name='domain_name'>\n"; echo " <input type='text' style='min-width: 150px; width: 150px;' class='formfld' name='domain_name'>\n";
} }
echo " </td>\n"; echo " </td>\n";
} }
@ -1199,60 +1223,95 @@ legend {
echo " </table>\n"; echo " </table>\n";
echo " </form>"; echo " </form>";
echo "</div>"; echo "</div>";
}
} }
?>
</td>
</tr>
</table>
</td>
</tr>
<?php
if (strlen($_SESSION["username"]) > 0) {
?>
<tr>
<td height='9px'><img src='<!--{project_path}-->/themes/enhanced/images/blank.gif'></td>
</tr>
<tr>
<td class='menu_bar' height='30px'>
<!--{menu}-->
</td>
</tr>
<tr>
<td height='9px'><img src='<!--{project_path}-->/themes/enhanced/images/blank.gif'></td>
</tr>
<?php
}
?>
<tr>
<td valign='top' align='center' width='100%'>
<table cellpadding='0' cellspacing='1' border='0' width='100%' style='margin-bottom: 60px;'>
<tr>
<td class='main_content' valign='top' align='center'>
<!--{body}-->
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}
// default login being used
else {
?>
<div class='main_content' style='position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; padding: 0px;'>
<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'>
<tr>
<td align='center' valign='middle'>
<style>
#default_login {
background-color: #fff;
display: block;
width: 300px;
padding: 30px;
opacity: 0.93;
filter:alpha(opacity=93);
-moz-opacity:0.93;
-khtml-opacity: 0.93;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0px 1px 20px #888;
-moz-box-shadow: 0px 1px 20px #888;
box-shadow: 0px 1px 20px #888;
padding: 30px;
} }
?> </style>
<span id='default_login'>
<a href='<?php echo PROJECT_PATH; ?>/'><img src='<?php echo PROJECT_PATH; ?>/themes/enhanced/images/logo.png'></a>
<br />
<!--{body}-->
</span>
<br /><br /><br />
</td> </td>
</tr> </tr>
</table> </table>
</td> </div>
</tr>
<?php
if (strlen($_SESSION["username"]) > 0) {
?>
<tr>
<td height='9px'><img src='<!--{project_path}-->/themes/enhanced/images/blank.gif'></td>
</tr>
<tr>
<td class='menu_bar' height='30px'>
<!--{menu}-->
</td>
</tr>
<tr>
<td height='9px'><img src='<!--{project_path}-->/themes/enhanced/images/blank.gif'></td>
</tr>
<?php <?php
} }
?> ?>
<tr>
<td valign='top' align='center' width='100%'>
<table cellpadding='0' cellspacing='1' border='0' width='100%'>
<tr>
<td class='main_content' valign='top' align='center'>
<!--{body}-->
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
if (substr($_SERVER['PHP_SELF'], -9) != "login.php") {
echo "<span class='smalltext'>\n";
echo "<br />\n";
echo "&copy; Copyright 2008 - ".date("Y")." <a class='smalltext' target='_blank' href='http://www.fusionpbx.com'>fusionpbx.com</a>. All rights reserved.\n";
echo "</span><br><br>\n";
}
else {
echo "<!--\n";
echo " http://www.fusionpbx.com \n";
echo " Copyright 2008 - ".date("Y")." \n";
echo " All rights reserved.\n";
echo "-->\n";
}
?>
</div> </div>
<br /> <?php
$copyright .= "&copy; Copyright 2008 - ".date("Y")." <a href='http://www.fusionpbx.com' class='copyright' target='_blank'>fusionpbx.com</a>. All rights reserved.\n";
echo "<div id='copyright' style='position: absolute; z-index; 10000;'><span class='copyright'>".$copyright."</span></div>";
?>
</body> </body>
</html> </html>