From 4a8a1e0a0c0f0ede05ba5b4485add0e2ee7bf5cd Mon Sep 17 00:00:00 2001 From: x2001corpet Date: Tue, 20 Mar 2007 23:53:15 +0000 Subject: [PATCH] oops typo git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1591 839d8a87-29fc-0310-9880-83ba4fa771e5 --- classes/platalpage.php | 43 +++++++++++++++++++++++++++++++++++++++++++ modules/xnet.php | 8 ++++++++ modules/xnetgrp.php | 3 ++- templates/xnet/skin.tpl | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/classes/platalpage.php b/classes/platalpage.php index 1dd77ca..e3cf01f 100644 --- a/classes/platalpage.php +++ b/classes/platalpage.php @@ -27,6 +27,7 @@ class PlatalPage extends Smarty private $_tpl; private $_errors; private $_failure; + private $_jsonVars; // {{{ function PlatalPage() @@ -49,6 +50,7 @@ class PlatalPage extends Smarty $this->_page_type = $type; $this->_tpl = $tpl; $this->_errors = array(); + $this->_jsonVars = array(); $this->_failure = false; $this->register_prefilter('at_to_globals'); @@ -90,6 +92,10 @@ class PlatalPage extends Smarty $this->assign('xorg_failure', $this->_failure); $this->assign('globals', $globals); + if (Env::has('json') && count($this->_jsonVars)) { + return $this->jsonDisplay(); + } + if (Env::v('display') == 'light') { $this->_page_type = SIMPLE; } elseif (Env::v('display') == 'raw') { @@ -114,6 +120,9 @@ class PlatalPage extends Smarty $this->register_outputfilter('hide_emails'); $this->addJsLink('wiki.js'); header("Accept-Charset: utf-8"); + if (Env::v('forceXml')) { + header("Content-Type: text/xml; charset=utf-8"); + } if (!$globals->debug) { error_reporting(0); @@ -219,6 +228,40 @@ class PlatalPage extends Smarty } // }}} + // {{{ function jsonDisplay + protected function jsonDisplay() + { + header("Content-type: text/javascript; charset=utf-8"); + array_walk_recursive($this->_jsonVars, "escape_xorgDB"); + $jsonbegin = Env::v('jsonBegin'); + $jsonend = Env::v('jsonEnd'); + if (Env::has('jsonVar')) { + $jsonbegin = Env::v('jsonVar').' = '; + $jsonend = ';'; + } elseif (Env::has('jsonFunc')) { + $jsonbegin = Env::v('jsonFunc').'('; + $jsonend = ');'; + } + echo $jsonbegin, json_encode($this->_jsonVars), $jsonend; + exit; + } + // }}} + // {{{ function jsonAssign + public function jsonAssign($var, $value) + { + $this->_jsonVars[$var] = $value; + } +} + +function escape_xorgDB(&$item, $key) +{ + if (is_a($item, 'XOrgDBIterator')) { + $expanded = array(); + while ($a = $item->next()) { + $expanded[] = $a; + } + $item = $expanded; + } } // {{{ function escape_html () diff --git a/modules/xnet.php b/modules/xnet.php index 7d73eb2..66972df 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -32,6 +32,7 @@ class XnetModule extends PLModule 'groupes.php' => $this->make_hook('groups2', AUTH_PUBLIC), 'plan' => $this->make_hook('plan', AUTH_PUBLIC), 'photo' => $this->make_hook('photo', AUTH_MDP), + 'autologin' => $this->make_hook('autologin', AUTH_MDP), ); } @@ -196,6 +197,13 @@ class XnetModule extends PLModule $page->setType($cat); } + + function handler_autologin(&$page) + { + header("Content-type: text/javascript; charset=utf-8"); + echo '$.ajax({ url: "index?forceXml=1", dataType: "xml", success: function(xml) { $("body").empty(); $("body",xml).prependTo("body"); }});'; + exit; + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index f37d9ba..9eb51e0 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -409,7 +409,7 @@ class XnetGrpModule extends PLModule m.perms='admin' AS admin, m.origine='X' AS x, u.perms!='pending' AS inscrit, - m.uid, e.email AS actif + m.uid, IF(e.email IS NULL,NULL,1) AS actif FROM groupex.membres AS m LEFT JOIN auth_user_md5 AS u ON ( u.user_id = m.uid ) LEFT JOIN aliases AS a ON ( a.id = m.uid AND a.type='a_vie' ) @@ -420,6 +420,7 @@ class XnetGrpModule extends PLModule ORDER BY $tri LIMIT {?},{?}", $globals->asso('id'), $ofs*NB_PER_PAGE, NB_PER_PAGE); $page->assign('ann', $ann); + $page->jsonAssign('ann', $ann); } function handler_trombi(&$page, $num = 1) diff --git a/templates/xnet/skin.tpl b/templates/xnet/skin.tpl index 0993ed4..1babec4 100644 --- a/templates/xnet/skin.tpl +++ b/templates/xnet/skin.tpl @@ -211,7 +211,7 @@ {list_all_my_groups} {if !$smarty.session.auth}
Me connecter :
- polytechnicien + polytechnicien {/if} -- 2.1.4