new_popup_page n'a plus vraiment raison d'être (à part pour x.php, on traitera son cas plus tard...)
remplacée par new_nonhtml_page pour les pages type rss.php et cie.
j'ai aussi modifié la conf apache, plus besoin de hack pour faire marcher le site !
<?php
-require("nonhtml.inc.php");
+require("auto.prepend.inc.php");
+new_nonhtml_page('mescontacts_ldif.tpl', AUTH_COOKIE);
function ensure_adr(&$table) {
$trim = Array();
header("Cache-Control: ");
header("Content-type: text/x-ldif\n");
-$page->display('mescontacts_ldif.tpl');
+$page->display();
?>
<?php
-require("nonhtml.inc.php");
+require("auto.prepend.inc.php");
+new_nonhtml_page('rss.tpl', AUTH_PUBLIC);
$requete="SELECT e.id,e.titre,e.texte FROM evenements AS e WHERE FIND_IN_SET(flags, 'valide') AND peremption >= NOW()";
}
$requete.=" ORDER BY (e.promo_min != 0 AND e.promo_max != 0) DESC, e.peremption";
-mysql_assign($page,$requete,'rss');
+$page->mysql_assign($requete,'rss');
header("Content-Type: text/xml");
-$page->display('rss.tpl');
+$page->display();
?>
<?php
-require("nonhtml.inc.php");
+require("auto.prepend.inc.php");
+new_nonhtml_page('vcard.tpl', AUTH_COOKIE);
function quoted_printable_encode($input, $line_max = 76) {
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
header("Content-type: text/x-vcard\n");
header("Content-Transfer-Encoding: Quoted-Printable\n");
-$page->display('vcard.tpl');
+$page->display();
?>
<?php
require("config.xorg.inc.php") ;
-ini_set('include_path', ".:..:{$globals->root}/include/:{$globals->root}/configs/:$globals->libroot") ;
setlocale(LC_TIME, "fr_FR");
require("xorg.common.inc.php");
_new_page(SKINNED, $tpl_name, $tpl_head, $min_auth, $popup);
}
-function new_popup_page($tpl_name, $min_auth, $popup=false, $tpl_head="") {
- _new_page(SKINNED, $tpl_name, $tpl_head, $min_auth, $popup);
+function new_nonhtml_page($tpl_name, $min_auth) {
+ _new_page(NO_SKIN, $tpl_name, "", $min_auth, false);
}
function new_admin_page($tpl_name, $popup=false, $tpl_head="") {
+++ /dev/null
-<?php
-ini_set('include_path', ".:..:/home/x2000habouzit/dev/public/include:/home/x2000habouzit/dev/diogenes/lib/:/home/x2000habouzit/dev/smarty/");
-require("xorg.common.inc.php");
-require("Smarty.class.php");
-
-
-function mysql_assign(&$page,$sql_query,$var_name,$var_nb_name='') {
- $sql = mysql_query($sql_query);
- if(mysql_errno())
- return(mysql_error($sql));
-
- $array = Array();
- while($array[] = mysql_fetch_assoc($sql));
- array_pop($array);
- mysql_free_result($sql);
-
- $page->assign_by_ref($var_name,$array);
- if(!empty($var_nb_name))
- $page->assign($var_nb_name, count($array));
- return 0;
-}
-
-$page = new Smarty();
-
-$page->template_dir = $globals->spoolroot . "/templates/";
-$page->compile_dir = $globals->spoolroot . "/templates_c/";
-$page->plugins_dir[]= $globals->spoolroot . "/plugins/";
-$page->cache_dir = $globals->spoolroot . "/cache/";
-
-$page->config_overwrite=false;
-$page->compile_check=true;
-$page->caching=false;
-?>
define('SKIN_COMPATIBLE','default.tpl');
define('SKIN_COMPATIBLE_ID',1);
-define('SKIN_POPUP_COMPATIBLE','default.popup.tpl');
define('SKIN_STOCHASKIN_ID','254');
define('SKINNED', 0);
-define('POPUP', 1);
+define('NO_SKIN', 1);
// import class definitions
require("diogenes.database.inc.php");
$this->cache_dir = $globals->spoolroot."/cache/";
$this->config_overwrite=false;
- $this->compile_check=true;
- $this->caching=true;
+ $this->compile_check = isset($site_dev);
+ $this->caching = ($type == SKINNED);
- $this->_page_type = SKINNED;
+ $this->_page_type = $type;
$this->_tpl = $tpl;
$this->DiogenesCorePage();
$id = $this->make_id($append_to_id);
if($site_dev) {
$this->assign('validate', urlencode($baseurl.'/valid.html'));
- if($this->_page_type == POPUP)
- $result = $this->fetch('skin/'.$_SESSION['skin_popup'], $id);
+ if($this->_page_type == NO_SKIN)
+ $result = $this->fetch($this->_tpl, $id);
else
$result = $this->fetch('skin/'.$_SESSION['skin'], $id);
$fd = fopen($this->cache_dir."valid.html","w");
fclose($fd);
echo $result;
} else {
- if($this->_page_type == POPUP)
- parent::display('skin/'.$_SESSION['skin_popup'], $id);
+ if($this->_page_type == NO_SKIN)
+ parent::display($this->_tpl, $id);
else
parent::display('skin/'.$_SESSION['skin'], $id);
}
function xorg_is_cached($append_to_id="") {
$id = $this->make_id($append_to_id);
- if($this->_page_type == POPUP)
- return parent::is_cached('skin/'.$_SESSION['skin_popup'], $id);
+ if($this->_page_type == NO_SKIN)
+ return parent::is_cached($this->_tpl, $id);
else
return parent::is_cached('skin/'.$_SESSION['skin'], $id);
}
function make_id($append_to_id="") {
- $ret = $this->_tpl;
+ $ret = ($this->_page_type == NO_SKIN ? "noskin|" : "") . $this->_tpl;
if($append_to_id)
$ret.="|$append_to_id";
function set_skin() {
if(logged()) {
- $result = mysql_query("SELECT skin,skin_tpl,skin_popup
+ $result = mysql_query("SELECT skin,skin_tpl
FROM auth_user_md5 AS a INNER JOIN skins AS s
ON a.skin=s.id WHERE user_id='{$_SESSION['uid']}' AND skin_tpl != ''");
- if(list($_SESSION['skin_id'], $_SESSION['skin'], $_SESSION['skin_popup']) = mysql_fetch_row($result)) {
+ if(list($_SESSION['skin_id'], $_SESSION['skin']) = mysql_fetch_row($result)) {
if ($_SESSION['skin_id'] == SKIN_STOCHASKIN_ID) {
- $res = mysql_query("SELECT id,skin,skin_popup FROM skins
+ $res = mysql_query("SELECT id,skin FROM skins
WHERE !FIND_IN_SET('cachee',type) order by rand() limit 1");
- list($_SESSION['skin_id'], $_SESSION['skin'], $_SESSION['skin_popup']) = mysql_fetch_row($res);
+ list($_SESSION['skin_id'], $_SESSION['skin']) = mysql_fetch_row($res);
mysql_free_result($res);
}
} else {
$_SESSION['skin'] = SKIN_COMPATIBLE;
$_SESSION['skin_id'] = SKIN_COMPATIBLE_ID;
- $_SESSION['skin_popup'] = SKIN_POPUP_COMPATIBLE;
}
mysql_free_result($result);
}
{
$_SESSION['skin'] = SKIN_COMPATIBLE;
$_SESSION['skin_id'] = SKIN_COMPATIBLE_ID;
- $_SESSION['skin_popup'] = SKIN_POPUP_COMPATIBLE;
}
}
-{* $Id: rss.tpl,v 1.1 2004-02-04 19:47:47 x2000habouzit Exp $ *}
+{* $Id: rss.tpl,v 1.2 2004-02-19 13:22:05 x2000habouzit Exp $ *}
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
{foreach item=line from=$rss}
<item>
-<title>{$line.titre|strip_tags}</title>
+<title>{$line.titre|strip_tags|escape:"html"}</title>
<link>http://{$smarty.server.SERVER_NAME}/login.php#newsid{$line.id}</link>
</item>
{/foreach}