public function create($urlact)
 {
     $m = $urlact->getParam('module');
     $a = $urlact->getParam('action');
     $scriptName = $this->getBasePath($urlact->requestType, $m, $a);
     $script = $this->getScript($urlact->requestType, $m, $a);
     if (isset(jApp::config()->basic_significant_urlengine_entrypoints[$script]) && jApp::config()->basic_significant_urlengine_entrypoints[$script]) {
         if (!jApp::config()->urlengine['multiview']) {
             $script .= jApp::config()->urlengine['entrypointExtension'];
         }
         $scriptName .= $script;
     }
     $url = new jUrl($scriptName, $urlact->params, '');
     if (in_array($urlact->requestType, array('xmlrpc', 'jsonrpc', 'soap'))) {
         $url->clearParam();
     } else {
         $pi = '/' . $m . '/';
         if ($a != 'default:index') {
             list($c, $a) = explode(':', $a);
             $pi .= $c . '/';
             if ($a != 'index') {
                 $pi .= $a;
             }
         }
         $url->pathInfo = $pi;
         $url->delParam('module');
         $url->delParam('action');
     }
     return $url;
 }
Exemple #2
0
 public function create($urlact)
 {
     $m = $urlact->getParam('module');
     $a = $urlact->getParam('action');
     $scriptName = $this->getBasePath($urlact->requestType, $m, $a);
     $scriptName .= $this->getScript($urlact->requestType, $m, $a);
     if (!jApp::config()->urlengine['multiview']) {
         $scriptName .= jApp::config()->urlengine['entrypointExtension'];
     }
     $url = new jUrl($scriptName, $urlact->params, '');
     if (in_array($urlact->requestType, array('xmlrpc', 'jsonrpc', 'soap'))) {
         $url->clearParam();
     }
     return $url;
 }
 /**
  *
  */
 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'));
     }
 }
 /**
  * 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;
 }
 protected function _prepareTpl()
 {
     // Get the project and repository params
     $project = $this->param('project');
     $repository = $this->param('repository');
     $auth_url_return = $this->param('auth_url_return');
     if (!$auth_url_return) {
         $auth_url_return = jUrl::get('view~map:index', array("repository" => $repository, "project" => $project));
     }
     // Get lizmapProject class
     $assign = array('isConnected' => jAuth::isConnected(), 'user' => jAuth::getUserSession(), 'auth_url_return' => $auth_url_return, "externalSearch" => "", "edition" => false, "measure" => false, "locate" => false, "geolocation" => false, "timemanager" => false, "print" => false, "attributeLayers" => false);
     try {
         $lproj = lizmap::getProject($repository . '~' . $project);
         $configOptions = $lproj->getOptions();
         if (property_exists($configOptions, 'externalSearch')) {
             $assign['externalSearch'] = $configOptions->externalSearch;
         }
     } catch (UnknownLizmapProjectException $e) {
         jLog::logEx($e, 'error');
     }
     $this->_tpl->assign($assign);
     // Get lizmap services
     $services = lizmap::getServices();
     if ($services->allowUserAccountRequests) {
         $this->_tpl->assign('allowUserAccountRequests', True);
     }
 }
Exemple #6
0
/**
 * function plugin :  write the url corresponding to the given jelix action
 *
 * @param jTpl $tpl template engine
 * @param string $selector selector action
 * @param array $params parameters for the url
 */
function jtpl_function_html_formurl($tpl, $selector, $params = array())
{
    $url = jUrl::get($selector, $params, 2);
    // retourne le jurl correspondant
    echo $url->getPath();
    $tpl->_privateVars['_formurl'] = $url;
}
/**
 * function plugin :  Ajax request
 *
 * it creates a javascript ajax function
 * example :
 * <pre>
 * {link_to_remote
 *  'Link',    <!-- link label -->
 *  'result',    <!-- id dom for ajax result -->
 *  'test~default:ajax', array('id'=>'34'),    <!-- jurl request -->
 *  array(
 *    'position'=>'html',    <!-- html or append or prepend (default html) -->
 *    'method'=>'GET',    <!-- GET or POST (default POST) -->
 *    'beforeSend'=>'alert("beforeSend")',    <!-- JS script before send (default null) -->
 *    'complete'=>'alert("complete")',    <!-- JS script after send  (default null)-->
 *    'error'=>'alert("error")',    <!-- JS if error  (default null) -->
 * )}
 * <div id="result"></div>
 * </pre>
 */
