Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 function index()
 {
     $id = $this->param('j_user_login');
     if ($id === null) {
         $rep = $this->getResponse('redirect');
         $rep->action = 'master_admin~default:index';
         return $rep;
     }
     if ($this->personalView && $id != jAuth::getUserSession()->login) {
         jMessage::add(jLocale::get('jelix~errors.acl.action.right.needed'), 'error');
         $rep = $this->getResponse('redirect');
         $rep->action = 'master_admin~default:index';
         return $rep;
     }
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $tpl->assign('id', $id);
     $tpl->assign('randomPwd', jAuth::getRandomPassword());
     $tpl->assign('personalview', $this->personalView);
     if ($this->personalView) {
         $tpl->assign('viewaction', 'user:index');
     } else {
         $tpl->assign('viewaction', 'default:view');
     }
     $rep->body->assign('MAIN', $tpl->fetch('password_change'));
     return $rep;
 }
Exemplo n.º 3
0
 /**
  * action to display the page
  * @param jTpl $tpl the template container
  */
 function show($tpl)
 {
     if (!isset($_SESSION['dbprofiles'])) {
         $this->loadProfiles();
     }
     $sections = $_SESSION['dbprofiles']['profiles'];
     $data = $_SESSION['dbprofiles']['data'];
     $ignoreProfiles = isset($this->config['ignoreProfiles']) ? $this->config['ignoreProfiles'] : '';
     $ignoreProfiles = preg_split("/ *, */", $ignoreProfiles);
     if (count($ignoreProfiles)) {
         $newsections = array();
         foreach ($sections as $profile) {
             if (!in_array(substr($profile, 4), $ignoreProfiles)) {
                 $newsections[] = $profile;
             }
         }
         $tpl->assign('profiles', $newsections);
         $_SESSION['dbprofiles']['profiles'] = $newsections;
     } else {
         $tpl->assign('profiles', $sections);
     }
     $tpl->assign($data);
     //$preferPDO = isset($this->config['preferpdo'])?$this->config['preferpdo']:false;
     $tpl->assign('drivers', $this->getDriversList());
     return true;
 }
Exemplo n.º 4
0
 function extensionsConfig()
 {
     $rep = $this->getResponse('js');
     $config = array();
     $dir = "modules/";
     //
     $iter = new DirectoryIterator($dir);
     foreach ($iter as $file) {
         if (!$file->isDot()) {
             if ($file->isDir() && file_exists($dir . $file->getFilename() . '/urls.json')) {
                 $doc = jFile::read($dir . $file->getFilename() . '/urls.json');
                 $urls = json_decode($doc);
                 foreach ($urls->config as $row) {
                     $config['config'][] = $row;
                 }
                 foreach ($urls->modules as $row) {
                     $config['modules'][] = $row;
                 }
             }
         }
     }
     $tpl = new jTpl();
     $tpl->assign('config', $config);
     $tpl->assign('rootUrl', jApp::config()->urlengine['basePath']);
     $content = $tpl->fetch('bos~init');
     $rep->data = $content;
     return $rep;
 }
Exemplo n.º 5
0
 function index()
 {
     $form = jForms::create('hfnuadmin~bans');
     $dao = jDao::get('havefnubb~bans');
     $bans = $dao->findAll();
     $tpl = new jTpl();
     $tpl->assign('form', $form);
     $tpl->assign('bans', $bans);
     $rep = $this->getResponse('html');
     $rep->body->assign('MAIN', $tpl->fetch('hfnuadmin~bans_edit'));
     $rep->body->assign('selectedMenuItem', 'ban');
     return $rep;
 }
Exemplo n.º 6
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;
 }
Exemplo n.º 7
0
 /**
  *
  */
 function index()
 {
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     if (jAuth::isConnected()) {
         $tpl->assign('user', jAuth::getUserSession());
     }
     $config = new \Jelix\JCommunity\Config();
     $tpl->assign('canRegister', $config->isRegistrationEnabled());
     $tpl->assign('canResetPassword', $config->isResetPasswordEnabled());
     $rep->body->assign('MAIN', $tpl->fetch('startpage'));
     return $rep;
 }
