function WYURL($s) { global $goApp; $sQuery = ""; $iPos = 0; $aQueryPairs = array(); $sPair = ""; $aKeyValue = array(); $iMaxProtocolIdentLen = 5; // https $iPos = strpos($s, ":"); if ($iPos !== false && $iPos <= $iMaxProtocolIdentLen) { $this->sProtocol = strtolower(substr($s, 0, $iPos)); $s = substr($s, $iPos + 1); } else { $this->sProtocol = "http"; } if (substr($s, 0, 2) == "//") { $iPos = strpos($s, "/", 2); if ($iPos !== false) { $this->sHost = substr($s, 2, $iPos - 2); $s = substr($s, $iPos); if (!$s) { $s = "/"; } } else { $this->sHost = substr($s, 2); $s = "/"; } } else { $this->sHost = WYApplication::sHTTPHost(); } $iPos = strpos($s, "#"); if ($iPos !== false) { $this->sAnchor = substr($s, $iPos + 1); $s = substr($s, 0, $iPos); } else { $this->sAnchor = ""; } $this->dQuery = array(); $iPos = strpos($s, "?"); if ($iPos !== false) { $sQuery = substr($s, $iPos + 1); $aQueryPairs = explode("&", $sQuery); foreach ($aQueryPairs as $sPair) { $aKeyValue = explode("=", $sPair); $this->dQuery[$aKeyValue[0]] = isset($aKeyValue[1]) ? urldecode($aKeyValue[1]) : ""; } $s = substr($s, 0, $iPos); } parent::WYPath($s); }
<?php $webyep_bDocumentPage = false; $webyep_sIncludePath = "."; include_once "{$webyep_sIncludePath}/webyep.php"; header("Content-Type: audio/x-ms-wax"); $sAuthor = ""; $sTitle = ""; $sURL = $_GET['URL']; if (strpos($sURL, ":") !== false || strpos($sURL, "\\") !== false) { exit(0); } $sURL = "http://" . WYApplication::sHTTPHost() . "/" . $sURL; echo "<ASX version = \"3.0\">\n"; echo " <Entry>\n"; echo " <Ref href=\"{$sURL}\" />\n"; if ($sAuthor) { echo " <Author>{$sAuthor}</Author>\n"; } if ($sTitle) { echo " <Title>{$sTitle}</Title>\n"; } echo " </Entry>\n"; echo "</ASX>\n";
function bAddEntry($sName, $sEMail, $sMessage) { global $goApp; $b = true; $dEntry = array(); $iID = 0; $iTime = time(); $aEntries =& $this->dContent[WY_DK_GB_ENTRIES]; $aBlockedIPs =& $this->dContent[WY_DK_GB_BLOCKED_IPS]; $sIP = $goApp->sClientIP(); if ($sIP && in_array($sIP, $aBlockedIPs)) { return false; } while ($this->bIDUsed($iID = mt_rand(1, 100000))) { } $sName = $this->sCleanupUserInput($sName); $sEMail = $this->sCleanupUserInput($sEMail); $sMessage = $this->sCleanupUserInput($sMessage); $dEntry = array(WY_DK_GB_ID => $iID, WY_DK_GB_TIME => $iTime, WY_DK_GB_NAME => $sName, WY_DK_GB_EMAIL => $sEMail, WY_DK_GB_MESSAGE => $sMessage, WY_DK_GB_IP => $sIP); array_unshift($aEntries, $dEntry); while (count($aEntries) && count($aEntries) > $this->iMaxEntries) { array_pop($aEntries); } $this->save(); if ($this->sEMail) { // we set sender to recipent to make sure the mail gets transmitted // even if some garbage was entered as sender - and replying to a // guestbook entry via email isn't the usual... $sFrom = $this->sEMail; $sSubject = sprintf(WYTS("GuestbookMailSubject"), WYApplication::sHTTPHost()); $oPageURL = od_clone(WYURL::oCurrentURL()); $oPageURL->dQuery[WY_QK_EDITMODE] = "yes" . mt_rand(1000, 9999); $sText = "********************************************************\n"; $sText .= "* {$sSubject}\n"; $sText .= "********************************************************\n\n"; $sText .= WYTS("AtDate") . " " . sWYTDate($iTime) . " " . WYTS("AtTime") . " " . sWYTTime($iTime) . "\n\n"; $sText .= str_replace("\\n", "\n", sprintf(WYTS("GuestbookMailText"), $sName, $sEMail, $sMessage)); $sText .= "\n\n"; $sText .= $oPageURL->sURL(true, true, true) . "\n\n"; $sText .= "********************************************************\n\n"; @mail($this->sEMail, $sSubject, $sText, "From: {$sFrom}"); } return $b; }
function iMemoryLimit() { $iMem = WYApplication::iByteSizeStringToBytes(ini_get("memory_limit")); return $iMem; }
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}"); } }