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; }
<?php $oFlexi = FlexiController::getInstance(); //based on ?mod=xxxx $oControl = FlexiController::getCurrentController(); //echo "class: " . get_class($oControl); //var_dump($oControl->getView()->getVars()); echo $oControl->getView()->getVar("body"); //echo $oControl->renderLayout();