/** * */ 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 initExpectedValue() { $numbers = jLocale::get('jelix~captcha.number'); $id = rand(1, intval($numbers)); $this->question = jLocale::get('jelix~captcha.question.' . $id); $this->container->privateData[$this->ref] = jLocale::get('jelix~captcha.response.' . $id); }
protected function _prepareTpl() { jClasses::inc('masterAdminMenuItem'); $menu = array(); $menu['toplinks'] = new masterAdminMenuItem('toplinks', '', ''); $dashboard = new masterAdminMenuItem('dashboard', jLocale::get('gui.menu.item.dashboard'), jUrl::get('default:index')); $dashboard->icon = $GLOBALS['gJConfig']->urlengine['jelixWWWPath'] . 'design/images/dashboard.png'; $menu['toplinks']->childItems[] = $dashboard; $menu['system'] = new masterAdminMenuItem('system', jLocale::get('gui.menu.item.system'), '', 100); $items = jEvent::notify('masteradminGetMenuContent')->getResponse(); foreach ($items as $item) { if ($item->parentId) { if (!isset($menu[$item->parentId])) { $menu[$item->parentId] = new masterAdminMenuItem($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, "masterAdminItemSort"); foreach ($menu as $topitem) { usort($topitem->childItems, "masterAdminItemSort"); } $this->_tpl->assign('menuitems', $menu); $this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', '')); }
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 update() { $id = $this->param('id'); $pwd = $this->param('pwd'); $pwdconf = $this->param('pwd_confirm'); $rep = $this->getResponse('redirect'); if (trim($pwd) == '' || $pwd != $pwdconf) { jMessage::add(jLocale::get('crud.message.bad.password'), 'error'); $rep->action = 'password:index'; $rep->params['id'] = $id; return $rep; } if (jAuth::changePassword($id, $pwd)) { jMessage::add(jLocale::get('crud.message.change.password.ok', $id), 'notice'); if ($this->personalView) { $rep->action = 'user:index'; } else { $rep->action = 'default:view'; } $rep->params['id'] = $id; return $rep; } else { jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error'); $rep->action = 'password:index'; $rep->params['id'] = $id; } return $rep; }
/** * Main Menu of the navbar * @pararm event $event Object of a listener */ function onhfnuGetMenuContent($event) { $gJConfig = jApp::config(); $event->add(new hfnuMenuItem('home', jLocale::get('havefnubb~main.home'), jUrl::get('havefnubb~default:index'), 1, 'main')); $event->add(new hfnuMenuItem('members', jLocale::get('havefnubb~main.member.list'), jUrl::get('havefnubb~members:index'), 2, 'main')); $event->add(new hfnuMenuItem('search', jLocale::get('havefnubb~main.search'), jUrl::get('hfnusearch~default:index'), 3, 'main')); if ($gJConfig->havefnubb['rules'] != '') { $event->add(new hfnuMenuItem('rules', jLocale::get('havefnubb~main.rules'), jUrl::get('havefnubb~default:rules'), 4, 'main')); } // dynamic menu $menus = jClasses::getService('havefnubb~hfnumenusbar')->getMenus(); if (!empty($menus)) { foreach ($menus as $indx => $menu) { $event->add(new hfnuMenuItem($menu['itemName'], $menu['name'], $menu['url'], 50 + $menu['order'], 'main')); } } if ($event->getParam('admin') === true) { $url = ''; try { // let's try to retrieve the url of the admin, if the admin is in // the same app $url = jUrl::get('hfnuadmin~default:index'); } catch (Exception $e) { if (isset($gJConfig->havefnubb["admin_url"])) { $url = $gJConfig->havefnubb["admin_url"]; } } if ($url) { $event->add(new hfnuMenuItem('admin', jLocale::get('havefnubb~main.admin.panel'), $url, 100, 'main')); } } }
/** * */ 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')); } }
/** * Get JSON containing all translation for a given jelix property file. * @param string $property Name of the property file. Ex: map if searched file is map.UTF-8.properties * @param string $lang Language. Ex: fr_FR (optional) * @return binary object The image for this project. */ function getDictionary() { $rep = $this->getResponse('json'); // Get the property file $property = $this->param('property'); $lang = $this->param('lang'); if (!$lang) { $lang = jLocale::getCurrentLang() . '_' . jLocale::getCurrentCountry(); } $data = array(); $path = jApp::appPath() . 'modules/view/locales/' . $lang . '/' . $property . '.UTF-8.properties'; if (file_exists($path)) { $lines = file($path); foreach ($lines as $lineNumber => $lineContent) { if (!empty($lineContent) and $lineContent != '\\n') { $exp = explode('=', trim($lineContent)); if (!empty($exp[0])) { $data[$exp[0]] = jLocale::get('view~dictionnary.' . $exp[0], null, $lang); } } } } $rep->data = $data; return $rep; }
/** * Main page */ public function index() { $submit = $this->param('validate'); if ($submit == jLocale::get('hfnucontact~contact.form.saveBt')) { $form = jForms::fill('hfnucontact~admincontact'); $rep = $this->getResponse('redirect'); if (!$form->check()) { $rep->action = 'hfnucontact~admin:index'; return $rep; } $HfnucontactConfig = new jIniFileModifier(jApp::configPath('defaultconfig.ini.php')); $HfnucontactConfig->setValue('email_contact', $this->param('contact'), 'hfnucontact'); $HfnucontactConfig->save(); jMessage::add(jLocale::get('hfnucontact~contact.admin.form.email.saved'), 'ok'); jForms::destroy('hfnucontact~admincontact'); $rep->action = 'hfnucontact~admin:index'; return $rep; } else { $form = jForms::create('hfnucontact~admincontact'); } $form->setData('contact', jApp::config()->hfnucontact['email_contact']); $rep = $this->getResponse('html'); $tpl = new jTpl(); $tpl->assign('form', $form); $rep->body->assign('MAIN', $tpl->fetch('hfnucontact~admincontact')); $rep->body->assign('selectedMenuItem', 'contact'); 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; }
/** * */ function in() { $rep = $this->getResponse('redirectUrl'); $conf = jApp::coord()->getPlugin('auth')->config; $url_return = '/'; if ($conf['after_login'] == '') { throw new jException('jcommunity~login.error.no.auth_login'); } if ($conf['after_logout'] == '') { throw new jException('jcommunity~login.error.no.auth_logout'); } $form = jForms::fill('jcommunity~login'); if (!$form) { $rep->url = jUrl::get($conf['after_logout']); return $rep; } if (!jAuth::login($form->getData('auth_login'), $form->getData('auth_password'), $form->getData('auth_remember_me'))) { sleep(intval($conf['on_error_sleep'])); $form->setErrorOn('auth_login', jLocale::get('jcommunity~login.error')); //jMessage::add(jLocale::get('jcommunity~login.error'), 'error'); if ($auth_url_return = $this->param('auth_url_return')) { $url_return = jUrl::get('login:index', array('auth_url_return' => $auth_url_return)); } else { $url_return = jUrl::get('login:index'); } } else { jForms::destroy('jcommunity~login'); if (!($conf['enable_after_login_override'] && ($url_return = $this->param('auth_url_return')))) { $url_return = jUrl::get($conf['after_login']); } } $rep->url = $url_return; return $rep; }
/** * */ function update() { $id = $this->param('j_user_login'); $pwd = $this->param('pwd'); $pwdconf = $this->param('pwd_confirm'); $rep = $this->getResponse('redirect'); if ($this->personalView && $id != jAuth::getUserSession()->login) { jMessage::add(jLocale::get('jelix~errors.acl.action.right.needed'), 'error'); $rep->action = 'master_admin~default:index'; return $rep; } if (trim($pwd) == '' || $pwd != $pwdconf) { jMessage::add(jLocale::get('crud.message.bad.password'), 'error'); $rep->action = 'password:index'; $rep->params['j_user_login'] = $id; return $rep; } if (jAuth::changePassword($id, $pwd)) { jMessage::add(jLocale::get('crud.message.change.password.ok', $id), 'notice'); if ($this->personalView) { $rep->action = 'user:index'; } else { $rep->action = 'default:view'; } $rep->params['j_user_login'] = $id; return $rep; } else { jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error'); $rep->action = 'password:index'; $rep->params['j_user_login'] = $id; } return $rep; }
/** * */ 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); } }
protected function _prepareTpl() { $id = jAuth::getUserSession()->id; $title = jLocale::get("jmessenger~message.msg.inbox"); $dao = jDao::get($this->dao); $msg = $dao->getRecus($id); $this->_tpl->assign(compact('msg', 'id', 'title')); }
/** * */ function index() { $rep = $this->getResponse('html'); $groups = array(); $o = new StdClass(); $o->id_aclgrp = '-2'; $o->name = jLocale::get('jacl2_admin~acl2.all.users.option'); $o->grouptype = 0; $groups[] = $o; $o = new StdClass(); $o->id_aclgrp = '-1'; $o->name = jLocale::get('jacl2_admin~acl2.without.groups.option'); $o->grouptype = 0; $groups[] = $o; foreach (jAcl2DbUserGroup::getGroupList() as $grp) { $groups[] = $grp; } $listPageSize = 15; $offset = $this->intParam('idx', 0, true); $grpid = $this->intParam('grpid', -2, true); $p = jAcl2Db::getProfil(); if ($grpid == -2) { //all users $dao = jDao::get('jelix~jacl2groupsofuser', $p); $cond = jDao::createConditions(); $cond->addCondition('grouptype', '=', 2); $rs = $dao->findBy($cond, $offset, $listPageSize); $usersCount = $dao->countBy($cond); } elseif ($grpid == -1) { //only those who have no groups $sql = 'SELECT login, count(id_aclgrp) as nbgrp FROM jacl2_user_group GROUP BY login HAVING nbgrp < 2 ORDER BY login'; $cnx = jDb::getConnection($p); $rs = $cnx->query($sql); $usersCount = -1; } else { //in a specific group $dao = jDao::get('jelix~jacl2usergroup', $p); $rs = $dao->getUsersGroupLimit($grpid, $offset, $listPageSize); $usersCount = $dao->getUsersGroupCount($grpid); } $users = array(); $dao2 = jDao::get('jelix~jacl2groupsofuser', $p); foreach ($rs as $u) { $u->groups = array(); $gl = $dao2->getGroupsUser($u->login); foreach ($gl as $g) { if ($g->grouptype != 2) { $u->groups[] = $g; } } $users[] = $u; } $tpl = new jTpl(); $tpl->assign(compact('offset', 'grpid', 'listPageSize', 'groups', 'users', 'usersCount')); $rep->body->assign('MAIN', $tpl->fetch('users_list')); return $rep; }
/** * */ 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')); } }
protected function _prepareTpl() { $id = $this->getParam("id", jAuth::getUserSession()->id); $title = jLocale::get("jmessenger~message.msg.archived"); $dao = jDao::get($this->dao); $msg = $dao->getArchive($id); $send = true; $this->_tpl->assign(compact('msg', 'id', 'title', 'send')); }
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); } }
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) { $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); } }
protected function _prepareTpl() { $id = $this->getParam('id', false); $scope = $this->getParam('scope', false); if (!$id || !$scope) { throw new Exception(jLocale::get("jtags~tags.error.parametermissing")); } $tags = jClasses::getService("jtags~tags")->getTagsBySubject($scope, $id); $this->_tpl->assign(compact('tags')); }
/** * 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); } }
/** * function that display the nickname of the admin that censored the post */ function jtpl_function_html_censored_by($tpl, $id) { $user = jDao::get('havefnubb~member')->getById($id); $str = jLocale::get('havefnubb~main.censored.by'); if ($user->nickname != '') { echo $str . ' ' . $user->nickname; } else { echo $str . ' ' . $user->login; } }
/** * NumberFormat plugin for jTpl that wraps PHP number_format function * * @param float $number the number to format * @param int $decimals the number of decimals to return * @param string $dec_point the separator string for the decimals * @param string $thousands_sep the separator string for the thousands * @return string */ function jtpl_modifier_common_number_format($number, $decimals = 0, $dec_point = false, $thousands_sep = false) { if ($dec_point == false) { $dec_point = jLocale::get('jelix~format.decimal_point'); } if ($thousands_sep == false) { $thousands_sep = jLocale::get('jelix~format.thousands_sep'); } return number_format($number, $decimals, $dec_point, $thousands_sep); }
/** * 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); } }
/** * */ function index() { $resp = $this->getResponse('html'); $resp->title = jLocale::get('gui.dashboard.title'); $resp->body->assignZone('MAIN', 'dashboard'); if (jAuth::getUserSession()->login == 'admin' && jAuth::getUserSession()->password == md5('admin')) { jMessage::add(jLocale::get('gui.message.admin.password'), 'error'); } $resp->body->assign('selectedMenuItem', 'dashboard'); return $resp; }
/** * */ 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); } }
public function __construct($sel, &$container, $reset = false) { parent::__construct($sel, $container, $reset); $ctrl = new jFormsControlinput('name'); $ctrl->label = jLocale::get('jPicasa~common.forms.input.name'); $this->addControl($ctrl); $ctrl = new jFormsControlsubmit('_submit'); $ctrl->label = jLocale::get('jPicasa~common.search'); $ctrl->datasource = new jFormsStaticDatasource(); $this->addControl($ctrl); }
/** * handle a possible flood protection from the same IP user */ function error() { $resp = $this->getResponse('html'); $title = stripslashes(jApp::config()->havefnubb['title']); $history = jApp::coord()->getPlugin('history'); $history->change('label', ucfirst(htmlentities($title, ENT_COMPAT, 'UTF-8'))); $history->change('title', jLocale::get('havefnubb~main.goto_homepage')); $tpl = new jTpl(); $tpl->assign('message', jLocale::get('havefnubb~flood.detected')); $resp->body->assign('MAIN', $tpl->fetch('havefnubb~flood')); return $resp; }