Пример #1
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', ''));
 }
Пример #2
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;
 }
Пример #3
0
 /**
  * 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'));
         }
     }
 }
Пример #4
0
 public function testCall()
 {
     jClasses::inc('jelix_tests~testCache');
     $myClass = new testCache();
     $returnData = jCache::call(array('testCache', 'staticMethod'), array(1, 2), 0, $this->profile);
     $this->assertTrue($returnData == 3);
     $dataCached = jCache::get(md5(serialize(array('testCache', 'staticMethod')) . serialize(array(1, 2))), $this->profile);
     $this->assertTrue($dataCached == $returnData);
     try {
         jCache::call(array('testCache', 'missingStaticMethod'), null, 0, $this->profile);
         $this->fail();
     } catch (jException $e) {
         $this->pass();
     }
     $returnData = jCache::call(array($myClass, 'method'), array(1, 2), 0, $this->profile);
     $this->assertTrue($returnData == 3);
     $dataCached = jCache::get(md5(serialize(array($myClass, 'method')) . serialize(array(1, 2))), $this->profile);
     $this->assertTrue($dataCached == $returnData);
     try {
         jCache::call(array($myClass, 'missingMethod'), null, 0, $this->profile);
         $this->fail();
     } catch (jException $e) {
         $this->pass();
     }
     $returnData = jCache::call('testFunction', array(1, 2), 0, $this->profile);
     $this->assertTrue($returnData == 3);
     $dataCached = jCache::get(md5(serialize('testFunction') . serialize(array(1, 2))), $this->profile);
     $this->assertTrue($dataCached == $returnData);
     try {
         jCache::call('testFunction_missing', null, 0, $this->profile);
         $this->fail();
     } catch (jException $e) {
         $this->pass();
     }
 }
Пример #5
0
 /**
  * Send an email to the members that have subsribe to this post
  * @param integer $id of the subscribed post
  * @return void
  */
 public static function sendMail($id)
 {
     if (!jAuth::isConnected()) {
         return;
     }
     $dao = jDao::get(self::$daoSub);
     $memberDao = jDao::get('havefnubb~member');
     //get all the members that subscribe to this thread except "ME" !!!
     $records = $dao->findSubscribedPost($id, jAuth::getUserSession()->id);
     $gJConfig = jApp::config();
     // then send them a mail
     foreach ($records as $record) {
         //get all the member that subscribe to the thread id $id (called by hfnupost -> savereply )
         $thread = jClasses::getService('havefnubb~hfnuposts')->getThread($id);
         $post = jClasses::getService('havefnubb~hfnuposts')->getPost($thread->id_last_msg);
         //get the email of the member that subscribes this thread
         $member = $memberDao->getById($record->id_user);
         $subject = jLocale::get('havefnubb~post.new.comment.received') . " : " . $post->subject;
         $mail = new jMailer();
         $mail->From = $gJConfig->mailer['webmasterEmail'];
         $mail->FromName = $gJConfig->mailer['webmasterName'];
         $mail->Sender = $gJConfig->mailer['webmasterEmail'];
         $mail->Subject = $subject;
         $tpl = new jTpl();
         $tpl->assign('server', $_SERVER['SERVER_NAME']);
         $tpl->assign('post', $post);
         $tpl->assign('login', $member->login);
         $mail->Body = $tpl->fetch('havefnubb~new_comment_received', 'text');
         $mail->AddAddress($member->email);
         $mail->Send();
     }
 }
