function WYApplication() { global $webyep_sIncludePath; // set in page init code global $goApp, $webyep_bTesting; global $webyep_bDocumentPage; global $webyep_bLiveDemo, $webyep_sLiveDemoSlotID, $webyep_sCookiePath; $oP = od_nil; $oF = od_nil; $this->iActionID = 0; if (!isset($webyep_sCookiePath)) { $webyep_sCookiePath = "/"; } else { setcookie(WY_CK_ACTION_ID, "", $this->iCookieTTL(), "/"); } // make sure there's no action ID in the "/" cookie $this->bDataAccessProblem = false; $this->bLiveDemoProblem = false; $this->oProgramPath = new WYPath(WYApplication::sScriptPath(__FILE__)); $this->oProgramPath->removeLastComponent(); $this->oProgramPath->removeLastComponent(); $this->oProgramURL = new WYURL($webyep_sIncludePath); $this->oProgramURL->makeSiteRelative(); $this->oImageURL = od_clone($this->oProgramURL); $this->oImageURL->addComponent("images"); $this->oDataPath = od_clone($this->oProgramPath); $this->oDataPath->normalize(); $this->oDataPath->removeLastComponent(); $this->oDataURL = od_clone($this->oProgramURL); $this->oDataURL->normalize(); $this->oDataURL->removeLastComponent(); if (strstr(WYApplication::sScriptPath(__FILE__), "webyep-system/programm")) { $this->oDataPath->addComponent("daten" . ($webyep_bLiveDemo && $webyep_sLiveDemoSlotID ? "_{$webyep_sLiveDemoSlotID}" : "")); $this->oDataURL->addComponent("daten" . ($webyep_bLiveDemo && $webyep_sLiveDemoSlotID ? "_{$webyep_sLiveDemoSlotID}" : "")); } else { $this->oDataPath->addComponent("data" . ($webyep_bLiveDemo && $webyep_sLiveDemoSlotID ? "_{$webyep_sLiveDemoSlotID}" : "")); $this->oDataURL->addComponent("data" . ($webyep_bLiveDemo && $webyep_sLiveDemoSlotID ? "_{$webyep_sLiveDemoSlotID}" : "")); } if ($webyep_bLiveDemo && !$this->oDataPath->bExists()) { $this->bLiveDemoProblem = true; } $goApp = $this; // other modules might need the global app object early $this->bIsiPhone = false; $this->bIsOmniWeb = false; $this->bIsSafari = false; $this->bIsOpera = false; $this->bIsNavigator = false; $this->bIsExplorer = false; if (isset($_SERVER['HTTP_USER_AGENT'])) { if ($webyep_bTesting && (stristr($_SERVER['HTTP_USER_AGENT'], "iPhone") || stristr($_SERVER['HTTP_USER_AGENT'], "iPod"))) { $this->bIsiPhone = true; } else { if (stristr($_SERVER['HTTP_USER_AGENT'], "Safari")) { $this->bIsSafari = true; } else { if (stristr($_SERVER['HTTP_USER_AGENT'], "Opera")) { $this->bIsOpera = true; } else { if (stristr($_SERVER['HTTP_USER_AGENT'], "OmniWeb")) { $this->bIsOmniWeb = true; } else { if (stristr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $this->bIsExplorer = true; } else { $this->bIsNavigator = true; } } } } } } else { $this->bIsExplorer = true; // default browser } if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "Mac") === false) { $this->bIsMac = false; } else { $this->bIsMac = true; } if (isset($_COOKIE[WY_CK_ACTION_ID])) { $this->iActionID = (int) $_COOKIE[WY_CK_ACTION_ID]; } if ($webyep_bDocumentPage) { $this->iActionID++; } if (!headers_sent()) { setcookie(WY_CK_ACTION_ID, $this->iActionID, $this->iCookieTTL(), $webyep_sCookiePath); } else { $this->log("can't set cookie " . WY_CK_ACTION_ID . ": headers already sent"); } // check EditMode $this->bEditMode = false; // cookie is set AND contains "yes" if (isset($_COOKIE[WY_CK_EDITMODE]) && $_COOKIE[WY_CK_EDITMODE] == "yes") { $this->bEditMode = true; } else { if (stristr($this->sFormFieldValue(WY_QK_EDITMODE), "yes")) { $this->bEditMode = true; if (!headers_sent()) { setcookie(WY_QK_EDITMODE, "yes", $this->iCookieTTL(), $webyep_sCookiePath); } else { $this->log("can't set cookie " . WY_QK_EDITMODE . " to yes: headers already sent"); } } } if (stristr($this->sFormFieldValue(WY_QK_EDITMODE), "no")) { $this->bEditMode = false; if (isset($_COOKIE[WY_CK_EDITMODE])) { if (!headers_sent()) { setcookie(WY_QK_EDITMODE, "no", $this->iCookieTTL(), $webyep_sCookiePath); $_SESSION[WY_SV_IS_AUTH] = false; } else { $this->log("can't set cookie " . WY_QK_EDITMODE . " to no: headers already sent"); } } if ($this->sFormFieldValue(WY_QK_LOGOUT, "")) { if (!headers_sent()) { setcookie(WY_CK_USERNAME, "", $this->iCookieTTL(), $webyep_sCookiePath); $_COOKIE[WY_CK_USERNAME] = ""; setcookie(WY_CK_PASSWORD, "", $this->iCookieTTL(), $webyep_sCookiePath); $_COOKIE[WY_CK_PASSWORD] = ""; $_SESSION[WY_SV_IS_AUTH] = false; } } } }
function setup() { global $webyep_iLanguageID, $webyep_dLanguageStrings, $webyep_sLang, $goApp; $oLangFile = od_nil; $aLines = array(); $iLineCount = 0; $sLine = ""; $sKey = ""; $oP = od_clone($goApp->oProgramPath); $oP->addComponent("lstrings.dat"); $oLangFile = new WYFile($oP); $aLines = $oLangFile->aContentLines(); $iLineCount = count($aLines); for ($i = 0; $i < $iLineCount; $i++) { $sLine = $aLines[$i]; if (substr(trim($sLine), 0, 2) == "/*") { continue; } if (!$sKey && $sLine) { $sKey = $sLine; } else { if ($sLine) { $webyep_dLanguageStrings[$sKey][] = $sLine; } else { $sKey = ""; } } } $webyep_sLang = strtolower($webyep_sLang); if ($webyep_sLang == "" || $webyep_sLang == "auto") { // tetermine language: for now by looking at the spelling of the program folder if (strstr(WYApplication::sScriptPath(__FILE__), "/programm/lib/WYLanguage")) { $webyep_iLanguageID = WYLANG_GERMAN; } else { if (strstr(WYApplication::sScriptPath(__FILE__), "/program/lib/WYLanguage")) { $webyep_iLanguageID = WYLANG_ENGLISH; } else { $goApp->fatalError("Could not tetermine language"); } } } else { if ($webyep_sLang == "srpski") { $webyep_iLanguageID = WYLANG_SRPSKI; } else { if ($webyep_sLang == "polski") { $webyep_iLanguageID = WYLANG_POLISH; } else { if ($webyep_sLang == "swedish") { $webyep_iLanguageID = WYLANG_SWEDISH; } else { if ($webyep_sLang == "portuguese") { $webyep_iLanguageID = WYLANG_PORTUGUESE; } else { if ($webyep_sLang == "swedish") { $webyep_iLanguageID = WYLANG_SWEDISH; } else { if ($webyep_sLang == "dutch") { $webyep_iLanguageID = WYLANG_DUTCH; } else { if ($webyep_sLang == "french") { $webyep_iLanguageID = WYLANG_FRENCH; } } } } } } } } if (isset($GLOBALS["webyep_iForcedLanguageID"])) { $webyep_iLanguageID = $GLOBALS["webyep_iForcedLanguageID"]; $goApp->log("forced language ID to: {$webyep_iLanguageID}"); } }