Exemplo n.º 8
0
    function testSimpleFetch()
    {
        $tpl = new jTpl();
        $tpl->assign(array('toto' => 'firefox', 'titi' => 'chrome'));
        $tpl->assign('foo', 'hello');
        $tpl->assign('list', array('aaa', 'bbb', 'ccc'));
        $content = $tpl->fetch('jelix_tests~test_tpl_fetch');
        $expected = 'firefoxchrome
foo=hello
value=aaa
value=bbb
value=ccc
end';
        $this->assertEqualOrDiff($expected, $content);
    }
Exemplo n.º 9
0
 /**
  * action to display the page
  * @param jTpl $tpl the template container
  */
 function show($tpl)
 {
     if (!isset($_SESSION['hfnconf'])) {
         $_SESSION['hfnconf'] = $this->loadconf();
     }
     $themes = array();
     $dir = new DirectoryIterator(jApp::varPath() . 'themes/');
     foreach ($dir as $dirContent) {
         if ($dirContent->isDir() && !$dirContent->isDot()) {
             $themes[] = $dirContent->getFilename();
         }
     }
     $tpl->assign('themes', $themes);
     $tpl->assign($_SESSION['hfnconf']);
     return true;
 }
Exemplo n.º 10
0
 function config()
 {
     $resp = $this->getResponse('html');
     $form = jForms::get('hfnuadmin~config');
     if (!$form) {
         $form = jForms::create('hfnuadmin~config');
         $this->initform($form);
     }
     $tpl = new jTpl();
     $tpl->assign('form', $form);
     $forumUrl = '<a href="' . jUrl::get('hfnuadmin~forum:index') . '" >' . jLocale::get('config.anonymous_post_authorized.rights.management.by.forum') . '</a>';
     $tpl->assign('forumUrl', $forumUrl);
     $resp->body->assign('MAIN', $tpl->fetch('config'));
     $resp->body->assign('selectedMenuItem', 'config');
     return $resp;
 }
Exemplo n.º 11
0
 /**
  * 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;
 }
Exemplo n.º 12
0
 /**
  *
  */
 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;
 }
Exemplo n.º 13
0
 /**
  * action to display the page
  * @param jTpl $tpl the template container
  */
 function show($tpl)
 {
     if (!isset($_SESSION['installdemo'])) {
         $_SESSION['installdemo'] = false;
     }
     $tpl->assign('installdemo', $_SESSION['installdemo']);
     return true;
 }
Exemplo n.º 14
0
 /**
  * action to display the page
  * @param jTpl $tpl the template container
  */
 function show($tpl)
 {
     if (isset($this->config['level'])) {
         $level = $this->config['level'];
         if (!in_array($level, array('error', 'notice', 'warning'))) {
             $level = 'warning';
         }
     } else {
         $level = 'warning';
     }
     $reporter = new wizInstallReporter($level, $this);
     $installer = new jInstaller($reporter);
     $ok = $installer->installApplication();
     $tpl->assign('messages', $reporter->messages);
     $tpl->assign('installok', $ok);
     return $ok;
 }
Exemplo n.º 15
0
 function index()
 {
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $form = jForms::create('search');
     $tpl->assign('formulaire', $form);
     $vidsServ = new OnDiskVideosService();
     $tpl->assign('video', $vidsServ->randomVideo());
     $picasaSrv = new jPicasa();
     $paintings = array();
     foreach ($picasaSrv->lastImages() as $img) {
         $paintings[$img->name] = new Painting($img);
     }
     $tpl->assign('images', $paintings);
     $rep->body->assign('MAIN', $tpl->fetch('photogallery_index'));
     return $rep;
 }
Exemplo n.º 16
0
 function index()
 {
     $tpl = new jTpl();
     $form = jForms::create('hfnuadmin~ranks');
     $dao = jDao::get('havefnubb~ranks');
     $ranks = $dao->findAll();
     //initializing of the Token
     $token = jClasses::getService("havefnubb~hfnutoken");
     $token->setHfnuToken();
     $tpl->assign('hfnutoken', $token->getHfnuToken());
     $tpl->assign('form', $form);
     $tpl->assign('ranks', $ranks);
     $rep = $this->getResponse('html');
     $rep->body->assign('MAIN', $tpl->fetch('hfnuadmin~ranks_index'));
     $rep->body->assign('selectedMenuItem', 'ranks');
     return $rep;
 }
Exemplo n.º 17
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;
 }
Exemplo n.º 18
0
 /**
  * action to display the page
  * @param jTpl $tpl the template container
  */
 function show($tpl)
 {
     if (!isset($_SESSION['confmail'])) {
         $_SESSION['confmail'] = $this->loadconf();
     }
     $tpl->assign($_SESSION['confmail']);
     return true;
 }
