public function renderXml() { $system =& $this->_params['system']; $widgets =& $this->_params['widgets']; $document = new DOMDocument('1.0', 'utf-8'); $document->formatOutput = true; $rootNode = $document->createElement('widget_framework'); $rootNode->setAttribute('version', $system['version_string']); $document->appendChild($rootNode); foreach ($widgets as $widget) { $widgetNode = $document->createElement('widget'); $widgetNode->setAttribute('title', $widget['title']); $widgetNode->setAttribute('class', $widget['class']); $optionsNode = $document->createElement('options'); $optionsString = $widget['options']; if (!is_string($optionsString)) { $optionsString = serialize($optionsString); } $optionsData = XenForo_Helper_DevelopmentXml::createDomCdataSection($document, $optionsString); $optionsNode->appendChild($optionsData); $widgetNode->appendChild($optionsNode); $widgetNode->setAttribute('position', $widget['position']); $widgetNode->setAttribute('display_order', $widget['display_order']); $widgetNode->setAttribute('active', $widget['active']); $rootNode->appendChild($widgetNode); } $this->setDownloadFileName('widget_framework-widgets-' . XenForo_Template_Helper_Core::date(XenForo_Application::$time, 'YmdHi') . '.xml'); return $document->saveXml(); }
public function actionGetOnline() { $session_model = $this->_getSessionModel(); $bypass_privacy = $this->_getUserModel()->canBypassUserPrivacy(); $visitor = XenForo_Visitor::getInstance(); $online = $session_model->getSessionActivityRecords(array('cutOff' => array('>', $session_model->getOnlineStatusTimeout()), 'getInvisible' => $bypass_privacy, 'getUnconfirmed' => $bypass_privacy, 'forceInclude' => true), array('join' => XenForo_Model_Session::FETCH_USER, 'order' => 'view_date')); $online = $session_model->addSessionActivityDetailsToList($online); $totals = $session_model->getSessionActivityQuickList($visitor->toArray(), array('cutOff' => array('>', $session_model->getOnlineStatusTimeout())), $visitor['user_id'] ? $visitor->toArray() : null); $online_users = array(); foreach ($online as $rec) { if (!$rec['user_id']) { continue; } $activity = ''; if ($rec['activityDescription'] instanceof XenForo_Phrase) { $activity = $rec['activityDescription']->render(); } $out = array('userid' => $rec['user_id'], 'username' => prepare_utf8_string(strip_tags($rec['username']))); if ($activity != '') { $out['activity'] = prepare_utf8_string($activity); } if ($visitor->getUserId() == $rec['user_id']) { $out['me'] = true; } $avatarurl = process_avatarurl(XenForo_Template_Helper_Core::getAvatarUrl($rec, 'm')); if (strpos($avatarurl, '/xenforo/avatars/avatar_') !== false) { $avatarurl = ''; } if ($avatarurl != '') { $out['avatarurl'] = $avatarurl; } $online_users[] = $out; } return array('users' => $online_users, 'num_guests' => $totals['guests']); }
public static function helperSnippet($string, $maxLength = 0, array $options = array()) { // TODO: smart stripping of tags with options $string = self::stripTag('ismemberofusergroup', $string); $string = self::stripTag('isnotmemberofusergroup', $string); $string = self::stripTag('isuserid', $string); $string = self::stripTag('isusername', $string); $string = self::stripTag('isnotuserid', $string); $string = self::stripTag('isnotusername', $string); $visitor = XenForo_Visitor::getInstance(); /* @var $userModel XenForo_Model_User */ $userModel = XenForo_Model::create('XenForo_Model_User'); if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 1)) { $string = self::stripTag('guest', $string); } else { $string = self::stripTag('notguest', $string); } if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 2)) { $string = self::stripTag('registered', $string); } else { $string = self::stripTag('notregistered', $string); } if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 3)) { $string = self::stripTag('admin', $string); } else { $string = self::stripTag('notadmin', $string); } if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 4)) { $string = self::stripTag('mod', $string); } else { $string = self::stripTag('notmod', $string); } return XenForo_Template_Helper_Core::callHelper('th_usergroupbbcodes_snippet', array($string, $maxLength, $options)); }
public static function template_create(&$templateName, array &$params, XenForo_Template_Abstract $template) { if (defined('WIDGET_FRAMEWORK_LOADED')) { WidgetFramework_Core::getInstance()->prepareWidgetsFor($templateName, $params, $template); WidgetFramework_Core::getInstance()->prepareWidgetsForHooksIn($templateName, $params, $template); if ($templateName === 'PAGE_CONTAINER') { $template->preloadTemplate('wf_hook_moderator_bar'); $template->preloadTemplate('wf_revealer'); if (WidgetFramework_Option::get('indexNodeId')) { // preload our links template for performance $template->preloadTemplate('wf_home_navtab_links'); } WidgetFramework_Template_Extended::WidgetFramework_setPageContainer($template); if (isset($params['contentTemplate']) and $params['contentTemplate'] === 'wf_widget_page_index' and empty($params['selectedTabId'])) { // make sure a navtab is selected if user is viewing our (as index) widget page if (!XenForo_Template_Helper_Core::styleProperty('wf_homeNavTab')) { // oh, our "Home" navtab has been disable... // try something from $params['tabs'] OR $params['extraTabs'] if (isset($params['tabs']) and isset($params['extraTabs'])) { WidgetFramework_Helper_Index::setNavtabSelected($params['tabs'], $params['extraTabs']); } } } } } }
public function renderRaw() { $url = $this->_params['url']; $width = $this->_params['width']; $height = $this->_params['height']; $crop = $this->_params['crop']; $extension = XenForo_Helper_File::getFileExtension($url); $imageInfo = @getimagesize($url); if (!$imageInfo || !in_array($imageInfo[2], array_values(sonnb_XenGallery_Model_PhotoData::$typeMap)) || !in_array(strtolower($extension), array_keys(sonnb_XenGallery_Model_PhotoData::$imageMimes))) { $url = XenForo_Template_Helper_Core::getAvatarUrl(array(), 'l'); $extension = XenForo_Helper_File::getFileExtension($url); $imageInfo = @getimagesize($url); } $this->_response->setHeader('Content-type', sonnb_XenGallery_Model_PhotoData::$imageMimes[$extension], true); $this->_response->setHeader('ETag', XenForo_Application::$time, true); $this->_response->setHeader('X-Content-Type-Options', 'nosniff'); $this->setDownloadFileName($url, true); $image = XenForo_Image_Abstract::createFromFile($url, sonnb_XenGallery_Model_PhotoData::$typeMap[$extension]); if ($image) { if (XenForo_Image_Abstract::canResize($width, $height)) { if ($crop) { $image->thumbnail($width * 2, $height * 2); $image->crop(0, 0, $width, $height); } else { $image->thumbnail($width, $height); } } else { $image->output(sonnb_XenGallery_Model_PhotoData::$typeMap[$extension]); } } }
public function renderHtml() { XenForo_Template_Helper_Core::setThreadPrefixes($this->_params['prefixes']); // don't pass a view to this, because the templates don't exist in the admin $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base')); $this->_params['entry']['messageHtml'] = new XenForo_BbCode_TextWrapper($this->_params['entry']['message'], $bbCodeParser); }
public function actionWithdraw() { $visitor = XenForo_Visitor::getInstance(); $xenOptions = XenForo_Application::getOptions(); if (!$visitor->hasPermission('thAffiliatePermissions', 'earnAffiliatePoints') || !$xenOptions->th_affiliate_enableAffiliatePoints) { return $this->responseNoPermission(); } if ($this->isConfirmedPost()) { $amount = $this->_input->filterSingle('amount', XenForo_Input::FLOAT); if ($amount < $xenOptions->th_affiliate_minWithdraw) { return $this->responseError(new XenForo_Phrase('th_you_must_withdraw_at_least_x_affiliate', array('amount' => XenForo_Template_Helper_Core::numberFormat($xenOptions->th_affiliate_minWithdraw, 2)))); } if ($amount > $visitor['affiliate_points']) { return $this->responseError(new XenForo_Phrase('th_you_do_not_have_enough_points_affiliate', array('amount' => XenForo_Template_Helper_Core::numberFormat($xenOptions->th_affiliate_minWithdraw, 2)))); } $newPoints = $visitor['affiliate_points'] - $amount; $userWriter = XenForo_DataWriter::create('XenForo_DataWriter_User'); $userWriter->setExistingData(XenForo_Visitor::getUserId()); $userWriter->set('affiliate_points', $newPoints); $userWriter->save(); $withdrawalWriter = XenForo_DataWriter::create('ThemeHouse_Affiliate_DataWriter_Withdraw'); $withdrawalWriter->set('user_id', XenForo_Visitor::getUserId()); $withdrawalWriter->set('amount', $amount); $withdrawalWriter->save(); return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('affiliate'), new XenForo_Phrase('th_your_withdrawal_request_has_been_submitted_affiliate')); } else { $viewParams = array(); return $this->responseView('ThemeHouse_Affiliate_ViewPublic_Affiliate_Withdraw', 'th_withdraw_affiliate', $viewParams); } }
/** * Section that lists all games and individual game stats */ public function actionGames() { $sHelper = new Steam_Helper_Steam(); $gameId = $this->_input->filterSingle('game_id', XenForo_Input::UINT); if ($gameId) { $userModel = XenForo_Model::create('XenForo_Model_User'); $sHelper = new Steam_Helper_Steam(); $users = $sHelper->getGameOwners($gameId); $owners = array(); $hours = 0; foreach ($users as $user) { $u = $userModel->getUserById($user['user_id']); $user['avatar_url'] = XenForo_Template_Helper_Core::callHelper('avatar', array($u, 's', null, true)); $owners[] = $user; $hours += $user['hours']; } if (count($owners) == 0) { $hoursAvgMath = 0; } else { $hoursAvgMath = round($hours / count($owners)); } $viewParams = array('count' => count($owners), 'game' => $sHelper->getGameInfo($gameId), 'users' => $owners, 'hours' => $hours, 'hoursAvg' => $hoursAvgMath); $template = 'steam_stats_game_view'; } else { $steamModel = new Steam_Model_Steam(); $gamesPerPage = 25; $page = $this->_input->filterSingle('page', XenForo_Input::UINT); $viewParams = array('page' => $page, 'totalGames' => $sHelper->getAvailableGamesCount(), 'gamesPerPage' => $gamesPerPage, 'games' => $steamModel->getAvailableGames(array('perPage' => $gamesPerPage, 'page' => $page))); $template = 'steam_stats_games'; } return $this->responseView('XenForo_ViewAdmin_Steam_Games', $template, $viewParams); }
public function actionEdit() { $id = $this->_input->filterSingle('tag_id', XenForo_Input::UINT); $tag = $this->_getTagOrError($id); if ($this->isConfirmedPost()) { $dwInput = $this->_input->filter(array('tag_text' => XenForo_Input::STRING, 'tag_title' => XenForo_Input::STRING, 'tag_description' => XenForo_Input::STRING, 'is_staff' => XenForo_Input::UINT)); $dw = $this->_getTagDataWriter(); $dw->setExistingData($id); $dw->bulkSet($dwInput); // process link target_type // since 1.8 $link = $this->_input->filterSingle('link', XenForo_Input::STRING); if (!empty($link)) { $existingLink = $this->_getTagModel()->getTagLink($tag); if ($link != $existingLink) { $dw->bulkSet(array('target_type' => 'link', 'target_id' => 0, 'target_data' => array('link' => $link))); } } else { $dw->bulkSet(array('target_type' => '', 'target_id' => 0, 'target_data' => array())); } $dw->save(); return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('xentag-tags') . '#' . XenForo_Template_Helper_Core::callHelper('listitemid', array($tag['tag_id']))); } else { $viewParams = array('tag' => $tag, 'tagLink' => $this->_getTagModel()->getTagLink($tag)); return $this->responseView('Tinhte_XenTag_ViewAdmin_Tag_Edit', 'tinhte_xentag_tag_edit', $viewParams); } }
/** * Helper function to add mood display into hook. * * @param XenForo_Template_Abstract * @param string Needle to hook on to (empty for pure pre/append) * @param string Contents of the hook block * @param array User of the mood to be displayed * @param string Style property to check (null to disable check) * @param boolean Set to true to prepend, false to append * @param string Override mood display template * * @return void */ protected static function _addMoodDisplay(XenForo_Template_Abstract $template, $needle, &$contents, $user, $styleProperty = NULL, $prepend = TRUE, $templateName = NULL) { // check style property if (isset($styleProperty) and XenForo_Template_Helper_Core::styleProperty($styleProperty) == FALSE) { return; } // generate the mood template $moodDisplay = self::_getMoodTemplate($template, $user, $templateName); // pure prepend/append if (empty($needle)) { // do a bit of flip-flopping if ($prepend) { $contents = $moodDisplay . $contents; } else { $contents = $contents . $moodDisplay; } return; } // do more flip-flopping! if ($prepend) { $replace = $moodDisplay . $needle; } else { $replace = $needle . $moodDisplay; } // add it to the master template $contents = str_replace($needle, $replace, $contents); }
/** * * @see XenForo_Template_Helper_Core::helperAvatarHtml() */ public static function helperAvatarHtml(array $user, $img, array $attributes = array(), $content = '') { $returnLink = XenForo_Template_Helper_Core::callHelper('th_unlinkbanned_avatarhtml', array($user, $img, $attributes, $content)); if ($user['is_banned']) { return preg_replace('#(<a )href="[^"]*"([^>]*>.*<\\/a>)#Us', '$1$2', $returnLink); } return $returnLink; }
public function renderJson() { $results = array(); foreach ($this->_params['users'] as $user) { $results[$user['username']] = array('avatar' => XenForo_Template_Helper_Core::callHelper('avatar', array($user, 's')), 'username' => htmlspecialchars($user['username'])); } return array('results' => $results); }
public function renderJson() { $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName); if ($this->_params['isStatus']) { $output['statusHtml'] = XenForo_Template_Helper_Core::callHelper('bodytext', array($this->_params['profilePost']['message'])) . ' ' . XenForo_Template_Helper_Core::callHelper('datetimehtml', array($this->_params['profilePost']['post_date'])); } return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output); }
/** * Render the CSS version of the... CSS! * * @return string */ public function renderCss() { $params = $this->_params; $styleModel = XenForo_Model::create('XenForo_Model_Style'); $styleModel->setAdminStyles(true); $styles = XenForo_Application::isRegistered('adminStyles') ? XenForo_Application::get('adminStyles') : $styleModel->getAllStyles(); $styleId = $params['styleId']; if (!empty($styleId) && isset($styles[$styleId])) { $style = $styles[$styleId]; } else { $style = reset($styles); } $adminStyleProperties = XenForo_Application::get('adminStyleProperties'); $properties = unserialize($style['properties']); $properties = is_array($properties) ? $properties : array(); if (empty($properties)) { $properties = $adminStyleProperties; } else { $tmpAdminStyleProperties = array(); if (!isset($properties['contentWidth']) && isset($tmpAdminStyleProperties['contentWidth'])) { $properties['contentWidth'] = $tmpAdminStyleProperties['contentWidth']; } if (!isset($properties['formWidth']) && isset($tmpAdminStyleProperties['formWidth'])) { $properties['formWidth'] = $tmpAdminStyleProperties['formWidth']; } if (!isset($properties['nonResponsiveMinWidth']) && isset($tmpAdminStyleProperties['nonResponsiveMinWidth'])) { $properties['nonResponsiveMinWidth'] = $tmpAdminStyleProperties['nonResponsiveMinWidth']; } } $styleId = $style['style_id']; $styleModifiedDate = $style['last_modified_date']; $defaultProperties = XenForo_Application::get('defaultStyleProperties'); XenForo_Template_Helper_Core::setStyleProperties(XenForo_Application::mapMerge($defaultProperties, $properties)); Brivium_AdminStyleSystem_Template_Admin::setStyleId($style['style_id']); XenForo_Template_Abstract::setLanguageId(0); $bbCodeCache = !empty($params['bbCodeCache']) ? $params['bbCodeCache'] : array(); $templateParams = array('displayStyles' => array(), 'smilieSprites' => !empty($params['smilieSprites']) ? $params['smilieSprites'] : array(), 'xenOptions' => XenForo_Application::get('options')->getOptions(), 'customBbCodes' => !empty($bbCodeCache['bbCodes']) ? $bbCodeCache['bbCodes'] : array(), 'dir' => $this->_params['dir'], 'pageIsRtl' => $this->_params['dir'] == 'RTL'); $templates = array(); foreach ($this->_params['css'] as $cssTemplate) { if (strpos($cssTemplate, 'public:') === 0) { $templates[$cssTemplate] = new XenForo_Template_Public(substr($cssTemplate, strlen('public:')), $templateParams); } else { $templates[$cssTemplate] = new Brivium_AdminStyleSystem_Template_Admin($cssTemplate, $templateParams); } } if (XenForo_Application::isRegistered('adminStyleModifiedDate')) { $modifyDate = XenForo_Application::get('adminStyleModifiedDate'); } else { $modifyDate = XenForo_Application::$time; } $this->_response->setHeader('Expires', 'Wed, 01 Jan 2020 00:00:00 GMT', true); $this->_response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s', $modifyDate) . ' GMT', true); $this->_response->setHeader('Cache-Control', 'private', true); $css = XenForo_CssOutput::renderCssFromObjects($templates, true); $css = XenForo_CssOutput::prepareCssForOutput($css, $this->_params['dir'], false); return $css; }
public function getImage(XenForo_Model $model) { $resource = $this->_resourceDw->getMergedData(); if (isset(XenForo_Template_Helper_Core::$helperCallbacks['resourceiconurl'])) { $iconUrl = XenForo_Template_Helper_Core::callHelper('resourceiconurl', array($resource)); return XenForo_Link::convertUriToAbsoluteUri($iconUrl, true); } return parent::getImage($model); }
public static function helperAvatarUrl($user, $size, $forceType = null, $canonical = false) { if (!empty($user['gravatar'])) { $avatarUrl = self::parseGravatar($user['gravatar']); if (!empty($avatarUrl)) { return XenForo_Template_Helper_Core::callHelper('bdapiconsumer_avatarresize', array($avatarUrl, $size)); } } return call_user_func(self::$_helperOriginal, $user, $size, $forceType, $canonical); }
public function getData(array $entry) { $result = array('loc' => XenForo_Link::buildPublicLink('canonical:xengallery/users/albums', $entry), 'priority' => 0.3); if ($entry['gravatar'] || $entry['avatar_date']) { $avatarUrl = htmlspecialchars_decode(XenForo_Template_Helper_Core::callHelper('avatar', array($entry, 'l'))); $avatarUrl = XenForo_Link::convertUriToAbsoluteUri($avatarUrl, true, $this->getCanonicalPaths()); $result['image'] = $avatarUrl; } return $result; }
public function prepareApiDataForComment(array $comment, array $profilePost, array $user) { $comment = $this->prepareProfilePostComment($comment, $profilePost, $user); $publicKeys = array('profile_post_comment_id' => 'comment_id', 'profile_post_id' => 'profile_post_id', 'user_id' => 'comment_user_id', 'username' => 'comment_username', 'comment_date' => 'comment_create_date', 'message' => 'comment_body'); $data = bdApi_Data_Helper_Core::filter($comment, $publicKeys); $data['timeline_user_id'] = $profilePost['profile_user_id']; $data['links'] = array('detail' => bdApi_Data_Helper_Core::safeBuildApiLink('profile-posts/comments', $profilePost, array('comment_id' => $comment['profile_post_comment_id'])), 'profile_post' => bdApi_Data_Helper_Core::safeBuildApiLink('profile-posts', $profilePost), 'timeline' => bdApi_Data_Helper_Core::safeBuildApiLink('users/timeline', $user), 'timeline_user' => bdApi_Data_Helper_Core::safeBuildApiLink('users', $user), 'poster' => bdApi_Data_Helper_Core::safeBuildApiLink('users', $comment), 'poster_avatar' => XenForo_Template_Helper_Core::callHelper('avatar', array($comment, 'm', false, true))); $data['permissions'] = array('view' => $this->canViewProfilePost($profilePost, $user), 'delete' => $this->canDeleteProfilePostComment($comment, $profilePost, $user)); return $data; }
public function renderHtml() { if (isset($this->_params['scopes'])) { $scopes = array(); foreach ($this->_params['scopes'] as $scope) { $scopes[$scope] = XenForo_Template_Helper_Core::callHelper('api_scopeGetText', array($scope)); } $this->_params['scopes'] = $scopes; } }
public static function templateCreate(&$templateName, array &$params, XenForo_Template_Abstract $template) { if ($template instanceof XenForo_Template_Admin && !empty(self::$_defaultTemplateParams)) { $params = XenForo_Application::mapMerge(self::$_defaultTemplateParams, $params); if (!empty(self::$_setStyleProperties)) { XenForo_Template_Helper_Core::setStyleProperties(self::$_setStyleProperties); self::$_setStyleProperties = array(); } } }
public static function helperRichDisplayName(array $user, $usernameHtml = '') { $userFieldModel = XenForo_Model::create('XenForo_Model_UserField'); $values = $userFieldModel->getUserFieldValues($user['user_id']); $DisplayName = $values['AlexusDisplayName']; if ($DisplayName != "") { $user['username'] = $DisplayName; } return XenForo_Template_Helper_Core::helperRichUserName($user, $usernameHtml); }
public function actionGetSubscriptions() { $page = max($this->_input->filterSingle('page', XenForo_Input::UINT), 1); $perpage = $this->_input->filterSingle('perpage', XenForo_Input::UINT); if (!$perpage) { $perpage = XenForo_Application::get('options')->discussionsPerPage; } $previewtype = $this->_input->filterSingle('previewtype', XenForo_Input::UINT); if (!$previewtype) { $previewtype = 2; } $visitor = XenForo_Visitor::getInstance(); $watch_model = $this->_getThreadWatchModel(); $threads = $watch_model->getThreadsWatchedByUser($visitor['user_id'], false, array('join' => XenForo_Model_Thread::FETCH_FORUM | XenForo_Model_Thread::FETCH_USER, 'readUserId' => $visitor['user_id'], 'page' => $page, 'perPage' => $perpage, 'postCountUserId' => $visitor['user_id'], 'permissionCombinationId' => $visitor['permission_combination_id'])); $threads = $watch_model->unserializePermissionsInList($threads, 'node_permission_cache'); $threads = $watch_model->getViewableThreadsFromList($threads); $threads = $this->_prepareWatchedThreads($threads); $total = $watch_model->countThreadsWatchedByUser($visitor['user_id']); $this->canonicalizePageNumber($page, $perpage, $total, 'watched/threads/all'); $thread_data = array(); $thread_model = $this->_getThreadModel(); $post_model = $this->getModelFromCache('XenForo_Model_Post'); $preview_length = XenForo_Application::get('options')->discussionPreviewLength; $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text'); $parser = new XenForo_BbCode_Parser($formatter); foreach ($threads as &$thread) { $out = array('thread_id' => $thread['thread_id'], 'forum_title' => prepare_utf8_string($thread['node_title']), 'new_posts' => $thread['isNew'], 'forum_id' => $thread['node_id'], 'total_posts' => $thread['reply_count'] + 1, 'thread_title' => prepare_utf8_string(strip_tags($thread['title'])), 'post_lastposttime' => prepare_utf8_string(XenForo_Locale::dateTime($thread['last_post_date'], 'absolute'))); if ($previewtype == 1) { $out += array('post_username' => prepare_utf8_string(strip_tags($thread['username'])), 'post_userid' => $thread['user_id']); } else { $out += array('post_username' => prepare_utf8_string(strip_tags($thread['last_post_username'])), 'post_userid' => $thread['last_post_user_id']); } $post = $post_model->getPostById($thread[$previewtype == 1 ? 'first_post_id' : 'last_post_id'], array('join' => XenForo_Model_Post::FETCH_USER)); $avatarurl = process_avatarurl(XenForo_Template_Helper_Core::getAvatarUrl($post, 'm')); if (strpos($avatarurl, '/xenforo/avatars/avatar_') !== false) { $avatarurl = ''; } if ($avatarurl != '') { $out['avatarurl'] = $avatarurl; } $preview = ''; if ($preview_length) { $preview = $parser->render($post['message']); } if ($preview != '') { $out['thread_preview'] = prepare_utf8_string(html_entity_decode($preview)); } if ($thread['discussion_type'] == 'poll') { $out['poll'] = true; } $thread_data[] = $out; } $out = array('threads' => $thread_data, 'total_threads' => $total); return $out; }
public function actionAddEntry() { // this action must be called via POST $this->_assertPostOnly(); // guests not allowed $this->_assertRegistrationRequired(); $permissions = XenForo_Visitor::getInstance()->getPermissions(); $actionAllowed = XenForo_Permission::hasPermission($permissions, "forum", "postThread"); if (!$actionAllowed) { return $this->responseError('You do not have permissions to do this'); } # Grab user info/model/array from db $userModel = XenForo_Model::create('XenForo_Model_User'); // get donor id and also get the receiver's name $dbtc_donor_id = $this->_input->filterSingle('dbtc_donor_id', XenForo_Input::STRING); $dbtc_receiver_name = $this->_input->filterSingle('dbtc_receiver_name', XenForo_Input::STRING); // get transaction id if it exists $dbtc_transaction_id = $this->_input->filterSingle('dbtc_transaction_id', XenForo_Input::UINT); // get parent transaction id if it exists $dbtc_parent_transaction_id = $this->_input->filterSingle('dbtc_parent_transaction_id', XenForo_Input::UINT); $donorModel = $userModel->getUserById($dbtc_donor_id); $receiverModel = $userModel->getUserByNameOrEmail($dbtc_receiver_name); // get user id $dbtc_receiver_id = $receiverModel['user_id']; // get the user based on id or error // $user = $this->_getUserOrError($dbtc_receiver_id); // get status id $dbtc_status_id = $this->_input->filterSingle('dbtc_status_id', XenForo_Input::UINT); // get date and make sure we have a 'human' versino of the date $dbtc_date = $this->_input->filterSingle('dbtc_date', XenForo_Input::DATE_TIME); $dbtc_human_date = gmdate("m/d/Y", $dbtc_date); # Grab avatar and link $avatar = XenForo_Template_Helper_Core::callHelper('avatarhtml', array($receiverModel, TRUE, array('size' => 's'), '')); // get all necessary inputs from this form $dbtc_thread_id = $this->_input->filterSingle('dbtc_thread_id', XenForo_Input::UINT); // $data = array($dbtc_thread_id, $dbtc_donor_id, $dbtc_receiver_id, $dbtc_status_id, $dbtc_date, $avatar); // create a new DataWriter and set user_id and message fields $writer = XenForo_DataWriter::create('DBTC_DataWriter_DBTCNodeEntry'); // if we're editing a transaction if ($dbtc_transaction_id != 0) { $writer->setExistingData($dbtc_transaction_id); } $writer->set('dbtc_thread_id', $dbtc_thread_id); $writer->set('dbtc_donor_id', $dbtc_donor_id); $writer->set('dbtc_receiver_id', $dbtc_receiver_id); $writer->set('dbtc_status_id', $dbtc_status_id); $writer->set('dbtc_date', $dbtc_date); $writer->set('dbtc_parent_transaction_id', $dbtc_parent_transaction_id); $writer->save(); // get the data that was saved $nodeData = $writer->getMergedData(); $data = array('dbtc_transaction_id' => $nodeData['dbtc_transaction_id'], 'dbtc_thread_id' => $dbtc_thread_id, 'dbtc_donor_id' => $dbtc_donor_id, 'dbtc_receiver_id' => $dbtc_receiver_id, 'dbtc_receiver_name' => $dbtc_receiver_name, 'dbtc_status_id' => $dbtc_status_id, 'dbtc_date' => $dbtc_human_date, 'dbtc_receiver_avatar_html' => $avatar, 'dbtc_parent_transaction_id', $dbtc_parent_transaction_id); // redirect back to the normal scratchpad index page return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('dbtc-node-entry'), null, $data); }
/** * Returns the default gender-specific avatar URL * * @param string $size (s,m,l) * * @return string */ protected static function _getDefaultAvatarUrl(array $socialForum, $size) { if (XenForo_Application::get('options')->th_socialGroups_useCreatorAvatar && $socialForum['user_id']) { $user = XenForo_Model::create('XenForo_Model_User')->getUserById($socialForum['user_id']); if ($user) { return XenForo_Template_Helper_Core::getAvatarUrl($user, $size); } } if (!($imagePath = XenForo_Template_Helper_Core::styleProperty('imagePath'))) { $imagePath = 'styles/default'; } return "{$imagePath}/xenforo/avatars/avatar_{$size}.png"; }
public function actionIndex() { $code = $this->_input->filterSingle('code', XenForo_Input::STRING); $mask = $this->_getMaskOrError($code, array('join' => ThemeHouse_ImageRestrict_Model_Mask::FETCH_POST)); $maskModel = $this->_getMaskModel(); if (!$maskModel->canViewStuffInPost($mask)) { if (!($imagePath = XenForo_Template_Helper_Core::styleProperty('imagePath'))) { $imagePath = 'styles/default'; } $mask['url'] = $imagePath . '/xenforo/icons/moderated.png'; } return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $mask['url']); }
public static function goToTop(&$templateName, array &$params, XenForo_Template_Abstract $template) { switch ($templateName) { case 'PAGE_CONTAINER': //Init $visitor = XenForo_Visitor::getInstance(); $GttBrowser = ''; // Type: Normal/Mini/(None) $GttType = XenForo_Template_Helper_Core::styleProperty('gototopType'); $typeMobile = XenForo_Template_Helper_Core::styleProperty('gototopTypeMobile'); $typeTablet = XenForo_Template_Helper_Core::styleProperty('gototopTypeTablet'); //External Addon if (class_exists('Sedo_DetectBrowser_Listener_Visitor') && isset($visitor->getBrowser)) { //Check if mobile and not tablet if ($visitor->getBrowser['isMobile'] && !$visitor->getBrowser['isTablet']) { if ($typeMobile == 'none') { break; } $GttType = $typeMobile; } //Check if tablet if ($visitor->getBrowser['isTablet']) { if (in_array($typeTablet, array('none', 'error'))) { break; } $GttType = $typeTablet; } //Check if IE6 if ($visitor->getBrowser['IEis'] == 6) { $GttBrowser = 'IE'; } } else { //XenForo Mobile if (XenForo_Visitor::isBrowsingWith('mobile')) { if ($typeMobile == 'none') { break; } $GttType = $typeMobile; } //IE6 self function $checkIE6 = self::isBadIE('target', '1-6'); if ($checkIE6 === true) { $GttBrowser = 'IE'; } } $extraParams['goToTop'] = array('type' => $GttType, 'browser' => $GttBrowser); $params += $extraParams; break; } }
public function renderTagSigPic(array $tag, array $user) { $user = false; if (array_key_exists('0', $tag['children'])) { $user = XenForo_Model::create('XenForo_Model_User')->getUserById($tag['children'][0], array('join' => XenForo_Model_User::FETCH_USER_PERMISSIONS)); } else { $user = XenForo_Visitor::getInstance()->toArray(); } // For signature preview to not fail if ($user) { $user['permissions'] = XenForo_Permission::unserializePermissions($user['global_permission_cache']); if (XenForo_Permission::hasPermission($user['permissions'], 'signature', 'sigpic')) { return XenForo_Template_Helper_Core::callHelper('sigpic', array($user)); } } return ''; }
public function preRenderView(XenForo_ControllerResponse_Abstract $controllerResponse = null) { if (!empty($this->_viewStateChanges['brass_admin_style_id'])) { $styleId = $this->_viewStateChanges['brass_admin_style_id']; } else { $user = XenForo_Visitor::getInstance(); $styleId = !empty($user['brass_admin_style_id']) ? $user['brass_admin_style_id'] : 0; } $styleModel = XenForo_Model::create('XenForo_Model_Style'); $styleModel->setAdminStyles(true); $styles = XenForo_Application::isRegistered('adminStyles') ? XenForo_Application::get('adminStyles') : $styleModel->getAllStyles(); $style = array(); if (!empty($styles)) { $defaultStyleId = XenForo_Application::get('options')->BRASS_defaultAdminStyleId; if (!isset($styles[$defaultStyleId])) { $style = reset($styles); if (!empty($style['style_id'])) { XenForo_Model::create('XenForo_Model_Option')->updateOptions(array('BRASS_defaultAdminStyleId' => $style['style_id'])); } $defaultStyleId = $style['style_id']; } if (!empty($styleId) && isset($styles[$styleId]) && ($styles[$styleId]['brass_user_selectable'] || XenForo_Visitor::getInstance()->hasAdminPermission('BRASS_adminStyle'))) { $style = $styles[$styleId]; } else { $style = $styles[$defaultStyleId]; } } $defaultProperties = XenForo_Application::get('defaultStyleProperties'); if (!empty($style)) { $properties = unserialize($style['properties']); $properties = is_array($properties) ? $properties : array(); } if (empty($properties)) { $properties = XenForo_Application::get('adminStyleProperties'); } $setStyleProperties = XenForo_Application::mapMerge($defaultProperties, $properties); XenForo_Template_Helper_Core::setStyleProperties($setStyleProperties); if (!empty($style)) { Brivium_AdminStyleSystem_Template_Admin::setStyleId($style['style_id']); $this->_defaultTemplateParams['visitorStyle'] = $style; $this->_defaultTemplateParams['_styleId'] = $style['style_id']; } $this->_defaultTemplateParams['_styleModifiedDate'] = XenForo_Application::get('adminStyleModifiedDate'); return array($this->_defaultTemplateParams, $setStyleProperties); }
public function extraPrepareTitle(array $widget) { if (empty($widget['title'])) { return new XenForo_Phrase('wf_online_users'); } $preparedTitle = parent::extraPrepareTitle($widget); if ($preparedTitle instanceof XenForo_Phrase) { $onlineUsers = $this->_getOnlineUsers(); $params = $preparedTitle->getParams(); foreach ($onlineUsers as $key => $value) { if (is_numeric($value)) { $params[$key] = XenForo_Template_Helper_Core::numberFormat($value); } } $preparedTitle->setParams($params); } return $preparedTitle; }
public static function MceIntegration($mceConfigObj) { if (is_array($mceConfigObj)) { return false; } $xenOptions = XenForo_Application::get('options'); if ($mceConfigObj->buttonIsEnabled('tags_highlighter')) { $hlParams = array('adv_hl_norm' => array('open' => XenForo_Template_Helper_Core::styleProperty('adv_highlight_normal_tags_open'), 'options' => XenForo_Template_Helper_Core::styleProperty('adv_highlight_normal_tags_options'), 'close' => XenForo_Template_Helper_Core::styleProperty('adv_highlight_normal_tags_close')), 'adv_hl_spe' => array('open' => XenForo_Template_Helper_Core::styleProperty('adv_highlight_special_tags_open'), 'options' => XenForo_Template_Helper_Core::styleProperty('adv_highlight_special_tags_options'), 'close' => XenForo_Template_Helper_Core::styleProperty('adv_highlight_special_tags_close'), 'content' => XenForo_Template_Helper_Core::styleProperty('adv_highlight_special_tags_content')), 'adv_hl_tag_separator' => XenForo_Template_Helper_Core::styleProperty('adv_highlight_tag_options_separator')); $mceConfigObj->addMcePlugin('xenadvhl'); $mceConfigObj->addBulkMceParams($hlParams); } if ($xenOptions->sedo_bbm_adv_tinyquattro_menu_integration) { $menuItems = array('bbm_sedo_bimg', 'bbm_sedo_slides', '|', 'bbm_sedo_article', 'bbm_sedo_fieldset', 'bbm_sedo_encadre', 'bbm_sedo_spoilerbb', '|', 'bbm_sedo_latex', 'bbm_sedo_gview', 'bbm_sedo_picasa'); $mceConfigObj->addMenu('adv_insert', 'insert', 'Advanced Insert', $menuItems); $mceConfigObj->addMenuItem('tags_highlighter', 'view', '@view_1', true); } //Zend_Debug::dump($mceConfigObj->getMenusGrid()); //Zend_Debug::dump($mceConfigObj->getAvailableButtons()); }