{
global $page;
- new_skinned_page('index.tpl', AUTH_PUBLIC);
+ new_skinned_page('index.tpl');
if (empty($this->path)) {
$this->path = 'index';
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once("xorg.inc.php");
+require_once 'xorg.inc.php';
// this page is to create a smarty template page from a wiki file
// the wiki engine used is pmwiki.
// some page can be seen by everybody (public), but to validate a password
// if we arrive here before setting new access we need to try an auth
-new_skinned_page('wiki.tpl', Env::has('response') ? AUTH_MDP : AUTH_PUBLIC);
+new_skinned_page('wiki.tpl');
if ($globals->wiki->wikidir) {
$wikisite = 'xorg';
$this->compile_check = !empty($globals->debug);
- if ($type == SKINNED) {
- $this->register_modifier('escape_html', 'escape_html');
- $this->default_modifiers[] = '@escape_html';
- }
-
$this->_page_type = $type;
$this->_tpl = $tpl;
$this->_errors = array();
{
$this->_tpl = $tpl;
$this->_page_type = $type;
- if ($type == SKINNED) {
- $this->register_modifier('escape_html', 'escape_html');
- $this->default_modifiers = Array('@escape_html');
- }
-
$this->_page_type = $type;
$this->assign('xorg_tpl', $tpl);
}
if ($this->_page_type == NO_SKIN) {
$this->display($this->_tpl);
exit;
+ } else {
+ $this->register_modifier('escape_html', 'escape_html');
+ $this->default_modifiers = Array('@escape_html');
}
if (!$globals->debug) {
function init_rss($template, $alias, $hash)
{
global $page;
- new_nonhtml_page($template, AUTH_PUBLIC);
+ $page->changeTpl($template, NO_SKIN);
$page->register_modifier('rss_date', '_rss_encode_date');
$page->default_modifiers = Array('@to_rss');
function wiki_work_dir() {
global $globals;
- return realpath($globals->spoolroot.'htdocs/'.$globals->wiki->workdir);
+ return dirname(__FILE__).'/../htdocs/'.$globals->wiki->workdir;
}
function wiki_template($n) {
}
// }}}
-
-function new_identification_page()
-{
- global $page;
-
- new_page('');
- $page->doAuth(true);
- $page->useMenu();
-}
-
// {{{ function new_group_page()
function new_group_page($tpl_name)
XorgGlobals::setlocale();
XorgSession::init();
-// {{{ function _new_page()
+require_once('platal/page.inc.php');
-function _new_page($type, $tpl_name, $min_auth, $admin=false)
+// {{{ class XorgPage
+
+class XorgPage extends PlatalPage
{
- global $page, $globals;
- require_once("xorg/page.inc.php");
- if ($min_auth == AUTH_PUBLIC && Env::get('force_login') == '1')
- $min_auth = AUTH_COOKIE;
- if (!empty($admin)) {
- $page = new XorgAdmin($tpl_name, $type);
- } else switch($min_auth) {
- case AUTH_PUBLIC:
- $page = new XorgPage($tpl_name, $type);
- break;
+ // {{{ function XorgPage()
+
+ function XorgPage($tpl, $type=SKINNED)
+ {
+ $this->PlatalPage($tpl, $type);
+ }
- case AUTH_COOKIE:
- $page = new XorgCookie($tpl_name, $type);
- break;
+ // }}}
+ // {{{ function run()
- case AUTH_MDP:
- $page = new XorgAuth($tpl_name, $type);
+ function run()
+ {
+ global $globals;
+ if ($this->_page_type != NO_SKIN) {
+ $this->assign('menu', $globals->menu->menu());
+ }
+ $this->_run('skin/'.S::v('skin'));
}
- $page->assign('xorg_tpl', $tpl_name);
+ // }}}
}
// }}}
-function new_identification_page()
-{
- _new_page(SKINNED, '', AUTH_MDP);
-}
-// {{{ function new_skinned_page()
+// {{{ class XorgAdmin
-function new_skinned_page($tpl_name, $min_auth)
+/** Une classe pour les pages réservées aux admins (authentifiés!).
+ */
+class XorgAdmin extends XorgPage
{
- _new_page(SKINNED, $tpl_name, $min_auth);
+ // {{{ function XorgAdmin()
+
+ function XorgAdmin($tpl, $type=SKINNED)
+ {
+ $this->XorgPage($tpl, $type);
+ check_perms();
+ }
+
+ // }}}
}
// }}}
-// {{{ function new_simple_page()
-function new_simple_page($tpl_name, $min_auth)
+function _new_page($type, $tpl_name, $admin=false)
{
global $page;
- _new_page(SKINNED, $tpl_name, $min_auth);
- $page->assign('simple', true);
+ if (!empty($admin)) {
+ $page = new XorgAdmin($tpl_name, $type);
+ } else {
+ $page = new XorgPage($tpl_name, $type);
+ }
+
+ $page->assign('xorg_tpl', $tpl_name);
}
-// }}}
-// {{{ function new_nonhtml_page()
+// {{{ function new_skinned_page()
-function new_nonhtml_page($tpl_name, $min_auth)
+function new_skinned_page($tpl_name)
{
- _new_page(NO_SKIN, $tpl_name, $min_auth, false);
+ _new_page(SKINNED, $tpl_name);
}
// }}}
function new_admin_page($tpl_name)
{
- _new_page(SKINNED, $tpl_name, AUTH_MDP, true);
+ _new_page(SKINNED, $tpl_name, true);
}
// }}}
global $editor;
new_admin_page('table-editor.tpl');
require_once('xorg.table-editor.inc.php');
- $editor = new XOrgAdminTableEditor($table,$idfield,$idedit);
+ $editor = new XOrgAdminTableEditor($table, $idfield, $idedit);
}
// }}}
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-require_once('platal/page.inc.php');
-
-// {{{ class XorgPage
-
-class XorgPage extends PlatalPage
-{
- // {{{ function XorgPage()
-
- function XorgPage($tpl, $type=SKINNED)
- {
- $this->PlatalPage($tpl, $type);
- }
-
- // }}}
- // {{{ function run()
-
- function run()
- {
- global $globals;
- if ($this->_page_type != NO_SKIN) {
- $this->assign('menu', $globals->menu->menu());
- }
- $this->_run('skin/'.S::v('skin'));
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class XOrgAuth
-
-/** Une classe pour les pages nécessitant l'authentification.
- * (equivalent de controlauthentification.inc.php)
- */
-class XorgAuth extends XorgPage
-{
- // {{{ function XorgAuth()
-
- function XorgAuth($tpl, $type=SKINNED)
- {
- $this->XorgPage($tpl, $type);
- }
-
- // }}}
- // {{{ function doAuth()
-
- function doAuth()
- {
- XorgSession::doAuth($this);
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class XorgCookie
-
-/** Une classe pour les pages nécessitant l'authentification permanente.
- * (equivalent de controlpermanent.inc.php)
- */
-class XorgCookie extends XorgPage
-{
- // {{{ function XorgCookie()
-
- function XorgCookie($tpl, $type=SKINNED)
- {
- $this->XorgPage($tpl, $type);
- }
-
- // }}}
- // {{{ function doAuth()
-
- function doAuth()
- {
- XorgSession::doAuthCookie($this);
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class XorgAdmin
-
-/** Une classe pour les pages réservées aux admins (authentifiés!).
- */
-class XorgAdmin extends XorgAuth
-{
- // {{{ function XorgAdmin()
-
- function XorgAdmin($tpl, $type=SKINNED)
- {
- $this->XorgAuth($tpl, $type);
- check_perms();
- }
-
- // }}}
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
function handler_ical(&$page, $user = null, $hash = null, $all = null)
{
- new_nonhtml_page('carnet/calendar.tpl', AUTH_PUBLIC);
+ $page->changeTpl('carnet/calendar.tpl', NO_SKIN);
if ($alias && $hash) {
$res = XDB::query(
{
global $globals;
- new_nonhtml_page('geoloc/geolocInit.tpl', AUTH_COOKIE);
+ $page->changeTpl('geoloc/geolocInit.tpl', NO_SKIN);
header('Content-type: text/xml');
$page->assign('querystring', $this->_make_qs());
header("Content-type: text/xml");
- new_nonhtml_page('geoloc/getCityInfos.tpl', AUTH_COOKIE);
- // to debug sql use the next line
- //new_skinned_page('', AUTH_COOKIE);
+ $page->changeTpl('geoloc/getCityInfos.tpl', NO_SKIN);
require_once('geoloc.inc.php');
require_once('search.inc.php');
$page->assign('simple', true);
} else {
header("Content-type: text/xml");
- new_nonhtml_page('geoloc/getData.tpl', AUTH_COOKIE);
+ $page->changeTpl('geoloc/getData.tpl', NO_SKIN);
}
require_once 'geoloc.inc.php';
$x = substr($x, 0, strlen($x) - 4);
}
- new_nonhtml_page('vcard.tpl', AUTH_COOKIE);
+ $page->changeTpl('vcard.tpl', NO_SKIN);
require_once 'xorg.misc.inc.php';
require_once 'user.func.inc.php';
header('Pragma: ');
header('Cache-Control: ');
- new_nonhtml_page('xnetevents/csv.tpl');
+ $page->changeTpl('xnetevents/csv.tpl', NO_SKIN);
$admin = may_update();
// and translate any auth from the wiki to smarty auth
function AuthPlatal($pagename, $level, $authprompt, $since)
{
- global $Conditions;
+ global $Conditions, $page;
$authUser = false;
$authPage = false;
// if we arrive here, the user doesn't have enough permission to access page
+ // FIXME: seems to be broken, will be better soon
+ new_skinned_page('index.tpl');
// maybe it is because he is not identified
if ($authprompt && !S::identified())
{
- new_identification_page();
+ XorgSession::doAuth($page);
}
- global $page;
- new_identification_page();
+ XorgSession::doAuth($page);
if (S::has_perms()) {
$page->trig('Erreur : page Wiki inutilisable sur plat/al');
} else {