protected function fetchParentTitle($nodeid) { if (!$this->content['cms_section']) { $sections = vBCms_ContentManager::getSections(); foreach ($sections as $key => $section) { $this->content['cms_section'][$section['nodeid']] = $section; } } return $this->content['cms_section'][$nodeid]['title']; }
/** * Fetches the standard page view for a widget. * * @param bool $skip_errors - If using a collection, omit widgets that throw errors * @return vBCms_View_Widget - The resolved view, or array of views */ public function getPageView() { $this->assertWidget(); if (! isset($vbulletin->userinfo['permissions']['cms'])) { vBCMS_Permissions::getUserPerms(); } // Create view $config = $this->widget->getConfig(); if (!isset($config['template_name']) OR ($config['template_name'] == '') ) { $config['template_name'] = 'vbcms_widget_sectionnav_page'; } $canviewlist = implode(', ', vB::$vbulletin->userinfo['permissions']['cms']['viewonly']); $caneditlist = implode(', ', vB::$vbulletin->userinfo['permissions']['cms']['canedit']); $for_node = intval($this->content->getContentTypeId()) == intval(vb_Types::instance()->getContentTypeID("vBCms_Section")) ? $this->content->getNodeId() : $this->content->getParentId(); // Create view $view = new vBCms_View_Widget($config['template_name']); if ( $link_nodes = vB_Cache::instance()->read($cache_key = $this->getHash($this->widget->getId(), $for_node), false, true)) { $links_before = $link_nodes['links_before']; $links_above = $link_nodes['links_above']; $links_sibling = $link_nodes['links_sibling']; $links_children = $link_nodes['links_children']; $links_after = $link_nodes['links_after']; $myself = $link_nodes['myself']; } else { //If we're on a section, we show for this nodeid. If we're on // on a leaf-type node we show for the parent $section_possibles = vBCms_ContentManager::getSections(); $my_left = $this->content->getNodeLeft(); $my_right = $this->content->getNodeRight(); $my_parent = $this->content->getParentId(); $my_nodeid = $this->content->getNodeId(); $my_title = ''; $links_above = array(); $links_before = array(); $links_above = array(); $links_sibling = array(); $links_after = array(); $links_children = array(); $top_level = array(); if (! isset(vB::$vbulletin->userinfo['permissions']['cms']) ) { vBCMS_Permissions::getUserPerms(); } $route = new vBCms_Route_Content(); $route->setParameter('action', 'view'); $homeid = $sections[0]['nodeid']; //Now let's scan the array; $indent = 0; $i = 1; $noderight = 0; //Let's remove items we're not supposed to see. $sections= array(); foreach ($section_possibles as $key => $section) { if (/** This user has permissions to view this record **/ ( in_array($section['permissionsfrom'], vB::$vbulletin->userinfo['permissions']['cms']['canedit']) OR (in_array($section['permissionsfrom'],vB::$vbulletin->userinfo['permissions']['cms']['canview'] ) AND $section['setpublish'] == '1' AND $section['publishdate'] < TIMENOW )) AND /** This user also has rights to the parents **/ ($section['noderight'] > $noderight)) { $sections[] = $section; } else { //So the children will be skipped $noderight = $section['noderight']; } } //First the sections ahead of us while($i < count($sections) AND $my_left > $sections[$i]['nodeleft']) { $route->node = $sections[$i]['nodeid'] . (strlen($sections[$i]['url']) ? '-' . $sections[$i]['url'] : '' ); //see if it's a top-level if ($sections[$i]['parentnode'] == $homeid) { $links_before[] = array('title' => $sections[$i]['title'], 'sectionurl' => $route->getCurrentUrl(array('node' =>$route->node, 'action' => 'view')), 'indent' => 0); }//is it a sibling? else if ($my_parent == $sections[$i]['parentnode']) { $links_sibling[] = array('title' => $sections[$i]['title'], 'sectionurl' => $route->getCurrentUrl(array('node' =>$route->node, 'action' => 'view')), 'indent' => 0); } $i++; } //Now our parentage and children while($i < count($sections) AND $my_right > $sections[$i]['nodeleft']) { $route->node = $sections[$i]['nodeid'] . (strlen($sections[$i]['url']) ? '-' . $sections[$i]['url'] : '' ); if ($my_nodeid == $sections[$i]['parentnode']) { $links_children[] = array('title' => $sections[$i]['title'], 'sectionurl' => $route->getCurrentUrl(array('node' =>$route->node, 'action' => 'view')), 'indent' => ($indent) * 10); } else if ($my_nodeid == $sections[$i]['nodeid']) { $myself = array('title' => $sections[$i]['title'], 'sectionurl' => $route->getCurrentUrl(array('node' =>$route->node, 'action' => 'view')), 'indent' => $indent * 10); } else { $links_above[] = array('title' => $sections[$i]['title'], 'sectionurl' => $route->getCurrentUrl(array('node' =>$route->node, 'action' => 'view')), 'indent' => $indent * 10); $my_title = $sections[$i]['title']; $indent++; } $i++; } //Now the afters while ($i < count($sections)) { $route->node = $sections[$i]['nodeid'] . (strlen($sections[$i]['url']) ? '-' . $sections[$i]['url'] : '' ); if ($sections[$i]['parentnode'] == $homeid) { $links_after[] = array('title' => $sections[$i]['title'], 'sectionurl' => $route->getCurrentUrl(array('node' =>$route->node, 'action' => 'view')), 'indent' => 0); } else if ($my_parent == $sections[$i]['parentnode']) { $links_sibling[] = array('title' => $sections[$i]['title'], 'sectionurl' => $route->getCurrentUrl(array('node' =>$route->node, 'action' => 'view')), 'indent' => 0); } $i++; } foreach($links_sibling as $key => $value) { $links_sibling[$key]['indent'] = $indent * 10; } $route->node = $sections[1]['nodeid'] . (strlen($sections[1]['url']) ? '-' . $sections[1]['url'] : '' ); //We have the pieces, now let's string them together; //Top level first $links_before = array_merge(array(array('title' => $sections[0]['title'], 'sectionurl' => $route->getCurrentUrl(array('node' =>$route->node, 'action' => 'view')), 'indent' => 0)), $links_before); //Now write to the cache vB_Cache::instance()->write($cache_key, array('links_before' => $links_before, 'links_above' => $links_above, 'links_sibling' => $links_sibling , 'links_after' => $links_after, 'links_children' => $links_children, 'myself' => $myself ), $this->cache_ttl, array('section_nav_' . $for_node, 'sections_updated')); } //The first record is the root $view->links_before = $links_before; $view->links_above = $links_above; $view->links_sibling = $links_sibling; $view->links_children = $links_children; $view->links_after = $links_after; $view->myself = $myself; $view->widget_title = $this->widget->getTitle(); return $view; }
/** * 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; }
/** * load the existing data * */ private function load_data() { $sections = vBCms_ContentManager::getSections(); $perms = vBCMS_Permissions::getPerms(0); $this->custom_priority['cms'] = array(); $level = array(); foreach ($sections as $nodeid => $section) { if (!$section['hidden'] and in_array($section['permissionsfrom'], $perms['canview'])) { $section['priority'] = false; $this->custom_priority['cms'][$section['nodeid']] = $section; } } $this->set_priorities('cms'); }
public static function getPermissionString($userid = false) { if (($userid === false) AND ($userid !== 0)) { $userid = vB::$vbulletin->userinfo['userid']; } if (($userid == vB::$vbulletin->userinfo['userid']) AND self::$permission_string) { return self::$permission_string; } require_once DIR . '/includes/class_bootstrap_framework.php' ; vB_Bootstrap_Framework::init(); $can_view = array(); $blocked = array(); $perms = self::getPerms($userid); //We need to block out unpublished sections. $sections = vBCms_ContentManager::getSections(); foreach($sections as $section) { $can_view_this = (intval($section['setpublish']) > 0) && ($section['publishdate'] < TIMENOW); if (!$can_view_this) { $blocked[$section['nodeid']] = 1; if (isset($can_view[$section['nodeid']])) { unset($can_view[$section['nodeid']]); } } else if (!isset($can_view[$section['nodeid']]) AND ! isset($blocked[$section['nodeid']])) { $can_view[$section['nodeid']] = 1; } } $canedit = array_unique(array_merge($perms['canedit'], $perms['canpublish'])); self::$permission_string = "( (node.permissionsfrom IN (" . implode(',', $canedit) . "))"; if (intval($userid)) { self::$permission_string .= " OR (node.userid =" . vB::$vbulletin->userinfo['userid'] . ") "; } if (!empty($can_view)) { self::$permission_string .= " OR ( node.permissionsfrom in (" . implode(',', $perms['canview']) . ") AND (node.parentnode IN (" . implode(',', array_keys($can_view)) . ")" . (isset($can_view[1]) ? " OR node.nodeid = 1" : "") . "))"; } self::$permission_string .= ")"; return self::$permission_string; }
/** * load the existing data * */ private function load_data() { //See if we need to bootstrap require_once(DIR . '/includes/class_bootstrap_framework.php'); vB_Bootstrap_Framework::init(); $sections = vBCms_ContentManager::getSections(); $perms = vBCMS_Permissions::getPerms(0); $this->custom_priority['cms'] = array(); $level = array(); foreach ($sections as $nodeid => $section) { if ((!$section['hidden']) AND (in_array($section['permissionsfrom'], $perms['canview']))) { $section['priority'] = false; $this->custom_priority['cms'][$section['nodeid']] = $section; } } $this->set_priorities('cms'); }
/** generates the section options list * @param string $section_str * @return string */ private function getSectionList($section_str) { $current_sections = explode(',', $section_str); $sections = vBCms_ContentManager::getSections(false); $select = '<option value="0">' . new vB_Phrase('global', 'all') . "</option>\n"; foreach ($sections as $section) { $select .= "<option value=\"" . $section['nodeid'] . '" ' . (in_array($section['nodeid'], $current_sections) ? 'selected="selected"' : '' ) . '>' . $section['title'] . " (" . $section['publish_count'] . ")</option>\n"; } return $select; }
/** Creates the publish editor at the top right of the edit section * * @return mixed * ****/ public function getPublishEditor($submit_url, $formid, $showpreview = true, $showcomments = true, $publicpreview = false, $comments_enabled = false, $pagination_links = 1) { if ($this->canPublish()) { $pub_view = new vB_View('vbcms_edit_publisher'); $pub_view->formid = $formid; $pub_view->setpublish = $this->setpublish; // if this is an unpublished article then we display publish to facebook if (is_facebookenabled() AND vB::$vbulletin->options['fbfeednewarticle'] AND !$this->setpublish) { // only display box if user is connectected to facebook $pub_view->showfbpublishcheckbox = is_userfbconnected(); } //Get date is a most annoying function for us. It takes a Unix time stamp // and converts it to server local time. We need to compensate for the difference between // server time (date('Z')) and usertime (vBCms_ContentManager::getTimeOffset(vB::$vbulletin->userinfo)) $offset = vBCms_ContentManager::getTimeOffset(vB::$vbulletin->userinfo) - date('Z'); if (intval($this->publishdate)) { $pub_view->publishdate = $this->publishdate ; } else { // get the current date/time dependent on user locality $pub_view->publishdate = TIMENOW; } $then = getdate(intval($pub_view->publishdate) + $offset); $pub_view->hour = $then['hours']; $pub_view->minute = $then['minutes']; //we need to parse out the date and time //Are we using a 24 hour clock? if ((strpos(vB::$vbulletin->options['timeformat'], 'G') !== false) OR (strpos( vB::$vbulletin->options['timeformat'], 'H') !== false)) { $pub_view->show24 = 1; } else { $pub_view->show24 = 0; $pub_view->offset = $pub_view->hour >= 12 ? 'PM' : 'AM'; if ($pub_view->hour > 12) { $pub_view->hour -= 12; } } $pub_view->title = $this->title; $pub_view->html_title = $this->html_title; $pub_view->username = $this->username; $pub_view->dateformat = vB::$vbulletin->options['dateformat']; // get the appropriate date format string for the // publish date calendar based on user's locale $pub_view->calendardateformat = (!empty(vB::$vbulletin->userinfo['lang_dateoverride']) ? '%Y/%m/%d' : 'Y/m/d'); $pub_view->groups = $this->getReaderGroups(); $pub_view->parents = $this->getParentage(); $pub_view->submit_url = $submit_url; $pub_view->sectiontypeid = vb_Types::instance()->getContentTypeID("vBCms_Section"); $pub_view->parents = $this->getParentage(); $pub_view->showtitle = $this->getShowTitle(); $pub_view->showuser = $this->getShowUser(); $pub_view->showpreviewonly = $this->getShowPreviewonly(); $pub_view->showupdated = $this->getShowUpdated(); $pub_view->showviewcount = $this->getShowViewcount(); $pub_view->showpublishdate = $this->getShowPublishdate(); $pub_view->settingsforboth = $this->getSettingsForboth(); $pub_view->showall = $this->getShowall(); $pub_view->includechildren = $this->getIncludeChildren(); $pub_view->showrating = $this->getShowRating(); $pub_view->hidden = $this->getHidden(); $pub_view->pagination_links = $pagination_links; $pub_view->show_pagination_link = ($this->contenttypeid == vb_Types::instance()->getContentTypeID("vBCms_Section") ) ? 1 : 0; $pub_view->shownav = $this->getShowNav(); $pub_view->show_shownav = ($this->contenttypeid == vb_Types::instance()->getContentTypeID("vBCms_Section") ) ? 0 : 1; $pub_view->nosearch = $this->getNoSearch(); $sectionid = (1 == $this->nodeid) ? 1 : $this->parentnode; $pub_view->hours24 = vB::$vbulletin->options['dateformat']; if ($this->contenttypeid == $pub_view->sectiontypeid) { $pub_view->show_categories = 0; $pub_view->is_section = 1; $pub_view->show_showsettings = 0; } else { $pub_view->show_categories = 1; $pub_view->categories = $this->getThisCategories(); $pub_view->show_showsettings = 1; $pub_view->is_section = 0; $pub_view->sectionid = $this->parentnode; } if ($pub_view->show_htmloption = ( $this->contenttypeid == vb_Types::instance()->getContentTypeID("vBCms_Article") // this is limited here to article but could be moved to any contenttype AND $this->canusehtml // this is set by some of the member functions above... )) { $pub_view->htmloption = $this->htmlstate; } $pub_view->show_categories = ($this->contenttypeid == $pub_view->sectiontypeid ? 0 : 1); //get the nodes $nodelist = vBCms_ContentManager::getSections(false); if (! isset(vB::$vbulletin->userinfo['permissions']['cms']) ) { vBCMS_Permissions::getUserPerms(); } foreach ($nodelist as $key => $node) { if (in_array(strval($node['permissionsfrom']), vB::$vbulletin->userinfo['permissions']['cms']['canpublish'])) { $nodelist[$key]['selected'] = ($sectionid == $node['nodeid'] ? 'selected="selected"' : ''); } else { unset($nodelist[$key]); } } $pub_view->nodelist = $nodelist; $pub_view->showpreview = $showpreview; $pub_view->showcomments = $showcomments; $pub_view->publicpreview = $publicpreview; $pub_view->hidden = $this->hidden; $pub_view->comments_enabled = $comments_enabled; $pub_view->show_sections = (1 != $this->nodeid); return $pub_view; } }