function jtpl_function_html_link_to_remote($tpl, $label, $element_id, $action_selector, $action_parameters, $option)
{
    global $gJCoord, $gJConfig;
    static $id_link_to_remote = 0;
    if ($gJCoord->response->getFormatType() == 'html') {
        // Add js link
        $gJCoord->response->addJSLink($gJConfig->urlengine['basePath'] . 'jelix/jquery/jquery.js');
    }
    $id_link_to_remote++;
    $url = jUrl::get($action_selector, $action_parameters);
    $position = array_key_exists("position", $option) ? $option['position'] : 'html';
    $method = array_key_exists("method", $option) ? $option['method'] : 'GET';
    $beforeSend = array_key_exists("beforeSend", $option) ? $option['beforeSend'] : '';
    $complete = array_key_exists("complete", $option) ? $option['complete'] : '';
    $error = array_key_exists("error", $option) ? $option['error'] : '';
    // Link
    echo '<a href="#" onclick="link_to_remote_' . $id_link_to_remote . '();">' . $label . "</a>\n";
    // Script
    echo '
    <script>
      function link_to_remote_' . $id_link_to_remote . '() {
        $.ajax({
          type: \'' . $method . "',\n          url: '" . $url . "',\n          beforeSend: function(){" . $beforeSend . ";},\n          complete: function(){" . $complete . ";},\n          error: function(){" . $error . ';},
          success: function(msg){
            $(\'#' . $element_id . "')." . $position . "(msg);\n          }\n        });\n      };\n    </script>";
}
 /**
  * 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'));
         }
     }
 }
Exemple #9
0
 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', ''));
 }
/**
* @package    jelix
* @subpackage jtpl_plugin
* @author     Laurent Jouanneau
* @copyright  2011-2012 Laurent Jouanneau
* @link        http://www.jelix.org
* @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
*/
function jtpl_function_html_resurl($tpl, $module, $file, $intheme = false, $escape = true)
{
    if ($intheme) {
        $file = 'themes/' . jApp::config()->theme . '/' . $file;
    }
    echo jUrl::get("jelix~www:getfile", array('targetmodule' => $module, 'file' => $file), $escape ? 1 : 0);
}
 /**
  * Main page
  */
 function index()
 {
     $title = stripslashes(jApp::config()->havefnubb['title']);
     $rep = $this->getResponse('html');
     $historyPlugin = jApp::coord()->getPlugin('history');
     $historyPlugin->change('label', ucfirst(htmlentities($title, ENT_COMPAT, 'UTF-8')));
     $historyPlugin->change('title', jLocale::get('havefnubb~main.goto_homepage'));
     $forums = jClasses::getService('hfnuforum');
     $forumsList = $forums->getFullList();
     // generate rss links list
     foreach ($forumsList->getLinearIterator() as $f) {
         // get the list of forum to build the RSS link
         $url = jUrl::get('havefnubb~posts:rss', array('ftitle' => $f->record->forum_name, 'id_forum' => $f->record->id_forum));
         $rep->addHeadContent('<link rel="alternate" type="application/rss+xml" title="' . $f->record->forum_name . ' - RSS" href="' . htmlentities($url) . '" />');
         $url = jUrl::get('havefnubb~posts:atom', array('ftitle' => $f->record->forum_name, 'id_forum' => $f->record->id_forum));
         $rep->addHeadContent('<link rel="alternate" type="application/atom+xml" title="' . $f->record->forum_name . ' - ATOM " href="' . htmlentities($url) . '" />');
     }
     $tpl = new jTpl();
     $tpl->assign('selectedMenuItem', 'community');
     $tpl->assign('currentIdForum', 0);
     $tpl->assign('action', 'index');
     $tpl->assign('forumsList', $forumsList);
     $rep->body->assign('MAIN', $tpl->fetch('havefnubb~index'));
     return $rep;
 }
/**
 * @package     jelix
 * @subpackage  jtpl_plugin
 * @author      Lepeltier kévin
 * @contributor Dominique Papin
 * @copyright   2008 Lepeltier kévin, 2008 Dominique Papin
 * @link        http://www.jelix.org
 * @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
 */
function jtpl_function_html_breadcrumb($tpl, $nb = null, $separator = '')
{
    $plugin = jApp::coord()->getPlugin('history', true);
    if ($plugin === null) {
        return;
    }
    $config =& $plugin->config;
    if (!isset($config['session_name']) || $config['session_name'] == '') {
        $config['session_name'] = 'HISTORY';
    }
    if (!isset($_SESSION[$config['session_name']])) {
        return;
    }
    echo '<ol class="history">';
    $leng = count($_SESSION[$config['session_name']]);
    $nb = $nb !== null ? count($_SESSION[$config['session_name']]) - $nb : 0;
    $nb = $nb < 0 ? 0 : $nb;
    for ($i = $nb; $i < $leng; $i++) {
        $page = $_SESSION[$config['session_name']][$i];
        echo '<li' . ($i == $nb ? ' class="first"' : ($i == $leng - 1 ? ' class="end"' : '')) . '>';
        if ($i != $leng - 1) {
            echo '<a href="' . jUrl::get($page['action'], $page['params'], jUrl::XMLSTRING) . '" ' . ($page['title'] != '' ? 'title="' . $page['title'] . '"' : '') . '>';
        }
        echo $_SESSION[$config['session_name']][$i]['label'];
        if ($i != $leng - 1) {
            echo '</a>';
        }
        echo ($i == $leng - 1 ? '' : $separator) . '</li>';
    }
    echo '</ol>';
}
 /**
  * Create a jurl object with the given action data
  * @param jUrlAction $url  information about the action
  * @return jUrl the url correspondant to the action
  */
 public function create($urlact)
 {
     global $gJConfig;
     $m = $urlact->getParam('module');
     $a = $urlact->getParam('action');
     $scriptName = $this->getBasePath($urlact->requestType, $m, $a);
     $script = $this->getScript($urlact->requestType, $m, $a);
     if (isset($gJConfig->basic_significant_urlengine_entrypoints[$script]) && $gJConfig->basic_significant_urlengine_entrypoints[$script]) {
         if (!$gJConfig->urlengine['multiview']) {
             $script .= $gJConfig->urlengine['entrypointExtension'];
         }
         $scriptName .= $script;
     }
     $url = new jUrl($scriptName, $urlact->params, '');
     // pour certains types de requete, les paramètres ne sont pas dans l'url
     // donc on les supprime
     // c'est un peu crade de faire ça en dur ici, mais ce serait lourdingue
     // de charger la classe request pour savoir si on peut supprimer ou pas
     if (in_array($urlact->requestType, array('xmlrpc', 'jsonrpc', 'soap'))) {
         $url->clearParam();
     } else {
         $pi = '/' . $m . '/';
         if ($a != 'default:index') {
             list($c, $a) = explode(':', $a);
             $pi .= $c . '/';
             if ($a != 'index') {
                 $pi .= $a;
             }
         }
         $url->pathInfo = $pi;
         $url->delParam('module');
         $url->delParam('action');
     }
     return $url;
 }
 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);
     }
 }
 protected function _prepareTpl()
 {
     $config = new \Jelix\JCommunity\Config();
     $this->_tpl->assign('canRegister', $config->isRegistrationEnabled());
     $this->_tpl->assign('canResetPassword', $config->isResetPasswordEnabled());
     if (jAuth::isConnected()) {
         $this->_tpl->assign('login', jAuth::getUserSession()->login);
     } else {
         $conf = jAuth::loadConfig();
         $this->_tpl->assign('persistance_ok', jAuth::isPersistant());
         $form = jForms::get("jcommunity~login");
         if (!$form) {
             $form = jForms::create("jcommunity~login");
         }
         $this->_tpl->assign('form', $form);
         $this->_tpl->assign('url_return', '');
         if ($conf['enable_after_login_override']) {
             $req = jApp::coord()->request;
             if ($req->getParam('auth_url_return')) {
                 $this->_tpl->assign('url_return', $req->getParam('auth_url_return'));
             } else {
                 if ($this->param('as_main_content')) {
                     if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] && $_SERVER['HTTP_REFERER'] != jUrl::getCurrentUrl(false, true)) {
                         $this->_tpl->assign('url_return', $_SERVER['HTTP_REFERER']);
                     }
                 } else {
                     if ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') {
                         $this->_tpl->assign('url_return', jUrl::getCurrentUrl(false, true));
                     }
                 }
             }
         }
     }
 }
 protected function getcapabilities()
 {
     $result = parent::getcapabilities();
     if ($result->cached) {
         return $result;
     }
     $data = $result->data;
     if (empty($data) or floor($result->code / 100) >= 4) {
         jMessage::add('Server Error !', 'Error');
         return $this->serviceException();
     }
     if (preg_match('#ServiceExceptionReport#i', $data)) {
         return $result;
     }
     // Replace qgis server url in the XML (hide real location)
     $sUrl = jUrl::getFull("lizmap~service:index", array("repository" => $this->repository->getKey(), "project" => $this->project->getKey()));
     $sUrl = str_replace('&', '&amp;', $sUrl);
     preg_match('/<get>.*\\n*.+xlink\\:href="(.+)"/i', $data, $matches);
     if (count($matches) < 2) {
         preg_match('/get onlineresource="(.+)"/i', $data, $matches);
     }
     if (count($matches) > 1) {
         $data = str_replace($matches[1], $sUrl, $data);
     }
     $data = str_replace('&amp;&amp;', '&amp;', $data);
     // Add response to cache
     $cacheId = $this->repository->getKey() . '_' . $this->project->getKey() . '_' . $this->param('service');
     $newhash = md5_file(realpath($this->repository->getPath()) . '/' . $this->project->getKey() . ".qgs");
     jCache::set($cacheId . '_hash', $newhash);
     jCache::set($cacheId . '_mime', $result->mime);
     jCache::set($cacheId . '_data', $data);
     return (object) array('code' => 200, 'mime' => $result->mime, 'data' => $data, 'cached' => False);
 }