Пример #6
0
 /**
  * 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', ''));
 }
 protected function _prepareTpl()
 {
     jClasses::inc('masterAdminMenuItem');
     $items = jEvent::notify('masteradminGetInfoBoxContent')->getResponse();
     usort($items, "masterAdminItemSort");
     $this->_tpl->assign('infoboxitems', $items);
     $this->_tpl->assign('user', jAuth::getUserSession());
 }
Пример #8
0
 public function unread()
 {
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $tpl->assign('posts', jClasses::getService('havefnubb~hfnuposts')->findUnreadThreadByMod());
     $rep->body->assign('MAIN', $tpl->fetch('posts.list'));
     return $rep;
 }
Пример #9
0
 protected function _createInstance()
 {
     if ($this->toSelector === null) {
         $this->instance = null;
         $this->toSelector = $this->_getClassSelector();
     }
     return jClasses::create($this->toSelector->toString());
 }
Пример #10
0
 /**
  * function to manage data before assigning to the template of its zone
  */
 protected function _prepareTpl()
 {
     list($nbAnonymous, $members, $bots) = jClasses::create('activeusers~connectedusers')->getConnectedList();
     $this->_tpl->assign('nbAnonymous', $nbAnonymous);
     $this->_tpl->assign('members', $members);
     $this->_tpl->assign('nbMembers', count($members));
     $this->_tpl->assign('bots', $bots);
 }
Пример #11
0
 public function verifyPassword($login, $password)
 {
     if (trim($password) == '') {
         return false;
     }
     $classuser = jClasses::create($this->_params['class']);
     $user = $classuser->getByLoginPassword($login, $this->cryptPassword($password));
     return $user ? $user : false;
 }
Пример #12
0
 /**
  * function to manage data before assigning to the template of its zone
  */
 protected function _prepareTpl()
 {
     $today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
     list($nbAnonymous, $members, $bots) = jClasses::create('activeusers~connectedusers')->getConnectedList($today, true);
     $this->_tpl->assign('nbAnonymous', $nbAnonymous);
     $this->_tpl->assign('members', $members);
     $this->_tpl->assign('nbMembers', count($members));
     $this->_tpl->assign('bots', $bots);
 }
Пример #13
0
 /**
  * Get the binded instance
  *
  * @return mixed
  */
 public function getInstance()
 {
     if ($this->instance === null) {
         if ($this->toSelector === null) {
             $this->toSelector = $this->_getClassSelector();
         }
         $this->instance = jClasses::create($this->toSelector->toString());
     }
     return $this->instance;
 }
Пример #14
0
 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'));
 }
 /**
  * function to manage data before assigning to the template of its zone
  */
 protected function _prepareTpl()
 {
     $subs = array();
     // get the threads the user subscribed
     $threads = jDao::get('havefnubb~sub')->findSubscribedPostByUser(jAuth::getUserSession()->id);
     foreach ($threads as $t) {
         // get the thread details
         $thread = jClasses::getService('havefnubb~hfnuposts')->getThread($t->id_post);
         $subs[] = array('id_post' => $thread->id_last_msg, 'ptitle' => jClasses::getService('havefnubb~hfnuposts')->getPost($thread->id_last_msg)->subject, 'thread_id' => $thread->id_thread, 'id_forum' => $thread->id_forum_thread, 'ftitle' => jClasses::getService('havefnubb~hfnuforum')->getForum($thread->id_forum_thread)->forum_name);
     }
     $this->_tpl->assign('subs', $subs);
 }
Пример #16
0
 /**
  * function to manage data before assigning to the template of its zone
  */
 protected function _prepareTpl()
 {
     $srvinfos = jClasses::getService("servinfo~serverinfos");
     list($records, $size) = $srvinfos->dbSize();
     $this->_tpl->assign('LOADS_AVG', $srvinfos->loadsAvg());
     $this->_tpl->assign('CACHE_ENGINE', $srvinfos->cacheEngine());
     $this->_tpl->assign('PHP_VERSION', phpversion());
     $this->_tpl->assign('PHP_OS', PHP_OS);
     $this->_tpl->assign('DB_VERSION', $srvinfos->dbVersion());
     $this->_tpl->assign('DB_SIZE', $size);
     $this->_tpl->assign('DB_RECORDS', $records);
     $this->_tpl->assign('otherInfos', jEvent::notify('servinfoGetInfo')->getResponse());
 }
