/** * @see wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { WCF::getTPL()->assign(array( 'option' => $option, 'value' => $value )); return WCF::getTPL()->fetch('textareaOptionType'); }
public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { //get id attribute $fileID = 0; if (isset($openingTag['attributes'][0])) { $fileID = $openingTag['attributes'][0]; } $file = new File($fileID); if ($file === null) { return ''; } if (preg_match('~(image/*)+~', $file->fileType)) { $this->isImage = true; } if ($this->isImage && isset($openingTag['attributes'][1])) { $this->align = $openingTag['attributes'][1]; } if ($this->isImage && isset($openingTag['attributes'][2])) { $this->width = $openingTag['attributes'][2]; } if ($this->isImage && isset($openingTag['attributes'][3])) { $this->caption = $openingTag['attributes'][3]; } WCF::getTPL()->assign(array('_file' => $file, '_align' => $this->align, '_width' => $this->width, '_isImage' => $this->isImage, '_caption' => $this->caption)); return WCF::getTPL()->fetch('cmsFileBBCodeTag', 'cms'); }
/** * @see wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { $useRequestData = count($_POST) ? true : false; I18nHandler::getInstance()->assignVariables($useRequestData); WCF::getTPL()->assign(array('option' => $option, 'value' => $value)); return WCF::getTPL()->fetch('textareaI18nOptionType'); }
/** * @see wcf\system\package\plugin\IPackageInstallationPlugin::install() */ public function install() { parent::install(); // extract files.tar to temp folder $sourceFile = $this->installation->getArchive()->extractTar($this->instruction['value'], 'acptemplates_'); // create file handler $fileHandler = new ACPTemplatesFileHandler($this->installation); // extract content of files.tar $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir)); try { $fileInstaller = $this->installation->extractFiles($packageDir.'acp/templates/', $sourceFile, $fileHandler); } catch (SystemException $e) { WCF::getTPL()->assign(array( 'exception' => $e )); WCF::getTPL()->display('packageInstallationFileInstallationFailed'); exit; } // delete temporary sourceArchive @unlink($sourceFile); }
/** * @see \wcf\system\event\IEventListener::execute() */ public function execute($eventObj, $className, $eventName) { // try { // $request = new HTTPRequest(self::FEED_URL); // $request->execute(); // $feedData = $request->getReply(); // $feedData = $feedData['body']; // } // catch (SystemException $e) { // // log error // $e->getExceptionID(); // return; // } // if (!$xml = simplexml_load_string($feedData)) { // return; // } $feed = array(); // $i = 10; // foreach ($xml->channel[0]->item as $item) { // if ($i -- == 0) { // break; // } // $feed[] = array( // 'title' => (string) $item->title, // 'description' => (string) $item->description, // 'link' => (string) $item->guid, // 'time' => strtotime((string) $item->pubDate) // ); // } WCF::getTPL()->assign(array('codequakeNewsFeed' => $feed)); }
/** * @see wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( 'availableUpdates' => $this->availableUpdates )); }
/** * Assignes the acl values to the template. * * @param integer $objectTypeID */ public function assignVariables($objectTypeID) { if (WCF::getTPL()->get('aclValues') === null) { WCF::getTPL()->assign('aclValues', array()); } if (!$this->assignVariablesDisabled && isset($_POST['aclValues'])) { $values = $_POST['aclValues']; $data = $this->getPermissions($objectTypeID, array(), null, true); foreach ($values as $type => $optionData) { if ($type === 'user') { $users = User::getUsers(array_keys($optionData)); } $values[$type] = array('label' => array(), 'option' => array()); foreach ($optionData as $typeID => $optionValues) { foreach ($optionValues as $optionID => $optionValue) { if (!isset($data['options'][$optionID])) { unset($optionValues[$optionID]); } } if (empty($optionValues)) { continue; } $values[$type]['option'][$typeID] = $optionValues; if ($type === 'group') { $values[$type]['label'][$typeID] = UserGroup::getGroupByID($typeID)->getName(); } else { $values[$type]['label'][$typeID] = $users[$typeID]->username; } } } $values['options'] = $data['options']; $values['categories'] = $data['categories']; WCF::getTPL()->append('aclValues', array($objectTypeID => $values)); } }
/** * @see \wcf\data\IGroupedUserListAction::getGroupedUserList() */ public function getGroupedUserList() { $year = $month = $day = 0; $value = explode('-', $this->parameters['date']); if (isset($value[0])) { $year = intval($value[0]); } if (isset($value[1])) { $month = intval($value[1]); } if (isset($value[2])) { $day = intval($value[2]); } // get users $users = array(); $userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options'); if (isset($userOptions['birthday'])) { $birthdayUserOption = $userOptions['birthday']; $userIDs = UserBirthdayCache::getInstance()->getBirthdays($month, $day); $userList = new UserProfileList(); $userList->setObjectIDs($userIDs); $userList->readObjects(); foreach ($userList->getObjects() as $user) { $birthdayUserOption->setUser($user->getDecoratedObject()); if (!$user->isProtected() && $birthdayUserOption->isVisible() && $user->getAge($year) >= 0) { $users[] = $user; } } } WCF::getTPL()->assign(array('users' => $users, 'year' => $year)); return array('pageCount' => 1, 'template' => WCF::getTPL()->fetch('userBirthdayList')); }
/** * @see \wcf\system\captcha\ICaptchaHandler::getFormElement() */ public function getFormElement() { if ($this->question === null) { $this->readCaptchaQuestion(); } return WCF::getTPL()->fetch('captchaQuestion', 'wcf', array('captchaQuestion' => $this->captchaQuestion, 'captchaQuestionAnswered' => WCF::getSession()->getVar('captchaQuestionSolved_' . $this->captchaQuestion) !== null, 'captchaQuestionObject' => $this->question)); }
/** * @see wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { // get options $options = $this->parseEnableOptions($option); WCF::getTPL()->assign(array('disableOptions' => $options['disableOptions'], 'enableOptions' => $options['enableOptions'], 'option' => $option, 'selectOptions' => $option->parseSelectOptions(), 'value' => $value)); return WCF::getTPL()->fetch('selectOptionType'); }
/** * Loads the active dashboard boxes for the given object type and page. * * @param string $objectType * @param \wcf\page\IPage $page */ public function loadBoxes($objectType, IPage $page) { $objectTypeObj = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.dashboardContainer', $objectType); if ($objectTypeObj === null) { throw new SystemException("Unable to find object type '" . $objectType . "' for definition 'com.woltlab.wcf.user.dashboardContainer'"); } $boxIDs = array(); if (isset($this->pageCache[$objectTypeObj->objectTypeID]) && is_array($this->pageCache[$objectTypeObj->objectTypeID])) { foreach ($this->pageCache[$objectTypeObj->objectTypeID] as $boxID) { $boxIDs[] = $boxID; } } $contentTemplate = $sidebarTemplate = ''; foreach ($boxIDs as $boxID) { $className = $this->boxCache[$boxID]->className; if (!ClassUtil::isInstanceOf($className, 'wcf\\system\\dashboard\\box\\IDashboardBox')) { throw new SystemException("'" . $className . "' does not implement 'wcf\\system\\dashboard\\box\\IDashboardBox'"); } $boxObject = new $className(); $boxObject->init($this->boxCache[$boxID], $page); if ($this->boxCache[$boxID]->boxType == 'content') { $contentTemplate .= $boxObject->getTemplate(); } else { $sidebarTemplate .= $boxObject->getTemplate(); } } WCF::getTPL()->assign(array('__boxContent' => $contentTemplate, '__boxSidebar' => $sidebarTemplate)); }
/** * @see \wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { $nodeTree = new PageNodeTree(); $nodeList = $nodeTree->getIterator(); WCF::getTPL()->assign(array('nodeList' => $nodeList, 'option' => $option, 'value' => !is_array($value) ? explode("\n", $value) : $value)); return WCF::getTPL()->fetch('pageMultiSelectOptionType', 'cms'); }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); // get phpinfo() output ob_start(); phpinfo(); $info = ob_get_contents(); ob_end_clean(); // parse output $info = preg_replace('%^.*<body>(.*)</body>.*$%s', '$1', $info); // style fixes // remove first table $info = preg_replace('%<table.*?</table>(<br />)?%s', '', $info, 1); // float logos $info = preg_replace('%<img([^>]*)>%s', '<img style="float:right" \\1>', $info, 1); // fix tables $info = preg_replace('%<h2>(.*?)</h2>\\s*<table( border="0" cellpadding="3" width="600")?>%', '<div class="tabularBox tabularBoxTitle marginTop"><header><h2>\\1</h2></header><table class="table" style="table-layout:fixed;">', $info); $info = preg_replace('%<table( border="0" cellpadding="3" width="600")?>%', '<div class="tabularBox marginTop"><table class="table" style="table-layout:fixed;">', $info); $info = preg_replace('%<tr><td class="e">(\\w+ )<\\/td><\\/tr>%', '<tr><td class="e">\\1</td><td></td></tr>', $info); $info = str_replace('</table>', '</table></div>', $info); // fix display of disable_functions & disable_classes $info = preg_replace_callback('%<td class="e">disable_(?P<t>functions|classes)</td><td class="v">(?P<l>.*?)</td><td class="v">(?P<m>.*?)</td>%s', function ($match) { $ret = '<td class="e">disable_' . $match['t'] . '</td>'; $ret .= '<td class="v">' . str_replace(' ', ', ', rtrim(wordwrap(str_replace(',', ' ', $match['l'])))) . '</td>'; $ret .= '<td class="v">' . str_replace(' ', ', ', rtrim(wordwrap(str_replace(',', ' ', $match['m'])))) . '</td>'; return $ret; }, $info); WCF::getTPL()->assign(array('phpInfo' => $info)); }
/** * @see wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( 'deletedPackageUpdateServerID' => $this->deletedPackageUpdateServerID )); }
/** * @see wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( 'languages' => $this->objectList->getObjects() )); }
/** * @see wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( 'deletedGroups' => $this->deletedGroups )); }
/** * @see wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { // get options $selectOptions = $option->parseSelectOptions(); $availableOptions = $option->parseMultipleEnableOptions(); $options = array( 'disableOptions' => array(), 'enableOptions' => array() ); foreach ($availableOptions as $key => $enableOptions) { $optionData = Option::parseEnableOptions($enableOptions); $options['disableOptions'][$key] = $optionData['disableOptions']; $options['enableOptions'][$key] = $optionData['enableOptions']; } WCF::getTPL()->assign(array( 'disableOptions' => $options['disableOptions'], 'enableOptions' => $options['enableOptions'], 'option' => $option, 'selectOptions' => $selectOptions, 'value' => $value )); return WCF::getTPL()->fetch($this->templateName); }
/** * @see wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( 'applicationList' => $this->applicationList )); }
/** * @see \wcf\system\bbcode\IBBCode::getParsedTag() */ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { if ($parser->getOutputType() == 'text/html') { $quoteLink = !empty($openingTag['attributes'][1]) ? $openingTag['attributes'][1] : ''; $externalQuoteLink = !empty($openingTag['attributes'][1]) ? !ApplicationHandler::getInstance()->isInternalURL($openingTag['attributes'][1]) : false; if (!$externalQuoteLink) { $quoteLink = preg_replace('~^https?://~', RouteHandler::getProtocol(), $quoteLink); } $quoteAuthor = !empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : ''; $quoteAuthorObject = null; if ($quoteAuthor && !$externalQuoteLink) { $quoteAuthorLC = mb_strtolower(StringUtil::decodeHTML($quoteAuthor)); foreach (MessageEmbeddedObjectManager::getInstance()->getObjects('com.woltlab.wcf.quote') as $user) { if (mb_strtolower($user->username) == $quoteAuthorLC) { $quoteAuthorObject = $user; break; } } } WCF::getTPL()->assign(array('content' => $content, 'quoteLink' => $quoteLink, 'quoteAuthor' => $quoteAuthor, 'quoteAuthorObject' => $quoteAuthorObject, 'isExternalQuoteLink' => $externalQuoteLink)); return WCF::getTPL()->fetch('quoteBBCodeTag'); } else { if ($parser->getOutputType() == 'text/simplified-html') { return WCF::getLanguage()->getDynamicVariable('wcf.bbcode.quote.text', array('content' => $content, 'cite' => !empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : '')) . "\n"; } } }
/** * Handles a http request. * * @param string $application * @param boolean $isACPRequest */ public function handle($application = 'wcf', $isACPRequest = false) { $this->isACPRequest = $isACPRequest; if (!RouteHandler::getInstance()->matches()) { throw new SystemException("Cannot handle request, no valid route provided."); } // build request $this->buildRequest($application); // handle offline mode if (!$isACPRequest && defined('OFFLINE') && OFFLINE) { if (!WCF::getSession()->getPermission('admin.general.canViewPageDuringOfflineMode') && !$this->activeRequest->isAvailableDuringOfflineMode()) { if (isset($_SERVER['X-Requested-With']) && ($_SERVER['X-Requested-With'] == 'XMLHttpRequest')) { throw new AJAXException(WCF::getLanguage()->get('wcf.ajax.error.permissionDenied'), AJAXException::INSUFFICIENT_PERMISSIONS); } else { WCF::getTPL()->assign(array( 'templateName' => 'offline' )); WCF::getTPL()->display('offline'); } exit; } } // start request $this->activeRequest->execute(); }
/** * Loads a list of recent activity entries. * * @return array */ public function load() { $eventList = new ViewableUserActivityEventList(); if ($this->parameters['lastEventID']) { $eventList->getConditionBuilder()->add("user_activity_event.time <= ?", array($this->parameters['lastEventTime'])); $eventList->getConditionBuilder()->add("user_activity_event.eventID < ?", array($this->parameters['lastEventID'])); } else { $eventList->getConditionBuilder()->add("user_activity_event.time < ?", array($this->parameters['lastEventTime'])); } // profile view if ($this->parameters['userID']) { $eventList->getConditionBuilder()->add("user_activity_event.userID = ?", array($this->parameters['userID'])); } else { if ($this->parameters['filteredByFollowedUsers'] && count(WCF::getUserProfileHandler()->getFollowingUsers())) { $eventList->getConditionBuilder()->add('user_activity_event.userID IN (?)', array(WCF::getUserProfileHandler()->getFollowingUsers())); } } $eventList->readObjects(); $lastEventTime = $eventList->getLastEventTime(); if (!$lastEventTime) { return array(); } // removes orphaned and non-accessable events UserActivityEventHandler::validateEvents($eventList); if (!count($eventList)) { return array(); } // parse template WCF::getTPL()->assign(array('eventList' => $eventList)); $events = $eventList->getObjects(); return array('lastEventID' => end($events)->eventID, 'lastEventTime' => $lastEventTime, 'template' => WCF::getTPL()->fetch('recentActivityListItem')); }
public function getTemplate() { $nodeTree = new NewsCategoryNodeTree($this->objectTypeName); $nodeList = $nodeTree->getIterator(); WCF::getTPL()->assign(array('nodeList' => $nodeList)); return WCF::getTPL()->fetch('newsSitemap', 'cms'); }
/** * @see \wcf\system\bbcode\IBBCode::getParsedTag() */ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { // copyright TeraliosBBCodesCopyright::callCopyright(); $content = StringUtil::trim($content); // check controller for parsing foot notes. if (static::$parse == null) { static::parseFootnotes(); } // footnote and fn parse. if ($openingTag['name'] == 'fn') { if (self::$parse == true) { // no content and no index for content tag: drop footnote. $content = StringUtil::trim($content); if (empty($content) && !isset($openingTag['attributes'][0])) { return ''; } // build hash from content or use index for content attribute $hash = !empty($content) ? StringUtil::getHash($content) : StringUtil::getHash($openingTag['attributes'][0]); // check footnotes for existing. if (!isset(static::$footnotes[$hash])) { // check for buffred content. if (empty($content) && isset(static::$footnoteContent[$hash])) { $content = static::$footnoteContent[$hash]; } $footnoteIndex = FootnoteMap::getInstance()->add($content, Footnote::TYPE_BBCODE); static::$footnotes[$hash] = $footnoteIndex; } else { $footnoteIndex = static::$footnotes[$hash]; } // get index for tag attribute. $footnoteTagIndex = Footnote::getTagIndex($footnoteIndex); } else { $footnoteTagIndex = ''; $footnoteIndex = static::$indexNoParse; ++static::$indexNoParse; } WCF::getTPL()->assign(array('footnoteTagID' => $footnoteTagIndex, 'footnoteIndex' => $footnoteIndex)); return WCF::getTPL()->fetch('footnoteBBCode'); } else { if ($openingTag['name'] == 'fnc') { if (static::$parse == false) { return ''; } $contentIndex = StringUtil::getHash($openingTag['attributes'][0]); // set content or buffered. if (isset(static::$footnotes[$contentIndex])) { $index = static::$footnotes[$contentIndex]; $footnote = FootnoteMap::getInstance()->getFootnote($index); if ($footnote != false) { $footnote->setText(StringUtil::trim($content), Footnote::TYPE_HTML); } } else { static::$footnoteContent[$contentIndex] = $content; } return ''; } } }
/** * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render() */ protected function render() { if (!count($this->pageList)) { return ''; } WCF::getTPL()->assign(array('pageList' => $this->pageList)); return WCF::getTPL()->fetch('dashboardBoxMostViewedPages', 'cms'); }
/** * @see \wcf\page\IPage::show() */ public function show() { parent::show(); // set correct content-type @header('Content-Type: application/rss+xml; charset=UTF-8'); // show template WCF::getTPL()->display($this->templateName, $this->application, false); }
/** * @see wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { WCF::getTPL()->assign(array( 'option' => $option, 'selectOptions' => $option->parseSelectOptions(), 'value' => explode("\n", $value) )); return WCF::getTPL()->fetch('multiSelectOptionType'); }
/** * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render() */ protected function render() { if (!count($this->entryList)) { return ''; } WCF::getTPL()->assign(array('entryList' => $this->entryList)); return WCF::getTPL()->fetch('dashboardSidebarBoxMostViewedNewsEntries', 'cms'); }
/** * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render() */ protected function render() { if (!count($this->visits)) { return ''; } WCF::getTPL()->assign(array('visits' => $this->visits)); return WCF::getTPL()->fetch('dashboardBoxWeeklyVisitors', 'cms'); }
/** * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render() */ protected function render() { if ($this->tagCloud === null) { return ''; } WCF::getTPL()->assign(array('tags' => $this->tagCloud->getTags(), 'taggableObjectType' => 'de.incendium.cms.news.entry')); return WCF::getTPL()->fetch('tagCloudBox'); }
/** * @see \wcf\system\sitemap\ISitemapProvider::getTemplate() */ public function getTemplate() { // get all accessible news categories $categoryList = new NewsCategoryNodeTree('de.incendium.cms.news.category'); WCF::getTPL()->assign(array('categoryNodeList' => $categoryList->getIterator())); // init template return WCF::getTPL()->fetch('newsSitemap', 'cms'); }