/** * generate the xml content and send it to the browser * @return boolean true if ok */ public final function output() { $this->_httpHeaders['Content-Type'] = 'text/xml;charset=' . $this->_charset; if (is_string($this->content)) { // utilisation chaine de caractères xml $xml_string = $this->content; } else { if (!empty($this->contentTpl)) { // utilisation d'un template $xml_string = $this->content->fetch($this->contentTpl); } else { throw new jException('jelix~errors.repxml.no.content'); } } if ($this->checkValidity) { if (!simplexml_load_string($xml_string)) { // xml mal-formed throw new jException('jelix~errors.repxml.invalid.content'); } } $this->sendHttpHeaders(); if ($this->sendXMLHeader) { echo '<?xml version="1.0" encoding="' . $this->_charset . '"?>', "\n"; $this->outputXmlHeader(); } echo $xml_string; return true; }
/** * */ 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; }
/** * send the Html part * @return boolean true if it's ok */ public final function output() { global $gJConfig; $this->doAfterActions(); $content = implode("\n", $this->_contentTop); if ($this->tplname != '') { $content .= $this->tpl->fetch($this->tplname, 'html'); } $content .= implode("\n", $this->_contentBottom); $this->_httpHeaders['Content-Type'] = 'text/plain;charset=' . $gJConfig->charset; $this->_httpHeaders['Content-length'] = strlen($content); $this->sendHttpHeaders(); echo $content; return true; }
/** * */ function index() { $rep = $this->getResponse('html'); $tpl = new jTpl(); $rep->body->assign('MAIN', $tpl->fetch('startpage')); return $rep; }
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; }
function login() { $rep = $this->getResponse('html'); $tpl = new jTpl(); $rep->body->assign('MAIN', $tpl->fetch('login')); return $rep; }
/** * call to phpinfo */ public function phpinfo() { $rep = $this->getResponse('html'); $tpl = new jTpl(); $rep->body->assign('MAIN', $tpl->fetch('servinfo~phpinfo')); 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; }
function confirm() { $tpl = new jTpl(); $rep = $this->getResponse('html'); $rep->body->assign('MAIN', $tpl->fetch('confirm')); return $rep; }
/** * 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; }
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; }
protected function notavailable() { $rep = $this->_getjCommunityResponse(); $rep->setHttpStatus(404, "Not found"); $tpl = new \jTpl(); $rep->body->assign('MAIN', $tpl->fetch('not_available')); return $rep; }
/** * 403 error page */ public function badright() { $rep = $this->getResponse('html'); $tpl = new jTpl(); $rep->body->assign('MAIN', $tpl->fetch('havefnubb~403.html')); $rep->setHttpStatus('403', 'Forbidden'); return $rep; }
function index() { $tpl = new jTpl(); $rep = $this->getResponse('html'); $rep->body->assign('MAIN', $tpl->fetch('cache_index')); $rep->body->assign('selectedMenuItem', 'cache'); return $rep; }
function createform() { $rep = $this->getResponse('html'); //$sujet=$this->param('sujet'); //$text=$this->param('texte'); $tpl = new jTpl(); $rep->body->assign('MAIN', $tpl->fetch('newsform')); return $rep; }
/** * 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; }
/** * 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); }
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); }
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; }
/** * 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; }
/** * 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; }
protected function serviceException() { $messages = jMessage::getAll(); $mime = 'text/plain'; $data = implode('\\n', $messages); if ($this->tplExceptions !== null) { $mime = 'text/xml'; $tpl = new jTpl(); $tpl->assign('messages', $messages); $data = $tpl->fetch($this->tplExceptions); } return (object) array('code' => 200, 'mime' => $mime, 'data' => $data, 'cached' => False); }
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; }
/** * 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; }
/** * */ 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; }
/** * */ function index() { $rep = $this->getResponse('html'); $form = jForms::get('config'); if (!$form) { $form = jForms::create('config'); $activeusers = jClasses::create('activeusers~connectedusers'); $form->setData('timeout_visit', $activeusers->getVisitTimeout()); } $tpl = new jTpl(); $tpl->assign('form', $form); $rep->body->assign('MAIN', $tpl->fetch('config')); return $rep; }
function ok() { $form = jForms::get('sample'); $rep = $this->getResponse('html'); $rep->title = 'Form editing'; if ($form) { $tpl = new jTpl(); $tpl->assign('form', $form); $rep->body->assign('MAIN', $tpl->fetch('sampleformresult')); } else { $rep->body->assign('MAIN', '<p>The form doesn\'t exist.</p>'); } $rep->body->assign('page_title', 'formulaires'); return $rep; }
function onhfbAccountShowDiv($event) { $tpl = new jTpl(); $login = $event->getParam('user'); $members = jDao::get('jcommunity~user'); $user = $members->getByLogin($login); $fields = jDao::get('havefnubb~member_custom_fields'); $records = $fields->getByUserAndFamilyType($user->id, 'im:%'); $im = array('xfire' => '', 'icq' => '', 'yim' => '', 'hotmail' => '', 'aol' => '', 'gtalk' => '', 'jabber' => ''); foreach ($records as $val) { $im[substr($val->type, 3)] = $val->data; } $tpl->assign($im); $event->add($tpl->fetch('hfnuim~account_show')); }
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); }
public function fetchContent() { $content = $this->content; if (is_string($content)) { return $content; } elseif (is_array($content)) { $tpl = new jTpl(); $tplName = $content[0]; if (count($content) > 1) { $tpl->assign($content[1]); } return $tpl->fetch($tplName); } return ''; }