Beispiel #1
0
 private function getOutput()
 {
     if (!AnwEnv::_GET("outputname") || !AnwEnv::_GET("outputlang")) {
         return self::ERR_BADCALL;
     }
     $sOutput = "";
     try {
         //fake current page
         $_GET[AnwActionPage::GET_PAGENAME] = AnwEnv::_GET("outputcurrent");
         $sPageName = AnwEnv::_GET("outputname");
         if (substr($sPageName, 0, 1) == '/') {
             $sPageName = substr($sPageName, 1);
         }
         $sPageLang = AnwEnv::_GET("outputlang");
         //additionnal permissions check
         if (!AnwCurrentSession::isActionAllowed($sPageName, 'output', $sPageLang)) {
             return self::ERR_ACLS;
         }
         //get page execution result
         $bAutoLoadTranslatedPage = true;
         $bUseCache = false;
         //TODO?
         $sCacheKey = "";
         //"currentpage-".AnwActionPage::getCurrentPageName();
         $sOutput = AnWiki::includePage($sPageName, $sPageLang, $bAutoLoadTranslatedPage, $bUseCache, $sCacheKey);
     } catch (AnwPageNotFoundException $e) {
         $sOutput = self::ERR_NOTFOUND;
     } catch (AnwAclException $e) {
         $sOutput = self::ERR_ACLS;
     } catch (AnwException $e) {
         $sOutput = self::ERR_UNKNOWN;
     }
     return $sOutput;
 }
Beispiel #2
0
 private function getAnwloopFetchItems($nLoopLimit, $sLoopClass, $sLoopMatch, $asLoopLangs, $sLoopSort, $sLoopOrder, $asLoopFilters, $bDoCaching, $nLoopCacheTime)
 {
     $aoLoopsItems = array();
     try {
         //try to get it from cache
         if (!$bDoCaching) {
             throw new AnwCacheNotFoundException();
         }
         $sCacheKey = implode('-', array($nLoopLimit, $sLoopClass, $sLoopMatch, implode('.', $asLoopLangs), $sLoopSort, $sLoopOrder, md5(serialize($asLoopFilters))));
         $aoLoopsItems = AnwCache_loops::getCachedLoop($this->oPage->getId(), $sCacheKey, $nLoopCacheTime);
     } catch (AnwCacheNotFoundException $e) {
         //cache not found or disabled
         //fetch loop datas from database
         $aoLoopsItems = AnWiki::tag_anwloop($sLoopMatch, $sLoopClass, $asLoopLangs, $nLoopLimit, $sLoopSort, $sLoopOrder, $asLoopFilters);
         if ($bDoCaching) {
             //put result in cache for next time
             AnwCache_loops::putCachedLoop($this->oPage->getId(), $sCacheKey, $aoLoopsItems);
         }
     }
     return $aoLoopsItems;
 }