/** * load in the roles for the given SQL statement * * @param string $sql * @param array $params the parameters that go into the sql statement * @return RoleSet (this) */ function load($sql, $params) { global $DB; if (!isset($params)) { $params = array(); } $resArray = $DB->select($sql, $params); $count = count($resArray); for ($i = 0; $i < $count; $i++) { $array = $resArray[$i]; $r = new Role($array["NodeTypeID"]); $this->add($r->load()); } return $this; }
/** * * @return Role */ public static function getAllRoles() { if (Cache::contains("roles", "all")) { $res = Cache::getData("roles", "all"); } else { $roles = DataBase::Current()->ReadRows("SELECT id FROM {'dbprefix'}roles ORDER BY name, id"); foreach ($roles as $role) { $newRole = new Role(); $newRole->load($role->id); $res[] = $newRole; } Cache::setData("roles", "all", $res); } return $res; }
public function cbModifyPages($context = NULL) { if (!Administration::instance()->isLoggedIn()) { return; } $callback = Administration::instance()->getPageCallback(); $doc = $context['page']; $role = Role::load(Administration::instance()->User->role_id); // Remove items from navigation that the user has no permission to access // Publish and Blueprints $items = $doc->xpath("//ul[@id='nav']//li[./a[contains(@href, '/blueprints/') or contains(@href, '/publish/')]]"); foreach ($items as $element) { $href = $element->getElementsByTagName('a')->item(0)->getAttribute('href'); if (!preg_match_all('/\\/(publish|blueprints)\\/([^\\/]+)\\//', $href, $match, PREG_SET_ORDER)) { continue; } $area = $match[0][1]; $handle = $match[0][2]; if ((!isset($role->permissions()->{"{$area}::{$handle}.create"}) || $role->permissions()->{"{$area}::{$handle}.create"} < 1) && (!isset($role->permissions()->{"{$area}::{$handle}.edit"}) || $role->permissions()->{"{$area}::{$handle}.edit"} < 1)) { $element->parentNode->removeChild($element); } } // System // Users if ((!isset($role->permissions()->{"system::users.create"}) || $role->permissions()->{"system::users.create"} < 1) && (!isset($role->permissions()->{"system::users.edit"}) || $role->permissions()->{"system::users.edit"} < 1)) { $users = $doc->xpath("//ul[@id='nav']//li[./a[contains(@href, '/system/users/')]]"); foreach ($users as $element) { $element->parentNode->removeChild($element); } } // TODO: Add delegate for extensions to remove navigation items based on permissions // Remove empty navigation groups foreach ($doc->xpath("//ul[@id='nav']/li[not(./ul/li)]") as $element) { $element->parentNode->removeChild($element); } /* // Users if($callback['pageroot'] == '/system/users/'){ // Index if(is_null($callback['context'])){ if(isset($role->permissions()->{"system::users.edit"}) && $role->permissions()->{"system::users.edit"} > 0){ if(isset($_POST['with-selected']) && isset($_POST['items']) && preg_match('/^aac-role::(\d+)/i', $_POST['with-selected'], $match)){ $checked = @array_keys($_POST['items']); if(is_array($checked) && !empty($checked)){ Symphony::Database()->query(sprintf( "UPDATE `tbl_users` SET `role_id` = %d WHERE `id` IN (%s)", (int)$match[1], implode(',', $checked) )); } } } // Remove the 'Create New' button if user has no 'create' privileges if(!isset($role->permissions()->{"system::users.create"}) || $role->permissions()->{"system::users.create"} < 1){ $this->removeCreateButton($doc); } // Remove the 'With Selected' and row checkboxes if user has no 'edit' privileges if(!isset($role->permissions()->{"system::users.edit"}) || $role->permissions()->{"system::users.edit"} < 1){ $this->removeFormActions($doc); $this->removeCheckboxesFromTableRows($doc); } $this->modifyUsersPageIndex($context); } // New elseif(isset($callback['context'][0]) && $callback['context'][0] == 'new'){ $this->modifyUsersPageNew($context); } // Edit elseif(isset($callback['context'][0]) && $callback['context'][0] == 'edit'){ $this->modifyUsersPageEdit((int)$callback['context'][1], $context); } } */ // Publish if (preg_match('/^\\/publish\\/([^\\/]+)\\/$/i', $callback['pageroot'], $match)) { $handle = $match[1]; switch ($callback['context']['page']) { case 'index': // Remove the 'Create New' button if user has no 'create' privileges if (!isset($role->permissions()->{"publish::{$handle}.create"}) || $role->permissions()->{"publish::{$handle}.create"} < 1) { $this->removeCreateButton($doc); } // Remove the 'With Selected' and row checkboxes if user has no 'edit' privileges if (!isset($role->permissions()->{"publish::{$handle}.edit"}) || $role->permissions()->{"publish::{$handle}.edit"} < 1) { $this->removeFormActions($doc); $this->removeCheckboxesFromTableRows($doc); } break; case 'edit': // User only has "edit own" permissions if ($role->permissions()->{"publish::{$handle}.edit"} < 2) { $entry = Entry::loadFromID($callback['context']['entry_id']); if (Administration::instance()->User->id != $entry->meta()->user_id) { $this->removeFormActions($doc); } } break; } } elseif (preg_match('/^\\/blueprints\\/([^\\/]+)\\/$/i', $callback['pageroot'], $match)) { $handle = $match[1]; switch ($callback['context'][0]) { case 'index': default: // Remove the 'Create New' button if user has no 'create' privileges if (!isset($role->permissions()->{"blueprints::{$handle}.create"}) || $role->permissions()->{"blueprints::{$handle}.create"} < 1) { $this->removeCreateButton($doc); } // Remove the 'With Selected' and row checkboxes if user has no 'edit' privileges if (!isset($role->permissions()->{"blueprints::{$handle}.edit"}) || $role->permissions()->{"blueprints::{$handle}.edit"} < 1) { $this->removeWithSelected($doc); } break; } } // TODO: Delegate for extensions to modify pages based on their own permissions }
/** * Loads the data for the connection from the database * * @param String $style (optional - default 'long') may be 'short' or 'long' of 'cif' * @return Connection object (this) or Error */ function load($style = 'long') { global $DB, $CFG, $HUB_SQL; try { $this->canview(); } catch (Exception $e) { return access_denied_error(); } $this->style = $style; $params = array(); $params[0] = $this->connid; $resArray = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT, $params); $count = count($resArray); if ($count == 0) { $ERROR = new error(); $ERROR->createConnectionNotFoundError($this->connid); return $ERROR; } $fromid = 0; $toid = 0; for ($i = 0; $i < $count; $i++) { $array = $resArray[$i]; $fromid = trim($array['FromID']); $toid = trim($array['ToID']); $this->fromcontexttypeid = trim($array['FromContextTypeID']); $this->tocontexttypeid = trim($array['ToContextTypeID']); $this->creationdate = trim($array['CreationDate']); $this->modificationdate = trim($array['ModificationDate']); $this->userid = trim($array['UserID']); $this->users = array(); $this->users[0] = getUser($this->userid, $style); $this->linktypeid = trim($array['LinkTypeID']); $this->private = $array['Private']; $this->description = $array['Description']; } //now add in from/to nodes $from = new CNode($fromid); $this->from = $from->load($style); // we need to for the resource node title // $this->from->description = ""; // we don't need the long descriptions on connections - even if style for rest is long $to = new CNode($toid); $this->to = $to->load($style); // we need to for the resource node title //$this->to->description = ""; // we don't need the long descriptions on connections - even if style for rest is long $r = new Role($this->fromcontexttypeid); $this->fromrole = $r->load(); $r = new Role($this->tocontexttypeid); $this->torole = $r->load(); //If both ends of the connection are Comments, it's part of a chat tree. //and if the description holds a nodeid, load it as the parent item the chat is against if (isset($this->fromrole->name) && $this->fromrole->name == "Comment" || isset($this->torole->name) && $this->torole->name == "Comment") { if (isset($this->description) && $this->description != "") { // the description could hold a list of id'd id1:id2:id3 etc // if it does, the first item is the one to use. //echo $this->description; $reply = split(":", $this->description); $id = $reply[0]; if ($reply[0] == "") { $id = $reply[1]; } $parentnode = new CNode($id); $parentnode = $parentnode->load(); if (!$parentnode instanceof Error) { $this->parentnode = $parentnode; } } } $l = new LinkType($this->linktypeid); $this->linktype = $l->load(); if ($style == 'long') { // add in the groups $resArray2 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_GROUP, $params); $count2 = count($resArray2); if ($count2 > 0) { $this->groups = array(); for ($i = 0; $i < $count2; $i++) { $array = $resArray2[$i]; $group = new Group(trim($array['GroupID'])); array_push($this->groups, $group->load()); } } //now add in any tags $resArray3 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_TAGS, $params); $count3 = count($resArray3); if ($count3 > 0) { $this->tags = array(); for ($i = 0; $i < $count3; $i++) { $array = $resArray3[$i]; $tag = new Tag(trim($array['TagID'])); array_push($this->tags, $tag->load()); } } } if ($style != 'cif') { $this->loadVotes(); } return $this; }
/** * * @param string $alias * @param string $editor * @param string $title * @return boolean */ public static function create($alias, $editor, $title) { $canonical = DataBase::Current()->EscapeString(UrlRewriting::GetUrlByAlias($alias)); $alias = DataBase::Current()->EscapeString($alias); $title = DataBase::Current()->EscapeString($title); $editor = DataBase::Current()->EscapeString($editor); $res = DataBase::Current()->Execute("INSERT INTO {'dbprefix'}pages (alias,editor, title, content, canonical) VALUES ('" . $alias . "','" . $editor . "','" . $title . "','<h1>" . $title . "</h1>','" . $canonical . "')"); if ($res) { $res = DataBase::Current()->InsertID(); $args['id'] = $res; $args['editor'] = $editor; $args['alias'] = $alias; $admin = new Role(); $admin->load(2); $admin->allowAccessByID($args['id']); EventManager::RaiseEvent("page_created", $args); } $args['id'] = DataBase::Current()->ReadField("SELECT id FROM {'dbprefix'}pages WHERE alias = '" . $alias . "'"); Cache::clear("page"); return $args['id']; }
/** * Loads the data for the connection from the database * * @param String $style (optional - default 'long') may be 'short' or 'long' of 'cif' * @return Connection object (this) or Error */ function load($style = 'long') { global $DB, $CFG, $HUB_SQL; try { $this->canview(); } catch (Exception $e) { return access_denied_error(); } $this->style = $style; $params = array(); $params[0] = $this->connid; $resArray = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT, $params); $count = count($resArray); if ($count == 0) { $ERROR = new error(); $ERROR->createConnectionNotFoundError($this->connid); return $ERROR; } $fromid = 0; $toid = 0; for ($i = 0; $i < $count; $i++) { $array = $resArray[$i]; $fromid = trim($array['FromID']); $toid = trim($array['ToID']); $this->fromcontexttypeid = trim($array['FromContextTypeID']); $this->tocontexttypeid = trim($array['ToContextTypeID']); $this->creationdate = trim($array['CreationDate']); $this->modificationdate = trim($array['ModificationDate']); $this->userid = trim($array['UserID']); $this->users = array(); $this->users[0] = getUser($this->userid, $style); $this->linktypeid = trim($array['LinkTypeID']); $this->private = $array['Private']; $this->description = $array['Description']; } //now add in from/to nodes. Try from the cache first? $from = new CNode($fromid); $this->from = $from->load($style); $to = new CNode($toid); $this->to = $to->load($style); $r = new Role($this->fromcontexttypeid); $this->fromrole = $r->load(); $r = new Role($this->tocontexttypeid); $this->torole = $r->load(); $l = new LinkType($this->linktypeid); $this->linktype = $l->load(); if ($style == 'long') { // add in the groups $resArray2 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_GROUP, $params); $count2 = count($resArray2); if ($count2 > 0) { $this->groups = array(); for ($i = 0; $i < $count2; $i++) { $array = $resArray2[$i]; $group = new Group(trim($array['GroupID'])); array_push($this->groups, $group->load()); } } //now add in any tags $resArray3 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_TAGS, $params); $count3 = count($resArray3); if ($count3 > 0) { $this->tags = array(); for ($i = 0; $i < $count3; $i++) { $array = $resArray3[$i]; $tag = new Tag(trim($array['TagID'])); array_push($this->tags, $tag->load()); } } } if ($style != 'cif') { $this->loadVotes(); } return $this; }
/** * Add a Connection. Requires login.<br> * @param string $fromnodeid * @param string $fromroleid * @param string $linktypeid * @param string $tonodeid * @param string $toroleid * @param string $private optional, can be Y or N, defaults to users preferred setting * @param string $description * @return Connection or Error */ function addConnection($fromnodeid, $fromroleid, $linktypeid, $tonodeid, $toroleid, $private = "", $description = "") { global $USER, $HUB_DATAMODEL, $ERROR; //echo "linktypeid=".$linktypeid; //echo("<br>".$fromnodeid); //echo("<br>".$fromroleid); //echo("<br>".$tonodeid); //echo("<br>".$toroleid); if ($private == "") { $private = $USER->privatedata; } // Check connection adheres to datamodel rules $fromNode = getNode($fromnodeid, 'short'); $toNode = getNode($tonodeid, 'short'); $link = new LinkType($linktypeid); $linkType = $link->load(); $from = new Role($fromroleid); $fromRole = $from->load(); $to = new Role($toroleid); $toRole = $to->load(); $allowed = false; //echo("<br>".$fromNode->role->name); //echo("<br>".$fromRole->name); //echo("<br>".$toNode->role->name); //echo("<br>".$toRole->name); //echo $linkType->label; if ($fromNode instanceof Error) { $ERROR = new Error(); return $ERROR->createInvalidConnectionError("fromnodeid:" . $fromnodeid); } if ($toNode instanceof Error) { $ERROR = new Error(); return $ERROR->createInvalidConnectionError("tonodeid:" . $tonodeid); } if (!$linkType instanceof Error) { if ($fromNode->role->name == $fromRole->name && $toNode->role->name == $toRole->name) { //error_log("HERE1"); //error_log($fromRole->name); //error_log($linkType->label); //error_log($toRole->name); $allowed = $HUB_DATAMODEL->matchesModel($fromRole->name, $linkType->label, $toRole->name); } else { if ($fromRole->name == 'Pro') { //error_log("HERE2"); $allowed = $HUB_DATAMODEL->matchesModelPro($fromNode->role->name, $linkType->label, $toNode->role->name); } else { if ($fromRole->name == 'Con') { //error_log("HERE3"); $allowed = $HUB_DATAMODEL->matchesModelCon($fromNode->role->name, $linkType->label, $toNode->role->name); } } } if (!$allowed) { //error_log("NOT ALLOWED"); $ERROR = new Error(); return $ERROR->createInvalidConnectionError(); } else { //error_log("ALLOWED"); $cobj = new Connection(); return $cobj->add($fromnodeid, $fromroleid, $linktypeid, $tonodeid, $toroleid, $private, $description); } } else { //error_log("NOT ALLOWED - LINK ERROR"); $ERROR = new Error(); return $ERROR->createInvalidConnectionError("linktypeid" . $linktypeid); } }
/** * Loads the data for the node from the database * * @param String $style (optional - default 'long') may be 'short' or 'long' or 'mini' or 'full' or 'shortactivity' (mini used for graphs) * 'mini' include the base information like name, description, role, user, private, creation and modifications dates, connectedness, image, thumb. * 'short' includes 'mini' plus address information, start and end date, otherconnections, userfollow. * 'long' includes 'short' and associated website objects, tag objects, group objects, votes, view counts and extra properties. * 'full' includes 'long' and all activity and voting data. This is likely to be very heavy. Use wisely. * 'shortactivity' includes 'short' plus the activity and voting data. * 'cif' just what is needed for cif. * @return Node object (this) */ function load($style = 'long') { global $DB, $CFG, $USER, $ERROR, $HUB_FLM, $HUB_SQL; try { $this->canview(); } catch (Exception $e) { return access_denied_error(); } $this->style = $style; $this->cachetime = time(); $params = array(); $params[0] = $this->nodeid; $resArray = $DB->select($HUB_SQL->DATAMODEL_NODE_SELECT, $params); if ($resArray !== false) { $count = count($resArray); if ($count == 0) { $ERROR = new error(); $ERROR->createNodeNotFoundError($this->nodeid); return $ERROR; } else { for ($i = 0; $i < $count; $i++) { $array = $resArray[$i]; $this->name = stripslashes(trim($array['Name'])); $this->creationdate = $array['CreationDate']; $this->modificationdate = $array['ModificationDate']; if (isset($array['NodeTypeID'])) { $role = new Role($array['NodeTypeID']); $this->role = $role->load(); } if (trim($array['Description']) != "") { $this->hasdesc = true; } $this->description = stripslashes(trim($array['Description'])); $this->users = array(); if ($style == 'cif') { //CIF does not need the whole user info at present // or just userid at this level? $this->users[0] = new User($array['UserID']); } else { $this->connectedness = $array['connectedness']; $this->private = $array['Private']; $this->users[0] = getUser($array['UserID'], $style); if ($array['Image']) { $this->filename = $array['Image']; $imagedir = $HUB_FLM->getUploadsNodeDir($this->nodeid, $array['UserID']); $originalphotopath = $HUB_FLM->createUploadsDirPath($imagedir . "/" . stripslashes($array['Image'])); if (file_exists($originalphotopath)) { $this->image = $HUB_FLM->getUploadsWebPath($imagedir . "/" . stripslashes($array['Image'])); $this->thumb = $HUB_FLM->getUploadsWebPath($imagedir . "/" . str_replace('.', '_thumb.', stripslashes($array['Image']))); if (!file_exists($this->thumb)) { create_image_thumb($array['Image'], $CFG->IMAGE_THUMB_WIDTH, $imagedir); } } else { if ($this->role->name == 'Issue') { $this->image = $HUB_FLM->getUploadsWebPath($CFG->DEFAULT_ISSUE_PHOTO); $this->thumb = $HUB_FLM->getUploadsWebPath(str_replace('.', '_thumb.', stripslashes($CFG->DEFAULT_ISSUE_PHOTO))); } } } else { if ($this->role->name == 'Issue') { $this->image = $HUB_FLM->getUploadsWebPath($CFG->DEFAULT_ISSUE_PHOTO); $this->thumb = $HUB_FLM->getUploadsWebPath(str_replace('.', '_thumb.', stripslashes($CFG->DEFAULT_ISSUE_PHOTO))); } } //if(isset($array['Image'])){ // $this->imageurlid = $array['Image']; //} //if(isset($array['ImageThumbnail'])){ // $this->thum = $array['ImageThumbnail']; //} if ($style != 'mini') { if (isset($array['StartDate'])) { $this->startdatetime = $array['StartDate']; } if (isset($array['EndDate'])) { $this->enddatetime = $array['EndDate']; } if (isset($array['LocationText'])) { $this->location = $array['LocationText']; } else { $this->location = ''; } if (isset($array['LocationCountry'])) { $cs = getCountryList(); $this->countrycode = $array['LocationCountry']; if (isset($cs[$array['LocationCountry']])) { $this->country = $cs[$array['LocationCountry']]; } } if (isset($array['LocationLat'])) { $this->locationlat = $array['LocationLat']; } if (isset($array['LocationLng'])) { $this->locationlng = $array['LocationLng']; } if (isset($array['LocationAddress1'])) { $this->locationaddress1 = $array['LocationAddress1']; } if (isset($array['LocationAddress2'])) { $this->locationaddress2 = $array['LocationAddress2']; } if (isset($array['LocationPostCode'])) { $this->locationpostcode = $array['LocationPostCode']; } if (isset($array['AdditionalIdentifier'])) { $this->identifier = $array['AdditionalIdentifier']; } if (isset($array['CurrentStatus'])) { $this->status = $array['CurrentStatus']; } } } } } } else { return database_error(); } $currentuser = ''; if (isset($USER->userid)) { $currentuser = $USER->userid; } if ($style != 'mini' && $style != 'cif') { $params = array(); $params[0] = $this->nodeid; $params[1] = $this->nodeid; $params[2] = $currentuser; $resArray = $DB->select($HUB_SQL->DATAMODEL_NODE_EXTERNAL_CONNECTIONS, $params); if ($resArray !== false) { if (count($resArray) > 0) { $this->otheruserconnections = $resArray[0]['connectedness']; } else { $this->otheruserconnections = 0; } } $this->userfollow = "N"; //load the current user's following status for this node if any $params = array(); $params[0] = $currentuser; $params[1] = $this->nodeid; $resArray = $DB->select($HUB_SQL->DATAMODEL_NODE_USER_FOLLOW, $params); if ($resArray !== false) { if (count($resArray) > 0) { $this->userfollow = "Y"; } } } if ($style == 'long' || $style == 'full' || $style == 'cif') { $this->loadWebsites($style); } if ($style == 'long' || $style == 'full') { $this->loadTags(); $this->loadGroups(); $this->loadVotes(); $this->loadProperties(); $this->loadViewCount(); } if ($style == 'full' || $style == 'shortactivity') { $this->activity = getAllNodeActivity($this->nodeid, 0, 0, -1); $this->votes = getVotes($this->nodeid); } //load comments, pro count and con count if Solution. if ($this->role->name == "Solution") { $this->haschildren = 'N'; $conSetKids = getConnectionsByNode($this->nodeid, 0, 0, 'date', 'ASC', 'all', '', 'Pro,Con,Comment'); if (!$conSetKids instanceof Error) { if ($conSetKids->totalno > 0) { $this->haschildren = 'Y'; } } else { return database_error(); } } return $this; }
public function __actionEdit() { if (array_key_exists('save', $_POST['action'])) { $this->__save(Role::load((int) $this->_context[1])); } elseif (array_key_exists('delete', $_POST['action'])) { try { Role::delete((int) $this->_context[1]); redirect(ADMIN_URL . '/extension/aac/roles/'); } catch (RoleException $e) { $this->alerts()->append($e->getMessage(), AlertStack::ERROR, $this->errors); } catch (Exception $e) { $this->alerts()->append(__('An unknown error has occurred. <a class="more">Show trace information.</a>'), AlertStack::ERROR, $e); } } }
public function display() { $template = new Template(); $template->load("site_edit"); $page = new Page(); if (isset($_GET['site'])) { $page->loadProperties(DataBase::Current()->EscapeString($_GET['site'])); if (isset($_POST['save'])) { $oldpage = $page; $page->title = $_POST['title']; $page->menu = $_POST['menu']; $page->getMeta()->description = $_POST['meta-description']; $page->getMeta()->keywords = $_POST['meta-keywords']; $page->getMeta()->robots = $_POST['meta-robots']; $page->alias = $page->getDir() . $_POST['localalias']; $page->ownerid = $_POST['owner']; $page->canonical = $_POST['canonical']; $page->advancedHtmlHeader = $_POST['advanced_html_header']; $page->SetChangeFrequence($_POST['change_frequence']); if (isset($_POST['in_sitemap'])) { $page->inSitemap = $_POST['in_sitemap']; } else { $page->inSitemap = false; } $page->priority = $_POST['priority']; $page->save(); $page->getEditor()->save($page, $oldpage); Role::clearAccess($page); if ($_POST['rights']) { foreach ($_POST['rights'] as $right) { $role = new Role(); $role->load($right); $role->allowAccess($page); } } } else { if (isset($_POST['menu'])) { $page->title = $_POST['title']; $page->alias = $page->getDir() . $_POST['localalias']; $page->menu = $_POST['menu']; $page->getEditor()->content = $_POST['content']; } } $url = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $page->alias); $template->assign_var("PATH", $url); $template->assign_var("ALIAS", $page->alias); $template->assign_var("LOCALALIAS", $page->getLocalAlias()); if (!isset($_POST['menu'])) { foreach (Role::getAllRoles() as $role) { $index = $template->add_loop_item("RIGHTS"); $template->assign_loop_var("RIGHTS", $index, "LABEL", "/"); $template->assign_loop_var("RIGHTS", $index, "VALUE", $role->ID); $template->assign_loop_var("RIGHTS", $index, "NAME", $role->name); if ($role->canAccess($page)) { $template->assign_loop_var("RIGHTS", $index, "SELECTED", "selected=\"1\" "); } else { $template->assign_loop_var("RIGHTS", $index, "SELECTED", ""); } } } else { foreach (Role::getAllRoles() as $role) { $index = $template->add_loop_item("RIGHTS"); $template->assign_loop_var("RIGHTS", $index, "LABEL", "/"); $template->assign_loop_var("RIGHTS", $index, "VALUE", $role->ID); $template->assign_loop_var("RIGHTS", $index, "NAME", $role->name); if (isset($_POST['rights']) && in_array($role->ID, $_POST['rights'])) { $template->assign_loop_var("RIGHTS", $index, "SELECTED", "selected=\"1\" "); } else { $template->assign_loop_var("RIGHTS", $index, "SELECTED", ""); } } } $index = $template->add_loop_item("MENU"); $template->assign_loop_var("MENU", $index, "VALUE", "0"); $template->assign_loop_var("MENU", $index, "NAME", "-- " . Language::DirectTranslate("NO_MENU") . " --"); $template->assign_loop_var("MENU", $index, "SELECTED", ""); foreach (sys::getMenues($_SESSION['dir']) as $menu) { $index = $template->add_loop_item("MENU"); $template->assign_loop_var("MENU", $index, "VALUE", $menu->id); $template->assign_loop_var("MENU", $index, "NAME", $menu->name); if (isset($_POST['menu']) && $_POST['menu'] == $menu->id) { $template->assign_loop_var("MENU", $index, "SELECTED", "selected=\"1\" "); } else { if (!isset($_POST['menu']) && $menu->id == $page->menu) { $template->assign_loop_var("MENU", $index, "SELECTED", "selected=\"1\" "); } else { $template->assign_loop_var("MENU", $index, "SELECTED", ""); } } } if (isset($_POST['menu'])) { $template->assign_var("MENUPREVIEW", Menu::getCode($_POST['menu'], "<ul>", "</ul>", "<li>", "</li>", "")); } else { if ($page->menu > 0) { $template->assign_var("MENUPREVIEW", Menu::getCode($page->menu, "<ul>", "</ul>", "<li>", "</li>", "")); } else { $template->assign_var("MENUPREVIEW", ""); } } $template->assign_var("METADESCRIPTION", htmlentities($page->getMeta()->description)); $template->assign_var("METAKEYWORDS", htmlentities($page->getMeta()->keywords)); $template->assign_var("METAROBOTS", htmlentities($page->getMeta()->robots)); $template->assign_var("CANONICAL", $page->canonical); $template->assign_var("ADVANCED_HTML_HEADER", htmlentities($page->advancedHtmlHeader)); $template->assign_var("TITLE", $page->title); $template->assign_var("EDITOR", $page->getEditor()->getEditableCode()); $template->assign_var("HOST", Settings::getRootInstance()->dir($page->alias . "§page")->get("host") . $page->getDir()); $template->assign_var("CHANGE_FREQUENCE", $page->GetChangeFrequence()); $template->assign_var("PRIORITY", $page->priority); if ($page->inSitemap) { $template->assign_var("IN_SITEMAP_CHECKED", " checked=\"checked\""); } else { $template->assign_var("IN_SITEMAP_CHECKED", ""); } $selector = new PageSelector(); $selector->name = 'owner'; $selector->value = $page->ownerid; $selector->noValueText = "-- " . Language::DirectTranslate("NOOWNER") . " --"; $template->assign_var("OWNERCONTROL", $selector->getCode()); $template->output(); } }