Exemplo n.º 19
0
 /**
  * action to display the page
  * @param jTpl $tpl the template container
  * @return true
  */
 function show($tpl)
 {
     include dirname(__FILE__) . '/../../../version.php';
     if (!isset($_SESSION['adminaccount'])) {
         $_SESSION['adminaccount'] = array('login' => '', 'password' => '', 'password_confirm' => '', 'email' => '', 'alreadyInstalled' => $alreadyInstalled, 'errors' => array());
     }
     $tpl->assign($_SESSION['adminaccount']);
     return true;
 }
Exemplo n.º 20
0
 /**
  * View a given Category of forum then the list of forums
  */
 function view()
 {
     $ctitle = $this->param('ctitle');
     $id_cat = (int) $this->param('id_cat');
     if ($id_cat == 0) {
         $rep = $this->getResponse('redirect');
         $rep->action = 'havefnubb~default:index';
         return $rep;
     }
     // add the category name in the page title
     // so
     // 1) get the category record
     $category = jClasses::getService('havefnubb~hfnucat')->getCat($id_cat);
     // check that the title of the category exist
     // if not => error404
     if (jUrl::escape($ctitle, true) != jUrl::escape($category->cat_name, true)) {
         $rep = $this->getResponse('redirect');
         $rep->action = jApp::config()->urlengine['notfoundAct'];
         return $rep;
     }
     $rep = $this->getResponse('html');
     // 2) assign the title page
     $rep->title = $category->cat_name;
     $historyPlugin = jApp::coord()->getPlugin('history');
     $histname = ucfirst(htmlentities($category->cat_name, ENT_COMPAT, 'UTF-8'));
     $historyPlugin->change('label', $histname);
     $historyPlugin->change('title', $histname);
     $categories = jDao::get('havefnubb~forum')->findParentByCatId($id_cat);
     foreach ($categories as $cat) {
         if (jAcl2::check('hfnu.forum.list', 'forum' . $cat->id_forum)) {
             // get the list of forum to build the RSS link
             $url = jUrl::get('havefnubb~posts:rss', array('ftitle' => $cat->forum_name, 'id_forum' => $cat->id_forum));
             $rep->addHeadContent('<link rel="alternate" type="application/rss+xml" title="' . $cat->forum_name . '" href="' . htmlentities($url) . '" />');
         }
     }
     $tpl = new jTpl();
     $tpl->assign('action', 'view');
     $tpl->assign('cat_name', $category->cat_name);
     $tpl->assign('categories', $categories);
     $tpl->assign('currentIdForum', 0);
     $rep->body->assign('MAIN', $tpl->fetch('index'));
     return $rep;
 }
Exemplo n.º 21
0
 /**
  * The user want to change his password
  */
 function changepwd()
 {
     $login = $this->param('user');
     if ($login == '' || !jAuth::isConnected() || jAuth::getUserSession()->login != $login) {
         $rep = $this->getResponse('redirect');
         $rep->action = 'jcommunity~account:show';
         $rep->params = array('user' => $user);
         return $rep;
     }
     $form = jForms::create('havefnubb~pwd', $login);
     $form->initFromDao('havefnubb~pwd');
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $tpl->assign('login', $login);
     $tpl->assign('form', $form);
     $rep->body->assign('selectedMenuItem', 'members');
     $rep->body->assign('MAIN', $tpl->fetch('member_changepwd'));
     return $rep;
 }
 function onmapMiniDockable($event)
 {
     // creation du mini dock
     // id, titre, contenu html, index, [chemin vers css], [chemin vers js]
     $bp = jApp::config()->urlengine["basePath"];
     $tpl = new jTpl();
     $tpl->assign(array("depts" => $depts));
     $dock = new lizmapMapDockItem("localiz", "Se localiser", $tpl->fetch("localiz~map_localiz"), 10, $bp . "css/localiz.css", $bp . "js/localiz.js");
     $event->add($dock);
 }
Exemplo n.º 23
0
 /**
  * form to ask to reindex
  */
 function index()
 {
     $rep = $this->getResponse('html');
     $form = jForms::create('hfnusearch~indexing');
     $tpl = new jTpl();
     $tpl->assign('form', $form);
     $rep->body->assign('MAIN', $tpl->fetch('hfnusearch~admin.index'));
     $rep->body->assign('selectedMenuItem', 'searchengine');
     return $rep;
 }
