/** * Creates a 404 exception with the given message * * @param string $message - A user friendly error * @param int $code - The PHP code of the error * @param string $file - The file the exception was thrown from * @param int $line - The line the exception was thrown from */ public function __construct($message = false, $code = false, $file = false, $line = false) { $message = $message ? $message : new vB_Phrase('error', 'page_not_found'); // Standard exception initialisation parent::__construct(vB_Router::get404Path(), $message, $code, $file, $line); }
/** * Main entry point for the controller. * * @return string - The final page output */ public function getResponse() { $error = vB_Router::getSegment('error'); // Resolve rerouted error $error = in_array($error, array('403', '404', '500')) ? $error : '404'; // Setup the templater for xhtml vB_View::registerTemplater(vB_View::OT_XHTML, new vB_Templater_vB()); $view = new vB_View_AJAXHTML('http_error'); if ('403' == $error) { $view->addError(new vB_Phrase('error', 'nopermission_loggedin_ajax')); } else if ('500' == $error) { $view->addError(new vB_Phrase('error', 'error_500')); } else { $view->addError(new vB_Phrase('error', 'error_400')); } return $view->render(true); }
/** * Main entry point for the controller. * * @return string - The final page output */ public function getResponse($parameters) { // Resolve rerouted error $error = in_array($parameters[0], array('403', '404', '500')) ? $parameters[0] : '404'; // Create the standard vB templater $templater = new vB_Templater_vB(); // TODO: Check what happens to style when undefined. // Register the templater to be used for XHTML vB_View::registerTemplater(vB_View::OT_XHTML, new vB_Templater_vB()); // Create the page view $page_view = new vB_View_Page('page'); // Create the body view $error_view = new vB_View('error_' . $error); // Get original requested url so we can link to retry or redirect to it after login $error_view->initial_url = vB_Router::getInitialURL(); // Add the body view to the page $page_view->setBodyView($error_view); // Add general page info // TODO: $view->setBreadcrumbInfo(); // May not be needed $page_view->setPageTitle(new vB_Phrase('error', 'error_' . $error)); return $page_view->render(); }
/** * Prepares properties for rendering. */ protected function prepareProperties() { parent::prepareProperties(); // vB_View_Content has already htmlspecialchars_uni($this->title) so we should not htmlspecialchars_uni again here. Fixed bug #29663 // $this->title = htmlspecialchars_uni($this->title); $this->css = new vB_View('vbcms_article_css'); $this->author_phrase = new vB_Phrase('vbcms', 'author'); if ($this->pagelist AND sizeof($this->pagelist) > 1) { // create a route $route = new vBCms_Route_Content(); $route->setSegments(array('node' => $this->nodesegment, 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View'))); $pagelist = $this->pagelist; $pagelist[1] = $this->title; $this->pagelist = $pagelist; $pages = array(); foreach ($this->pagelist AS $pagenum => $title) { $route->setParameter(0, $pagenum); $title = $title ? $title : new vB_Phrase('vbcms', 'page_x', $pagenum); // undo the 'stop_parse' from the [page] bbcode and strip bbcode and html $title = vbchop(strip_tags(strip_bbcode(str_replace(array('[', ']'), array('[', ']'), $title))), 75); $pages[$pagenum] = array( 'url' => $route->getCurrentURL(null, array($pagenum)), 'title' => htmlspecialchars_uni($title), 'selected' => ($pagenum == $this->current_page) ? 1 : 0 ); } if ($this->current_page > 1) { $this->prev_page_url = $pages[$this->current_page - 1]['url']; $this->prev_page_phrase = new vB_Phrase('vbcms', 'previous'); } if ($this->current_page < sizeof($pages)) { $this->next_page_url = $pages[$this->current_page + 1]['url']; $this->next_page_phrase = new vB_Phrase('vbcms', 'next'); } $this->pagelist = $pages; } else { $this->pagelist = false; } }
/** * Constructor. * The constructor grabs the requested node segment and parameters. * * @param array mixed $parameters - User requested parameters. * @param string $action - User requested action */ public function __construct($parameters, $action = false) { parent::__construct($parameters, $action); // Evaluate the node that we're working with $this->node_segment = vB_Router::getSegment('node'); if (!$this->node_segment) { throw (new vB_Exception_404()); } if ($this->auto_initialize) { $this->initialize(); } }
/** * Constructor. * The constructor grabs the requested node segment and parameters. * * @param array mixed $parameters - User requested parameters. */ public function __construct($parameters, $action = false) { parent::__construct($parameters, $action); // Evaluate the node that we're working with if (!($this->action = vB_Router::getSegment('action'))) { // TODO: shouldn't throw 404's on construction, only in getResponse() throw (new vB_Exception_404()); } if (!($this->widget = vB_Router::getSegment('widget')) OR !intval($this->widget)) { throw (new vB_Exception_404()); } $this->node = intval(vB_Router::getSegment('node')); $this->initialize(); }
/** * Fetches a rich page view of the specified content item. * This method can accept parameters from the client code which are usually * derived from user input. Parameters are passed as an array in the order that * they were received. Parameters do not normally have assoc keys. * * Note: Parameters are always passed raw, so ensure that validation and * escaping is performed where required. * * Skip permissions should allow content to be rendered regardless of the * current user's permissions. * * Child classes will inevitably override this with wildly different * implementations. * * @param array mixed $parameters - Request parameters * @param bool $skip_permissions - Whether to skip can view permission checking * @return vB_View | bool - Returns a view or false */ public function getInlineEditBodyView($parameters = false) { global $vbphrase; require_once DIR . '/includes/functions_databuild.php' ; fetch_phrase_group('cpcms'); //confirm that the user has edit rights if (!$this->content->canEdit()) { return $vb_phrase['no_edit_permissions']; } if ($_REQUEST['do'] == 'delete') { $dm = $this->content->getDM(); $dm->delete(); $this->cleanContentCache(); return $vbphrase['item_deleted']; } // Load the content item if (!$this->loadContent($this->getViewInfoFlags(self::VIEW_PAGE ))) { throw (new vB_Exception_404()); } if ($_REQUEST['do'] == 'apply' OR $_REQUEST['do'] == 'update' OR $_REQUEST['do'] == 'movenode') { $this->SaveData(); } // Create view $view = $this->createView('inline', self::VIEW_PAGE); // Add the content to the view $this->populateViewContent($view, self::VIEW_PAGE, false); // Check if inline form was submitted // postback content // TODO: Don't need to escape this with new template syntax $view->formid = 'cms_statichtml_data'; $view->type = new vB_Phrase('vbcms', 'statichtml'); $view->adding = new vB_Phrase('cpcms', 'adding_x', $vbphrase['article']); $view->typetitle = $this->content->getTypeTitle(); $view->metadata = $this->content->getMetadataEditor(); $view->comments_enabled = ($this->content->getComments_Enabled()); $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View')); $view->view_url = vBCms_Route_Content::getURL($segments); // Add URL to submit to $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->submit_url = vBCms_Route_Content::getURL($segments); $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View')); $view->editbar = $this->content->getEditBar($view->submit_url, vBCms_Route_Content::getURL($segments), $view->formid); $view->publisher = $this->content->getPublishEditor($view->submit_url, $view->formid); $view->show_threaded = true; $view->per_page = 10; $this->addPostId($view); return $view; }
/** * Fetches the standard page view . * @param integer $nodeid - node for which we are displaying comments * * @return vBCms_View - The resolved view, or array of views */ public function getPageView($nodeid, $target_url) { global $vbphrase; require_once DIR . '/includes/functions_editor.php'; vB::$vbulletin->input->clean_array_gpc('r', array( 'nodeid' => vB_Input::TYPE_INT, 'page' => vB_Input::TYPE_INT, 'direction' => vB_Input::TYPE_STR, 'postid' => vB_Input::TYPE_UINT )); if (! $row = vB::$vbulletin->db->query_first("SELECT node.comments_enabled, node.setpublish, node.publishdate, nodeinfo.associatedthreadid, thread.forumid FROM " . TABLE_PREFIX . "cms_node AS node LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo AS nodeinfo ON node.nodeid = nodeinfo.nodeid LEFT JOIN " . TABLE_PREFIX . "thread AS thread on thread.threadID = nodeinfo.associatedthreadid WHERE nodeinfo.nodeid = $nodeid LIMIT 1;" )) { return false; } if (! $row['comments_enabled'] OR !$row['setpublish'] OR ($row['publishdate'] > TIMENOW)) { return false; } if (! intval($row['forumid'])) { $this->repairComments($row['associatedthreadid']); } if (!intval($row['associatedthreadid'])) { return false; } $associatedthreadid = $row['associatedthreadid']; $base_url = empty($target_url) ? vB_Router::getCurrentURL() : $target_url; // Create view $view = new vB_View('vbcms_comments_page'); $view->nodeid = $nodeid; $view->threadid = $row['associatedthreadid']; $view->this_url = str_replace('&', '&', $base_url); // display publish to Facebook checkbox in quick editor? if (is_facebookenabled()) { $view->fbpublishcheckbox = construct_fbpublishcheckbox(); } $this_user = new vB_Legacy_CurrentUser(); $pageno = vB::$vbulletin->GPC_exists['page'] ? vB::$vbulletin->GPC['page'] : 1; $view->pageno = $pageno; $view->node_comments = self::showComments($view->nodeid, $this_user, $pageno, 20, $target_url, $associatedthreadid); // make sure user has permission to post comment before displaying comment editor if (self::canPostComment($view->threadid, $this_user)) { // prepare the wyswiwig editor for comments $view->show_comment_editor = true; global $messagearea; $editor_name = construct_edit_toolbar(''); $view->messagearea = $messagearea;// $view->editor_name = $editor_name; // include captcha validation and guest username field if (fetch_require_hvcheck('post')) { require_once(DIR . '/includes/class_humanverify.php'); $reg = vB::$vbulletin; $verification =& vB_HumanVerify::fetch_library($reg); $human_verify = $verification->output_token(); } else { $human_verify = ''; } $view->human_verify = $human_verify; $view->usernamecode = new vB_View('newpost_usernamecode'); } else { $view->show_comment_editor = false; } return $view; }
/** * Verify Friendly URL * Ensures the requested URL was in the correct format according to the * friendlyurl option. If not, throw a 301 to the correct route. */ public function assertFriendlyUrl() { // API don't need to redirect if (defined('VB_API') and VB_API === true) { return; } // Only redirect on GET if ('GET' != $_SERVER['REQUEST_METHOD']) { return; } // If this route isn't valid then we'll be 404'ing anyway if (!$this->isValid()) { return; } // If we don't have an entry path then there's nothing to do if (!($request_path = vB_Router::getEntryPath())) { return; } // Allow hooks to handle non canonical urls ($hook = vBulletinHook::fetch_hook('friendlyurl_redirect_canonical_route')) ? eval($hook) : false; // Check if we should be enforcing the canonical url if (vB_Friendly_Url::CANON_OFF == vB::$vbulletin->options['friendlyurl_canonical']) { return; } // Only redirect guests and search engines if (vB::$vbulletin->userinfo['userid'] and !vB::$vbulletin->options['friendlyurl_canonical_registered']) { return; } // Get the canonical path if (!isset($canonical_path)) { $canonical_path = $this->getRoutePath(false, vB_Friendly_Url::CANON_STRICT == vB::$vbulletin->options['friendlyurl_canonical'], true); } // Whether the request was canonical $canonical = true; // If no route path is specified then only rewrite can differ if ($request_path == VB_ROUTER_SEGMENT) { //This looks like a bug. The second "==" should be an "AND". This is based on the fact that how its written doesn't //make a lot of sense and the behavior with the change is more consistant. However its a bug with senority at this //point and fixing it will change how urls behave. For the time being leaving it alone is better than the risk of //changing it. if ((FRIENDLY_URL == FRIENDLY_URL_REWRITE) == (vB::$vbulletin->options['friendlyurl'] == FRIENDLY_URL_REWRITE)) { return; } } // Check the Friendly URL method if (FRIENDLY_URL !== intval(vB::$vbulletin->options['friendlyurl'])) { $canonical = false; } // Check URI if ($canonical and vB_Friendly_URL::CANON_STRICT == vB::$vbulletin->options['friendlyurl_canonical']) { if ($request_path != $canonical_path) { // request may have been in the current charset, try utf-8 $request_path = to_utf8($request_path, vB::$vbulletin->userinfo['lang_charset']); if ($request_path != $canonical_path) { $canonical = false; } } } // Redirect if incorrect if (!$canonical) { // Get the raw redirect url $url = $this->getCurrentURL(null, null, '', false, true); // add any query vars $vars = $_GET; unset($vars[vB::$vbulletin->options['route_requestvar']]); unset($vars['pagenumber']); // Remove duplicate created by shortvar code if (!empty($vars)) { $url .= (strpos($url, '?') ? '&' : '?') . urlimplode($vars, false, true); } //do a quick check to ensure that we aren't trying to redirect to the url //we came in on. This is needed primarily because of a special case where the //friendly url logic doesn't correctly detect the rewrite URL version of the //incoming link and will attempt to redirect because they don't match. $url = create_full_url($url); $cleaned_url = vB::$vbulletin->input->xss_clean(vB::$vbulletin->input->strip_sessionhash($url)); $cleaned_url = $this->domain_to_lower($cleaned_url); //if ($url != VB_URL_CLEAN) if (urldecode($cleaned_url) != urldecode($this->domain_to_lower(VB_URL_CLEAN))) { // redirect to the canonical url exec_header_redirect($url, 301); } } }
/** * Fetches a rich page view of the specified content item. * This method can accept parameters from the client code which are usually * derived from user input. Parameters are passed as an array in the order that * they were received. Parameters do not normally have assoc keys. * * Note: Parameters are always passed raw, so ensure that validation and * escaping is performed where required. * * Skip permissions should allow content to be rendered regardless of the * current user's permissions. * * Child classes will inevitably override this with wildly different * implementations. * * @param array mixed $parameters - Request parameters * @param bool $skip_permissions - Whether to skip can view permission checking * @return vB_View | bool - Returns a view or false */ public function getInlineEditBodyView($parameters = false) { global $vbphrase; require_once DIR . '/includes/functions.php'; require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('cpcms'); $this->editing = true; //confirm that the user has edit rights if (!$this->content->canPublish()) { return new vB_Phrase('cpcms', 'no_edit_permissions'); } if ($_REQUEST['do'] == 'apply' OR $_REQUEST['do'] == 'update' OR $_REQUEST['do'] == 'movenode') { $this->checkSaveData($view); unset($_REQUEST['do']); } $this->content->requireInfo(vBCms_Item_Content::INFO_BASIC & vBCms_Item_Content::INFO_CONFIG & vBCms_Item_Content::INFO_NODE & vBCms_Item_Content::INFO_NAVIGATION & vBCms_Item_Content::INFO_PARENTS); $this->content->isValid(); $config = $this->content->getConfig(); //See if we're deleting if ($_REQUEST['do'] == 'delete') { //We can't delete if there is content below if ($record = vB::$vbulletin->db->query_first("SELECT nodeid FROM " . TABLE_PREFIX . "cms_node WHERE parentnode = " . $this->content->getNodeId() . " limit 1") and intval($record['nodeid'])) { return new vB_Phrase('cpcms', 'cannot_delete_with_subnodes'); } $dm = $this->content->getDM(); $dm->delete(); $events = $this->getCleanCacheEvents(); vB_Cache::instance()->event($events); vB_Cache::instance()->cleanNow(); return new vB_Phrase('cpcms', 'section_deleted'); } vB::$vbulletin->input->clean_array_gpc('r', array( 'sortby' => vB_Input::TYPE_STR, 'dir' => vB_Input::TYPE_STR, 'page' => vB_Input::TYPE_INT, 'item_count' => vB_Input::TYPE_INT, 'per_page' => TYPE_INT, 'simple_paging' => TYPE_INT, 'page' => TYPE_INT )); // Load the content item if (!$this->loadContent($this->getViewInfoFlags(self::VIEW_PAGE))) { throw (new vB_Exception_404()); } // Create view $view = $this->createView('inline', self::VIEW_PAGE); // Add the content to the view parent::populateViewContent($view, self::VIEW_PAGE); $this->config = $this->getConfig(); $view->formid = 'cms_content_data'; $view->title = $this->content->getTitle(); $view->html_title = $this->content->getHtmlTitle(); $view->url = $this->content->getUrl(); $view->contentfrom = $this->config['contentfrom']; $view->editshowchildren = $this->content->getEditShowchildren() ? 1 : 0; $view->layout_select = vBCms_ContentManager::getLayoutSelect($this->content->getLayoutSetting(), $this->getParentId()); $view->style_select = vBCms_ContentManager::getStyleSelect($this->content->getStyleSetting()) ; $view->display_order_select = vBCms_ContentManager::getSectionPrioritySelect($this->config['section_priority']) ; $view->content_layout_select = $tmp = vBCms_ContentManager::getContentLayoutSelect($this->config['content_layout']); $view->simple_paging = $this->config['simple_paging']; $view->per_page = $this->config['items_perhomepage']; $view->nodeid = $this->content->getNodeId(); $view->dateformat = vB::$vbulletin->options['dateformat'] . " " . vB::$vbulletin->options['timeformat']; if (intval($this->content->getPublishDate)) { $view->publishdate = $this->content->getPublishDate(); } $aggregate = new vBCms_Collection_Content_Section(); switch(vB::$vbulletin->GPC['sortby']) { case 'title' : $aggregate->setSortBy('ORDER BY title ' . vB::$vbulletin->GPC['dir']); break; case 'setpublish' : $aggregate->setSortBy('ORDER BY setpublish ' . vB::$vbulletin->GPC['dir']); break; case 'displayorder' : $aggregate->setSortBy('ORDER BY displayorder ' . vB::$vbulletin->GPC['dir']); break; case 'username' : $aggregate->setSortBy('ORDER BY username ' . vB::$vbulletin->GPC['dir']); break; case 'publishdate' : $aggregate->setSortBy('ORDER BY publishdate ' . vB::$vbulletin->GPC['dir']); break; case 'pageviews' : $aggregate->setSortBy('ORDER BY viewcount ' . vB::$vbulletin->GPC['dir']); break; case 'replycount': $aggregate->setSortBy('ORDER BY replycount ' . vB::$vbulletin->GPC['dir']); ; break; case 'section': $aggregate->setSortBy('ORDER BY parenttitle ' . vB::$vbulletin->GPC['dir']); ; break; default: $aggregate->setOrderBy(1); ; } // switch //See if we need to hide the children $filter_node = $this->content->getEditShowchildren(); if (!$filter_node) { $aggregate->setFilterNodeExact($this->content->getNodeId()); } else { $aggregate->filterNode($this->content->getNodeId()); } $nodes = array(); $sequence = 0; $candelete = 1; if (vB::$vbulletin->GPC_exists['perpage'] AND intval(vB::$vbulletin->GPC['perpage'])) { $perpage = vB::$vbulletin->GPC['perpage']; } else { $perpage = vBCms_ContentManager::getPerPage(new vB_Legacy_CurrentUser()); } $current_page = (vB::$vbulletin->GPC_exists['page'] AND intval(vB::$vbulletin->GPC['page']) ) ? vB::$vbulletin->GPC['page'] : 1; $aggregate->paginate(); $aggregate->paginateQuantity($perpage); $aggregate->paginatePage($current_page); foreach ($aggregate as $id => $content_node) { $candelete = 0; if ($content_node->getContentTypeid() != vb_Types::instance()->getContentTypeID("vBCms_Section") ) { $sequence++; $nodes[] = array('sequence' => $sequence, 'class' => $content_node->getClass(), 'title' => $content_node->getTitle(), 'html_title' => $content_node->getHtmlTitle(), 'nodeid' => $content_node->getNodeid(), 'prev_checked' => ($content_node->getPublicPreview() ? " checked=\"checked\" " : ''), 'publicpreview' => $content_node->publicpreview, 'parenttitle' => $content_node->getParentTitle(), 'published_select' => vBCms_ContentManager::getPublishedSelect($content_node->getSetPublish(), $content_node->getPublishDate()), 'order_select' => vBCms_ContentManager::getOrderSelect($content_node->getDisplayOrder($this->content->getNodeId()), $this->content->getNodeId()), 'author' => $content_node->getUsername(), 'pub_date' => (intval($content_node->getPublishDate()) ? vbdate(vB::$vbulletin->options['dateformat'], $content_node->getPublishDate()) : '') , 'viewcount' => $content_node->getViewCount(), 'view_url' => vBCms_Route_Content::getURL(array('node' => $content_node->getUrlSegment())), 'replycount' => $content_node->getReplyCount()); } } if (vB::$vbulletin->GPC_exists['item_count']) { $item_count = vB::$vbulletin->GPC['item_count']; } else { $aggregate->filterNoSections(1); $item_count = $aggregate->getCount(); } $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View')); $view->view_url = vBCms_Route_Content::getURL($segments); $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->submit_url = vBCms_Route_Content::getURL($segments); $base_url = $view->submit_url; $base_url .= strpos($base_url, '?') ? '&' : '?'; $view->record_count = count($aggregate); $view->item_count = $item_count; $pagination = construct_page_nav($current_page, $perpage, $item_count, $view->submit_url); $view->pagination = $pagination; $perpage_select .= '<select name="perpage" onchange="checkShouldSave(\'' . $view->formid . '\', \'perpage\', \'' . vB_Template_Runtime::escapeJS(new vB_Phrase('cpcms', 'confirm_save_section')) . '\', \'' . vB_Template_Runtime::escapeJS($view->submit_url) . '\');">' . "\n"; foreach (array(5,10,15,20,25,50,75,100,200, 250, 500) as $this_perpage) { $perpage_select .= "<option value=\"$this_perpage\"" . (intval($this_perpage) == intval($perpage) ? ' selected="selected" ' : '') . ">$this_perpage</option>\n" ; } $perpage_select .= "</select>"; $view->perpage_select = $perpage_select; $record = vB::$vbulletin->db->query_first("SELECT SUM(childinfo.viewcount) AS viewcount, SUM(CASE when child.contenttypeid <> " . vb_Types::instance()->getContentTypeID("vBCms_Section") ." THEN 1 ELSE 0 END) AS content, SUM(CASE when (child.parentnode = node.nodeid AND child.contenttypeid <> " . vb_Types::instance()->getContentTypeID("vBCms_Section") .") THEN 1 ELSE 0 END) AS children, SUM(CASE when child.contenttypeid =" . vb_Types::instance()->getContentTypeID("vBCms_Section") ." AND child.parentnode = node.nodeid THEN 1 ELSE 0 END) AS subsections FROM " . TABLE_PREFIX . "cms_node AS node LEFT JOIN " . TABLE_PREFIX . "cms_node AS child ON (child.nodeleft >= node.nodeleft AND child.nodeleft <= node.noderight AND child.nodeid <> node.nodeid AND child.new != 1) LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo AS childinfo ON childinfo.nodeid = child.nodeid AND child.contenttypeid <> " . vb_Types::instance()->getContentTypeID("vBCms_Section") ." WHERE node.nodeid = " . $this->content->getNodeId()); $view->viewcount = $record['viewcount']; $view->content = $record['content']; $view->children = $record['children']; $view->subsections = $record['subsections']; $view->nodes = $nodes; $view->metadata = $this->content->getMetadataEditor(); //Here we create some url's. This should allow to sort in reverse direction $view->sorttitle_url = $base_url . 'sortby=title&dir=' . ((vB::$vbulletin->GPC_exists['sortby'] AND vB::$vbulletin->GPC['sortby'] == 'title' AND vB::$vbulletin->GPC['dir'] == 'asc') ? 'desc' : 'asc'); $view->sortpub_url = $base_url . 'sortby=setpublish&dir=' . ((vB::$vbulletin->GPC_exists['sortby'] AND vB::$vbulletin->GPC['sortby'] == 'setpublish' AND vB::$vbulletin->GPC['dir'] == 'asc') ? 'desc' : 'asc'); $view->sortorder_url = $base_url . 'sortby=displayorder&dir=' . ((vB::$vbulletin->GPC_exists['sortby'] AND vB::$vbulletin->GPC['sortby'] == 'displayorder' AND vB::$vbulletin->GPC['dir'] == 'asc') ? 'desc' : 'asc'); $view->sortauthor_url = $base_url . 'sortby=username&dir=' . ((vB::$vbulletin->GPC_exists['sortby'] AND vB::$vbulletin->GPC['sortby'] == 'username' AND vB::$vbulletin->GPC['dir'] == 'asc') ? 'desc' : 'asc'); $view->sortdate_url = $base_url . 'sortby=publishdate&dir=' . ((vB::$vbulletin->GPC_exists['sortby'] AND vB::$vbulletin->GPC['sortby'] == 'publishdate' AND vB::$vbulletin->GPC['dir'] == 'asc') ? 'desc' : 'asc'); $view->sorthits_url = $base_url . 'sortby=pageviews&dir=' . ((vB::$vbulletin->GPC_exists['sortby'] AND vB::$vbulletin->GPC['sortby'] == 'pageviews' AND vB::$vbulletin->GPC['dir'] == 'asc') ? 'desc' : 'asc'); $view->sortreplycount_url = $base_url . 'sortby=replycount&dir=' . ((vB::$vbulletin->GPC_exists['sortby'] AND vB::$vbulletin->GPC['sortby'] == 'replycount' AND vB::$vbulletin->GPC['dir'] == 'asc') ? 'desc' : 'asc'); $view->sortsection_url = $base_url . 'sortby=section&dir=' . ((vB::$vbulletin->GPC_exists['sortby'] AND vB::$vbulletin->GPC['sortby'] == 'section' AND vB::$vbulletin->GPC['dir'] == 'asc') ? 'desc' : 'asc'); $view->editbar = $this->content->getEditBar($view->submit_url, $view->view_url, $view->formid, (intval($this->content->getNodeId()) ? 'edit' : 'add'), $candelete); $view->publisher = $this->content->getPublishEditor($view->submit_url, $view->formid, false, false, false, false, $this->config['pagination_links']); $view->contenttypeid = vB_Types::instance()->getContentTypeID("vBCms_Section"); $this->addPostId($view); // Sub menu if (!$this->content->isRoot()) { $view->inherit_section = $this->content->getNavigationParentTitle(); $view->inherited = !$this->content->hasNavigation(); } $navigation_nodes = $this->content->getNavigationNodes(); $subnav_nodes = vBCms_ContentManager::getSections(false, true); // array for the navigation display order drop-down menu $displayorder_array = array(0 => ''); $count = max(count($nodes), 40); for ($i=1; $i <= $count; $i++) { $displayorder_array[$i] = $i; } // populate sub-nav configuration menu with all cms sections $sections = array(); $subnav = new vB_View('vbcms_content_section_subnavedit'); $subnav->displayorder_array = $displayorder_array; foreach ($subnav_nodes AS $node) { $nodeid = $node['nodeid']; // check if the section has already been selected for the menu nav // if so, its position in the array (key+1) is its display order $displayorder = 0; //default display order is 0 $selected = false; if (isset($navigation_nodes) AND is_array($navigation_nodes)) { if ($selected = in_array($nodeid, $navigation_nodes)) { $displayorder = array_search($nodeid, $navigation_nodes) + 1; } } $sections[] = array('id' => $nodeid, 'title' => $node['title'], 'depth' => $node['depth'], 'selected' => $selected, 'displayorder' => $displayorder); } $subnav->sections = $sections; $subnav_rendered = $subnav->render(); $view->subnav = $subnav_rendered; unset($nodes, $subnav_nodes, $sections); return $view; }
function construct_online_bit($userinfo, $doall = 0) { global $vbulletin, $limitlower, $limitupper, $vbphrase, $ipclass, $show; global $wol_album, $wol_attachment, $wol_calendar, $wol_event, $wol_inf, $wol_pm, $wol_post, $wol_search, $wol_socialgroup, $wol_thread, $wol_user; static $count; $count++; $show['nopermission'] = false; $show['lockedout'] = false; $show['errormessage'] = false; if ($doall == 1 AND ($count > $limitupper OR $count < $limitlower)) { return ''; } if ($userinfo['attachmentid']) { $postid = $wol_attachment["$userinfo[attachmentid]"]; } else { $postid = $userinfo['postid']; } if ($postid) { $threadid = $wol_post["$postid"]; } else { $threadid = $userinfo['threadid']; } $forumid = $userinfo['forumid']; $calendarid = $userinfo['calendarid']; $eventid = $userinfo['eventid']; $searchid = $userinfo['searchid']; $groupid = $userinfo['socialgroupid']; $albumid = $userinfo['albumid']; if ($albumid) { require_once(DIR . '/includes/functions_album.php'); $albumname = fetch_censored_text($wol_album["$albumid"]['title']); $canviewalbum = true; if ($wol_album["$albumid"]['state'] == 'profile' AND !can_view_profile_albums($wol_album["$albumid"]['userid'])) { $canviewalbum = false; } else if ($wol_album["$albumid"]['state'] == 'private' AND !can_view_private_albums($wol_album["$albumid"]['userid'])) { $canviewalbum = false; } } if ($groupid) { $groupname = fetch_censored_text($wol_socialgroup["$groupid"]['name']); $canviewgroup = true; } if ($searchid) { $searchquery = $wol_search["$searchid"]['query']; $searchuser = $wol_search["$searchid"]['searchuser']; $searchuserid = $wol_search["$searchid"]['userid']; } if (!$forumid AND isset($wol_thread["$threadid"]['forumid'])) { $forumid = $wol_thread["$threadid"]['forumid']; } else if (!$forumid AND isset($wol_thread["$wol_post[$postid]"]['forumid'])) { $forumid = $wol_thread["$wol_post[$postid]"]['forumid']; } $threadtitle = fetch_censored_text($wol_thread["$threadid"]['title']); $threadprefix = ($wol_thread["$threadid"]['prefixid'] ? $vbphrase['prefix_' . $wol_thread["$threadid"]['prefixid'] . '_title_rich'] . ' ' : ''); $canview = $vbulletin->userinfo['forumpermissions']["$forumid"] & $vbulletin->bf_ugp_forumpermissions['canview']; $canviewothers = $vbulletin->userinfo['forumpermissions']["$forumid"] & $vbulletin->bf_ugp_forumpermissions['canviewothers']; $canviewthreads = $vbulletin->userinfo['forumpermissions']["$forumid"] & $vbulletin->bf_ugp_forumpermissions['canviewthreads']; $postuserid = $wol_thread["$threadid"]['postuserid']; $forumtitle = $vbulletin->forumcache["$forumid"]['title']; $threadpreview = $wol_thread["$threadid"]['preview']; if (!$calendarid AND isset($wol_event["$eventid"]['calendarid'])) { $calendarid = $wol_event["$eventid"]['calendarid']; } $eventtitle = htmlspecialchars_uni($wol_event["$eventid"]['title']); $eventpostuserid = $wol_event["$eventid"]['postuserid']; $calendartitle = $wol_calendar["$calendarid"]; $canviewcalendar = $vbulletin->userinfo['calendarpermissions']["$calendarid"] & $vbulletin->bf_ugp_calendarpermissions['canviewcalendar']; $canviewothersevent = $vbulletin->userinfo['calendarpermissions']["$calendarid"] & $vbulletin->bf_ugp_calendarpermissions['canviewothersevent']; if (($wol_thread["$threadid"]['isdeleted'] OR !$wol_thread["$threadid"]['visible']) AND !can_moderate($forumid)) { $threadviewable = 0; } else { $threadviewable = 1; } if ($threadviewable AND $threadtitle AND $canview AND ($canviewothers OR $postuserid == $vbulletin->userinfo['userid']) AND verify_forum_password($forumid, $vbulletin->forumcache["$forumid"]['password'], false)) { $seetitle = 1; } if ($forumtitle AND ($canview OR $vbulletin->forumcache["$forumid"]['showprivate'] > 1 OR (!$vbulletin->forumcache["$forumid"]['showprivate'] AND $vbulletin->options['showprivateforums']))) { $seeforum = 1; } if ($eventtitle AND $canviewcalendar AND ($canviewothersevent OR $eventpostuserid == $vbulletin->userinfo['userid'])) { $seeevent = 1; } if ($calendartitle AND $canviewcalendar) { $seecalendar = 1; } if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { if ($userinfo['pmid']) { $seeuserid = $wol_pm["$userinfo[pmid]"]; } else if ($userinfo['searchid']) { $seeuserid = $wol_search["$searchid"]['targetuserid']; } else if ($userinfo['infractionid']) { $seeuserid = $wol_inf["$userinfo[infractionid]"]['userid']; } else { $seeuserid = $userinfo['targetuserid']; } $username = $wol_user["$seeuserid"]['musername']; } if (strpos($userinfo['location'], 'route:') === 0) { $handled = false; $location = substr($userinfo['location'], strlen('route:')); $location = explode('|', $location); if (sizeof($location) == 4) { try { if (!defined('VB_FRAMEWORK')) { require_once(DIR . '/includes/class_bootstrap_framework.php'); vB_Bootstrap_Framework::init(); } list($route_path, $phrasegroup, $phrasekey, $title) = $location; $route_path = urldecode($route_path); $title = urldecode($title); $route = vB_Router::createRoute($route_path); $userinfo['action'] = new vB_Phrase($phrasegroup, $phrasekey); $userinfo['where'] = '<a href="' . $route->getCurrentUrl() . '">' . htmlspecialchars_uni($title) . '</a>'; if (vB::$vbulletin->session->vars['sessionhash']) { $userinfo['where'] .= '&s=' . vB::$vbulletin->session->vars['sessionhash']; } $handled = true; } catch (vB_Exception $e){} } } if (!$handled) { switch($userinfo['activity']) { case 'visitormessage_posting': $userinfo['action'] = $vbphrase['posting_visitor_message']; break; case 'visitormessage_delete': $userinfo['action'] = $vbphrase['deleting_visitor_message']; break; case 'viewingipaddress': $userinfo['action'] = '<b><i>' . $vbphrase['moderating'] . '</b></i>'; if (can_moderate()) { $userinfo['action'] = $vbphrase['viewing_ip_address']; } break; case 'visitormessage_reporting': $userinfo['action'] = $vbphrase['reporting_visitor_message']; break; case 'posthistory': $userinfo['action'] = $vbphrase['viewing_post_history']; if ($seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title']), array('p' => $postid)) . "#post$postid\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'tags': $userinfo['action'] = $vbphrase['managing_tags']; break; case 'tag_list': $userinfo['action'] = $vbphrase['viewing_tag_list']; break; case 'socialgroups_join': $userinfo['action'] = $vbphrase['joining_social_group']; if ($canviewgroup) { $userinfo['where'] = '<a href="group.php?' . $vbulletin->session->vars['sessionurl'] . "do=view&groupid=$groupid\">$groupname</a>"; } break; case 'socialgroups_leave': $userinfo['action'] = $vbphrase['leaving_social_group']; if ($canviewgroup) { $userinfo['where'] = '<a href="group.php?' . $vbulletin->session->vars['sessionurl'] . "do=view&groupid=$groupid\">$groupname</a>"; } break; case 'socialgroups_edit': $userinfo['action'] = $vbphrase['editing_social_group']; if ($canviewgroup) { $userinfo['where'] = '<a href="group.php?' . $vbulletin->session->vars['sessionurl'] . "do=view&groupid=$groupid\">$groupname</a>"; } break; case 'socialgroups_view': $userinfo['action'] = $vbphrase['viewing_social_group']; if ($canviewgroup) { $userinfo['where'] = '<a href="group.php?' . $vbulletin->session->vars['sessionurl'] . "do=view&groupid=$groupid\">$groupname</a>"; } break; case 'socialgroups_memberlist': $userinfo['action'] = $vbphrase['viewing_social_group_memberlist']; if ($canviewgroup) { $userinfo['where'] = '<a href="group.php?' . $vbulletin->session->vars['sessionurl'] . "do=viewmembers&groupid=$groupid\">$groupname</a>"; } break; case 'socialgroups_delete': $userinfo['action'] = $vbphrase['deleting_social_group']; if ($canviewgroup) { $userinfo['where'] = '<a href="group.php?' . $vbulletin->session->vars['sessionurl'] . "do=viewmembers&groupid=$groupid\">$groupname</a>"; } break; case 'socialgroups_create': $userinfo['action'] = $vbphrase['creating_social_group']; break; case 'socialgroups_list': $userinfo['action'] = $vbphrase['viewing_social_group_list']; if ($canviewgroup) { $userinfo['where'] = '<a href="group.php?' . $vbulletin->session->vars['sessionurl'] . "do=view&groupid=$groupid\">$groupname</a>"; } break; case 'socialgroups_subscriptions': $userinfo['action'] = $vbphrase['viewing_social_group_subscriptions']; break; case 'group_inlinemod': $userinfo['action'] = '<b><i>' . $vbphrase['moderating'] . '</i></b>'; break; case 'showthread': $userinfo['action'] = $vbphrase['viewing_thread']; if ($seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) . "\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'showpost': $userinfo['action'] = $vbphrase['viewing_thread']; if ($seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title']), array('p' => $postid)) . "#post$postid\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'forumdisplay': $userinfo['action'] = $vbphrase['viewing_forum']; if ($seeforum) { if ($vbulletin->forumcache["$forumid"]['link']) { $userinfo['action'] = $vbphrase['followed_forum_link']; } $userinfo['where'] = '<a href="' . fetch_seo_url('forum', array('forumid' => $forumid, 'title' => $forumtitle)) . "\">$forumtitle</a>"; } break; case 'newthread': $userinfo['action'] = $vbphrase['creating_thread']; if ($seeforum) { $userinfo['where'] = '<a href="' . fetch_seo_url('forum', array('forumid' => $forumid, 'title' => $forumtitle)) . "\">$forumtitle</a>"; } break; case 'newreply': $userinfo['action'] = $vbphrase['replying_to_thread']; if ($seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) . "\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'attachments': case 'manageattachment': $userinfo['action'] = $vbphrase['managing_attachments']; break; case 'attachment': $userinfo['action'] = $vbphrase['viewing_attachment']; break; case 'index': $userinfo['action'] = $vbphrase['viewing_index']; $userinfo['where'] = '<a href="' . $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q'] . '">' . $vbulletin->options['bbtitle'] . '</a>'; break; case 'online': $userinfo['action'] = $vbphrase['viewing_whos_online']; break; case 'searchnew': $userinfo['action'] = $vbphrase['viewing_new_posts']; $userinfo['where'] = '<a href="search.php?' . $vbulletin->session->vars['sessionurl'] . "do=getnew\">$vbphrase[new_posts]</a>"; break; case 'search': $userinfo['action'] = $vbphrase['searching_forums']; if ($searchid AND $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { if ($searchquery) { $userinfo['where'] = construct_phrase($vbphrase['query_x'], htmlspecialchars_uni($searchquery)); } if ($searchuser AND $wol_search["$searchid"]['targetuserid']) { if ($searchquery) { $userinfo['where'] .= '<br />'; } $userinfo['where'] .= construct_phrase($vbphrase['user_x'], '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"); } } break; case 'mail': $userinfo['action'] = $vbphrase['emailing']; if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } break; case 'getinfo': $userinfo['action'] = $vbphrase['viewing_user_profile']; if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } break; case 'converse': $userinfo['action'] = $vbphrase['viewing_conversation']; if ($seeuserid AND $wol_user["{$userinfo['guestuserid']}"]) { $userinfo['where'] = construct_phrase($vbphrase['x_and_y_converse'], '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>", '<a href="' . fetch_seo_url('member', array('userid' => $userinfo['guestuserid'], 'username' => $wol_user["{$userinfo['guestuserid']}"])) . "\">$username</a>"); } break; case 'editprofile': $userinfo['action'] = $vbphrase['modifying_profile']; break; case 'editoptions': $userinfo['action'] = $vbphrase['modifying_options']; break; case 'lostpw': case 'editpassword': $userinfo['action'] = $vbphrase['modifying_password']; break; case 'editavatar': $userinfo['action'] = $vbphrase['modifying_avatar']; break; case 'editprofilepic': $userinfo['action'] = $vbphrase['modifying_profilepic']; break; case 'editsignature': $userinfo['action'] = $vbphrase['modifying_signature']; break; case 'markread': $userinfo['where'] = $vbphrase['marking_forums_read']; break; case 'whoposted': if ($seetitle) { $userinfo['action'] = $vbphrase['viewing_who_posted']; $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) . "\" title=\"$threadpreview\">$threadtitle</a>"; } else { $userinfo['action'] = $vbphrase['viewing_thread']; } break; case 'showattachments': if ($seetitle) { $userinfo['action'] = $vbphrase['viewing_attachment_list']; $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) . "\" title=\"$threadpreview\">$threadtitle</a>"; } else { $userinfo['action'] = $vbphrase['viewing_thread']; } break; case 'showgroups': $userinfo['action'] = $vbphrase['viewing_forum_leaders']; break; case 'login': $userinfo['action'] = $vbphrase['logging_in']; break; case 'logout': if ($userinfo['badlocation']) { $userinfo['action'] = $vbphrase['logging_out']; } break; case 'archive': $userinfo['action'] = $vbphrase['viewing_archives']; if ($seetitle) { $userinfo['where'] = $threadprefix . "<a href=\"archive/index.php/t-$threadid.html\" title=\"$threadpreview\">$threadtitle</a>"; } else if ($seeforum) { $userinfo['where'] = "<a href=\"archive/index.php/f-$forumid.html\">$forumtitle</a>"; } break; case 'pm': $userinfo['action'] = $vbphrase['private_messaging']; if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } if ($userinfo['values']['do'] == 'newpm' OR $userinfo['values']['do'] == 'insertpm' OR $userinfo['values']['do'] == 'newmessage') { $userinfo['action'] = $vbphrase['creating_private_message']; } else if ($userinfo['values']['do'] == 'editfolders' OR $userinfo['action']['do'] == 'updatefolders') { $userinfo['action'] = $vbphrase['modifying_private_message_folders']; } else if ($userinfo['values']['do'] == 'trackpm' OR $userinfo['values']['do'] == 'deletepmreceipt') { $userinfo['action'] = $vbphrase['tracking_private_messages']; } else if ($userinfo['values']['do'] == 'showpm') { $userinfo['action'] = $vbphrase['viewing_private_message']; } else if ($userinfo['values']['do'] == 'downloadpm') { $userinfo['action'] = $vbphrase['downloading_private_messages']; } } break; case 'addbuddy': case 'addignore': case 'buddyignore': $userinfo['action'] = $vbphrase['modifying_contact_ignore_list']; break; case 'subfolders': $userinfo['action'] = $vbphrase['modifying_subscription_folders']; break; case 'subscription': $userinfo['action'] = $vbphrase['viewing_subscribed_threads']; break; case 'addsubforum': $userinfo['action'] = $vbphrase['subscribing_to_forum']; if ($seeforum) { $userinfo['where'] = '<a href="' . fetch_seo_url('forum', array('forumid' => $forumid, 'title' => $forumtitle)) . "\">$forumtitle</a>"; } break; case 'addsubthread': $userinfo['action'] = $vbphrase['subscribing_to_thread']; if ($seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) . "\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'remsubthread': $userinfo['action'] = $vbphrase['deleting_subscribed_threads']; break; case 'remsubforum': $userinfo['action'] = $vbphrase['deleting_subscribed_forums']; break; case 'usercp': $userinfo['action'] = $vbphrase['viewing_user_control_panel']; break; case 'memberlistsearch': $userinfo['action'] = $vbphrase['searching_member_list']; break; case 'memberlist': $userinfo['action'] = $vbphrase['viewing_member_list']; break; case 'member_inlinemod': $userinfo['action'] = '<b><i>' . $vbphrase['moderating'] . '</i></b>'; if (can_moderate()) { if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } } break; case 'inlinemod': $userinfo['action'] = '<b><i>' . $vbphrase['moderating'] . '</i></b>'; if (can_moderate()) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) . "\" title=\"$threadpreview\">$threadtitle</a>"; switch ($userinfo['values']['do']) { case 'open': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_opening_threads'] . '</i>'; break; case 'close': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_closing_threads'] . '</i>'; break; case 'stick': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_sticking_threads'] . '</i>'; break; case 'unstick': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_unsticking_threads'] . '</i>'; break; case 'deletethread': case 'dodeletethreads': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_deleting_threads'] . '</i>'; break; case 'undeletethread': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_undeleting_threads'] . '</i>'; break; case 'approvethread': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_approving_threads'] . '</i>'; break; case 'unapprovethread': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_unapproving_threads'] . '</i>'; break; case 'movethread': case 'domovethreads': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_moving_threads'] . '</i>'; break; case 'mergethread': case 'domergethreads': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_merging_threads'] . '</i>'; break; case 'deleteposts': case 'dodeleteposts': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_deleting_posts'] . '</i>'; break; case 'undeleteposts': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_undeleting_posts'] . '</i>'; break; case 'approveposts': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_approving_posts'] . '</i>'; break; case 'unapproveposts': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_unapproving_posts'] . '</i>'; break; case 'mergeposts': case 'domergeposts': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_merging_posts'] . '</i>'; break; case 'moveposts': case 'domoveposts': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_moving_posts'] . '</i>'; break; case 'clearthread': case 'clearpost': $userinfo['action'] = '<i>' . $vbphrase['inline_mod_clear'] . '</i>'; break; case 'spampost': case 'dodeletespam': case 'spamconfirm': $userinfo['action'] = '<i>' . $vbphrase['managing_spam'] . '</i>'; break; } } break; case 'postings': $userinfo['action'] = '<b><i>' . $vbphrase['moderating'] . '</b></i>'; if (can_moderate($forumid) AND $threadtitle AND $canview AND ($canviewothers OR $postuserid == $vbulletin->userinfo['userid'])) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) ."\" title=\"$threadpreview\">$threadtitle</a>"; switch ($userinfo['values']['do']) { case 'editthread': case 'updatethread': $userinfo['action'] = '<i>' . $vbphrase['modifying_thread'] . '</i>'; break; case 'openclosethread': $userinfo['action'] = '<i>' . $vbphrase['open_close_thread'] . '</i>'; break; case 'movethread': $userinfo['action'] = '<i>' .$vbphrase['choosing_forum_to_move_thread_to'] . '</i>'; break; case 'domovethread': switch($userinfo['values']['method']) { case 'copy': $userinfo['action'] = '<i>' . $vbphrase['copying_thread_to_forum'] . '</i>'; break; case 'move': $userinfo['action'] = '<i>' . $vbphrase['moving_thread_to_forum'] . '</i>'; break; case 'movered': $userinfo['action'] = '<i>' . $vbphrase['moving_thread_with_redirect_to_forum'] . '</i>'; break; } $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) . "\" title=\"$threadpreview\">$threadtitle</a><br />" . '<a href="' . fetch_seo_url('forum', array('forumid' => $forumid, 'title' => $forumtitle)) . "\">$forumtitle</a>"; break; case 'deletethread': case 'dodeletethread': $userinfo['action'] = '<i>' . $vbphrase['deleting_thread'] . '</i>'; break; case 'deleteposts': case 'dodeleteposts': $userinfo['where'] = '<i>' . $vbphrase['deleting_posts'] . '</i>'; break; case 'merge': case 'domergethread': $userinfo['where'] = '<i>' . $vbphrase['merging_threads'] . '</i>'; break; case 'stick': $userinfo['where'] = '<i>' . $vbphrase['stick_unstick_thread'] . '</i>'; break; case 'getip': $userinfo['where'] = '<i>' . $vbphrase['viewing_ip_address'] . '</i>'; break; case 'removeredirect': $userinfo['where'] = '<i>' . $vbphrase['deleting_redirect'] . '</i>'; break; } } break; case 'register': $userinfo['action'] = $vbphrase['registering']; break; case 'requestemail': $userinfo['action'] = $vbphrase['request_activation_code']; break; case 'activate': $userinfo['action'] = $vbphrase['activating_registration']; break; case 'announcement': $userinfo['action'] = $vbphrase['viewing_announcement']; if ($seeforum) { $userinfo['where'] = '<a href="announcement.php?' . $vbulletin->session->vars['sessionurl'] . "f=$forumid\">$forumtitle</a>"; } break; case 'usergroup': $userinfo['action'] = $vbphrase['modifying_usergroups']; break; case 'polls': switch ($userinfo['values']['do']) { case 'showresults': $userinfo['action'] = $vbphrase['viewing_poll']; break; case '': case 'newpoll': case 'postpoll': $userinfo['action'] = $vbphrase['creating_poll']; if ($seeforum) { $userinfo['where'] = '<a href="' . fetch_seo_url('forum', array('forumid' => $forumid, 'title' => $forumtitle)) . "\">$forumtitle</a>"; } break; case 'polledit': case 'updatepoll': $userinfo['action'] = $vbphrase['modifying_poll']; break; case 'pollvote': $userinfo['action'] = $vbphrase['voting']; break; } break; case 'showsmilies': $userinfo['action'] = $vbphrase['viewing_smilies']; break; case 'showavatars': $userinfo['action'] = $vbphrase['viewing_avatars']; break; case 'bbcode': $userinfo['action'] = $vbphrase['viewing_bb_code']; break; case 'faq': $userinfo['action'] = $vbphrase['viewing_faq']; break; case 'edit': $userinfo['action'] = $vbphrase['modifying_post']; if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull'] AND $seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title']), array('p' => $postid)) ."#post$postid\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'sendto': $userinfo['action'] = $vbphrase['sending_thread_to_friend']; if ($seetitle) { $userinfo['where'] = $threadprefix . '<a href="printthread.php?' . $vbulletin->session->vars['sessionurl'] . "t=$threadid\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'contactus': $userinfo['action'] = $vbphrase['sending_forum_feedback']; break; case 'aim': $userinfo['action'] = $vbphrase['sending_aim_message']; if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } break; case 'msn': $userinfo['action'] = $vbphrase['sending_msn_message']; if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } break; case 'yahoo': $userinfo['action'] = $vbphrase['sending_yahoo_message']; if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } break; case 'icq': $userinfo['action'] = $vbphrase['sending_icq_message']; if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } break; case 'skype': $userinfo['action'] = $vbphrase['sending_skype_message']; if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } break; case 'report': if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull'] AND $seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title']), array('p' => $postid)) ."#post$postid\" title=\"$threadpreview\">$threadtitle</a>"; } $userinfo['action'] = $vbphrase['reporting_post']; break; case 'printthread': $userinfo['action'] = $vbphrase['viewing_printable_version']; if ($seetitle) { $userinfo['where'] = $threadprefix . '<a href="printthread.php?' . $vbulletin->session->vars['sessionurl'] . "t=$threadid\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'calendarweek': $userinfo['action'] = $vbphrase['viewing_calendar']; if ($seecalendar) { if ($userinfo['week']) { $week = "&week=$userinfo[week]"; } $userinfo['where'] = '<a href="calendar.php?' . $vbulletin->session->vars['sessionurl'] . "do=displayweek&c=$calendarid$week\">$calendartitle</a>"; } break; case 'calendarmonth'; $userinfo['action'] = $vbphrase['viewing_calendar']; if ($seecalendar) { $userinfo['where'] = '<a href="calendar.php?' . $vbulletin->session->vars['sessionurl'] . "do=displaymonth&c=$calendarid&month=$userinfo[month]&year=$userinfo[year]\">$calendartitle</a>"; } break; case 'calendaryear'; $userinfo['action'] = $vbphrase['viewing_calendar']; if ($seecalendar) { if ($userinfo['year']) { $year = "&year=$userinfo[year]"; } $userinfo['where'] = '<a href="calendar.php?' . $vbulletin->session->vars['sessionurl'] . "do=displayyear&c=$calendarid$year\">$calendartitle</a>"; } break; case 'calendarday': $userinfo['action'] = $vbphrase['viewing_calendar']; if ($seecalendar) { $userinfo['where'] = '<a href="calendar.php?' . $vbulletin->session->vars['sessionurl'] . "do=getday&c=$calendarid&day=$userinfo[day]\">$calendartitle</a>"; } break; case 'calendarevent': $userinfo['action'] = $vbphrase['viewing_event']; if ($seeevent) { $userinfo['where'] = '<a href="calendar.php?' . $vbulletin->session->vars['sessionurl'] . "do=getinfo&e=$eventid\">$eventtitle</a>"; } break; case 'calendaradd': case 'calendaraddrecur': $userinfo['action'] = $vbphrase['creating_event']; if ($seecalendar) { $userinfo['where'] = '<a href="calendar.php?' . $vbulletin->session->vars['sessionurl'] . "c=$calendarid\">$calendartitle</a>"; } break; case 'calendaredit': $userinfo['action'] = $vbphrase['modifying_event']; if ($seeevent) { $userinfo['where'] = '<a href="calendar.php?' . $vbulletin->session->vars['sessionurl'] . "do=getinfo&e=$eventid\">$eventtitle</a>"; } break; case 'calreminder': $userinfo['action'] = $vbphrase['managing_reminder']; if ($seeevent) { $userinfo['where'] = '<a href="calendar.php?' . $vbulletin->session->vars['sessionurl'] . "do=getinfo&e=$eventid\">$eventtitle</a>"; } break; case 'newusernote': $userinfo['action'] = $vbphrase['creating_user_note']; if ($seeuserid) { $userinfo['where'] = '<a href="usernote.php?' . $vbulletin->session->vars['sessionurl'] . "do=viewuser&u=$seeuserid\">$username</a>"; } break; case 'usernote': $userinfo['action'] = $vbphrase['viewing_user_note']; if ($seeuserid) { $userinfo['where'] = '<a href="usernote.php?' . $vbulletin->session->vars['sessionurl'] . "do=viewuser&u=$seeuserid\">$username</a>"; } break; case 'reputation': $userinfo['action'] = $vbphrase['giving_reputation']; if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull'] AND $seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) . "\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'joinrequests': $userinfo['action'] = $vbphrase['processing_joinrequests']; if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull'] AND $vbulletin->usergroupcache["$userinfo[usergroupid]"]['title']) { $userinfo['where'] = construct_phrase($vbphrase['viewing_x'], $vbulletin->usergroupcache["$userinfo[usergroupid]"]['title']); } break; case 'threadrate': $userinfo['action'] = $vbphrase['rating_thread']; if ($seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title'])) . "\" title=\"$threadpreview\">$threadtitle</a>"; } break; case 'infractionreport': if ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cangiveinfraction'] OR $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_wolpermissions['canreverseinfraction']) { $userinfo['action'] = $vbphrase['giving_infraction']; if ($seeuserid) { $userinfo['where'] = '<a href="' . fetch_seo_url('member', array('userid' => $seeuserid, 'username' => $wol_user["$seeuserid"]['username'])) . "\">$username</a>"; } else if ($seetitle) { $userinfo['where'] = $threadprefix . '<a href="' . fetch_seo_url('thread', array('threadid' => $threadid, 'title' => $wol_thread["$threadid"]['title']), array('p' => $postid)) . "#post$postid\" title=\"$threadpreview\">$threadtitle</a>"; } } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'infractionreverse': if ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cangiveinfraction'] OR $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_wolpermissions['canreverseinfraction']) { $userinfo['action'] = $vbphrase['reversing_infraction']; if ($seeuserid) { $userinfo['where'] = '<a href="infraction.php?' . $vbulletin->session->vars['sessionurl'] . "do=view&infractionid=$userinfo[infractionid]\">$username</a>"; } } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'infractionview': if ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cangiveinfraction'] OR $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_wolpermissions['canreverseinfraction']) { $userinfo['action'] = $vbphrase['viewing_infraction']; if ($seeuserid) { $userinfo['where'] = '<a href="infraction.php?' . $vbulletin->session->vars['sessionurl'] . "do=view&infractionid=$userinfo[infractionid]\">$username</a>"; } } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_deletedthreads': if (can_moderate()) { $userinfo['action'] = $vbphrase['viewing_deleted_threads']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_deletedposts': if (can_moderate()) { $userinfo['action'] = $vbphrase['viewing_deleted_posts']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_deletedvms': if (can_moderate(0,'canmoderatevisitormessages')) { $userinfo['action'] = $vbphrase['viewing_deleted_visitor_messages']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_deletedgms': if (can_moderate(0, 'canmoderategroupmessages')) { $userinfo['action'] = $vbphrase['viewing_deleted_social_group_messages']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_deletedpcs': if (can_moderate(0, 'canmoderatepicturecomments')) { $userinfo['action'] = $vbphrase['viewing_deleted_picture_comments']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_moderatedthreads': if (can_moderate(0, 'canmoderateposts')) { $userinfo['action'] = $vbphrase['viewing_moderated_threads']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_moderatedposts': if (can_moderate(0, 'canmoderateposts')) { $userinfo['action'] = $vbphrase['viewing_moderated_posts']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_moderatedvms': if (can_moderate(0, 'canmoderatevisitormessages')) { $userinfo['action'] = $vbphrase['viewing_moderated_visitor_messages']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_moderatedgms': if (can_moderate(0, 'canmoderategroupmessages')) { $userinfo['action'] = $vbphrase['viewing_moderated_social_group_messages']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_moderatedpcs': if (can_moderate(0, 'canmoderatepicturecomments')) { $userinfo['action'] = $vbphrase['viewing_moderated_picture_comments']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'modcp_moderatedattachments': if (can_moderate()) { $userinfo['action'] = $vbphrase['viewing_moderated_attachments']; } else { $userinfo['action'] = $vbphrase['viewing_index']; } break; case 'payments': $userinfo['action'] = $vbphrase['viewing_paid_subscriptions']; break; case 'spider': $userinfo['action'] = $vbphrase['search_engine_spider']; break; case 'admincp': $userinfo['action'] = $vbphrase['admin_control_panel']; break; case 'admincplogin': $userinfo['action'] = $vbphrase['admin_control_panel_login']; break; case 'modcp': $userinfo['action'] = $vbphrase['moderator_control_panel']; break; case 'modcplogin': $userinfo['action'] = $vbphrase['moderator_control_panel_login']; break; case 'album_delete': $userinfo['action'] = $vbphrase['deleting_album']; break; case 'album_edit_album': { $userinfo['action'] = $vbphrase['editing_album']; if ($canviewalbum) { $userinfo['where'] = '<a href="album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid=$albumid\">$albumname</a>"; } break; } case 'album_new_album': $userinfo['action'] = $vbphrase['creating_album']; break; case 'album_edit_picture': { $userinfo['action'] = $vbphrase['editing_pictures']; if ($canviewalbum) { if (!empty($userinfo['attachmentid'])) { $userinfo['where'] = '<a href="album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid=$albumid&attachmentid=" . $userinfo['attachmentid'] ."\">$albumname</a>"; } else { $userinfo['where'] = '<a href="album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid=$albumid\">$albumname</a>"; } } } break; case 'album_upload': { $userinfo['action'] = $vbphrase['uploading_pictures']; if ($canviewalbum) { $userinfo['where'] = '<a href="album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid=$albumid\">$albumname</a>"; } } break; case 'album_picture': { $userinfo['action'] = $vbphrase['viewing_picture']; if ($canviewalbum) { if (!empty($userinfo['attachmentid'])) { $userinfo['where'] = '<a href="album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid=$albumid&attachmentidid=" . $userinfo['attachmentid'] ."\">$albumname</a>"; } else { $userinfo['where'] = '<a href="album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid=$albumid\">$albumname</a>"; } } } break; case 'album_album': { $userinfo['action'] = $vbphrase['viewing_album']; if ($canviewalbum) { $userinfo['where'] = '<a href="album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid=$albumid\">$albumname</a>"; } } break; case 'album_user': { $userinfo['action'] = $vbphrase['viewing_users_album']; if ($seeuserid) { $userinfo['where'] = '<a href="album.php?' . $vbulletin->session->vars['sessionurl'] . "userid=$seeuserid\">$username</a>"; } } break; case 'album_unread_comments': $userinfo['action'] = $vbphrase['viewing_unread_picture_comments']; break; case 'album_moderated_comments': $userinfo['action'] = $vbphrase['viewing_picture_comments_awaiting_approval']; break; case 'picturecomment_posting': $userinfo['action'] = $vbphrase['posting_picture_comment']; break; case 'picturecomment_delete': $userinfo['action'] = $vbphrase['deleting_picture_comment']; break; case 'picturecomment_reporting': $userinfo['action'] = $vbphrase['reporting_picture_comment']; break; case 'picture_inlinemod': $userinfo['action'] = '<b><i>' . $vbphrase['moderating'] . '</i></b>'; break; case 'viewing_cms_content': require_once(DIR . '/includes/functions_login.php'); $userinfo['action'] = $vbphrase['viewing_cms_content'] ; $userinfo['location'] = fetch_replaced_session_url(stripslashes($userinfo['location'])); $userinfo['where'] = "<a href=\"$userinfo[location]\">$userinfo[location]</a>"; break; case 'viewing_cms_list': require_once(DIR . '/includes/functions_login.php'); $userinfo['action'] =$vbphrase['viewing_cms_list'] ; $userinfo['location'] = fetch_replaced_session_url(stripslashes($userinfo['location'])); $userinfo['where'] = "<a href=\"$userinfo[location]\">$userinfo[location]</a>"; break; default: $handled = false; ($hook = vBulletinHook::fetch_hook('online_location_unknown')) ? eval($hook) : false; if ($handled == false) { if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinebad']) { require_once(DIR . '/includes/functions_login.php'); $userinfo['location'] = fetch_replaced_session_url(stripslashes($userinfo['location'])); $userinfo['where'] = "<a href=\"$userinfo[location]\">$userinfo[location]</a>"; $userinfo['action'] = '<b>' . $vbphrase['unknown_location'] . '</b>'; } else { // We were unable to parse the location $userinfo['action'] = $vbphrase['viewing_index']; $userinfo['where'] = '<a href="' . $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q'] . '">' . $vbulletin->options['bbtitle'] . "</a>"; } } } } if ($userinfo['badlocation'] == 1) { // User received 'no permissions screen' if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinebad'] OR $userinfo['userid'] == $vbulletin->userinfo['userid']) { $show['nopermission'] = true; } else { $userinfo['action'] = $vbphrase['viewing_index']; $userinfo['where'] = '<a href="' . $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q'] . '">' . $vbulletin->options['bbtitle'] . "</a>"; } } else if ($userinfo['badlocation'] == 2) { // Forum is locked $show['lockedout'] = true; } else if ($userinfo['badlocation'] == 3) { // User received error screen if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinebad'] OR $userinfo['userid'] == $vbulletin->userinfo['userid']) { $show['errormessage'] = true; } else { $userinfo['action'] = $vbphrase['viewing_index']; $userinfo['where'] = '<a href="' . $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q'] . '">' . $vbulletin->options['bbtitle'] . "</a>"; } } if (!($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinelocation'])) { unset($userinfo['location']); } $userinfo['host_encoded'] = urlencode($userinfo['host']); if ($vbulletin->options['yestoday'] == 2) { $userinfo['time'] = vbdate($vbulletin->options['dateformat'], $userinfo['lastactivity'], 1); } else { $userinfo['time'] = vbdate($vbulletin->options['timeformat'], $userinfo['lastactivity']); } $wol_post['userid'] = $userinfo['userid']; $wol_post['username'] = $userinfo['realname']; ($hook = vBulletinHook::fetch_hook('online_bit_complete')) ? eval($hook) : false; if ($doall) { $show['loggedinuser'] = iif($userinfo['userid'], true, false); $show['buddy'] = iif($userinfo['buddy'], true, false); if ($userinfo['spider']) { $show['spider'] = true; if (!$userinfo['spidertype'] OR !($spidertype = construct_phrase($vbphrase["x_spider_{$userinfo['spidertype']}"], $userinfo['spider']))) { $spidertype = construct_phrase($vbphrase['x_spider_searchspider'], $userinfo['spider']); } } else { $show['spider'] = false; } $show['reallocation'] = iif($userinfo['location'], true, false); $show['subscribed'] = iif($wol_thread["$threadid"]['issubscribed'] AND $seetitle, true, false); $show['where'] = iif($userinfo['where'], true, false); $templater = vB_Template::create('whosonlinebit'); $templater->register('count', $count); $templater->register('ipclass', $ipclass); $templater->register('spidertype', $spidertype); $templater->register('userinfo', $userinfo); $onlinebits = $templater->render(); return $onlinebits; } else { return $userinfo; } }
/** * Returns the config view for the widget. * * @return vBCms_View_Widget - The view result */ public function getConfigView($widget = false) { global $vbphrase; $this->assertWidget(); vB::$vbulletin->input->clean_array_gpc('r', array( 'do' => vB_Input::TYPE_STR, 'template_name' => vB_Input::TYPE_STR )); $view = new vB_View_AJAXHTML('cms_widget_config'); $view->title = new vB_Phrase('vbcms', 'configuring_widget_x', $this->widget->getTitle()); $config = $this->widget->getConfig(); $widgetdm = $this->widget->getDM(); if ((vB::$vbulletin->GPC['do'] == 'config') AND $this->verifyPostId()) { if (vB::$vbulletin->GPC_exists['template_name']) { $config['template_name'] = vB::$vbulletin->GPC['template_name']; } if ($this->content) { $widgetdm->setConfigNode($this->content->getNodeId()); } $widgetdm->set('config', $config); $widgetdm->save(); if (!$widgetdm->hasErrors()) { if ($this->content) { $segments = array('node' => $this->content->getNodeURLSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->setUrl(vB_View_AJAXHTML::URL_FINISHED, vBCms_Route_Content::getURL($segments)); } $view->setStatus(vB_View_AJAXHTML::STATUS_FINISHED, new vB_Phrase('vbcms', 'configuration_saved')); } else { if (vB::$vbulletin->debug) { $view->addErrors($widgetdm->getErrors()); } // only send a message $view->setStatus(vB_View_AJAXHTML::STATUS_MESSAGE, new vB_Phrase('vbcms', 'configuration_failed')); } } if (!isset($config['template_name']) OR ($config['template_name'] == '') ) { $config['template_name'] = 'vbcms_widget_sectionnav_page'; } // add the config content $configview = $this->createView('config'); $configview->template_name = $config['template_name']; // item id to ensure form is submitted to us $this->addPostId($configview); $view->setContent($configview); // send the view $view->setStatus(vB_View_AJAXHTML::STATUS_VIEW, new vB_Phrase('vbcms', 'configuring_widget')); return $view; }
/** * Builds the toolbar view for managing the page. * * @param bool $edit_mode - Whether the user is currently in edit mode * @return vB_View */ protected function getToolbarView($edit_mode = false) { global $vbulletin; global $vbphrase; if (!$this->content->canCreate() AND !$this->content->canEdit() AND !$this->content->canPublish()) { return; } require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('cpcms'); // Create view $view = new vB_View('vbcms_toolbar'); $view->edit_mode = $edit_mode; $view->page_url = vB_Router::getURL(); $view->access = ($this->content->publicCanView() ? $vbphrase['public'] : $vbphrase['public']); // Setup a new route to get URLs $route = new vBCms_Route_Content(); $route->node = $this->node->getURLSegment(); $view->view_url = $route->getCurrentURL(array('action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View'))); $view->edit_url = $route->getCurrentURL(array('action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage'))); $view->edit_label = new vB_Phrase('vbcms', 'edit_this_page'); // New content options $view->add_url = $route->getCurrentURL(array('action' => vB_Router::getUserAction('vBCms_Controller_Content', 'AddNode'))); $view->add_label = new vB_Phrase('vbcms', 'create_new'); // Get placable contenttypes. TODO: This should be a method of vB_Types for reuse if (!($view->contenttypes = vB_Cache::instance()->read('vbcms_controller_content.place_nonaggs', true, true))) { $contenttype_collection = new vB_Collection_ContentType(); $contenttype_collection->filterPlaceable(true); $contenttype_collection->filterNonAggregators(true); $contenttypes = array(); $permissionsfrom = $this->content->getPermissionsFrom(); foreach ($contenttype_collection AS $contenttype) { $this_type = vBCms_Content::create($contenttype->getPackageClass(), $contenttype->getClass(), 0); if ($this_type->canCreateHere($permissionsfrom)) { $title = (string)$contenttype->getTitle(); $contenttypes[$title] = array('id' => $contenttype->getId(), 'title' => $title); }; unset($this_type); } ksort($contenttypes); $view->contenttypes = $contenttypes; unset($contenttype_collection, $contenttypes); vB_Cache::instance()->write('vbcms_controller_content.place_nonaggs', $view->contenttypes, false, vB_Types::instance()->getContentTypeCacheEvents()); } // Set the publish state description if ($this->node->isPublished()) { $view->publish_status = new vB_Phrase('vbcms', 'page_is_published'); } else if ($this->node->getPendingParentId()) { $pending_title = $this->node->getPendingParentTitle(); $pending_route = vB_Route::create('vBCms_Route_Content')->getCurrentURL(array('node' => $this->node->getPendingParentId())); $view->publish_status = new vB_Phrase('vbcms', 'section_x_not_published', $pending_route, $pending_title); } else if ($date = $this->node->getPublishDate()) { $date = vbdate(vB::$vbulletin->options['dateformat'], $date, true); $view->publish_status = new vB_Phrase('vbcms', 'page_will_be_published_x', $date); } else { $view->publish_status = new vB_Phrase('vbcms', 'page_not_published'); } $view->can_publish = $this->content->canPublish(); $view->can_edit = $this->content->canEdit(); $view->can_create = $this->content->canCreate(); // Add postid $this->addPostId($view); return $view; }
/** * Creates a string representation of the error. * This is useful when logging or mailing the error and displays full details * of the error and where it occurred, including a full stack trace. * * @param bool $verbose - Whether to display full details * @return string */ public function toString($verbose = false) { // Build string $str = $this->message . "\r\n"; // Add details if ($verbose) { $str .= "********************\r\n"; $str .= 'Occured in file: ' . $this->file . " on line {$this->line}\r\n"; $str .= 'Current Route: ' . vB_Router::getCurrentRoute() . "\r\n"; $str .= 'Initial Route: ' . vB_Router::getInitialRoute() . "\r\n"; $str .= 'Time: ' . date('l dS \\of F Y h:i:s A') . "\r\n"; $str .= "Stack Trace:\n" . $this->getTraceAsString() . "\r\n"; } return $str; }
/** * Returns the config view for the widget. * * @param vB_Widget $widget * @return vBCms_View_Widget - The view result */ public function getConfigView($widget = false) { $this->assertWidget(); require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('cpcms'); fetch_phrase_group('vbblock'); fetch_phrase_group('vbblocksettings'); vB::$vbulletin->input->clean_array_gpc('r', array( 'do' => vB_Input::TYPE_STR, 'template_name' => vB_Input::TYPE_STR, 'cache_ttl' => vB_Input::TYPE_INT, 'commentusernames' => vB_Input::TYPE_STR, 'postusernames' => vB_Input::TYPE_STR, 'taglist' => vB_Input::TYPE_STR, 'blogid' => vB_Input::TYPE_STR, 'cat_case_sensitive' => vB_Input::TYPE_INT, 'messagemaxchars' => vB_Input::TYPE_INT, 'categories' => vB_Input::TYPE_STR, 'days' => vB_Input::TYPE_INT, 'count' => vB_Input::TYPE_INT )); $view = new vB_View_AJAXHTML('cms_widget_config'); $view->title = new vB_Phrase('vbcms', 'configuring_widget_x', $this->widget->getTitle()); $config = $this->widget->getConfig(); if ((vB::$vbulletin->GPC['do'] == 'config') AND $this->verifyPostId()) { $widgetdm = new vBCms_DM_Widget($this->widget); if (vB::$vbulletin->GPC_exists['template_name']) { $config['template_name'] = vB::$vbulletin->GPC['template_name']; } if (vB::$vbulletin->GPC_exists['days']) { $config['days'] = vB::$vbulletin->GPC['days']; } if (vB::$vbulletin->GPC_exists['count']) { $config['count'] = vB::$vbulletin->GPC['count']; } if (vB::$vbulletin->GPC_exists['cache_ttl']) { $config['cache_ttl'] = vB::$vbulletin->GPC['cache_ttl']; } if (vB::$vbulletin->GPC_exists['messagemaxchars']) { $config['messagemaxchars'] = vB::$vbulletin->GPC['messagemaxchars']; } if (vB::$vbulletin->GPC_exists['commentusernames']) { //We could be passed an empty string. If so, clear the existing value if (empty(vB::$vbulletin->GPC['commentusernames'])) { $config['commentuserid'] = ''; } else { //We are passed names. We need to turn those into user id's $usernames = explode(',', vB::$vbulletin->GPC['commentusernames']); foreach ($usernames as $key => $username) { $usernames[$key] = "'" . vB::$db->escape_string(trim($username)) . "'"; } $sql = "SELECT username, userid FROM " . TABLE_PREFIX . "user WHERE username IN (" . implode(',', $usernames) . ") ORDER BY lower(username)"; if ($rst = vB::$db->query_read($sql)) { $userids = array(); while($record = vB::$db->fetch_array($rst)) { $userids[$record['userid']] = $record['username']; } } $config['commentuserid'] = $userids; } } if (vB::$vbulletin->GPC_exists['postusernames']) { //We could be passed an empty string. If so, clear the existing value if (empty(vB::$vbulletin->GPC['postusernames'])) { $config['postuserid'] = ''; } else { //We are passed names. We need to turn those into user id's $usernames = explode(',', vB::$vbulletin->GPC['postusernames']); foreach ($usernames as $key => $username) { $usernames[$key] = "'" . vB::$db->escape_string(trim($username)) . "'"; } $sql = "SELECT username, userid FROM " . TABLE_PREFIX . "user WHERE username IN (" . implode(',', $usernames) . ") ORDER BY lower(username)"; if ($rst = vB::$db->query_read($sql)) { $userids = array(); while($record = vB::$db->fetch_array($rst)) { $userids[$record['userid']] = $record['username']; } } $config['postuserid'] = $userids; } } if (vB::$vbulletin->GPC_exists['taglist']) { //We could be passed an empty string. If so, clear the existing value if (empty(vB::$vbulletin->GPC['taglist'])) { $config['taglist'] = ''; } else { //We need to confirm these are valid tags $tags = explode(',', vB::$vbulletin->GPC['taglist']); foreach ($tags as $key => $tag) { $tags[$key] = "'" . vB::$db->escape_string(trim($tag)) . "'"; } $sql = "SELECT tagid, tagtext FROM " . TABLE_PREFIX . "tag WHERE tagtext IN (" . implode(',', $tags) . ") ORDER BY tagtext"; if ($rst = vB::$db->query_read($sql)) { $tagids = array(); while($record = vB::$db->fetch_array($rst)) { $tagids[$record['tagid']] = $record['tagtext']; } } $config['taglist'] = $tagids; } } if (vB::$vbulletin->GPC_exists['blogid']) { //We could be passed an empty string. If so, clear the existing value if (empty(vB::$vbulletin->GPC['blogid'])) { $config['blogid'] = ''; } else { //We need to confirm these are valid ids $blogids = explode(',', vB::$vbulletin->GPC['blogid']); $blogid_checked = array(); foreach ($blogids as $key => $blogid) { if (intval(intval($blogid))) { } $blogid_checked[] = intval($blogid); } $sql = "SELECT blogid FROM " . TABLE_PREFIX . "blog WHERE blogid IN (" . implode(',', $blogid_checked) . ")"; if ($rst = vB::$db->query_read($sql)) { $blogids = array(); while($record = vB::$db->fetch_array($rst)) { $blogids[] = $record['blogid']; } } $config['blogid'] = implode(',', $blogids); } } if (vB::$vbulletin->GPC_exists['categories']) { //We could be passed an empty string. If so, clear the existing value if (vB::$vbulletin->GPC['categories'] == '') { $config['categories'] = ''; } else { $categories = explode(',', vB::$vbulletin->GPC['categories']); foreach ($categories as $key => $category) { $categories[$key] = "'" . vB::$db->escape_string(trim($category)) . "'"; } $sql = "SELECT title, blogcategoryid FROM " . TABLE_PREFIX . "blog_category WHERE title IN (" . implode(',', $categories) . ")"; if ($rst = vB::$db->query_read($sql)) { $categories = array(); while($record = vB::$db->fetch_array($rst)) { $categories[$record['blogcategoryid']] = $record['title']; } } $config['categories'] = $categories; } } $widgetdm->set('config', $config); $widgetdm->save(); if (!$widgetdm->hasErrors()) { if ($this->content) { $segments = array('node' => $this->content->getNodeURLSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->setUrl(vB_View_AJAXHTML::URL_FINISHED, vBCms_Route_Content::getURL($segments)); } $view->setStatus(vB_View_AJAXHTML::STATUS_FINISHED, new vB_Phrase('vbcms', 'configuration_saved')); } else { if (vB::$vbulletin->debug) { $view->addErrors($widgetdm->getErrors()); } // only send a message $view->setStatus(vB_View_AJAXHTML::STATUS_MESSAGE, new vB_Phrase('vbcms', 'configuration_failed')); } } else { // add the config content $configview = $this->createView('config'); if (!isset($config['template_name']) OR ($config['template_name'] == '') ) { $config['template_name'] = 'vbcms_widget_recentblog_page'; } // add the config content $configview->template_name = $config['template_name']; $configview->days = $config['days']; $configview->count = $config['count']; $configview->messagemaxchars = $config['messagemaxchars']; $configview->blogid = $config['blogid']; if (!empty($config['postuserid'])) { $configview->postusernames = implode(',', $config['postuserid']); } if (!empty($config['commentuserid'])) { $configview->commentusernames = implode(',', $config['commentuserid']); } if (!empty($config['taglist'])) { $configview->taglist = implode(',', $config['taglist']); } //Case sensitivity is an interesting issue. We will do the // search based on the db collation, which defaults to case // insensitive. But let's display in the stored value case $categories = array(); if (!empty($config['categories'])) { $lcase_categories = array(); foreach($config['categories'] as $category) { if (!in_array(strtolower($category), $lcase_categories)) { $categories[] = $category; $lcase_categories[] = strtolower($category); } } $configview->categories = implode(',', $config['categories']); } $configview->categories = implode(',', $categories); $configview->cache_ttl = $config['cache_ttl']; $this->addPostId($configview); $view->setContent($configview); // send the view $view->setStatus(vB_View_AJAXHTML::STATUS_VIEW, new vB_Phrase('vbcms', 'configuring_widget')); } return $view; }
public function getInlineEditBodyView() { global $vbphrase; require_once DIR . '/includes/functions_databuild.php'; require_once DIR . '/includes/functions.php'; fetch_phrase_group('cpcms'); $this->editing = true; //confirm that the user has edit rights if (!$this->content->canEdit() AND !($this->getUserId() == vB::$vbulletin->userinfo['userid']) AND !$this->content->canPublish()) { return $vb_phrase['no_edit_permissions']; } vB::$vbulletin->input->clean_array_gpc('r', array( 'postid' => vB_Input::TYPE_UINT, 'blogcommentid' => vB_Input::TYPE_UINT, 'do' => vB_Input::TYPE_STR, 'blogid' => TYPE_UINT )); if ($_REQUEST['do'] == 'delete') { $dm = $this->content->getDM(); $dm->delete(); $this->cleanContentCache(); return $vbphrase['article_deleted']; } if ($_REQUEST['do'] == 'apply' OR $_REQUEST['do'] == 'update') { $this->SaveData($view); } require_once DIR . '/packages/vbcms/contentmanager.php'; // Load the content item if (!$this->loadContent($this->getViewInfoFlags(self::VIEW_PAGE))) { throw (new vB_Exception_404()); } global $show; $show['img_bbcode'] = true; // Get smiliecache and bbcodecache vB::$vbulletin->datastore->fetch(array('smiliecache','bbcodecache')); // Create view $view = $this->createView('inline', self::VIEW_PAGE); // Add the content to the view $view = $this->populateViewContent($view, self::VIEW_PAGE, false); $pagetext = $this->content->getPageText(); // Get postings phrasegroup // need posting group require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('posting'); // Build editor global $messagearea; require_once DIR . '/includes/functions_file.php'; require_once DIR . '/includes/functions_editor.php'; require_once(DIR . '/packages/vbattach/attach.php'); $view->formid = "cms_content_data"; $view->can_edit = $this->content->canEdit(); if ($this->content->canEdit()) { $attach = new vB_Attach_Display_Content(vB::$vbulletin, 'vBCms_Article'); //this will set a number of its parameters if they are not already set. $posthash = null; $poststarttime = null; $postattach = array(); $attachcount = 0; $values = "values[f]=" . $this->content->getNodeId() ; $attachmentoption = $attach->fetch_edit_attachments($posthash, $poststarttime, $postattach, $this->content->getNodeId(), $values, '', $attachcount); $attachinfo = fetch_attachmentinfo($posthash, $poststarttime, $this->getContentTypeId(), array('f' => $this->content->getNodeId())); $view->editorid = construct_edit_toolbar( $pagetext, false, new vBCms_Editor_Override(vB::$vbulletin), true, true, true, 'cms_article', '', $attachinfo ); $templater = vB_Template::create('vbcms_article_editor'); $templater->register('attachmentoption', $attachmentoption); $templater->register('attachmentoption', $attachmentoption); $templater->register('posthash', $posthash); $templater->register('poststarttime', $poststarttime); $templater->register('contenttypeid', $this->getContentTypeId()); $templater->register('values', $values); $templater->register('contentid', $this->content->getNodeId()); $templater->register('insertinline ', 1); $templater->register('checked', $checked); $templater->register('disablesmiliesoption', $disablesmiliesoption); $templater->register('editorid', $view->editorid); $templater->register('messagearea', $messagearea); $tag_delimiters = addslashes_js(vB::$vbulletin->options['tagdelimiter']); $templater->register('tag_delimiters', $tag_delimiters); $content = $templater->render(); $view->editor = $content; } else { $view->previewtext = $this->content->getPreviewText();; } $view->url = $this->content->getUrl(); $view->type = new vB_Phrase('vbcms', 'content'); $view->adding = new vB_Phrase('cpcms', 'adding_x', $vbphrase['article']); $view->html_title = $this->content->getHtmlTitle(); $view->title = $this->content->getTitle(); $view->metadata = $this->content->getMetadataEditor(); $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View')); $view->view_url = vBCms_Route_Content::getURL($segments); // Add URL to submit to $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->submit_url = vBCms_Route_Content::getURL($segments); $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View')); $view->editbar = $this->content->getEditBar($view->submit_url, vBCms_Route_Content::getURL($segments), $view->formid); $view->publisher = $this->content->getPublishEditor($view->submit_url, $view->formid, true, true, $this->content->getPublicPreview(), $this->content->getComments_Enabled()); $view->authorid = ($this->content->getUserId()); $view->authorname = ($this->content->getUsername()); $view->viewcount = ($this->content->getViewCount()); $view->parentid = $this->content->getParentId(); $view->post_started = ($this->content->getPostStarted()); $view->post_posted = ($this->content->getPostPosted()); $view->comment_count = ($this->content->getReplyCount()); $view->contentid = $this->content->getContentId(true); $view->show_threaded = true; $view->per_page = 10; $view->indent_per_level = 5; $view->max_level = 4; // Add form check $this->addPostId($view); return $view; }
public function getInlineEditBodyView() { global $vbphrase; require_once DIR . '/includes/functions_databuild.php'; require_once DIR . '/includes/functions.php'; fetch_phrase_group('cpcms'); $this->config = $this->content->getConfig(); $this->editing = true; //confirm that the user has edit rights if ( (!$this->content->canEdit() AND !$this->content->canUseHtml(vB::$vbulletin->userinfo['userid']) ) OR !$this->content->canPublish() ) { return $vb_phrase['no_edit_permissions']; } vB::$vbulletin->input->clean_array_gpc('r', array( 'do' => vB_Input::TYPE_STR, )); if ($_REQUEST['do'] == 'delete') { $dm = $this->content->getDM(); $dm->delete(); $this->cleanContentCache(); return $vbphrase['article_deleted']; } $view = new vB_View('vbcms_content_' . strtolower($this->class). '_inline'); if ($_REQUEST['do'] == 'apply' OR $_REQUEST['do'] == 'update') { $this->saveData($view); } $this->config = $this->content->getConfig(); require_once DIR . '/packages/vbcms/contentmanager.php'; // Load the content item if (!$this->loadContent($this->getViewInfoFlags(self::VIEW_PAGE))) { throw (new vB_Exception_404()); } global $show; $show['img_bbcode'] = true; // Create view //make sure we have template names. if (empty($this->config['previewtemplate'])) { $this->config['previewtemplate'] = $this->default_previewtemplate; } if (empty($this->config['template'])) { $this->config['template'] = $this->default_template; } // Add the content to the view $view = $this->populateViewContent($view, self::VIEW_PAGE, false); //the configuration settings foreach ($this->config as $key => $value) { if (($key == 'preview_image') OR ($key == 'title')) { $view->$key = htmlspecialchars_uni($value); } else { $view->$key = $value; } } $view->formid = "cms_content_data"; $view->can_edit = $this->content->canEdit() AND $this->content->canUseHtml(vB::$vbulletin->userinfo['userid']); $view->url = $this->content->getUrl(); $view->type = new vB_Phrase('vbcms', 'content'); $view->adding = new vB_Phrase('cpcms', 'adding_x', $vbphrase['article']); $view->html_title = $this->content->getHtmlTitle(); $view->title = $this->content->getTitle(); $view->metadata = $this->content->getMetadataEditor(); $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View')); $view->view_url = vBCms_Route_Content::getURL($segments); // Add URL to submit to $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->submit_url = vBCms_Route_Content::getURL($segments); $segments = array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View')); $view->editbar = $this->content->getEditBar($view->submit_url, vBCms_Route_Content::getURL($segments), $view->formid); $view->publisher = $this->content->getPublishEditor($view->submit_url, $view->formid, true, true, $this->content->getPublicPreview(), $this->content->getComments_Enabled()); $view->authorid = ($this->content->getUserId()); $view->authorname = ($this->content->getUsername()); $view->viewcount = ($this->content->getViewCount()); $view->parentid = $this->content->getParentId(); $view->comment_count = ($this->content->getReplyCount()); $view->contentid = $this->content->getContentId(true); $view->show_threaded = true; $view->per_page = 10; $view->indent_per_level = 5; $view->max_level = 4; // Add form check $this->addPostId($view); return $view; }
/** * Returns the inline edit view for the widget. * Widgets do not have to support this, however if they are editable and * configurable then the page view can be returned in a tool block view, which * the default implementation provides. * * The inline edit view allows the current user to edit the contents of the * widget. This should only be allowed for users with permission and should * generally be used to edit widget content rather than configuration. * * @return vBCms_View_Widget - The view result */ public function getInlineEditView() { $this->assertWidget(); // add the tool block $view = new vBCms_View_EditBlock('vbcms_edit_block'); if ($this->canEdit()) { $view->content = $this->getInlineEditBodyView(); if ($this->is_editable) { $view->edit_url = vBCms_Route_Content::getURL(array('node' => $this->content->getNodeURLSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Widget', 'Edit')), array($this->widget->getId())); } if ($this->is_configurable) { $view->config_url = vBCms_Route_Content::getURL(array('node' => $this->content->getNodeURLSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Widget', 'Config')), array($this->widget->getId())); } } else { $view->content = $this->getPageView(); } $view->type = new vB_Phrase('vbcms', 'widget'); $view->typetitle = $this->widget->getTypeTitle(); $view->title = $this->widget->getTitle(); return $view; }
/** * Creates a 404 exception with the given message * * @param string $message - A user friendly error * @param int $code - The PHP code of the error * @param string $file - The file the exception was thrown from * @param int $line - The line the exception was thrown from */ public function __construct($message = false, $code = false, $file = false, $line = false) { // Standard exception initialisation parent::__construct(vB_Router::get409Path(), $message, $code, $file, $line); }
define('SKIP_WOLPATH', 1); // Legacy info // TODO: Load the cms phrasegroup elsewhere $phrasegroups = array('vbcms'); // Bootstrap to the legacy system require './includes/class_bootstrap.php'; $bootstrap = new vB_Bootstrap(); $bootstrap->datastore_entries = array('routes'); $bootstrap->bootstrap(); /*MVC Bootstrap=====================================================================*/ // Get the entry time define('VB_ENTRY_TIME', microtime(true)); // vB core path define('VB_PATH', realpath(dirname(__FILE__)) . '/'); // The package path define('VB_PKG_PATH', realpath(VB_PATH . '../packages') . '/'); // Bootstrap the framework require_once VB_PATH . 'vb.php'; vB::init(); if (defined('VB_API') and VB_API === true) { // Force vB::$vbulletin->options['route_requestvar'] to 'r' for API. vB::$vbulletin->options['route_requestvar'] = 'r'; } // Get routed response print_output(vB_Router::getResponse()); /*======================================================================*\ || #################################################################### || # Downloaded: 03:13, Sat Sep 7th 2013 || # SVN: $Revision: 28749 $ || #################################################################### \*======================================================================*/
/** * Main entry point for the controller. * * @return string - The final page output */ public function getResponse() { // Register the templater to be used for XHTML vB_View::registerTemplater(vB_View::OT_XHTML, new vB_Templater_vB()); $error = vB_Router::getSegment('error'); // Resolve rerouted error $error = in_array($error, array('403', '404', '409', '500')) ? $error : '404'; $current_page = $_SERVER['SCRIPT_NAME'] . ($_SERVER['SCRIPT_NAME'] == '' ? '' : '?' . $_SERVER['QUERY_STRING']); if ('403' == $error) { define('WOLPATH', '403|cpglobal|403_error|' . new vB_Phrase('wol', 'viewing_no_permission_message')); vB::$vbulletin->session->set('location', $current_page); print_no_permission(); } else if ('409' == $error) { $message = ($message = vB_Router::getRerouteMessage()) ? $message : new vB_Phrase('error', 'error_409_description', vB_Router::getInitialURL(), vB_Router::getBaseURL(), vB::$vbulletin->options['contactuslink']); define('WOLPATH', '409|wol|' . new vB_Phrase('cpglobal', 'error') . "|$message"); vB::$vbulletin->session->set('location', $current_page); standard_error($message); } else if ('500' == $error) { $message = new vB_Phrase('error', 'error_500_description', vB_Router::getInitialURL(), vB_Router::getBaseURL(), vB::$vbulletin->options['contactuslink']); define('WOLPATH', '500|wol|' . new vB_Phrase('cpglobal', 'error') . "|$message"); vB::$vbulletin->session->set('location', $current_page); standard_error($message); } else { $message = new vB_Phrase('error', 'error_404_description', vB_Router::getBaseURL(), vB::$vbulletin->options['contactuslink']); define('WOLPATH', '404|wol|' . new vB_Phrase('cpglobal', 'error') . "|$message"); vB::$vbulletin->session->set('location', $current_page); } // Create the page view $page_view = new vB_View_Page('page'); $title = new vB_Phrase('error', 'error_404'); $page_view->setPageTitle($title); // Create the body view $error_view = new vB_View('error_message'); $subtitle = ($title != ($subtitle = vB_Router::getRerouteMessage())) ? $subtitle : false; $error_view->title = $title; $error_view->subtitle = $subtitle; $error_view->message = new vB_Phrase('error', 'error_404_description', vB_Router::getBaseURL(), vB::$vbulletin->options['contactuslink']); $page_view->setBodyView($error_view); // Add general page info $page_view->setPageTitle($title); return $page_view->render(); }
/** * Returns the config view for the widget. * * @return vBCms_View_Widget - The view result */ public function getConfigView() { require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('cpcms'); $this->assertWidget(); vB::$vbulletin->input->clean_array_gpc('r', array( 'do' => vB_Input::TYPE_STR, 'url' => vB_Input::TYPE_STR, 'template_name' => vB_Input::TYPE_STR, 'use_rss_title' => vB_Input::TYPE_BOOL, 'max_items' => vB_Input::TYPE_INT, )); $view = new vB_View_AJAXHTML('cms_widget_config'); $view->title = new vB_Phrase('vbcms', 'configuring_widget_x', $this->widget->getTitle()); $config = $this->widget->getConfig(); if ((vB::$vbulletin->GPC['do'] == 'config') AND $this->verifyPostId()) { $config['url'] = convert_urlencoded_unicode(vB::$vbulletin->GPC['url']); $config['use_rss_title'] = vB::$vbulletin->GPC['use_rss_title']; if (vB::$vbulletin->GPC_exists['template_name']) { $config['template_name'] = vB::$vbulletin->GPC['template_name']; } if (vB::$vbulletin->GPC_exists['max_items']) { $config['max_items'] = vB::$vbulletin->GPC['max_items']; } $widgetdm = $this->widget->getDM(); $widgetdm->set('config', $config); if ($this->content) { $widgetdm->setConfigNode($this->content->getNodeId()); } $widgetdm->save(); if (!$widgetdm->hasErrors()) { if ($this->content) { $segments = array('node' => $this->content->getNodeURLSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->setUrl(vB_View_AJAXHTML::URL_FINISHED, vBCms_Route_Content::getURL($segments)); } $view->setStatus(vB_View_AJAXHTML::STATUS_FINISHED, new vB_Phrase('vbcms', 'configuration_saved')); } else { if (vB::$vbulletin->debug) { $view->addErrors($widgetdm->getErrors()); } // only send a message $view->setStatus(vB_View_AJAXHTML::STATUS_MESSAGE, new vB_Phrase('vbcms', 'configuration_failed')); } } else { // add the config content $configview = $this->createView('config'); if (!isset($config['template_name']) OR ($config['template_name'] == '') ) { $config['template_name'] = 'vbcms_widget_rss_page'; } // add the config content $configview->use_rss_title = $config['use_rss_title']; $configview->template_name = $config['template_name']; $configview->max_items = $config['max_items']; $configview->url = $config['url'] ? htmlspecialchars_uni($config['url']) : $config['url']; // item id to ensure form is submitted to us $this->addPostId($configview); $view->setContent($configview); // send the view $view->setStatus(vB_View_AJAXHTML::STATUS_VIEW, new vB_Phrase('vbcms', 'configuring_widget')); } return $view; }
/** * Resolves the current Wolpath and assigns it to the session for saving. */ protected function resolveWolPath() { $route_path = vB_Router::getCurrentRoute(); $wol_info_phrase = (isset($this->wol_info[$this->action][0])) ? $this->wol_info[$this->action][0] : $this->wol_info['Default'][0]; $wol_info_segments = (isset($this->wol_info[$this->action][1])) ? $this->wol_info[$this->action][1] : $this->wol_info['Default'][1]; if ($wol_info_segments) { $route = vB_Router::createRoute($route_path); $route->setSegments($wol_info_segments); $route_path = (string)$route; } if ($wol_info_phrase) { $action_phrase = implode('|', $wol_info_phrase); } else { $action_phrase = 'global|viewing'; } $wol = array( urlencode($route_path), $action_phrase, urlencode($this->getTitle()) ); $wolpath = implode('|', $wol); vB::$vbulletin->session->set('location', 'route:' . $wolpath); define('WOLPATH', $wolpath); }
/** * Returns the config view for the widget. * * @return vBCms_View_Widget - The view result */ public function getConfigView() { global $vbphrase; require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('cpcms'); $this->assertWidget(); vB::$vbulletin->input->clean_array_gpc('r', array( 'do' => vB_Input::TYPE_STR, 'days' => vB_Input::TYPE_UINT, 'count' => vB_Input::TYPE_UINT, 'template' => vB_Input::TYPE_STR, 'inner_template' => vB_Input::TYPE_STR, 'cache_ttl' => vB_Input::TYPE_UINT, )); $view = new vB_View_AJAXHTML('cms_widget_config'); $view->title = new vB_Phrase('vbcms', 'configuring_widget_x', $this->widget->getTitle()); $config = $this->widget->getConfig(); if ((vB::$vbulletin->GPC['do'] == 'config') AND $this->verifyPostId()) { if (vB::$vbulletin->GPC_exists['days']) { $config['days'] = vB::$vbulletin->GPC['days']; } if (vB::$vbulletin->GPC_exists['count']) { $config['count'] = vB::$vbulletin->GPC['count']; } if (vB::$vbulletin->GPC_exists['template']) { $config['template'] = vB::$vbulletin->GPC['template']; } if (vB::$vbulletin->GPC_exists['inner_template']) { $config['inner_template'] = vB::$vbulletin->GPC['inner_template']; } if (vB::$vbulletin->GPC_exists['cache_ttl']) { $config['cache_ttl'] = vB::$vbulletin->GPC['cache_ttl']; } $widgetdm = $this->widget->getDM(); $widgetdm->set('config', $config); if ($this->content) { $widgetdm->setConfigNode($this->content->getNodeId()); } $widgetdm->save(); if (!$widgetdm->hasErrors()) { if ($this->content) { $segments = array('node' => $this->content->getNodeURLSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->setUrl(vB_View_AJAXHTML::URL_FINISHED, vBCms_Route_Content::getURL($segments)); } $view->setStatus(vB_View_AJAXHTML::STATUS_FINISHED, new vB_Phrase('vbcms', 'configuration_saved')); } else { if (vB::$vbulletin->debug) { $view->addErrors($widgetdm->getErrors()); } // only send a message $view->setStatus(vB_View_AJAXHTML::STATUS_MESSAGE, new vB_Phrase('vbcms', 'configuration_failed')); } } else { $configview = $this->createView('config'); $configview->days = $config['days']; $configview->count = $config['count']; $configview->cache_ttl = $config['cache_ttl']; if (!isset($config['template']) OR ($config['template'] == '') ) { $config['template'] = 'vbcms_widget_recentcmscomments_page'; } if (!isset($config['inner_template']) OR ($config['inner_template'] == '') ) { $config['inner_template'] = 'vbcms_searchresult_newcomment'; } $configview->template = $config['template']; $configview->inner_template = $config['inner_template']; // item id to ensure form is submitted to us $this->addPostId($configview); $view->setContent($configview); // send the view $view->setStatus(vB_View_AJAXHTML::STATUS_VIEW, new vB_Phrase('vbcms', 'configuring_widget')); } return $view; }
/** * Returns the inline edit view for the content. * The inline edit view allows the current user to edit the contents within the * body of the page. This should only be allowed for users with permission. * * Contenttypes do not have to support inline editing, however the inline edit * view also provides the page view within a tool block view with links to * configure and edit the content. This is provided by the default * implementation. * * @param array mixed $parameters - Request parameters * @return vBCms_View_Content - The view result */ public function getInlineEditView($parameters = false) { $this->assertContent(); if ($parameters) { $this->setParameters($parameters); } // add the tool block $view = new vBCms_View_EditBlock('vbcms_edit_block'); if ($this->canEdit() OR $this->canPublish()) { if ($this->is_editable) { $view->edit_url = vBCms_Route_Content::getURL(array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditContent'))); } if ($this->is_configurable) { $view->config_url = vBCms_Route_Content::getURL(array('node' => $this->content->getUrlSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'ConfigContent'))); } $view->content = $this->getInlineEditBodyView($parameters); } else { $view->content = $this->getPageView($parameters); } return $view; }
/** * Returns the config view for the widget. * * @return vBCms_View_Widget - The view result */ public function getConfigView($widget = false) { require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('cpcms'); fetch_phrase_group('search'); $this->assertWidget(); vB::$vbulletin->input->clean_array_gpc('r', array( 'do' => vB_Input::TYPE_STR, 'forumchoice' => vB_Input::TYPE_ARRAY, 'template_name' => vB_Input::TYPE_STR, 'cache_ttl' => vB_Input::TYPE_INT, 'days' => vB_Input::TYPE_INT, 'allow_html' => vB_Input::TYPE_INT, 'count' => vB_Input::TYPE_INT )); $view = new vB_View_AJAXHTML('cms_widget_config'); $view->title = new vB_Phrase('vbcms', 'configuring_widget_x', $this->widget->getTitle()); $config = $this->widget->getConfig(); if ((vB::$vbulletin->GPC['do'] == 'config') AND $this->verifyPostId()) { $widgetdm = new vBCms_DM_Widget($this->widget); if (vB::$vbulletin->GPC_exists['template_name']) { $config['template_name'] = vB::$vbulletin->GPC['template_name']; } //make sure we have actual values for forumchoice if (vB::$vbulletin->GPC_exists['forumchoice']) { $config['forumchoice'] = vB::$vbulletin->GPC['forumchoice']; } if (vB::$vbulletin->GPC_exists['count']) { $config['count'] = vB::$vbulletin->GPC['count']; } if (vB::$vbulletin->GPC_exists['days']) { $config['days'] = vB::$vbulletin->GPC['days']; } if (vB::$vbulletin->GPC_exists['cache_ttl']) { $config['cache_ttl'] = vB::$vbulletin->GPC['cache_ttl']; } if (vB::$vbulletin->GPC_exists['template_name']) { $config['template_name'] = vB::$vbulletin->GPC['template_name']; } $config['allow_html'] = vB::$vbulletin->GPC_exists['allow_html'] ? 1 : 0; $widgetdm->set('config', $config); if ($this->content) { $widgetdm->setConfigNode($this->content->getNodeId()); } $widgetdm->save(); if (!$widgetdm->hasErrors()) { if ($this->content) { $segments = array('node' => $this->content->getNodeURLSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->setUrl(vB_View_AJAXHTML::URL_FINISHED, vBCms_Route_Content::getURL($segments)); } $view->setStatus(vB_View_AJAXHTML::STATUS_FINISHED, new vB_Phrase('vbcms', 'configuration_saved')); } else { if (vB::$vbulletin->debug) { $view->addErrors($widgetdm->getErrors()); } // only send a message $view->setStatus(vB_View_AJAXHTML::STATUS_MESSAGE, new vB_Phrase('vbcms', 'configuration_failed')); } } else { // add the config content $configview = $this->createView('config'); if (!isset($config['template_name']) OR ($config['template_name'] == '') ) { $config['template_name'] = 'vbcms_widget_staticbb_page'; } // add the config content $configview->template_name = $config['template_name']; $configview->forumchoice_select = $this->getForums($config); $configview->days = $config['days']; $configview->count = $config['count']; $this->addPostId($configview); $configview->cache_ttl = $config['cache_ttl']; $configview->allow_html = $config['allow_html']; $view->setContent($configview); // send the view $view->setStatus(vB_View_AJAXHTML::STATUS_VIEW, new vB_Phrase('vbcms', 'configuring_widget')); } return $view; }
\*======================================================================*/ // ######################## SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); @set_time_limit(0); // ##################### DEFINE IMPORTANT CONSTANTS ####################### define('CVS_REVISION', '$RCSfile$ - $Revision: 76725 $'); @ini_set('display_errors', 'On'); // #################### PRE-CACHE TEMPLATES AND DATA ###################### $phrasegroups = array('attachment_image'); $specialtemplates = array(); // ########################## REQUIRE BACK-END ############################ require_once './global.php'; require_once DIR . '/includes/adminfunctions_attachment.php'; require_once DIR . '/includes/functions_file.php'; require_once DIR . '/packages/vbattach/attach.php'; vB_Router::setRelativePath('../'); // ######################## CHECK ADMIN PERMISSIONS ####################### if (!can_administer('canadminthreads')) { print_cp_no_permission(); } // ############################# LOG ACTION ############################### $vbulletin->input->clean_array_gpc('r', array('attachmentid' => TYPE_INT, 'extension' => TYPE_STR, 'attachpath' => TYPE_STR, 'dowhat' => TYPE_STR)); log_admin_action(iif($vbulletin->GPC['attachmentid'] != 0, 'attachment id = ' . $vbulletin->GPC['attachmentid'], iif(!empty($vbulletin->GPC['extension']), "extension = " . $vbulletin->GPC['extension'], ''))); // ######################################################################## // ######################### START MAIN SCRIPT ############################ // ######################################################################## print_cp_header($vbphrase['attachment_manager']); if (empty($_REQUEST['do'])) { $_REQUEST['do'] = 'intro'; } // ###################### Swap from database to file system and vice versa ##########
/** * Returns the config view for the widget. * * @return vBCms_View_Widget - The view result */ public function getConfigView($widget = false) { global $vbulletin, $messagearea, $vbphrase; $this->assertWidget(); require_once DIR . '/includes/functions_editor.php'; require_once DIR . '/packages/vbcms/wysiwyghtmlparser.php'; require_once DIR . '/packages/vbcms/editor/override.php'; require_once DIR . '/packages/vbcms/bbcode/html.php'; require_once DIR . '/packages/vbcms/bbcode/wysiwyg.php'; require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('posting'); vB::$vbulletin->input->clean_array_gpc('r', array( 'do' => vB_Input::TYPE_STR, 'message' => vB_Input::TYPE_STR, 'wysiwyg' => vB_Input::TYPE_BOOL, 'template_name' => vB_Input::TYPE_STR )); $view = new vB_View_AJAXHTML('cms_widget_config'); $view->title = new vB_Phrase('vbcms', 'configuring_widget_x', $this->widget->getTitle()); $config = $this->widget->getConfig(); if ((vB::$vbulletin->GPC['do'] == 'config') AND $this->verifyPostId()) { if (vB::$vbulletin->GPC['wysiwyg']) { $html_parser = new vBCms_WysiwygHtmlParser(vB::$vbulletin); $message = $html_parser->parse(vB::$vbulletin->GPC['message']); } else { $message = convert_urlencoded_unicode(vB::$vbulletin->GPC['message']); } $widgetdm = new vBCms_DM_Widget($this->widget); if (vB::$vbulletin->GPC_exists['template_name']) { $config['template_name'] = vB::$vbulletin->GPC['template_name']; } $widgetdm->set('config', $config); if ($this->content) { $widgetdm->setConfigNode($this->content->getNodeId()); } $widgetdm->save(); if (!$widgetdm->hasErrors()) { if ($this->content) { $segments = array('node' => $this->content->getNodeURLSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->setUrl(vB_View_AJAXHTML::URL_FINISHED, vBCms_Route_Content::getURL($segments)); } $view->setStatus(vB_View_AJAXHTML::STATUS_FINISHED, new vB_Phrase('vbcms', 'configuration_saved')); } else { if (vB::$vbulletin->debug) { $view->addErrors($widgetdm->getErrors()); } // only send a message $view->setStatus(vB_View_AJAXHTML::STATUS_MESSAGE, new vB_Phrase('vbcms', 'configuration_failed')); } } else { // add the config content $configview = $this->createView('config'); if (!isset($config['template_name']) OR ($config['template_name'] == '') ) { $config['template_name'] = 'vbcms_widget_staticbb_page'; } // add the config content $configview->template_name = $config['template_name']; //make the editor $configview->editorid = construct_edit_toolbar( $pagetext, false, new vBCms_Editor_Override(vB::$vbulletin), true, true, true, 'cms_article', '', array() ); $templater = vB_Template::create('vbcms_widgetcontent_editor'); $templater->register('values', $values); $templater->register('widgetid', $this->widget->getId()); $templater->register('disablesmiliesoption', true); $templater->register('editorid', $configview->editorid); $templater->register('messagearea', $messagearea); $configview->editor = $templater->render(); // $configview->editor = $this->getConfigEditorView(); // item id to ensure form is submitted to us $this->addPostId($configview); $view->setContent($configview); // send the view $view->setStatus(vB_View_AJAXHTML::STATUS_VIEW, new vB_Phrase('vbcms', 'configuring_widget')); } return $view; }
/** * Initializes the vB framework. * All framework level objects and services are created so that they are available * throughout the application. This is only done once per actual request. * * Note: If the framework is used this way then there are several limitations. * - If no vB_Bootstrap was created (ie, the admincp), then you cannot render any * views created by the framework. * - VB_ENTRY must be defined to a valid request script that runs the framework * with vB::Main() * - If you are rendering views, try to create all of the views that will be * used before rendering any of them. This optimises template and phrase * fetching. */ public static function init($relative_path = false) { global $vbulletin, $vbphrase; if (self::$initialized) { return; } // Reference legacy registry self::$vbulletin = $vbulletin; // Legacy DB self::$db = $vbulletin->db; // Set a top level exception handler set_exception_handler(array('vB', 'handleException')); // Set unserializer to use spl registered autoloader ini_set('unserialize_callback_func', 'spl_autoload_call'); // Set class autoloader spl_autoload_register(array('vB', 'autoload')); // Legacy language vB_Phrase::setLanguage(!empty(self::$vbulletin->session->vars['languageid']) ? self::$vbulletin->session->vars['languageid'] : intval(self::$vbulletin->options['languageid'])); vB_Phrase::preCache($vbphrase, $GLOBALS['phrasegroups']); // Ensure we have friendly url class require_once DIR . '/includes/class_friendly_url.php'; if ($relative_path) { vB_Router::setRelativePath($relative_path); } // Done self::$initialized = true; }
/** * Returns the config view for the widget. * * @return vBCms_View_Widget - The view result */ public function getConfigView() { $this->assertWidget(); global $vbphrase; require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('vbcms'); vB::$vbulletin->input->clean_array_gpc('r', array( 'do' => vB_Input::TYPE_STR, 'days' => vB_Input::TYPE_UINT, 'item_id' => vB_Input::TYPE_UINT, 'count' => vB_Input::TYPE_UINT, 'rb_type' => vB_Input::TYPE_UINT, 'template_name' => vB_Input::TYPE_STR, 'contenttypeid' => vB_Input::TYPE_ARRAY )); $view = new vB_View_AJAXHTML('cms_widget_config'); $view->title = new vB_Phrase('vbcms', 'configuring_widget_x', $this->widget->getTitle()); $config = $this->widget->getConfig(); if ((vB::$vbulletin->GPC['do'] == 'config') AND $this->verifyPostId()) { if (vB::$vbulletin->GPC_exists['days']) { $config['days'] = vB::$vbulletin->GPC['days']; } if (vB::$vbulletin->GPC_exists['count']) { $config['count'] = vB::$vbulletin->GPC['count']; } if (vB::$vbulletin->GPC_exists['template_name']) { $config['template_name'] = vB::$vbulletin->GPC['template_name']; } if ( vB::$vbulletin->GPC_exists['rb_type'] AND intval(vB::$vbulletin->GPC['rb_type'])) { $config['contenttypeid'] = vB::$vbulletin->GPC['rb_type']; vB::$vbulletin->input->clean_array_gpc('p', array( 'template_' . vB::$vbulletin->GPC['rb_type'] => vB_Input::TYPE_STR)); $config['template'] = (vB::$vbulletin->GPC_exists['template_' . vB::$vbulletin->GPC['rb_type']] ? vB::$vbulletin->GPC['template_' . vB::$vbulletin->GPC['rb_type']] : 'vbcms_searchresult_' . vB_Types::instance()->getPackageClass(vB::$vbulletin->GPC['rb_type']) ); } else { $config['contenttypeid'] = vB_Types::instance()->getContentTypeID('vBForum_Post'); $config[ 'template'] = 'vbcms_searchresult_post'; } $widgetdm = $this->widget->getDM(); $widgetdm->set('config', $config); if ($this->content) { $widgetdm->setConfigNode($this->content->getNodeId()); } $widgetdm->save(); //clear the cache vB_Cache::instance()->event('widget_config_' . $this->widget->getId()); vB_Cache::instance()->cleanNow(); if (!$widgetdm->hasErrors()) { if ($this->content) { $segments = array('node' => $this->content->getNodeURLSegment(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'EditPage')); $view->setUrl(vB_View_AJAXHTML::URL_FINISHED, vBCms_Route_Content::getURL($segments)); } $view->setStatus(vB_View_AJAXHTML::STATUS_FINISHED, new vB_Phrase('vbcms', 'configuration_saved')); } else { if (vB::$vbulletin->debug) { $view->addErrors($widgetdm->getErrors()); } // only send a message $view->setStatus(vB_View_AJAXHTML::STATUS_MESSAGE, new vB_Phrase('vbcms', 'configuration_failed')); } } else { // add the config content $configview = $this->createView('config'); $contenttypes = array() ; require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('search'); foreach (vB_Search_Core::get_instance()->get_indexed_types() as $type) { $contenttypes[$type['contenttypeid']] = array('name' => $type['class'], 'contenttypeid' => $type['contenttypeid'], 'template' => ((intval($type['contenttypeid']) == intval($config['contenttypeid'])) and isset($config['template'])) ? $config['template'] : 'vbcms_searchresult_' . strtolower($type['class']), 'checked' => intval($type['contenttypeid']) == intval($config['contenttypeid']) ? 'checked="checked"' : '') ; } $configview->contenttypes = $contenttypes; $show_checked = array(); // Contenttype select $select_types = ''; foreach (vB_Search_Core::get_instance()->get_indexed_types() as $type) { $contenttypes[$type['contenttypeid']] = array('name' => $type['class'], 'contenttypeid' => $type['contenttypeid'], 'template' => ((intval($type['contenttypeid']) == intval($config['contenttypeid'])) and isset($config['template'])) ? $config['template'] : 'vbcms_searchresult_' . strtolower($type['class']), 'checked' => intval($type['contenttypeid']) == intval($config['contenttypeid']) ? 'checked="checked"' : '') ; } $configview->contenttypes = $contenttypes; $configview->count = $config['count']; $configview->days = $config['days']; $configview->template_name = ($config['template_name'] ? $config['template_name'] : 'vbcms_widget_searchwidget_page'); // add id to form $this->addPostId($configview); $view->setContent($configview); // send the view $view->setStatus(vB_View_AJAXHTML::STATUS_VIEW, new vB_Phrase('vbcms', 'configuring_widget')); } return $view; }