<?php
/**
**
** NitricWare presents Oyster Dragon
**
** Desktop-Application
**
** by NitricWare Studios
** www.nitricware.at.tf
**
**/
define("IS_BOOT", false);
// Including all Classes and Functions
include("./System/Kernel/kernel.php");
if (!OYChainChomp()){
header("Location: ./");
}
// Timestamp Today
$today = date("d F Y");
$today = strtotime($today);
if (!file_exists("./Library/Logs/$today.OYLog")) {
@AQLog("Oyster called for the first time today by ".$_SERVER["REMOTE_ADDR"], "Oyster Central");
}
if (isset($_GET["logout"]) and $_GET["logout"] == "true"){
define("OYAPP", "Oyster Logout");
if (isset($_GET["application"])){
OYLogout($_GET["application"]);
} else {
OYLogout("Desktop");
}
}
if (isset ($_GET["login"]) and $_GET["login"] == 'true' and sha1($_POST["password"]) == OYGetPref('PASSWORD')){
define("OYAPP", "Oyster Login [DO]");
setcookie("Oyster_Dragon", "logged_in", OYGetPref('COOKIE_LIFETIME'));
header('Location: desktop.php?application='.$_GET["application"]);
}
if (!isset($_COOKIE["Oyster_Dragon"]) and USE_PASSWORD){
define("OYAPP", "Oyster Login [MASK]");
$login_mask = new Template();
$login_mask->_template_read("./System/Design/".DESIGN."/Templates/login_mask.tpl");
$login_mask->_template_assign("BROWSER_TITLE", OYLoadLanguageString("./System/Kernel/Language/".USE_LANGUAGE."/Core.xml", "TITLE_LOGIN"));
if (isset($_GET["application"])){
$login_mask->_template_assign("APP", $_GET["application"]);
}
$login_mask->_template_assign("LEGEND_LOGIN", OYLoadLanguageString("./System/Kernel/Language/".USE_LANGUAGE."/Core.xml", "LEGEND_LOGIN"));
$login_mask->_template_assign("ENTER_PASSWORD", OYLoadLanguageString("./System/Kernel/Language/".USE_LANGUAGE."/Core.xml", "ENTER_PASSWORD"));
$login_mask->_template_assign("BUTTON_LOGIN", OYLoadLanguageString("./System/Kernel/Language/".USE_LANGUAGE."/Core.xml", "BUTTON_LOGIN"));
if (isset($_POST["password"]) and sha1($_POST["password"]) != OYGetPref('PASSWORD')){
$login_mask->_template_assign("LEGEND_ERROR", OYLoadLanguageString("./System/Kernel/Language/".USE_LANGUAGE."/Core.xml", "LEGEND_ERROR"));
$login_mask->_template_assign("ERROR", OYLoadLanguageString("./System/Kernel/Language/".USE_LANGUAGE."/Core.xml", "LOGIN_ERROR"));
@AQLog("Failed attempt to log in using password ".$_POST["password"]." by IP ".$_SERVER["REMOTE_ADDR"]);
}
echo $login_mask->_template_toHTML();
exit();
}
$header = new Template();
$template = new Template();
$footer = new Template();
$header->_template_read("./System/Design/".DESIGN."/Templates/header.tpl");
$footer->_template_read("./System/Design/".DESIGN."/Templates/footer.tpl");
if (USE_PASSWORD){
$header->_template_assign("USE_PASSWORD", "true");
$header->_template_assign("LOGOUT", OYLoadLanguageString("./System/Kernel/Language/".USE_LANGUAGE."/Core.xml", "LOGOUT"));
}
$header->_template_assign("LEGEND_ERROR", OYLoadLanguageString("./System/Kernel/Language/".USE_LANGUAGE."/Core.xml", "LEGEND_ERROR"));
$header->_template_assign("LEGEND_SUCCESS", OYLoadLanguageString("./System/Kernel/Language/".USE_LANGUAGE."/Core.xml", "LEGEND_SUCCESS"));
$header->_template_assign("DESIGN", DESIGN);
$header->_template_assign("LINK_DOCK_DESKTOP", OYCreateLink("Desktop"));
$header->_template_assign("LINK_QUIT", OYCreateLink(STARTAPP));
if (DAYTIME_VIEW){
$header->_template_assign("DAYTIME_VIEW", true);
}
if (isset($_GET["application"]) AND file_exists("./Applications/".$_GET["application"].".OYApp/main.php")){
define("APP_PATH", "./Applications/".$_GET["application"].".OYApp/");
define("OYAPP", $_GET["application"]);
if (file_exists("./Applications/".$_GET["application"].".OYApp/Language/".USE_LANGUAGE."/")){
define("OYLANGUAGE", USE_LANGUAGE);
} else {
$languages_read = NWLoadDirectory("./Applications/".$_GET["application"].".OYApp/Language/", "directories", false, true);
$languages_pathinfo = pathinfo($languages_read[0]);
define("OYLANGUAGE", $languages_pathinfo["basename"]);
}
if (file_exists("./Applications/".$_GET["application"].".OYApp/Design/".DESIGN."/")){
define("OYDESIGN", DESIGN);
} else {
$styles_read = NWLoadDirectory("./Applications/".$_GET["application"].".OYApp/Design/", "directories", false, true);
$styles_pathinfo = pathinfo($styles_read[0]);
define("OYDESIGN", $styles_pathinfo["basename"]);
}
include("./Applications/".$_GET["application"].".OYApp/main.php");
} else {
define("APP_PATH", "./Applications/".STARTAPP.".OYApp/");
define("OYAPP", STARTAPP);
if (file_exists("./Applications/".STARTAPP.".OYApp/Language/".USE_LANGUAGE."/")){
define("OYLANGUAGE", USE_LANGUAGE);
} else {
$languages_read = NWLoadDirectory("./Applications/".STARTAPP.".OYApp/Language/", "directories", false, true);
$languages_pathinfo = pathinfo($languages_read[0]);
define("OYLANGUAGE", $languages_pathinfo["basename"]);
}
if (file_exists("./Applications/".STARTAPP.".OYApp/Design/".DESIGN."/")){
define("OYDESIGN", DESIGN);
} else {
$styles_read = NWLoadDirectory("./Applications/".STARTAPP.".OYApp/Design/", "directories", false, true);
$styles_pathinfo = pathinfo($styles_read[0]);
define("OYDESIGN", $styles_pathinfo["basename"]);
}
include("./Applications/".STARTAPP.".OYApp/main.php");
}
$header->_template_assign("LINK_BACK", OYCreateLink(OYAPP));
$header->_template_assign("LINK_DOCK_ONE", OYCreateLink(OYGetDock("1")));
$header->_template_assign("LINK_DOCK_TWO", OYCreateLink(OYGetDock("2")));
$header->_template_assign("LINK_DOCK_THREE", OYCreateLink(OYGetDock("3")));
$header->_template_assign("LINK_DOCK_FOUR", OYCreateLink(OYGetDock("4")));
$header->_template_assign("APP_NAME_ONE", OYGetDock("1"));
$header->_template_assign("APP_NAME_TWO", OYGetDock("2"));
$header->_template_assign("APP_NAME_THREE", OYGetDock("3"));
$header->_template_assign("APP_NAME_FOUR", OYGetDock("4"));
$OYInfo = OYOysterInfo();
$footer->_template_assign("OYSTER_VERSION", $OYInfo["Version"]);
$footer->_template_assign("OYSTER_SUBNAME", $OYInfo["SubName"]);
echo $header->_template_toHTML();
echo $template->_template_toHTML();
echo $footer->_template_toHTML();
?>