Пример #17
0
 /**
  * Index that will display all the available theme to be used
  */
 function index()
 {
     $tpl = new jTpl();
     $themes = jClasses::getService('themes');
     $lists = $themes->lists();
     $tpl->assign('themes', $lists);
     $tpl->assign('lang', jApp::config()->locale);
     $tpl->assign('current_theme', strtolower(jApp::config()->theme));
     $rep = $this->getResponse('html');
     $rep->body->assign('MAIN', $tpl->fetch('theme'));
     $rep->body->assign('selectedMenuItem', 'theme');
     return $rep;
 }
Пример #18
0
 function onHfnuSearchEngineRun($event)
 {
     $HfnuSearchConfig = parse_ini_file(jApp::configPath() . 'havefnu.search.ini.php', true);
     $cleaner = jClasses::getService('hfnusearch~cleaner');
     $words = $cleaner->stemPhrase($event->getParam('string'));
     $nb_words = count($words);
     // no words ; go back with nothing :P
     if (!$words) {
         return array('count' => 0, 'result' => array());
     }
     $service = jClasses::getService($HfnuSearchConfig['classToPerformSearchEngine']);
     $result = $service->searchEngineRun($event);
 }
Пример #19
0
 function save()
 {
     $f = jForms::fill('base~formauth');
     if (!$f->check) {
         $vue = $this->getResponse('redirect');
         $vue->action = 'base~identity:index';
         return $vue;
     }
     $vue = $this->common();
     $c = jClasses::getService('UserManager');
     $c->save($f);
     return $vue;
 }
Пример #20
0
 /**
  * function to manage data before assigning to the template of its zone
  */
 protected function _prepareTpl()
 {
     $login = $this->param('login');
     $status = 'offline';
     if ($login) {
         if (jClasses::create('connectedusers')->isConnected($login)) {
             $status = 'online';
         } else {
             $status = 'offline';
         }
     }
     $this->_tpl->assign('status', $status);
 }
Пример #21
0
/**
 * function that display the status of one post or post in a given forum
 */
function jtpl_function_html_post_status($tpl, $source, $data, $lastMarkThreadAsRead = 0, $forum = null)
{
    $statusAvailable = array('pined', 'pinedclosed', 'opened', 'closed', 'censored', 'uncensored', 'hidden');
    if ($source == 'forum') {
        $id_forum = $data;
        // does the user still read everything in the forum ?
        if (!jClasses::getService('havefnubb~hfnuposts')->getCountUnreadThreadbyForumId($id_forum)) {
            //yes
            $status = 'forumicone';
        } else {
            $status = 'forumiconenew';
        }
    } elseif ($source == 'post') {
        $post = $data;
        $status = $statusAvailable[$post->status_thread - 1];
        if (jAuth::isConnected()) {
            //opened thread ?
            if ($post->status_thread == 3) {
                //do the member already read that post ?
                // yes so status is opened
                if ($post->date_last_post < $lastMarkThreadAsRead || $post->date_read_post >= $post->date_last_post) {
                    $status = 'opened';
                } else {
                    // no so post is new
                    $status = 'post-new';
                }
            }
        }
        // does this forum manage auto-expiration ?
        $dayInSecondes = 24 * 60 * 60;
        $dateDiff = $post->date_modified == 0 ? floor((time() - $post->date_created) / $dayInSecondes) : floor((time() - $post->date_modified) / $dayInSecondes);
        //if forum has expired ...
        if ($forum->post_expire > 0 and $dateDiff >= $forum->post_expire) {
            //close the thread
            $status = 'closed';
        }
        $gJConfig = jApp::config();
        $important = false;
        if ($post->status_thread != 5 and $post->status_thread != 7) {
            if ($post->nb_replies >= $gJConfig->havefnubb['important_nb_replies']) {
                $important = true;
            }
            if ($post->nb_viewed >= $gJConfig->havefnubb['important_nb_views']) {
                $important = true;
            }
        }
        $status = $important === true ? $status . '_important' : $status;
    }
    echo $status;
}
Пример #22
0
 /**
  * Reindexing the search engine
  */
 function reindexing()
 {
     $confirm = $this->param('confirm');
     if ($confirm == 'Y') {
         $idx = jClasses::getService('hfnusearch~search_index');
         $nbWords = $idx->searchEngineReindexing();
         jMessage::add(jLocale::get('hfnusearch~search.admin.reindexing.done', $nbWords));
     } else {
         jMessage::add(jLocale::get('hfnusearch~search.admin.reindexing.canceled'));
     }
     $rep = $this->getResponse('redirect');
     $rep->action = 'hfnusearch~admin:index';
     return $rep;
 }
