public static function getMediaURL($asPath, $sRole = "", $sName = "", $aParam = array()) { if (empty($asPath)) { return ""; } if ($asPath[0] != "/" && substr($asPath, 1, 2) != ":\\" && substr($asPath, 1, 2) != ":/") { $sTempPath = FlexiConfig::$sRootDir . "/" . $asPath; } else { $sTempPath = $asPath; } $sTempPath = str_replace("//", "/", $sTempPath); $sPath = realpath($sTempPath); if ($sPath === false) { throw new Exception("File missing: " . $sTempPath); } //echo "path: " . $sPath; //FlexiLogger::info(__METHOD__, "isadmin: " . (FlexiConfig::$bIsAdminPath? "yes": "no") . ": " . $sPath); $oControl = FlexiController::getCurrentController(); $sQuery = "r=" . $sRole . "&path=" . $sPath . "&name=" . $sName . (count($aParam) < 1 ? "" : "&" . http_build_query($aParam)); $sFilePath = FlexiCryptUtil::b64URLEncrypt($sQuery); $sURL = $oControl->url(array("p" => $sFilePath), "GetFile", "media", true); return $sURL; }
public function getLoginURL($sUserId = "", $sPassword = "", $aOptions = null) { $sURL = FlexiConfig::$sLoginURL; $sURL .= strpos($sURL, "?") !== false ? "&" : "?"; $sURL .= "username="******"error"]) ? "&error=" . $aOptions["error"] : ""; $bStandAlone = isset($aOptions["standalone"]) ? $aOptions["standalone"] : false; if ($bStandAlone) { $sURL .= "&standalone=1"; } if (!empty($aOptions["url"])) { $sURL .= "&refurl=" . FlexiCryptUtil::b64URLEncrypt($aOptions["url"]); } //echo ($bStandAlone) ? "standalone" : "full"; return flexiURL($sURL, $bStandAlone); }