/** * */ function onmasteradminGetMenuContent($event) { $plugin = $GLOBALS['gJCoord']->getPlugin('auth', false); if ($plugin && $plugin->config['driver'] == 'Db' && jAcl2::check('auth.users.list')) { $event->add(new masterAdminMenuItem('users', jLocale::get('jauthdb_admin~auth.adminmenu.item.list'), jUrl::get('jauthdb_admin~default:index'), 10, 'system')); } }
/** * */ function index() { $rep = $this->getResponse('html'); $tpl = new jTpl(); $gid = array(0); $o = new StdClass(); $o->id_aclgrp = '0'; $o->name = jLocale::get('jacl2_admin~acl2.anonymous.group.name'); $o->grouptype = 0; $groups = array($o); $grouprights = array(0 => false); foreach (jAcl2DbUserGroup::getGroupList() as $grp) { $gid[] = $grp->id_aclgrp; $groups[] = $grp; $grouprights[$grp->id_aclgrp] = false; } $rights = array(); $p = jAcl2Db::getProfil(); $rs = jDao::get('jelix~jacl2subject', $p)->findAllSubject(); foreach ($rs as $rec) { $rights[$rec->id_aclsbj] = $grouprights; } $rs = jDao::get('jelix~jacl2rights', $p)->getRightsByGroups($gid); foreach ($rs as $rec) { $rights[$rec->id_aclsbj][$rec->id_aclgrp] = true; } $tpl->assign(compact('groups', 'rights')); if (jAcl2::check('acl.group.modify')) { $rep->body->assign('MAIN', $tpl->fetch('groups_right')); } else { $rep->body->assign('MAIN', $tpl->fetch('groups_right_view')); } return $rep; }
function onmasteradminGetMenuContent($event) { if (jAcl2::check('activeusers.configuration')) { $item = new masterAdminMenuItem('activeusers', jLocale::get('activeusers_admin~main.masteradmin.menu.item'), jUrl::get('activeusers_admin~default:index'), 120, 'system'); $event->add($item); } }
function onAuthLogout($event) { try { jAcl2::clearCache(); } catch (Exception $e) { } }
/** * function to manage data before assigning to the template of its zone */ protected function _prepareTpl() { jClasses::inc('havefnubb~hfnuMenuItem'); $admin = jAcl2::check('hfnu.admin.index'); $menu = array(); $items = jEvent::notify('hfnuGetMenuContent', array('admin' => $admin))->getResponse(); foreach ($items as $item) { if ($item->parentId) { if (!isset($menu[$item->parentId])) { $menu[$item->parentId] = new hfnuMenuItem($item->parentId, '', ''); } $menu[$item->parentId]->childItems[] = $item; } else { if (isset($menu[$item->id])) { $menu[$item->id]->copyFrom($item); } else { $menu[$item->id] = $item; } } } usort($menu, "hfnuItemSort"); foreach ($menu as $topitem) { usort($topitem->childItems, "hfnuItemSort"); } $this->_tpl->assign('menuitems', $menu); $this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', '')); }
/** * */ function index() { $id = $this->param('id'); if ($id === null) { $rep = $this->getResponse('redirect'); $rep->action = 'master_admin~default:index'; return $rep; } $rep = $this->getResponse('html'); // we're using a form to display a record, to have the portunity to have // labels with each values. $form = jForms::create($this->form, $id); $form->initFromDao($this->dao, $id, $this->dbProfile); $tpl = new jTpl(); $tpl->assign('id', $id); $tpl->assign('form', $form); $tpl->assign('personalview', true); $tpl->assign('otherInfo', jEvent::notify('jauthdbAdminGetViewInfo', array('form' => $form, 'tpl' => $tpl))->getResponse()); $form->deactivate('password'); $form->deactivate('password_confirm'); $tpl->assign('canUpdate', jAcl2::check('auth.user.modify')); $tpl->assign('canChangePass', jAcl2::check('auth.user.change.password')); $rep->body->assign('MAIN', $tpl->fetch('user_view')); return $rep; }
/** * Displays a list of project for a given repository. * * @param string $repository. Name of the repository. * @return Html page with a list of projects. */ function index() { if ($this->param('theme')) { jApp::config()->theme = $this->param('theme'); } $rep = $this->getResponse('html'); // Get lizmap services $services = lizmap::getServices(); // only maps if ($services->onlyMaps) { $repository = lizmap::getRepository($services->defaultRepository); if ($repository && jAcl2::check('lizmap.repositories.view', $repository->getKey())) { $project = lizmap::getProject($repository->getKey() . '~' . $services->defaultProject); if ($project) { // test redirection to an other controller $items = jEvent::notify('mainviewGetMaps')->getResponse(); foreach ($items as $item) { if ($item->parentId == $repository->getKey() && $item->id == $services->defaultProject) { $rep = $this->getResponse('redirectUrl'); $rep->url = $item->url; return $rep; } } // redirection to default controller $rep = $this->getResponse('redirect'); $rep->action = 'view~map:index'; return $rep; } } } // Get repository data $repository = $this->param('repository'); $repositoryList = array(); if ($repository) { if (!jAcl2::check('lizmap.repositories.view', $repository)) { $rep = $this->getResponse('redirect'); $rep->action = 'view~default:index'; jMessage::add(jLocale::get('view~default.repository.access.denied'), 'error'); return $rep; } } $title = jLocale::get("view~default.repository.list.title"); $rep->body->assign('repositoryLabel', $title); $rep->body->assign('isConnected', jAuth::isConnected()); $rep->body->assign('user', jAuth::getUserSession()); if ($services->allowUserAccountRequests) { $rep->body->assign('allowUserAccountRequests', True); } if ($repository) { $lrep = lizmap::getRepository($repository); $title .= ' - ' . $lrep->getData('label'); } $rep->title = $title; $rep->body->assignZone('MAIN', 'main_view', array('repository' => $repository)); $rep->addJSCode("\n \$(window).load(function() {\n \$('.liz-project-img').parent().mouseenter(function(){\n var self = \$(this);\n self.find('.liz-project-desc').slideDown();\n self.css('cursor','pointer');\n }).mouseleave(function(){\n var self = \$(this);\n self.find('.liz-project-desc').hide();\n }).click(function(){\n var self = \$(this);\n window.location = self.parent().find('a.liz-project-view').attr('href');\n return false;\n });\n });\n "); // Js hack to normalize the height of the project thumbnails to avoid line breaks with long project titles $bp = jApp::config()->urlengine['basePath']; $rep->addJSLink($bp . 'js/view.js'); return $rep; }
/** * @param array $params plugin parameters for the current action * @return null or jSelectorAct if action should change */ public function beforeAction($params) { $selector = null; $aclok = true; if (isset($params['jacl2.right'])) { $aclok = jAcl2::check($params['jacl2.right']); } elseif (isset($params['jacl2.rights.and'])) { $aclok = true; foreach ($params['jacl2.rights.and'] as $right) { if (!jAcl2::check($right)) { $aclok = false; break; } } } elseif (isset($params['jacl2.rights.or'])) { $aclok = false; foreach ($params['jacl2.rights.or'] as $right) { if (jAcl2::check($right)) { $aclok = true; break; } } } if (!$aclok) { if ($this->config['on_error'] == 1 || !$GLOBALS['gJCoord']->request->isAllowedResponse('jResponseRedirect')) { throw new jException($this->config['error_message']); } else { $selector = new jSelectorAct($this->config['on_error_action']); } } return $selector; }
/** * display the RSS of the forum */ public function read_rss() { $ftitle = jUrl::escape($this->param('ftitle'), true); $id_forum = (int) $this->param('id_forum'); if (!jAcl2::check('hfnu.posts.list', 'forum' . $id_forum)) { $rep = $this->getResponse('redirect'); $rep->action = 'default:index'; return $rep; } if ($id_forum == 0) { $rep = $this->getResponse('redirect'); $rep->action = 'default:index'; return $rep; } $forum = jClasses::getService('havefnubb~hfnuforum')->getForum($id_forum); if (jUrl::escape($forum->forum_name, true) != $ftitle) { $rep = $this->getResponse('redirect'); $rep->action = jApp::config()->urlengine['notfoundAct']; return $rep; } jApp::coord()->getPlugin('history')->change('label', htmlentities($forum->forum_name, ENT_COMPAT, 'UTF-8')); $feed_reader = new jFeedReader(); $feed_reader->setCacheDir(jApp::varPath('feeds')); $feed_reader->setTimeout(2); $feed_reader->setUserAgent('HaveFnuBB - http://www.havefnubb.org/'); $feed = $feed_reader->parse($forum->forum_url); $rep = $this->getResponse('html'); $tpl = new jTpl(); $tpl->assign('feed', $feed); $tpl->assign('forum', $forum); $rep->title = $forum->forum_name; $rep->body->assign('MAIN', $tpl->fetch('havefnubb~forum_rss.view')); return $rep; }
public function setFromIniNode($node_key, $node) { $this->id = substr($node_key, 5); if (!empty($node['type'])) { if (in_array($node['type'], self::$allowed_types)) { $this->type = $node['type']; } else { throw new jException('jPref~admin.type.not.allowed', array($node['type'], implode(',', self::$allowed_types))); } } if (!empty($node['locale'])) { $this->locale = $node['locale']; } if (!empty($node['group'])) { $this->group = $node['group']; } $this->_readable = empty($node['read_acl_subject']) || jAcl2::check($node['read_acl_subject']); $this->_writable = empty($node['write_acl_subject']) || jAcl2::check($node['write_acl_subject']); if (!empty($node['default_value'])) { $this->default_value = $node['default_value']; } if ($this->type == 'boolean') { if ($this->default_value == 'true' || $this->default_value == '1') { $this->default_value = true; } else { if ($this->default_value == 'false' || isset($node['default_value']) && $node['default_value'] == '') { $this->default_value = false; } } } }
/** * */ function onmasteradminGetMenuContent($event) { if (jAcl2::check('auth.users.list')) { $item = new masterAdminMenuItem('pref', jLocale::get('jpref_admin~admin.item.title'), jUrl::get('jpref_admin~prefs:index'), 50, 'system'); $item->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/cog.png'; $event->add($item); } }
/** * */ function onmasteradminGetMenuContent($event) { $plugin = $GLOBALS['gJCoord']->getPlugin('auth', false); if ($plugin && $plugin->config['driver'] == 'Db' && jAcl2::check('auth.users.list')) { $item = new masterAdminMenuItem('users', jLocale::get('jauthdb_admin~auth.adminmenu.item.list'), jUrl::get('jauthdb_admin~default:index'), 10, 'system'); $item->icon = $GLOBALS['gJConfig']->urlengine['jelixWWWPath'] . 'design/images/user.png'; $event->add($item); } }
function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; if (jAcl2::check('jelixcache.access')) { $item = new masterAdminMenuItem('jelixcache', jLocale::get('jelixcache~jelixcache.masteradmin.menu.item'), jUrl::get('jelixcache~default:index'), 100, 'system'); $item->icon = $chemin . 'images/clear_cache.png'; $event->add($item); } }
/** * */ function onmasteradminGetMenuContent($event) { if (jAcl2::check('acl.user.view')) { $event->add(new masterAdminMenuItem('usersrights', jLocale::get('jacl2db_admin~acl2.menu.item.rights'), jUrl::get('jacl2db_admin~users:index'), 30, 'system')); } if (jAcl2::check('acl.group.view')) { $event->add(new masterAdminMenuItem('usersgroups', jLocale::get('jacl2db_admin~acl2.menu.item.groups'), jUrl::get('jacl2db_admin~groups:index'), 20, 'system')); } }
function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; if (jAcl2::check('modulesinfo.access')) { $item = new masterAdminMenuItem('modulesinfo', jLocale::get('modulesinfo~modulesinfo.masteradmin.menu.item'), jUrl::get('modulesinfo~default:index'), 202, 'system'); $item->icon = $chemin . 'images/modules_list.png'; $event->add($item); } }
/** * the menu item * @param object $event * @return void */ function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; if (jAcl2::check('hfnu.admin.contact')) { $event->add(new masterAdminMenuItem('hfnucontact', 'Contact', '', 40)); $item = new masterAdminMenuItem('contact', jLocale::get('hfnucontact~contact.contact'), jUrl::get('hfnucontact~admin:index'), 100, 'hfnucontact'); $item->icon = $chemin . 'images/contact.png'; $event->add($item); } }
/** * the menu item * @param object $event * @return void */ function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; if (jAcl2::check('hfnu.admin.index')) { $event->add(new masterAdminMenuItem('hfnuthemes', jLocale::get('hfnuthemes~theme.themes'), '', 30)); $item = new masterAdminMenuItem('theme', jLocale::get('hfnuthemes~theme.themes'), jUrl::get('hfnuthemes~default:index'), 10, 'hfnuthemes'); $item->icon = $chemin . 'images/theme.png'; $event->add($item); } }
/** * the menu item * @param object $event * @return void */ function onmasteradminGetMenuContent($event) { $chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/'; $event->add(new masterAdminMenuItem('hfnusearch', jLocale::get('hfnusearch~search.admin.search.engine'), '', 50)); if (jAcl2::check('hfnu.admin.search')) { $item = new masterAdminMenuItem('hfnusearch', jLocale::get('hfnusearch~search.admin.search.engine'), jUrl::get('hfnusearch~admin:index'), 100, 'hfnusearch'); $item->icon = $chemin . 'images/search_engine.png'; $event->add($item); } }
/** * is this record allowed to be see ? */ function allowed() { if ($this->forbidden === null) { $this->forbidden = !jAcl2::check('hfnu.forum.list', 'forum' . $this->record->id_forum); if ($this->forbidden) { $this->disallow(); } } return !$this->forbidden; }
/** * */ function onmasteradminGetMenuContent($event) { $plugin = jApp::coord()->getPlugin('auth', false); $driver = $plugin->config['driver']; $hasDao = isset($plugin->config[$driver]['dao']) && isset($plugin->config[$driver]['compatiblewithdb']) && $plugin->config[$driver]['compatiblewithdb']; if ($plugin && ($driver == 'Db' || $hasDao) && jAcl2::check('auth.users.list')) { $item = new masterAdminMenuItem('users', jLocale::get('jauthdb_admin~auth.adminmenu.item.list'), jUrl::get('jauthdb_admin~default:index'), 10, 'system'); $item->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/user.png'; $event->add($item); } }
/** * set rights on the given forum * @param integer $group the group id. * @param array $rights list of rights key = subject, value = true * @param string $resource the resource corresponding to the "forum" string + id_forum */ public static function setRightsOnForum($group, $rights, $resource) { $dao = jDao::get('jacl2db~jacl2rights', jAcl2Db::getProfile()); $dao->deleteHfnuByGroup($group, $resource); foreach ($rights as $sbj => $val) { if ($val != '') { jAcl2DbManager::addRight($group, $sbj, $resource); } } jAcl2::clearCache(); }
/** * */ function onmasteradminGetMenuContent($event) { if (jAcl2::check('acl.user.view')) { $item = new masterAdminMenuItem('usersrights', jLocale::get('jacl2db_admin~acl2.menu.item.rights'), jUrl::get('jacl2db_admin~users:index'), 30, 'system'); $item->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/rights.png'; $event->add($item); } if (jAcl2::check('acl.group.view')) { $item = new masterAdminMenuItem('usersgroups', jLocale::get('jacl2db_admin~acl2.menu.item.groups'), jUrl::get('jacl2db_admin~groups:index'), 20, 'system'); $item->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/group.png'; $event->add($item); } }
/** * default searchEngineRun methode which make a search from the engine by querying the table define in the dao of the hfnusearch.ini.php file * @param object $event */ function searchEngineRun($event) { $cleaner = jClasses::getService('hfnusearch~cleaner'); $words = $cleaner->stemPhrase($event->getParam('string')); $page = (int) $event->getParam('page'); $limit = (int) $event->getParam('limit'); $id_forum = (int) $event->getParam('id_forum'); // no words ; go back with nothing :P if (!$words) { return array('count' => 0, 'result' => array()); } //1) open the config file $HfnuSearchConfig = parse_ini_file(jApp::configPath() . 'havefnu.search.ini.php', true); //2) get the dao we want to read $dataSource = $HfnuSearchConfig['dao']; //3) build an array with each one $dataSources = preg_split('/,/', $dataSource); foreach ($dataSources as $ds) { //4) get a factory of the current DAO $dao = jDao::get($ds); //getting the column name on which we need to make the query $indexSubject = $HfnuSearchConfig[$ds]['index_subject']; $indexMessage = $HfnuSearchConfig[$ds]['index_message']; //5) get all the record $conditions = jDao::createConditions(); $conditions->startGroup('OR'); if ($id_forum > 0) { $conditions->addCondition('id_forum', '=', $id_forum); } foreach ($words as $word) { $conditions->addCondition($indexSubject, 'LIKE', '%' . $word . '%'); $conditions->addCondition($indexMessage, 'LIKE', '%' . $word . '%'); } $conditions->endGroup(); $allRecord = $dao->findBy($conditions); if ($page > 0 and $limit > 0) { $record = $dao->findBy($conditions, $page, $limit); } else { $record = $allRecord; } foreach ($record as $rec) { if (jAcl2::check('hfnu.admin.post')) { $event->Add(array('SearchEngineResult' => $rec, 'SearchEngineResultTotal' => $allRecord->rowCount())); } elseif (jAcl2::check('hfnu.forum.view', 'forum' . $rec->id_forum) and $rec->status < 7) { $event->Add(array('SearchEngineResult' => $rec, 'SearchEngineResultTotal' => $allRecord->rowCount())); } } } }
function __construct($id) { // " jump to " will display all the forum except : // 1) the current one // 2) the ones the access are not granted $data = array(); $dao = jDao::get('havefnubb~forum'); $recs = $dao->findAll(); foreach ($recs as $rec) { if ($rec->id_forum != $id and jAcl2::check('hfnu.forum.view', 'forum' . $rec->id_forum)) { $data[$rec->id_forum] = $rec->forum_name; } } $this->formId = $id; $this->data = $data; }
/** * View a given Category of forum then the list of forums */ function view() { $ctitle = $this->param('ctitle'); $id_cat = (int) $this->param('id_cat'); if ($id_cat == 0) { $rep = $this->getResponse('redirect'); $rep->action = 'havefnubb~default:index'; return $rep; } // add the category name in the page title // so // 1) get the category record $category = jClasses::getService('havefnubb~hfnucat')->getCat($id_cat); // check that the title of the category exist // if not => error404 if (jUrl::escape($ctitle, true) != jUrl::escape($category->cat_name, true)) { $rep = $this->getResponse('redirect'); $rep->action = jApp::config()->urlengine['notfoundAct']; return $rep; } $rep = $this->getResponse('html'); // 2) assign the title page $rep->title = $category->cat_name; $historyPlugin = jApp::coord()->getPlugin('history'); $histname = ucfirst(htmlentities($category->cat_name, ENT_COMPAT, 'UTF-8')); $historyPlugin->change('label', $histname); $historyPlugin->change('title', $histname); $categories = jDao::get('havefnubb~forum')->findParentByCatId($id_cat); foreach ($categories as $cat) { if (jAcl2::check('hfnu.forum.list', 'forum' . $cat->id_forum)) { // get the list of forum to build the RSS link $url = jUrl::get('havefnubb~posts:rss', array('ftitle' => $cat->forum_name, 'id_forum' => $cat->id_forum)); $rep->addHeadContent('<link rel="alternate" type="application/rss+xml" title="' . $cat->forum_name . '" href="' . htmlentities($url) . '" />'); } } $tpl = new jTpl(); $tpl->assign('action', 'view'); $tpl->assign('cat_name', $category->cat_name); $tpl->assign('categories', $categories); $tpl->assign('currentIdForum', 0); $rep->body->assign('MAIN', $tpl->fetch('index')); return $rep; }
/** * function to manage data before assigning to the template of its zone */ protected function _prepareTpl() { $thread_id = (int) $this->param('thread_id'); $id_forum = (int) $this->param('id_forum'); if (!$thread_id and !$id_forum) { return; } $user = ''; $noMsg = ''; $dao = jDao::get('havefnubb~threads'); $admin = jAcl2::check('hfnu.admin.post'); if ($thread_id) { if ($admin) { $userPost = $dao->getUserLastCommentOnPosts($thread_id); } else { $userPost = $dao->getUserLastVisibleCommentOnPosts($thread_id); } $user = jDao::get('havefnubb~member')->getById($userPost->id_user); } else { if ($id_forum) { if ($admin) { $userPost = $dao->getUserLastCommentOnForums($id_forum); } else { $userPost = $dao->getUserLastVisibleCommentOnForums($id_forum); } if ($userPost !== false) { $user = jDao::get('havefnubb~member')->getById($userPost->id_user); } else { $noMsg = jLocale::get('havefnubb~forum.postlc.no.msg'); } } } $this->_tpl->assign('user', $user); $this->_tpl->assign('post', $userPost); $this->_tpl->assign('msg', $noMsg); }
/** * logout a user and delete the user in the php session */ public static function logout() { $config = self::_getConfig(); jEvent::notify('AuthLogout', array('login' => $_SESSION[$config['session_name']]->login)); $_SESSION[$config['session_name']] = new jAuthDummyUser(); try { jAcl::clearCache(); } catch (Exception $e) { } try { jAcl2::clearCache(); } catch (Exception $e) { } if (isset($config['persistant_enable']) && $config['persistant_enable']) { if (!isset($config['persistant_cookie_name'])) { throw new jException('jelix~auth.error.persistant.incorrectconfig', 'persistant_cookie_name, persistant_crypt_key'); } setcookie($config['persistant_cookie_name'] . '[auth]', '', time() - 3600, $config['persistant_cookie_path']); } }
public function getDefaultDockable() { jClasses::inc('view~lizmapMapDockItem'); $dockable = array(); $bp = jApp::config()->urlengine['basePath']; // Get lizmap services $services = lizmap::getServices(); // only maps if ($services->onlyMaps) { $projectsTpl = new jTpl(); $dockable[] = new lizmapMapDockItem('home', jLocale::get('view~default.repository.list.title'), $projectsTpl->fetch('view~map_projects'), 0); } $switcherTpl = new jTpl(); $switcherTpl->assign(array('layerExport' => jAcl2::check('lizmap.tools.layer.export', $this->repository->getKey()))); $dockable[] = new lizmapMapDockItem('switcher', jLocale::get('view~map.switchermenu.title'), $switcherTpl->fetch('view~map_switcher'), 1); //$legendTpl = new jTpl(); //$dockable[] = new lizmapMapDockItem('legend', 'Légende', $switcherTpl->fetch('map_legend'), 2); $metadataTpl = new jTpl(); // Get the WMS information $wmsInfo = $this->getWMSInformation(); // WMS GetCapabilities Url $wmsGetCapabilitiesUrl = jAcl2::check('lizmap.tools.displayGetCapabilitiesLinks', $this->repository->getKey()); if ($wmsGetCapabilitiesUrl) { $wmsGetCapabilitiesUrl = $this->getData('wmsGetCapabilitiesUrl'); } $metadataTpl->assign(array_merge(array('repositoryLabel' => $this->getData('label'), 'repository' => $this->repository->getKey(), 'project' => $this->getKey(), 'wmsGetCapabilitiesUrl' => $wmsGetCapabilitiesUrl), $wmsInfo)); $dockable[] = new lizmapMapDockItem('metadata', jLocale::get('view~map.metadata.link.label'), $metadataTpl->fetch('view~map_metadata'), 2); if ($this->hasEditionLayers()) { $tpl = new jTpl(); $dockable[] = new lizmapMapDockItem('edition', jLocale::get('view~edition.navbar.title'), $tpl->fetch('view~map_edition'), 3, '', $bp . 'js/edition.js'); } return $dockable; }
function rightres() { $rep = $this->getResponse('html'); $user = $this->param('user'); if (!$user) { $rep->body->assign('MAIN', '<p>invalid user</p>'); return $rep; } $daogroup = jDao::get('jacl2db~jacl2group', 'jacl2_profile'); $group = $daogroup->getPrivateGroup($user); $rightsWithResources = array(); $daorights = jDao::get('jacl2db~jacl2rights', 'jacl2_profile'); $rs = $daorights->getRightsHavingRes($group->id_aclgrp); $hasRightsOnResources = false; foreach ($rs as $rec) { if (!isset($rightsWithResources[$rec->id_aclsbj])) { $rightsWithResources[$rec->id_aclsbj] = array(); } $rightsWithResources[$rec->id_aclsbj][] = $rec; $hasRightsOnResources = true; } $subjects_localized = array(); if (!empty($rightsWithResources)) { $conditions = jDao::createConditions(); $conditions->addCondition('id_aclsbj', 'in', array_keys($rightsWithResources)); foreach (jDao::get('jacl2db~jacl2subject', 'jacl2_profile')->findBy($conditions) as $rec) { $subjects_localized[$rec->id_aclsbj] = jLocale::get($rec->label_key); } } $tpl = new jTpl(); $tpl->assign(compact('user', 'subjects_localized', 'rightsWithResources', 'hasRightsOnResources')); if (jAcl2::check('acl.user.modify')) { $rep->body->assign('MAIN', $tpl->fetch('user_rights_res')); } else { $rep->body->assign('MAIN', $tpl->fetch('user_rights_res_view')); } $rep->body->assign('selectedMenuItem', 'usersrights'); return $rep; }
function rightres() { $rep = $this->getResponse('html'); $groupid = $this->param('group', null); if ($groupid === null || $groupid == '') { $rep->body->assign('MAIN', '<p>invalid group.</p>'); return $rep; } $daogroup = jDao::get('jacl2db~jacl2group', 'jacl2_profile'); if ($groupid != '__anonymous') { $group = $daogroup->get($groupid); if (!$group) { $rep->body->assign('MAIN', '<p>invalid group.</p>'); return $rep; } $groupname = $group->name; } else { $groupname = jLocale::get('jacl2db_admin~acl2.anonymous.group.name'); } $rightsWithResources = array(); $daorights = jDao::get('jacl2db~jacl2rights', 'jacl2_profile'); $rs = $daorights->getRightsHavingRes($groupid); $hasRightsOnResources = false; foreach ($rs as $rec) { if (!isset($rightsWithResources[$rec->id_aclsbj])) { $rightsWithResources[$rec->id_aclsbj] = array(); } $rightsWithResources[$rec->id_aclsbj][] = $rec; $hasRightsOnResources = true; } $subjects_localized = array(); if (!empty($rightsWithResources)) { $conditions = jDao::createConditions(); $conditions->addCondition('id_aclsbj', 'in', array_keys($rightsWithResources)); foreach (jDao::get('jacl2db~jacl2subject', 'jacl2_profile')->findBy($conditions) as $rec) { $subjects_localized[$rec->id_aclsbj] = jLocale::get($rec->label_key); } } $tpl = new jTpl(); $tpl->assign(compact('groupid', 'groupname', 'subjects_localized', 'rightsWithResources', 'hasRightsOnResources')); if (jAcl2::check('acl.group.modify')) { $rep->body->assign('MAIN', $tpl->fetch('group_rights_res')); } else { $rep->body->assign('MAIN', $tpl->fetch('group_rights_res_view')); } $rep->body->assign('selectedMenuItem', 'usersgroups'); return $rep; }