Пример #23
0
 /**
  * function to manage data before assigning to the template of its zone
  */
 protected function _prepareTpl()
 {
     $tag = $this->param('tag');
     $srvTags = jClasses::getService("jtags~tags");
     $tags = $srvTags->getSubjectsByTags($tag, "forumscope");
     $posts = array();
     // We check the rights access to the posts in the template
     foreach ($tags as $tag) {
         if (jClasses::getService('havefnubb~hfnuposts')->getPost($tag) !== false) {
             $posts[] = jClasses::getService('havefnubb~hfnuposts')->getPost($tag);
         }
     }
     $this->_tpl->assign('posts', $posts);
 }
 /**
  * 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()));
             }
         }
     }
 }
Пример #25
0
 /**
  *Put a rate (in ajax)
  */
 function rate_ajax_it()
 {
     //info about the "source" from where the datas come from
     $id_source = $this->intParam('id_source');
     $source = $this->param('source');
     //check if the cancel button was selected
     if ($id_source == 0 or $source == '') {
         return $this->getResponse('htmlfragment');
     }
     $rate = $this->floatParam('star1');
     jClasses::getService('hfnurates~rates')->saveRatesBySource($id_source, $source, $rate);
     $result = jClasses::getService('hfnurates~rates')->getTotalRatesBySource($id_source, $source);
     $rep = $this->getResponse('htmlfragment');
     $rep->addContent(jLocale::get('hfnurates~main.total.of.rates') . ':' . $result->total_rates . ' ' . jLocale::get('hfnurates~main.rate') . ':' . $result->avg_level);
     return $rep;
 }
Пример #26
0
 /**
  * @param  array  $params   plugin parameters for the current action
  * @return null or jSelectorAct  if action should change
  */
 public function beforeAction($params)
 {
     $selector = null;
     $floodok = true;
     if (isset($params['check.flood']) && $params['check.flood'] && $this->config['time_interval']) {
         jClasses::inc('havefnubb~flood');
         $hasflood = flood::check($this->config['time_interval'], $this->config['only_same_ip']);
         if ($hasflood) {
             if ($this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
                 throw new jException("havefnubb~flood.elapsed_time_between_two_post");
             } else {
                 $selector = new jSelectorAct($this->config['on_error_action']);
             }
         }
     }
     return $selector;
 }