Exemplo n.º 24
0
 function listenews()
 {
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $fact = jDao::get('medsite~news');
     $liste = $fact->findAll();
     $tpl->assign('liste', $liste);
     $rep->body->assign('MAIN', $tpl->fetch('listenews'));
     return $rep;
 }
Exemplo n.º 25
0
 /**
  * create the content of the zone
  * by default, it uses a template, and so prepare a jtpl object to use in _prepareTpl.
  * zone parameters are automatically assigned in the template
  * If you don't want a template, override it in your class
  * @return string generated content
  */
 protected function _createContent()
 {
     $this->_tpl = new jTpl();
     $this->_tpl->assign($this->_params);
     $this->_prepareTpl();
     if ($this->_tplname == '') {
         return '';
     }
     return $this->_tpl->fetch($this->_tplname, $this->_tplOuputType);
 }
Exemplo n.º 26
0
 /**
  * action to display the page
  * @param jTpl $tpl the template container
  */
 function show($tpl)
 {
     if (!isset($_SESSION['dbprofiles'])) {
         $this->loadProfiles();
     }
     $sections = $_SESSION['dbprofiles']['profiles'];
     $data = $_SESSION['dbprofiles']['data'];
     $ignoreProfiles = isset($this->config['ignoreProfiles']) ? $this->config['ignoreProfiles'] : '';
     $ignoreProfiles = preg_split("/ *, */", $ignoreProfiles);
     if (count($ignoreProfiles)) {
         $newsections = array();
         foreach ($sections as $profile) {
             if (!in_array(substr($profile, 4), $ignoreProfiles)) {
                 $newsections[] = $profile;
             }
         }
         $tpl->assign('profiles', $newsections);
         $_SESSION['dbprofiles']['profiles'] = $newsections;
     } else {
         $tpl->assign('profiles', $sections);
     }
     $tpl->assign($data);
     //$preferPDO = isset($this->config['preferpdo'])?$this->config['preferpdo']:false;
     $drivers = isset($this->config['availabledDrivers']) ? $this->config['availabledDrivers'] : 'mysql,sqlite,pgsql';
     $list = preg_split("/ *, */", $drivers);
     $drivers = array();
     foreach ($list as $drv) {
         if (extension_loaded($drv)) {
             $drivers[$drv] = $drv;
         }
     }
     if (class_exists('PDO')) {
         $pdodrivers = PDO::getAvailableDrivers();
         foreach ($pdodrivers as $drv) {
             if (in_array($drv, $list)) {
                 $drivers[$drv . '_pdo'] = $drv . ' (PDO)';
             }
         }
     }
     $tpl->assign('drivers', $drivers);
     return true;
 }
Exemplo n.º 27
0
 function index()
 {
     $tpl = new jTpl();
     $dao = jDao::get('havefnubb~notify');
     $notify = $dao->findAll();
     $tpl->assign('notify', $notify);
     $rep = $this->getResponse('html');
     $rep->body->assign('MAIN', $tpl->fetch('hfnuadmin~notify_index'));
     $rep->body->assign('selectedMenuItem', 'notify');
     return $rep;
 }
Exemplo n.º 28
0
 /**
  * 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;
 }
Exemplo n.º 29
0
 /**
  * Page info display to banned users
  */
 function index()
 {
     $title = stripslashes(jApp::config()->havefnubb['title']);
     $hist = jApp::coord()->getPlugin('history');
     $hist->change('label', ucfirst(htmlentities($title, ENT_COMPAT, 'UTF-8')));
     $hist->change('title', jLocale::get('havefnubb~main.goto_homepage'));
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $tpl->assign('message', jLocale::get('havefnubb~ban.you.are.banned'));
     $rep->body->assign('MAIN', $tpl->fetch('havefnubb~banuser'));
     return $rep;
 }
Exemplo n.º 30
0
 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');
     $tpl = new jTpl();
     $tpl->assign('id', $id);
     $tpl->assign('randomPwd', jAuth::getRandomPassword());
     $tpl->assign('personalview', $this->personalView);
     if ($this->personalView) {
         $tpl->assign('viewaction', 'user:index');
     } else {
         $tpl->assign('viewaction', 'default:view');
     }
     $rep->body->assign('MAIN', $tpl->fetch('password_change'));
     return $rep;
 }