public function getLinkToSubscriberData() { $aArray = array(); $aArray[] = $this->countSubscriberGroupMemberships(); $aArray[] = LinkUtil::link(array('subscribers'), 'AdminManager', array('subscriber_group_id' => $this->getId())); return $aArray; }
public function renderFile() { $bCleanup = Manager::usePath() === self::DO_CLEANUP; $aReferences = ReferenceQuery::create()->find(); self::checkReferences($aReferences, $bCleanup); if (count(self::$REFERENCES_WITHOUT_FROM) === 0 && count(self::$REFERENCES_WITHOUT_TO) === 0) { if (!$bCleanup) { print TranslationPeer::getString('test_references.references_are_ok', null, null, array('count' => count($aReferences))); } else { print TranslationPeer::getString('test_references.wrong_references_removed'); print TagWriter::quickTag('p', array(), TagWriter::quickTag('a', array('href' => LinkUtil::link(array('test_references'), 'FileManager')), TranslationPeer::getString('test_references.test_again'))); } } else { if (count(self::$REFERENCES_WITHOUT_FROM) > 0) { print TagWriter::quickTag('p', array(), count(self::$REFERENCES_WITHOUT_FROM) . TranslationPeer::getString('test_references.loose_from_references_found')); foreach (self::$REFERENCES_WITHOUT_FROM as $oReference) { print TagWriter::quickTag('p', array(), $oReference->getFromModelName() . '/' . $oReference->getFromId()); } } if (count(self::$REFERENCES_WITHOUT_TO) > 0) { print TagWriter::quickTag('p', array(), count(self::$REFERENCES_WITHOUT_TO) . TranslationPeer::getString('test_references.loose_to_references_found')); foreach (self::$REFERENCES_WITHOUT_TO as $oReference) { print TagWriter::quickTag('p', array(), $oReference->getToModelName() . '/' . $oReference->getToId()); } } print TagWriter::quickTag('p', array(), TagWriter::quickTag('a', array('href' => LinkUtil::link(array('test_references', self::DO_CLEANUP), 'FileManager')), TranslationPeer::getString('test_references.remove_loose_ends'))); } }
public static function getReferences($aReferences) { if (count($aReferences) === null) { return null; } $aResult = array(); foreach ($aReferences as $oReference) { if ($oReference->getFromModelName() === 'LanguageObject') { $oReferencedFromObject = $oReference->getFrom(); if ($oReferencedFromObject) { $oContentObject = $oReferencedFromObject->getContentObject(); $aResult[$oReferencedFromObject->getId()]['title'] = TranslationPeer::getString('reference.used_in_page'); $aResult[$oReferencedFromObject->getId()]['page_name'] = $oContentObject->getPage()->getName(); $aResult[$oReferencedFromObject->getId()]['container_name'] = $oContentObject->getContainerName(); $aResult[$oReferencedFromObject->getId()]['edit_link'] = TagWriter::quickTag('a', array('href' => LinkUtil::link(array('content', $oContentObject->getPageId(), 'edit', $oContentObject->getId()), 'AdminManager')), 'edit')->render(); } else { // delete reference if getFrom() === null $oReference->delete(); } } else { $aResult[$oReference->getFromId()]['title'] = TranslationPeer::getString('reference.used_in_object'); $aResult[$oReference->getFromId()]['object_class'] = $oReference->getFromModelName(); $aResult[$oReference->getFromId()]['object_id'] = $oReference->getFromId(); } } return $aResult; }
public function renderFile() { $oDocument = new DOMDocument(); $oRoot = $oDocument->createElement("rss"); $oRoot->setAttribute('version', "2.0"); $oDocument->appendChild($oRoot); $oChannel = $oDocument->createElement("channel"); /** * @todo parametrize the argument */ $oQuery = FrontendJournalEntryQuery::create()->mostRecentFirst()->limit(10); if ($this->aJournalIds) { $oQuery->filterByJournalId($this->aJournalIds); } self::addSimpleAttribute($oDocument, $oChannel, 'title', $this->oJournalPage->getPageTitle()); self::addSimpleAttribute($oDocument, $oChannel, 'description', $this->oJournalPage->getDescription()); self::addSimpleAttribute($oDocument, $oChannel, 'link', LinkUtil::absoluteLink(LinkUtil::link($this->oJournalPage->getFullPathArray(), 'FrontendManager'), null, LinkUtil::isSSL())); self::addSimpleAttribute($oDocument, $oChannel, 'language', Session::language()); self::addSimpleAttribute($oDocument, $oChannel, 'ttl', "15"); $oRoot->appendChild($oChannel); $aJournalEntries = $oQuery->find(); foreach ($aJournalEntries as $oJournalEntry) { $oItem = $oDocument->createElement('item'); foreach ($oJournalEntry->getRssAttributes($this->aJournalIds ? $this->oJournalPage : null) as $sAttributeName => $mAttributeValue) { self::attributeToNode($oDocument, $oItem, $sAttributeName, $mAttributeValue); } $oChannel->appendChild($oItem); } print $oDocument->saveXML(); }
/** * The render method for the login page type. When on a login page type, this is given the login action as determined by the page type. Can be either null (default), 'password_forgotten', or 'password_reset' (or any other string of which a template "$sLoginType_action_$sAction" exists). * */ public function renderFrontend($sAction = 'login') { $aOptions = @unserialize($this->getData()); $sLoginType = isset($aOptions[self::MODE_SELECT_KEY]) ? $aOptions[self::MODE_SELECT_KEY] : 'login'; $this->oUser = Session::getSession()->getUser(); if ($this->oUser) { $sAction = 'logout'; } $oTemplate = $this->constructTemplate($sLoginType); if ($oTemplate->hasIdentifier('function_template')) { $oFunctionTemplate = null; try { $oFunctionTemplate = $this->constructTemplate("{$sLoginType}_action_{$sAction}"); } catch (Exception $e) { //Fallback to the default function template for the specified action $oFunctionTemplate = $this->constructTemplate("login_action_{$sAction}"); } $oTemplate->replaceIdentifier('function_template', $oFunctionTemplate, null, Template::LEAVE_IDENTIFIERS); } if ($this->oUser && $this->oPage) { $oPage = $this->oPage; if (Session::getSession()->hasAttribute('login_referrer_page')) { $oPage = Session::getSession()->getAttribute('login_referrer_page'); Session::getSession()->resetAttribute('login_referrer_page'); } if (!$this->oPage->getIsProtected() || Session::getSession()->getUser()->mayViewPage($this->oPage)) { $oTemplate->replaceIdentifier('fullname', Session::getSession()->getUser()->getFullName()); $oTemplate->replaceIdentifier('name', Session::getSession()->getUser()->getUsername()); $oTemplate->replaceIdentifier('action', LinkUtil::link(FrontendManager::$CURRENT_NAVIGATION_ITEM->getLink(), null, array('logout' => 'true'))); } else { $oFlash = Flash::getFlash(); $oFlash->addMessage('login.logged_in_no_access'); } } $oTemplate->replaceIdentifier('login_title', TranslationPeer::getString($sAction == 'password_forgotten' ? 'wns.login.password_reset' : 'wns.login')); $sOrigin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : LinkUtil::linkToSelf(); $oTemplate->replaceIdentifier('origin', $sOrigin); if ($sAction !== 'logout') { $oLoginPage = $this->oPage ? $this->oPage->getLoginPage() : null; $sLink = null; if ($oLoginPage === null) { $sLink = LinkUtil::link('', 'LoginManager'); } else { $sLink = LinkUtil::link($oLoginPage->getFullPathArray()); } $oTemplate->replaceIdentifier('action', $sLink); } if ($sAction === 'login') { $oLoginPage = $this->oPage ? $this->oPage->getLoginPage() : null; $sLink = null; if ($oLoginPage === null) { $sLink = LinkUtil::link(array(), 'LoginManager', array('password_forgotten' => 'true')); } else { $sLink = LinkUtil::link($oLoginPage->getFullPathArray(), null, array('password_forgotten' => 'true')); } $oTemplate->replaceIdentifier('password_forgotten_action', $sLink); } return $oTemplate; }
public function sendPasswordHint() { $oUser = UserQuery::create()->findPk($this->iUserId); if ($oUser) { LoginManager::sendResetMail($oUser, true, LinkUtil::link(array(), 'LoginManager')); return $this->iUserId; } return false; }
private function listInSidebar(Template $oTemplate) { $aWidgets = Module::listModulesByType(WidgetModule::getType()); $oLinks = new Template(TemplateIdentifier::constructIdentifier('links'), null, true); foreach ($aWidgets as $sWidgetName => $aWidgetInfo) { $oLink = new Template('<a href="{{href}}">{{name}}</a><br />', null, true); $oLink->replaceIdentifier('href', LinkUtil::link(array($sWidgetName), get_class())); $oLink->replaceIdentifier('name', WidgetModule::getDisplayNameByName($sWidgetName)); $oLinks->replaceIdentifierMultiple('links', $oLink); } $oTemplate->replaceIdentifierMultiple('sidebar_content', $oLinks); }
public function display(Template $oTemplate, $bIsPreview = false) { $sValue = $this->oPage->getPagePropertyValue('redirect-location', ''); if (is_numeric($sValue)) { $this->oPage = PageQuery::create()->findPk($sValue); LinkUtil::redirect(LinkUtil::link($this->oPage->getFullPathArray()), null, 'default', false); } else { if (!$sValue) { throw new Exception('Error in RedirectPageTypeModule->display(): no redirect location set'); } } LinkUtil::redirect($sValue, false); }
public function onFillPageAttributes($oCurrentPage, $oTemplate) { $oSearchPage = $oCurrentPage->getPageOfType('search_result'); if ($oSearchPage === null) { return; } $oTemplate->replaceIdentifier("search_action", LinkUtil::link($oSearchPage->getLinkArray())); foreach ($oTemplate->identifiersMatching('search_form', Template::$ANY_VALUE) as $oIdentifier) { $oSubTemplate = new Template($oIdentifier->getValue() ? $oIdentifier->getValue() : 'default', array(DIRNAME_TEMPLATES, 'search_form')); $oSubTemplate->replaceIdentifier("search_action", LinkUtil::link($oSearchPage->getLinkArray())); $oTemplate->replaceIdentifier($oIdentifier, $oSubTemplate); } }
public function getLinkToDocumentData() { $aArray = array(); if ($this->getDocumentCount() == 0) { $aArray[] = TranslationPeer::getString('wns.none'); } else { if ($this->getDocumentCount() === 1) { $aArray[] = $this->getDocumentCount() . ' ' . TranslationPeer::getString('wns.document'); } else { $aArray[] = $this->getDocumentCount() . ' ' . TranslationPeer::getString('wns.documents'); } } $aArray[] = LinkUtil::link(array('documents'), 'AdminManager', array('document_category_id' => $this->getId())); return $aArray; }
private function renderRecentJournalCommentTeaser($mJournalId) { $oJournalComment = JournalCommentQuery::create()->excludeUnverified()->joinJournalEntry()->useQuery('JournalEntry')->filterByJournalId($mJournalId)->excludeDraft()->endUse()->mostRecentFirst()->findOne(); if ($oJournalComment === null) { return null; } $oTemplate = $this->constructTemplate('journal_comment_teaser'); $sHref = LinkUtil::link($oJournalComment->getJournalEntry()->getLink($this->oJournalPage)) . '#comments'; $oTemplate->replaceIdentifier('title', TagWriter::quickTag('a', array('rel' => 'internal', 'href' => $sHref), $oJournalComment->getJournalEntry()->getTitle())); $oTemplate->replaceIdentifier('link_to_detail', $sHref); $oTemplate->replaceIdentifier('created_at', $oJournalComment->getCreatedAt('U')); $oTemplate->replaceIdentifier('name', $oJournalComment->getUsername()); $oTemplate->replaceIdentifier('text', $oJournalComment->getText(), null, Template::NO_HTML_ESCAPE); return $oTemplate; }
public function __construct($aRequestPath) { parent::__construct($aRequestPath); if (!isset($this->aPath[0])) { // Exceptions thrown in a file module’s constructor yield a UserError but that’s OK. throw new Exception("Error in DisplayDocumentFileModule->__construct: no key given"); } $this->oSession = Session::close(); $this->oDocument = DocumentQuery::create()->findPk(intval($this->aPath[0])); if ($this->oDocument === null || $this->oDocument->getIsProtected() && !$this->isAuthenticated()) { $oErrorPage = PageQuery::create()->findOneByName(Settings::getSetting('error_pages', 'not_found', 'error_404')); if ($oErrorPage) { LinkUtil::redirect(LinkUtil::link($oErrorPage->getLinkArray(), "FrontendManager")); } else { print "Not found"; exit; } } Session::close(); }
public function __construct($oReferencedObject, $sDefaultLanguageId = null) { $aMessageParameters = array(); foreach ($oReferencedObject->getReferees() as $oReferee) { $oFrom = $oReferee->getFrom(); $aFrom = array(); $aFrom["model"] = $oReferee->getFromModelName(); $aFrom["name"] = Util::descriptionForObject($oFrom, $sDefaultLanguageId); if (!$oFrom instanceof LanguageObject) { $aFrom["name"] = $aFrom["model"] . ': ' . $aFrom["name"]; } if (method_exists($oFrom, 'getAdminWidget')) { $oWidget = $oFrom->getAdminWidget(); $aFrom["admin_widget"] = array($oWidget->getModuleName(), $oWidget->getSessionKey()); } elseif (method_exists($oFrom, 'getAdminLink')) { $aFrom["admin_link"] = LinkUtil::link($oFrom->getAdminLink(), 'AdminManager'); } $aMessageParameters['references'][] = $aFrom; } $aMessageParameters['to'] = Util::nameForObject($oReferencedObject); parent::__construct('wns.still_referenced.message', $aMessageParameters, null, 0, $sDefaultLanguageId); }
public function getRssAttributes($oJournalPage = null, $bIsForRpc = false) { $aResult = array(); $aResult['title'] = $this->getTitle(); $aJournalPageLink = $this->getLink($oJournalPage); $aResult['link'] = LinkUtil::absoluteLink(LinkUtil::link($aJournalPageLink, 'FrontendManager'), null, LinkUtil::isSSL()); if ($bIsForRpc) { $aResult['description'] = RichtextUtil::parseStorageForBackendOutput($this->getText())->render(); } else { $aResult['description'] = RichtextUtil::parseStorageForFrontendOutput($this->getText())->render(); } $aResult['author'] = $this->getUserRelatedByCreatedBy()->getEmail() . ' (' . $this->getUserRelatedByCreatedBy()->getFullName() . ')'; $aTags = TagPeer::tagInstancesForObject($this); $aCategories = array(); foreach ($aTags as $oTag) { $aCategories[] = $oTag->getTagName(); } $aResult[$bIsForRpc ? 'categories' : 'category'] = $aCategories; if ($aJournalPageLink) { $aResult['guid'] = $aResult['link']; } else { $aResult['guid'] = array('isPermaLink' => 'false', '__content' => $this->getId() . "-" . $this->getJournal()->getId()); } $aResult['pubDate'] = date(DATE_RSS, (int) $this->getCreatedAtTimestamp()); if ($bIsForRpc) { $aResult['dateCreated'] = new xmlrpcval(iso8601_encode((int) $this->getCreatedAtTimestamp()), 'dateTime.iso8601'); $aResult['date_created_gmt'] = new xmlrpcval(iso8601_encode((int) $this->getCreatedAtTimestamp(), 1), 'dateTime.iso8601'); $aResult['postid'] = $this->getId(); } else { $aEnclosures = array(); foreach ($this->getImages() as $oImage) { $oDocument = $oImage->getDocument(); $aEnclosures[] = array('length' => $oDocument->getDataSize(), 'type' => $oDocument->getMimetype(), 'url' => LinkUtil::absoluteLink($oDocument->getLink(), null, LinkUtil::isSSL())); } $aResult['enclosure'] = $aEnclosures; } return $aResult; }
private function renderNavigationItem($oNavigationItem) { $oUrl = $this->oXmlDocument->createElement('url'); //Location, absolute url $sAbsoluteLink = LinkUtil::absoluteLink(LinkUtil::link($oNavigationItem->getLink(), 'FrontendManager'), null, LinkUtil::isSSL()); $oUrl->appendChild($this->element('loc', $sAbsoluteLink)); //Last modified if ($oNavigationItem instanceof PageNavigationItem) { $oUrl->appendChild($this->element('lastmod', $oNavigationItem->getMe()->getUpdatedAt('Y-m-d'))); } else { //@todo: figure out how to retrieve last modified for content other then text and configuration: FrontendModules } //Priority $iPriority = 1; if ($oNavigationItem->getCanonical() !== null) { $iPriority = 0.5; } $oUrl->appendChild($this->element('priority', $iPriority)); $this->oUrl->appendChild($oUrl); foreach ($oNavigationItem->getChildren(null, false, true) as $oChild) { $this->renderNavigationItem($oChild); } }
public function display(Template $oTemplate, $bIsPreview = false) { if (Manager::isPost()) { ArrayUtil::trimStringsInArray($_POST); } //1st step: user clicked on the recovery link // • Display email field if (isset($_REQUEST['password_forgotten'])) { $this->sAction = 'password_forgotten'; } //2nd step: user has entered an email address // • Send the email with the recovery link (and generate the hint) // • Add confirmation message to flash if (isset($_POST['password_reset_user_name'])) { $this->sAction = LoginManager::processPasswordReset(LinkUtil::link($this->oPage->getFullPathArray(), 'FrontendManager')); } //3rd step: user has clicked on the reset link in the e-mail // • Validate the hint // • Display a form for entering a new password (form also contains hidden fields for email and hint) // • Add the referrer to the session (again) if (isset($_REQUEST['recover_username'])) { $this->sAction = LoginManager::passwordReset(); } //4th step: user has submitted the new password // • Validate the hint (again) // • Validate password constraints // • Set the new password (if valid) // • Log in (if valid) // • Redirect to the referrer (if valid) if (isset($_POST['new_password'])) { $this->sAction = LoginManager::loginNewPassword(LinkUtil::link($this->oPage->getFullPathArray())); } if (isset($_POST[LoginManager::USER_NAME])) { LoginManager::login(null, null, LinkUtil::link($this->oPage->getFullPathArray())); } parent::display($oTemplate, $bIsPreview); }
public function getPageData() { $oPage = PageQuery::create()->findPk($this->iPageId); $aResult = $oPage->toArray(BasePeer::TYPE_PHPNAME, false); // addition related page fields $aResult['PageLink'] = LinkUtil::absoluteLink(LinkUtil::link($oPage->getFullPathArray(), 'FrontendManager', array(), AdminManager::getContentLanguage()), null, 'auto'); $aResult['PageHref'] = LinkUtil::absoluteLink(LinkUtil::link($oPage->getFullPathArray(), 'FrontendManager', array(), AdminManager::getContentLanguage()), null, 'default', true); // page properties are displayed if added to template try { $mAvailableProperties = $this->getAvailablePageProperties($oPage); if (count($mAvailableProperties) > 0) { $aResult['page_properties'] = $mAvailableProperties; } } catch (Exception $e) { ErrorHandler::handleException($e, true); } // page references are displayed if exist $mReferences = AdminModule::getReferences(ReferencePeer::getReferences($oPage)); $aResult['CountReferences'] = count($mReferences); if ($mReferences !== null) { $aResult['page_references'] = $mReferences; } return $aResult; }
/** * Closes the consolidator and adds the consolidation link. * Sometimes consolidatable resources are interrupted by ones that can’t be consolidated (if they were added with a flag prohibiting consolidation or if they have an IE condition or if they are from an external source) */ private function cleanupConsolidator(&$aConsolidatorInfo) { if ($aConsolidatorInfo === null) { return; } $aLocation = array('consolidated_resource', $aConsolidatorInfo['type']); foreach ($aConsolidatorInfo['contents'] as $oCache) { $aLocation[] = $oCache->getStrategy()->encodedKey($oCache); } $sLink = LinkUtil::absoluteLink(LinkUtil::link($aLocation, 'FileManager'), null, 'default', true); $aConsolidatorLink = array('location' => $sLink, 'template' => $aConsolidatorInfo['type']); $this->aIncludedResources[$aConsolidatorInfo['priority']][$aConsolidatorInfo['key']] = $aConsolidatorLink; $aConsolidatorInfo = null; }
public function getUserLinkData() { $aArray = array(); $aArray[] = $this->getUserCount() . ' ' . TranslationPeer::getString('wns.user'); $aArray[] = LinkUtil::link(array('users'), 'AdminManager', array('group_id' => $this->getId())); return $aArray; }
public function renderAdmin(Template $oTemplate = null) { if ($this->sModuleName === null) { $this->sModuleName = self::DEFAULT_MODULE; } try { $this->oModule = AdminModule::getModuleInstance($this->sModuleName); } catch (Exception $e) { LinkUtil::redirect(LinkUtil::link(array(self::DEFAULT_MODULE, 'module_not_found', $this->sModuleName))); } if (!Module::isModuleAllowed('admin', $this->sModuleName, Session::getSession()->getUser())) { LinkUtil::redirect(LinkUtil::link(array(self::DEFAULT_MODULE, 'module_denied', $this->sModuleName))); } $this->doAdmin($oTemplate); }
public function getDisplayLink() { return LinkUtil::link(array('display_newsletter', 'newsletter', $this->getId()), 'FileManager'); }
/** * Create internal links. * The identifier value signifies the destination. It can be either a path or one of the following special values: “to_self”, “host_only”, “base_href”. * The following additional parameters are allowed: “is_absolute”, “page”, “ignore_request”, “manager” * Implicitly, the value of is_absolute determines the type of absolute link generated. * A value of “false” will not generate absolute links. * Using “auto” will determine server-side whether to use http or https for protocol. * Setting is_absolute to “http” or “https” will set the protocol accordingly. * Any other value (including “true”) will generate a protocol-relative URL (starting with //), meaning the reference is determined on the client-side. * Creating a “base_href” link will always make it absolute and not explicitly setting “is_absolute” will default to “auto” (instead of “true” as is the case with all other link types). */ public function writeLink($oTemplateIdentifier) { $sDestination = $oTemplateIdentifier->getValue(); $aParameters = $oTemplateIdentifier->getParameters(); $bIsAbsolute = false; $bAbsoluteType = $oTemplateIdentifier->getParameter('is_absolute'); if ($bAbsoluteType === 'http' || $bAbsoluteType === 'false') { $bAbsoluteType = false; } else { if ($bAbsoluteType === 'https' || $bAbsoluteType === 'true') { $bAbsoluteType = true; } else { if ($bAbsoluteType === 'auto') { $bAbsoluteType = LinkUtil::isSSL(); } else { if ($oTemplateIdentifier->hasParameter('is_absolute')) { $bAbsoluteType = null; } else { $bAbsoluteType = 'default'; } } } } unset($aParameters['is_absolute']); if ($sDestination === "to_self") { $bIgnoreRequest = $oTemplateIdentifier->getParameter('ignore_request') === 'true'; unset($aParameters['ignore_request']); $sDestination = LinkUtil::linkToSelf(null, $aParameters, $bIgnoreRequest); } else { if ($sDestination === "host_only") { return LinkUtil::absoluteLink(''); } else { if ($sDestination === "base_href") { $sDestination = MAIN_DIR_FE_PHP; $bIsAbsolute = true; if (!$oTemplateIdentifier->hasParameter('is_absolute')) { $bAbsoluteType = LinkUtil::isSSL(); } } elseif ($sPage = $oTemplateIdentifier->getParameter('page')) { $oPage = PageQuery::create()->findOneByIdentifier($sPage); if ($oPage === null) { $oPage = PageQuery::create()->findOneByName($sPage); } $sManager = 'FrontendManager'; if ($oTemplateIdentifier->hasParameter('manager')) { $sManager = $oTemplateIdentifier->getParameter('manager'); } if ($oPage) { $sDestination = LinkUtil::link($oPage->getLink(), $sManager); } } else { $sManager = null; if ($oTemplateIdentifier->hasParameter('manager')) { unset($aParameters['manager']); $sManager = $oTemplateIdentifier->getParameter('manager'); } $sDestination = LinkUtil::link($sDestination, $sManager, $aParameters); } } } return LinkUtil::absoluteLink($sDestination, null, $bAbsoluteType, !$bIsAbsolute); }
public function getURL() { return LinkUtil::link($this->getLinkArray(), 'FrontendManager') . '#' . $this->getKey(); }
/** * @deprecated */ public static function getDisplayUrl($iDocumentId, $aUrlParameters = array(), $sFileModule = 'display_document') { return LinkUtil::link(array($sFileModule, $iDocumentId), "FileManager", $aUrlParameters); }
/** * Used as a callback to calculate the value of `page_link` identifiers in the template. * @param TemplateIdentifier $oTemplateIdentifier The TemplateIdentifier whose name is “page_link” * @return Template the Template containing a link * used in fillAttributes to replace page_link identifiers * - get a page by name * - get a page by id * - get a page by identifier string * - get nearest neighbor page {@link PageQuery::findOneByName()} */ public static function replacePageLinkIdentifier($oTemplateIdentifier) { $oPage = null; $sIdentifier = $oTemplateIdentifier->getParameter('identifier'); if ($sIdentifier !== null) { $oPage = PageQuery::create()->findOneByIdentifier($sIdentifier); } else { $iId = $oTemplateIdentifier->getParameter('id'); if ($iId !== null) { $oPage = PageQuery::create()->findPk($iId); } else { $sName = $oTemplateIdentifier->getParameter('name'); if ($sName !== null) { if ($oTemplateIdentifier->hasParameter('nearest_neighbour')) { $oPage = self::$CURRENT_PAGE->getPageOfName($sName); } else { $oPage = PageQuery::create()->findOneByName($sName); } } } } if ($oPage === null) { return null; } // hack to be able to display another name than the page_name, thanks to sl if ($oTemplateIdentifier->hasParameter('href_only')) { return LinkUtil::link($oPage->getLink()); } if (self::$CURRENT_PAGE !== null && self::$CURRENT_PAGE->getId() == $oPage->getId()) { return TagWriter::quickTag('span', array('class' => "meta_navigation {$oPage->getName()}", 'title' => $oPage->getPageTitle()), $oPage->getLinkText()); } return TagWriter::quickTag('a', array('class' => "meta_navigation {$oPage->getName()}", 'href' => LinkUtil::link($oPage->getLink()), 'title' => $oPage->getPageTitle()), $oPage->getLinkText()); }
/** * displayNewsletterList() * @param int/array subscriber group ids * @param boolean detail view link type * * Description $bDisplayFileLink * • true > render link to original newsletter view of get_file/display_newsletter/ analog to alternative view linked in newsletter * • false: display database "newsletter_body" only in normal page view * * @return Template */ private function displayNewsletterList($mSubscriberGroupId, $bDisplayFileLink = true) { $oQuery = NewsletterQuery::create()->distinct()->filterApprovedForLanguage(Session::language())->orderByCreatedAt(Criteria::DESC); if ($mSubscriberGroupId) { $oQuery->joinNewsletterMailing()->useQuery('NewsletterMailing')->filterBySubscriberGroupId($mSubscriberGroupId)->endUse(); } $aRecentNewsletters = $oQuery->limit(10)->find(); $bHasNewsletters = count($aRecentNewsletters) > 0; $oTemplate = $this->constructTemplate('newsletter_display_list'); if ($bHasNewsletters === false) { $oTemplate->replaceIdentifier('newsletter_item', TagWriter::quickTag('p', array('class' => 'no_result_message'), TranslationPeer::getString('wns.newsletter.no_newsletter_available'))); } if ($bDisplayFileLink) { $oItemPrototype = $this->constructTemplate('newsletter_list_item_file_module'); } else { $this->setNewsletter($mSubscriberGroupId); $oItemPrototype = $this->constructTemplate('newsletter_list_item'); } $oPage = FrontendManager::$CURRENT_PAGE; foreach ($aRecentNewsletters as $oNewsletter) { $oItemTemplate = clone $oItemPrototype; $oItemTemplate->replaceIdentifier('subject', $oNewsletter->getSubject()); if ($bDisplayFileLink) { $oItemTemplate->replaceIdentifier('newsletter_link', $oNewsletter->getDisplayLink()); } else { if ($oNewsletter === self::$NEWSLETTER) { $oItemTemplate->replaceIdentifier('class_active', ' class="active"', null, Template::NO_HTML_ESCAPE); } $oItemTemplate->replaceIdentifier('newsletter_link', LinkUtil::link($oPage->getFullPathArray(array(self::IDENTIFIER_DETAIL, $oNewsletter->getId())))); } $oItemTemplate->replaceIdentifier('date', $oNewsletter->getLastSent()); $oItemTemplate->replaceIdentifier('template_name', $oNewsletter->getTemplateName()); $oItemTemplate->replaceIdentifier('language_id', $oNewsletter->getLanguageId()); $oTemplate->replaceIdentifierMultiple('newsletter_item', $oItemTemplate); } return $oTemplate; }
public static function redirectToManager($mPath = "", $mManager = null, $aParameters = array(), $bIncludeLanguage = null, $bPermanent = false) { self::redirect(LinkUtil::link($mPath, $mManager, $aParameters, $bIncludeLanguage), null, 'default', $bPermanent); }
public function getLink() { return LinkUtil::link($this->getLinkArray(), 'FrontendManager'); }
/** * GET method handler for directories * * This is a very simple mod_index lookalike. * See RFC 2518, Section 8.4 on GET/HEAD for collections * * @param string directory path * @return void function has to handle HTTP response itself */ private function getDir($sFullPath, &$aOptions) { if (!StringUtil::endsWith(Manager::getOriginalPath(), '/')) { LinkUtil::redirect($this->_slashify(LinkUtil::link($aOptions["path"]))); } // fixed width directory column format $format = "%15s\t %-19s\t%-s\n"; $handle = @opendir($sFullPath); if (!$handle) { return false; } echo "<html><head><title>Index of " . htmlspecialchars($aOptions['path']) . "</title></head>\n"; echo "<h1>Index of " . htmlspecialchars($aOptions['path']) . "</h1>\n"; echo "<pre>"; printf($format, "Size", "Last modified", "Filename"); echo "<hr>"; while ($filename = readdir($handle)) { if ($filename === '.') { continue; } if (!$this->hasReadAccess($aOptions["path"] . '/' . $filename)) { continue; } //Add the file $sSubPath = $sFullPath . "/" . $filename; $name = htmlspecialchars($filename); $name_href = htmlspecialchars(rawurlencode($filename)); printf($format, number_format(filesize($sSubPath)), strftime("%Y-%m-%d %H:%M:%S", filemtime($sSubPath)), "<a href='{$name_href}'>{$name}</a>"); } echo "</pre>"; closedir($handle); echo "</html>\n"; exit; }
public function getLicenseImageUrl() { $aInfo = $this->getLicenseInfo(); if (!isset($aInfo['image'])) { return null; } return LinkUtil::link(array('license_image', $this->getLicense()), 'FileManager'); }