/**
 * function plugin :  write the url corresponding to the given jelix action
 *
 * @param jTpl $tpl template engine
 * @param string $selector selector action
 * @param array $params parameters for the url
 */
function jtpl_function_html_formurlparam($tpl, $selector, $params = array())
{
    $url = jUrl::get($selector, $params, 2);
    // retourne un jUrl
    foreach ($url->params as $p_name => $p_value) {
        echo '<input type="hidden" name="' . $p_name . '" value="' . htmlspecialchars($p_value) . '"/>', "\n";
    }
}
 /**
  *
  */
 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);
     }
 }
/**
* @package      jelix
* @subpackage   jtpl_plugin
* @author       Laurent Jouanneau
* @contributor  Yann (description and keywords), Dominique Papin (ie7 support), Mickaël Fradin (style), Loic Mathaud (title), Olivier Demah (auhor,generator), Julien Issler
* @copyright    2005-2012 Laurent Jouanneau, 2007 Dominique Papin, 2008 Mickaël Fradin, 2009 Loic Mathaud, 2010 Olivier Demah
* @copyright    2010 Julien Issler
* @link         http://www.jelix.org
* @licence      GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
*/
function jtpl_meta_html_htmlmodule($tpl, $method, $module, $path, $params = array())
{
    $resp = jApp::coord()->response;
    if ($resp->getType() != 'html') {
        return;
    }
    if (strpos($method, 'csstheme') === 0) {
        $url = jUrl::get('jelix~www:getfile', array('targetmodule' => $module, 'file' => 'themes/' . jApp::config()->theme . '/' . $path));
        switch ($method) {
            case 'csstheme':
                $resp->addCSSLink($url, $params);
                break;
            case 'cssthemeie':
                $resp->addCSSLink($url, $params, true);
                break;
            case 'cssthemeie7':
            case 'cssthemeie8':
            case 'cssthemeie9':
                $resp->addCSSLink($url, $params, 'IE ' . substr($method, -1, 1));
                break;
            case 'cssthemeltie7':
            case 'cssthemeltie8':
            case 'cssthemeltie9':
                $resp->addCSSLink($url, $params, 'lt IE ' . substr($method, -1, 1));
                break;
            default:
                trigger_error("Unknown resource type in meta_htmlmodule", E_USER_WARNING);
        }
    } else {
        $url = jUrl::get('jelix~www:getfile', array('targetmodule' => $module, 'file' => $path));
        switch ($method) {
            case 'js':
                $resp->addJSLink($url, $params);
                break;
            case 'css':
                $resp->addCSSLink($url, $params);
                break;
            case 'jsie':
                $resp->addJSLink($url, $params, true);
                break;
            case 'cssie':
                $resp->addCSSLink($url, $params, true);
                break;
            case 'cssie7':
            case 'cssie8':
            case 'cssie9':
                $resp->addCSSLink($url, $params, 'IE ' . substr($method, -1, 1));
                break;
            case 'cssltie7':
            case 'cssltie8':
            case 'cssltie9':
                $resp->addCSSLink($url, $params, 'lt IE ' . substr($method, -1, 1));
                break;
            default:
                trigger_error("Unknown resource type in meta_htmlmodule", E_USER_WARNING);
        }
    }
}
 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);
     }
 }
 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 index()
 {
     $rep = parent::index();
     if ($rep->getType() != 'html') {
         return $rep;
     }
     $rep->body->assign('auth_url_return', jUrl::get('view~map:index', array("repository" => $repository, "project" => $project)));
     return $rep;
 }
 public function output()
 {
     if ($this->hasErrors()) {
         return false;
     }
     $this->sendHttpHeaders();
     header('location: ' . jUrl::get($this->action, $this->params) . ($this->anchor != '' ? '#' . $this->anchor : ''));
     return true;
 }
 /**
  *
  */
 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'));
     }
 }
 /**
  * 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);
     }
 }
 /**
  * Create a jurl object with the given action data
  * @param jUrlAction $url  information about the action
  * @return jUrl the url correspondant to the action
  */
 public function create($urlact)
 {
     $m = $urlact->getParam('module');
     $a = $urlact->getParam('action');
     $scriptName = $this->getBasePath($urlact->requestType, $m, $a);
     $scriptName .= $this->getScript($urlact->requestType, $m, $a);
     if (!jApp::config()->urlengine['multiview']) {
         $scriptName .= '.php';
     }
     $url = new jUrl($scriptName, $urlact->params, '');
     // for some request types, parameters aren't in the url
     // so we remove them
     // it's a bit dirty to do that hardcoded here, but it would be a pain
     // to load the request class to check whether we can remove or not
     if (in_array($urlact->requestType, array('xmlrpc', 'jsonrpc', 'soap'))) {
         $url->clearParam();
     }
     return $url;
 }
 /**
  * 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);
     }
 }
 protected function getcapabilities()
 {
     $result = parent::getcapabilities();
     if ($result->cached) {
         return $result;
     }
     $data = $result->data;
     if (empty($data) or floor($result->code / 100) >= 4) {
         jMessage::add('Server Error !', 'Error');
         return $this->serviceException();
     }
     if (preg_match('#ServiceExceptionReport#i', $data)) {
         return $result;
     }
     // Remove no interoparable elements
     $data = preg_replace('@<GetPrint[^>]*?>.*?</GetPrint>@si', '', $data);
     $data = preg_replace('@<ComposerTemplates[^>]*?>.*?</ComposerTemplates>@si', '', $data);
     // Replace qgis server url in the XML (hide real location)
     $sUrl = jUrl::getFull("lizmap~service:index", array("repository" => $this->repository->getKey(), "project" => $this->project->getKey()));
     $sUrl = str_replace('&', '&amp;', $sUrl);
     preg_match('/<get>.*\\n*.+xlink\\:href="(.+)"/i', $data, $matches);
     if (count($matches) < 2) {
         preg_match('/get onlineresource="(.+)"/i', $data, $matches);
     }
     if (count($matches) > 1) {
         $data = str_replace($matches[1], $sUrl, $data);
     }
     $data = str_replace('&amp;&amp;', '&amp;', $data);
     if (preg_match('@WMS_Capabilities@i', $data)) {
         // Update namespace
         $schemaLocation = "http://www.opengis.net/wms";
         $schemaLocation .= " http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd";
         $schemaLocation .= " http://www.opengis.net/sld";
         $schemaLocation .= " http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd";
         $schemaLocation .= " http://www.qgis.org/wms";
         $schemaLocation .= " " . $sUrl . "SERVICE=WMS&amp;REQUEST=GetSchemaExtension";
         $data = preg_replace('@xsi:schemaLocation=".*?"@si', 'xsi:schemaLocation="' . $schemaLocation . '"', $data);
         if (!preg_match('@xmlns:qgs@i', $data)) {
             $data = preg_replace('@xmlns="http://www.opengis.net/wms"@', 'xmlns="http://www.opengis.net/wms" xmlns:qgs="http://www.qgis.org/wms"', $data);
             $data = preg_replace('@GetStyles@', 'qgs:GetStyles', $data);
         }
         if (!preg_match('@xmlns:sld@i', $data)) {
             $data = preg_replace('@xmlns="http://www.opengis.net/wms"@', 'xmlns="http://www.opengis.net/wms" xmlns:sld="http://www.opengis.net/sld"', $data);
             $data = preg_replace('@GetLegendGraphic@', 'sld:GetLegendGraphic', $data);
         }
     }
     // Add response to cache
     $cacheId = $this->repository->getKey() . '_' . $this->project->getKey() . '_' . $this->param('service');
     $newhash = md5_file(realpath($this->repository->getPath()) . '/' . $this->project->getKey() . ".qgs");
     jCache::set($cacheId . '_hash', $newhash);
     jCache::set($cacheId . '_mime', $result->mime);
     jCache::set($cacheId . '_data', $data);
     return (object) array('code' => 200, 'mime' => $result->mime, 'data' => $data, 'cached' => False);
 }