Skip to content

Commit

Permalink
Fix the indentation and login redirect issue
Browse files Browse the repository at this point in the history
  • Loading branch information
markjcrane committed Jul 27, 2014
1 parent 023176f commit 9140870
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<context name="{v_context}">
<extension name="do-not-disturb" number="*78,*79" continue="false" app_uuid="df32d982-e39e-4ae5-a46d-aed1893873f2" enabled="true">
<condition field="destination_number" expression="^\*78$" break="on-true">
<condition field="destination_number" expression="^\*78$|\*363$" break="on-true">
<action application="set" data="enabled=true"/>
<action application="lua" data="do_not_disturb.lua"/>
</condition>
Expand Down
39 changes: 23 additions & 16 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,35 @@
}

// if not logged in, clear the session variables
if (strlen($_SESSION["username"]) == 0) {
session_unset();
session_destroy();
}
if (strlen($_SESSION["username"]) == 0) {
session_unset();
session_destroy();
}

//adds multiple includes
require_once "resources/require.php";

// if logged in, redirect to login destination
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";
}
else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")) {
require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
if (strlen($_SESSION["username"]) > 0) {
if (strlen($_SESSION['login']['destination']['url']) > 0) {
header("Location: ".$_SESSION['login']['destination']['url']);
}
else {
require_once "resources/header.php";
require_once "resources/header.php";
}
}
else {
require_once "resources/login.php";
//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";
}
else 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";
}
}
}

?>

0 comments on commit 9140870

Please sign in to comment.