Пример #27
0
 /**
  * Use DynamicLayers python plugin to get a child project
  * And redirect to Lizmap view map controller with changed project parameter
  */
 function index()
 {
     // Set up redirect response
     $rep = $this->getResponse('redirect');
     $rep->action = 'view~map:index';
     $params = jApp::coord()->request->params;
     $rep->params = $params;
     // Redirect to normal map if no suitable parameters
     if (!$params['dlsourcelayer'] or !$params['dlexpression']) {
         jLog::log('Dynamic layers - no parameters DLSOURCELAYER or DLEXPRESSION');
         return $rep;
     }
     // Get project path
     $project = $params['project'];
     $repository = $params['repository'];
     $lrep = lizmap::getRepository($repository);
     $projectTemplatePath = realpath($lrep->getPath()) . '/' . $project . ".qgs";
     // Use QGIS python plugins dynamicLayers to get child project
     $lizmapServices = lizmap::getServices();
     $url = $lizmapServices->wmsServerURL . '?';
     $qparams = array();
     $qparams['service'] = 'dynamicLayers';
     $qparams['map'] = $projectTemplatePath;
     $qparams['dlsourcelayer'] = $params['dlsourcelayer'];
     $qparams['dlexpression'] = $params['dlexpression'];
     $rparams = http_build_query($qparams);
     $querystring = $url . $rparams;
     // Get remote data
     $lizmapCache = jClasses::getService('lizmap~lizmapCache');
     $getRemoteData = $lizmapCache->getRemoteData($querystring, $this->services->proxyMethod, $this->services->debugMode);
     $data = $getRemoteData[0];
     $mime = $getRemoteData[1];
     // Get returned response and redirect to appropriate project page
     $json = json_decode($data);
     if ($json->status == 0) {
         jLog::log('DynamicLayers error : ' . $json->message);
     } else {
         $params['project'] = preg_replace('#\\.qgs$#', '', $json->childProject);
         unset($params['dlsourcelayer']);
         unset($params['dlexpression']);
         $rep->params = $params;
         jLog::log('DynamicLayers message : ' . $json->message . ' - ' . $json->childProject);
     }
     return $rep;
 }
Пример #28
0
 protected function _prepareTpl()
 {
     jClasses::inc('masterAdminMenuItem');
     $menu = array();
     $menu['toplinks'] = new masterAdminMenuItem('toplinks', '', '');
     if (!isset(jApp::config()->master_admin['disable_dashboard_menu']) || !jApp::config()->master_admin['disable_dashboard_menu']) {
         $dashboard = new masterAdminMenuItem('dashboard', jLocale::get('gui.menu.item.dashboard'), jUrl::get('default:index'));
         $dashboard->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/dashboard.png';
         $menu['toplinks']->childItems[] = $dashboard;
     }
     $menu['refdata'] = new masterAdminMenuItem('refdata', jLocale::get('gui.menu.item.refdata'), '', 80);
     $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, '', '');
             }
             $isRedefining = false;
             foreach ($menu[$item->parentId]->childItems as $child) {
                 if ($child->id == $item->id) {
                     $child->copyFrom($item);
                     $isRedefining = true;
                     break;
                 }
             }
             if (!$isRedefining) {
                 $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', ''));
 }
Пример #29
0
 /**
  * @param  array  $params   plugin parameters for the current action
  * @return null or jSelectorAct  if action should change
  */
 public function beforeAction($params)
 {
     $selector = null;
     $banok = false;
     if (isset($params['banuser.check'])) {
         jClasses::inc('havefnubb~bans');
         $banok = bans::check();
     }
     if ($banok) {
         // disconnect the user if he was connected
         jAuth::logout();
         if ($this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
             throw new jException(jLocale::get("havefnubb~ban.you.are.banned"));
         } else {
             $selector = new jSelectorAct($this->config['on_error_action']);
         }
     }
     return $selector;
 }
 /**
  *
  */
 function view()
 {
     $lang = jLocale::getCurrentLang();
     $name = $this->param('name');
     jLog::log("lang: {$lang} / name: {$name}");
     $rep = $this->getResponse('html');
     jLog::log("Name of fame: " . $this->param('name'));
     $articles = jClasses::getService('amigatlk~articles');
     jLog::log(" " . get_class($articles));
     $article = $articles->getArticle($this->param('name'));
     if (empty($article)) {
         $rep->body->assignZone('MAIN', 'amigatlk~notFound404');
         $rep->setHttpStatus('404', 'Not Found');
         return $rep;
     }
     $rep->title = $article->title;
     $rep->body->assignZone('MAIN', 'amigatlk~viewArticle', array('article' => $article));
     return $rep;
 }