本文整理汇总了PHP中jAcl2类的典型用法代码示例。如果您正苦于以下问题:PHP jAcl2类的具体用法?PHP jAcl2怎么用?PHP jAcl2使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了jAcl2类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onmasteradminGetMenuContent
/**
*
*/
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'));
}
}
示例2: index
/**
*
*/
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;
}
示例3: onmasteradminGetMenuContent
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);
}
}
示例4: onAuthLogout
function onAuthLogout($event)
{
try {
jAcl2::clearCache();
} catch (Exception $e) {
}
}
示例5: _prepareTpl
/**
* 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', ''));
}
示例6: index
/**
*
*/
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;
}
示例7: index
/**
* 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;
}
示例8: beforeAction
/**
* @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;
}
示例9: read_rss
/**
* 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;
}
示例10: setFromIniNode
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;
}
}
}
}
示例11: onmasteradminGetMenuContent
/**
*
*/
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);
}
}
示例12: onmasteradminGetMenuContent
/**
*
*/
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);
}
}
示例13: onmasteradminGetMenuContent
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);
}
}
示例14: onmasteradminGetMenuContent
/**
*
*/
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'));
}
}
示例15: onmasteradminGetMenuContent
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);
}
}