* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: auto.prepend.inc.php,v 1.22 2004-08-31 11:16:47 x2000habouzit Exp $
+ $Id: auto.prepend.inc.php,v 1.23 2004-09-19 15:50:45 x2000habouzit Exp $
***************************************************************************/
ini_set('include_path', '/home/x2000habouzit/dev/diogenes/lib/:'.ini_get('include_path'));
require("config.xorg.inc.php") ;
-setlocale(LC_TIME, "fr_FR");
require_once("xorg.common.inc.php");
function _new_page($type, $tpl_name, $tpl_head, $min_auth, $popup=false, $admin=false) {
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: xorg.page.inc.php,v 1.39 2004-08-31 21:57:50 x2000habouzit Exp $
+ $Id: xorg.page.inc.php,v 1.40 2004-09-19 15:50:45 x2000habouzit Exp $
***************************************************************************/
require("diogenes.core.page.inc.php");
}
}
+function triple_quote_to_gettext($tpl_source, &$smarty) {
+ return preg_replace('/"""(.*?)"""/se', 'gettext(stripslashes(\'\\1\'))',$tpl_source);
+}
+
class XorgPage extends DiogenesCorePage {
var $_page_type;
var $_tpl;
function XorgPage($tpl, $type=SKINNED) {
global $site_dev,$globals;
+ $this->setLang();
+
$this->template_dir = $globals->spoolroot."/templates/";
$this->compile_dir = $globals->spoolroot."/templates_c/";
$this->plugins_dir[]= $globals->spoolroot."/plugins/";
$this->cache_dir = $globals->spoolroot."/cache/";
$this->use_sub_dirs = false;
+
$this->config_overwrite = false;
$this->compile_check = isset($site_dev);
$this->caching = ($type == SKINNED);
$this->register_block('dynamic', 'block_dynamic', false);
$this->register_function('dyn', 'function_dyn', false);
$this->register_function('implode', 'function_implode');
+ $this->register_prefilter('triple_quote_to_gettext');
// if necessary, construct new session
if (empty($_SESSION['session']))
$this->doAuth();
}
+ function setLang($lang=null) {
+ global $globals;
+ if(empty($lang)) {
+ if(!empty($_COOKIE['lang'])) {
+ $locale = $_COOKIE['lang'];
+ } else {
+ list($locale,) = explode(',', $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
+ $locale = strtolower(trim($locale));
+ $locale = strtr($locale,'-','_');
+ $locale = preg_replace('!_(.*)!e', "'_'.strtoupper('\\1')",$locale);
+ setcookie('lang',$locale,(time()+25920000),'/','',0);
+ }
+ } else {
+ $locale = $lang;
+ }
+ setlocale(LC_MESSAGES, $locale);
+ setlocale(LC_TIME, $locale);
+ $this->compile_id = $locale;
+ bindtextdomain('xorg', $globals->spoolroot.'/locale/');
+ textdomain('xorg');
+ }
+
function run($append_to_id="") {
global $baseurl, $site_dev, $globals;
if($this->_page_type == NO_SKIN)
- parent::display($this->_tpl);
+ $this->display($this->_tpl);
else {
if(isset($_SESSION['suid'])) $this->caching=false;
$id = $this->make_id($append_to_id);
exit;
}
} else
- parent::display('skin/'.$_SESSION['skin'], $id);
+ $this->display('skin/'.$_SESSION['skin'], $id);
}
exit;
}