/** Checks to see if the user can create a specific type in a specific section * @param int sectionid * * @return bool ***/ public function canCreateHere($sectionid) { if (! isset(vB::$vbulletin->userinfo['permissions']['cms'])) { vBCMS_Permissions::getPerms(); } return in_array($sectionid, vB::$vbulletin->userinfo['permissions']['cms']['cancreate']) ; }
/** * This gets a list of the publicly viewable "leaf" nodes. It was created for * use by the sitemap builder but it seems it could have other uses. * * @param int $sortby 1:section order, then title, 2: title, 3:publish_date * @return array */ public static function getPublicContent($startat = 0, $qty = 10000, $sortby = 1) { $perms = vBCMS_Permissions::getPerms(0); $sql = "SELECT node.nodeid, node.contenttypeid, node.hidden, info.title, parentinfo.title AS section, parent.nodeid AS sectionid, node.setpublish, node.publishdate, node.url FROM " . TABLE_PREFIX . "cms_node AS node INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid INNER JOIN " . TABLE_PREFIX . "cms_node AS parent ON parent.nodeid = node.parentnode INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS parentinfo ON parentinfo.nodeid = parent.nodeid WHERE node.setpublish > 0 AND parent.setpublish > 0 AND parent.publishdate < " . TIMENOW . " AND node.publishdate < " . TIMENOW . " AND node.permissionsfrom IN (" . implode(',', $perms['canview']) . ") AND (node.contenttypeid <> " . vb_Types::instance()->getContentTypeID("vBCms_Section") . ") "; switch($sortby){ case 3 : $sql .= " ORDER BY node.setpublish DESC"; break; case 2 : $sql .= " ORDER BY info.title"; break; default: $sql .= " ORDER BY parent.nodeleft, info.title"; } // switch $sql .= " LIMIT $startat, $qty "; $rst = vB::$db->query_read($sql); $nodes = array(); while($node = vB::$db->fetch_array($rst)) { $nodes[$node['nodeid']] = $node; } return $nodes; }
/** * 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'); }
/** * 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'); }