From: x2000habouzit Date: Sun, 21 Nov 2004 23:35:30 +0000 (+0000) Subject: all globals things goes in $globals X-Git-Tag: xorg/old~858 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=eacf602ce783088efc32646ddb06de119b240049;p=platal.git all globals things goes in $globals YOUR config.xorg.inc.php is obsolete, please see ~x2000habouzit/config.xorg.inc.php ! --- diff --git a/htdocs/admin/homonymes.php b/htdocs/admin/homonymes.php index b494746..121ce7e 100644 --- a/htdocs/admin/homonymes.php +++ b/htdocs/admin/homonymes.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: homonymes.php,v 1.8 2004-11-16 21:02:45 x2000habouzit Exp $ + $Id: homonymes.php,v 1.9 2004-11-21 23:35:31 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -47,7 +47,7 @@ if ($target) { $page->assign('op',$op); $page->assign('target',$target); -$page->assign('baseurl',$baseurl); +$page->assign('baseurl',$globals->baseurl); // on a un $target valide, on prepare les mails if ($target) { diff --git a/htdocs/inscription/step3.php b/htdocs/inscription/step3.php index 20e936f..546a4fc 100644 --- a/htdocs/inscription/step3.php +++ b/htdocs/inscription/step3.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: step3.php,v 1.3 2004-11-01 17:27:07 x2002marichez Exp $ + $Id: step3.php,v 1.4 2004-11-21 23:35:31 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -78,7 +78,7 @@ $mymail = new TplMailer('inscrire.mail.tpl'); $mymail->assign('forlife',$forlife); $mymail->assign('lemail',$_REQUEST['email']); $mymail->assign('pass_clair',$pass_clair); -$mymail->assign('baseurl',$baseurl); +$mymail->assign('baseurl',$globals->baseurl); $mymail->assign('ins_id',$ins_id); $mymail->assign('subj',$forlife."@polytechnique.org"); $mymail->send(); diff --git a/htdocs/inscription/step4.php b/htdocs/inscription/step4.php index 65c2f62..5af0e05 100644 --- a/htdocs/inscription/step4.php +++ b/htdocs/inscription/step4.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: step4.php,v 1.15 2004-11-20 19:07:00 x2000chevalier Exp $ + $Id: step4.php,v 1.16 2004-11-21 23:35:31 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -145,6 +145,6 @@ if (!empty($_REQUEST['ref'])) { } else $page->assign('error',ERROR_REF); -$page->assign('dev',(isset($site_dev) && $site_dev)?1:0); +$page->assign('dev',$globals->debug); $page->run(); ?> diff --git a/htdocs/marketing/relance.php b/htdocs/marketing/relance.php index 89c14d6..13f69ff 100644 --- a/htdocs/marketing/relance.php +++ b/htdocs/marketing/relance.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: relance.php,v 1.4 2004-11-15 09:22:15 x2000habouzit Exp $ + $Id: relance.php,v 1.5 2004-11-21 23:35:32 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -52,7 +52,7 @@ if (isset($_POST["relancer"]) && isset($_POST["relancer"]) != "") { $mymail->assign('fdate',$fdate); $mymail->assign('lusername',$lusername); $mymail->assign('nveau_pass',$nveau_pass); - $mymail->assign('baseurl',$baseurl); + $mymail->assign('baseurl',$globals->baseurl); $mymail->assign('lins_id',$lins_id); $mymail->assign('lemail',$lemail); diff --git a/htdocs/marketing/utilisateurs_marketing.php b/htdocs/marketing/utilisateurs_marketing.php index 3df3e2d..b5f7ca7 100644 --- a/htdocs/marketing/utilisateurs_marketing.php +++ b/htdocs/marketing/utilisateurs_marketing.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: utilisateurs_marketing.php,v 1.10 2004-11-18 14:43:27 x2000habouzit Exp $ + $Id: utilisateurs_marketing.php,v 1.11 2004-11-21 23:35:32 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -106,7 +106,7 @@ switch ($_REQUEST["submit"]) { $mymail->assign('from', $_REQUEST["from"]); $mymail->assign('to', stripslashes($_REQUEST["mail"])); $mymail->assign('femme', $femme); - $mymail->assign('baseurl', $baseurl); + $mymail->assign('baseurl', $globals->baseurl); $mymail->assign('user_id', $user_id); $mymail->assign('num_users', $num_users); $mymail->assign('mailorg', $mailorg); diff --git a/htdocs/paiement/cyberpaiement.inc.php b/htdocs/paiement/cyberpaiement.inc.php index 6f9677a..cbf82ec 100644 --- a/htdocs/paiement/cyberpaiement.inc.php +++ b/htdocs/paiement/cyberpaiement.inc.php @@ -1,12 +1,12 @@ baseurl)."/paiement/cyberpaiement_retour.php?uid={$_SESSION['uid']}&CHAMPBPX"; // on construit l'adresse de retour pour l'utilisateur -$returnurl = "$baseurl/"; +$returnurl = $globals->baseurl."/"; if (! isset($_COOKIE[session_name()])) $returnurl .= "?".SID; diff --git a/htdocs/recovery.php b/htdocs/recovery.php index efdd8f5..34f977c 100644 --- a/htdocs/recovery.php +++ b/htdocs/recovery.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: recovery.php,v 1.8 2004-11-18 15:35:35 x2000habouzit Exp $ + $Id: recovery.php,v 1.9 2004-11-21 23:35:30 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -76,7 +76,7 @@ if (isset($_REQUEST['login']) and isset($_REQUEST['birth'])) { $mymail->addTo($emails); $mymail->setSubject('Ton certificat d\'authentification'); $mymail->setTxtBody("Visite la page suivante qui expire dans six heures : -$baseurl/tmpPWD.php?certificat=$url +{$globals->baseurl}/tmpPWD.php?certificat=$url Si en cliquant dessus tu n'y arrives pas, copie intégralement l'adresse dans la barre de ton navigateur. diff --git a/htdocs/x.php b/htdocs/x.php index 8e4eca1..00ebd40 100644 --- a/htdocs/x.php +++ b/htdocs/x.php @@ -21,6 +21,6 @@ require("auto.prepend.inc.php"); new_skinned_page('x.tpl', AUTH_PUBLIC); -$page->assign('baseurl',$baseurl); +$page->assign('baseurl',$globals->baseurl); $page->run(); ?> diff --git a/include/xorg.common.inc.php b/include/xorg.common.inc.php index 6140e2d..808a757 100644 --- a/include/xorg.common.inc.php +++ b/include/xorg.common.inc.php @@ -18,9 +18,11 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.common.inc.php,v 1.7 2004-11-21 21:36:02 x2000habouzit Exp $ + $Id: xorg.common.inc.php,v 1.8 2004-11-21 23:35:32 x2000habouzit Exp $ ***************************************************************************/ +// {{{ defines + $i=0; define("AUTH_PUBLIC", $i++); define("AUTH_COOKIE", $i++); @@ -35,19 +37,26 @@ define('SKIN_COMPATIBLE_ID',1); define('SKINNED', 0); define('NO_SKIN', 1); -// import class definitions -require("diogenes.database.inc.php"); -require("xorg.globals.inc.php"); -require("xorg/session.inc.php"); +// }}} +// {{{ import class definitions + +require_once("xorg.globals.inc.php"); $globals = new XorgGlobals; require("config.xorg.inc.php"); +// }}} +// {{{ start session + database connection + session_start(); // connect to database $globals->dbconnect(); -$conn = $globals->db->connect_id; -if($site_dev) +if ($globals->debug) { $globals->db->trace_on(); +} + +//}}} + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: ?> diff --git a/include/xorg.globals.inc.php.in b/include/xorg.globals.inc.php.in index 6c43218..7aaa9b9 100644 --- a/include/xorg.globals.inc.php.in +++ b/include/xorg.globals.inc.php.in @@ -18,30 +18,50 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.globals.inc.php.in,v 1.1 2004-11-21 20:40:57 x99laine Exp $ + $Id: xorg.globals.inc.php.in,v 1.2 2004-11-21 23:35:32 x2000habouzit Exp $ ***************************************************************************/ -require("diogenes.core.globals.inc.php"); +require_once("diogenes.core.globals.inc.php"); +require_once("diogenes.database.inc.php"); +require_once("xorg/session.inc.php"); -class XorgGlobals extends DiogenesCoreGlobals { - var $page = 'XorgPage'; +// {{{ class XorgGlobals + +class XorgGlobals extends DiogenesCoreGlobals +{ + var $page = 'XorgPage'; var $session = 'XorgSession'; /** The x.org version */ var $version = "@VERSION@"; + var $debug = false; - var $dbdb = 'x4dat'; - var $table_auth = 'auth_user_md5'; - var $table_log_actions = 'logger.actions'; + /** db params */ + var $dbdb = 'x4dat'; + var $dbhost = 'localhost'; + var $dbuser = 'x4dat'; + var $dbpwd = 'x4dat'; + + var $table_auth = 'auth_user_md5'; + var $table_log_actions = 'logger.actions'; var $table_log_sessions = 'logger.sessions'; - var $table_log_events = 'logger.events'; + var $table_log_events = 'logger.events'; /** logger */ - var $tauth = array('native'=>"auth_user_md5"); + var $tauth = array('native'=>"auth_user_md5"); var $tlabel = array('native'=>"X.Org"); + /** paths */ + var $baseurl = "http://localhost/xorg"; + var $root = "/usr/share/xorg"; + var $spoolroot = "/var/spool/xorg"; + /** recherche */ var $public_max_search_results = 25; - var $search_results_per_page = 20; + var $search_results_per_page = 20; } + +// }}} + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: ?> diff --git a/include/xorg.page.inc.php b/include/xorg.page.inc.php index f3c6367..a2fb1a9 100644 --- a/include/xorg.page.inc.php +++ b/include/xorg.page.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.page.inc.php,v 1.50 2004-11-21 17:31:25 x2000habouzit Exp $ + $Id: xorg.page.inc.php,v 1.51 2004-11-21 23:35:32 x2000habouzit Exp $ ***************************************************************************/ require_once("diogenes.core.page.inc.php"); @@ -31,7 +31,7 @@ require_once("diogenes.core.page.inc.php"); * @category XOrgCore * @package XOrgCore * @author Jeremy Lainé - * @version $Id: xorg.page.inc.php,v 1.50 2004-11-21 17:31:25 x2000habouzit Exp $ + * @version $Id: xorg.page.inc.php,v 1.51 2004-11-21 23:35:32 x2000habouzit Exp $ * @access public * @see DiogenesCorePage */ @@ -47,7 +47,7 @@ class XorgPage extends DiogenesCorePage function XorgPage($tpl, $type=SKINNED) { - global $site_dev, $globals; + global $globals; $this->setLang(); @@ -60,7 +60,7 @@ class XorgPage extends DiogenesCorePage $this->config_overwrite = false; - $this->compile_check = !empty($site_dev); + $this->compile_check = !empty($globals->debug); $this->caching = ($type == SKINNED); if ($type == SKINNED) { $this->register_modifier('escape_html', 'escape_html'); @@ -81,7 +81,7 @@ class XorgPage extends DiogenesCorePage if (empty($_SESSION['session'])) $_SESSION['session'] = new XorgSession; - $this->assign('site_dev',$site_dev); + $this->assign('site_dev',$globals->debug); $this->doAuth(); } @@ -121,7 +121,7 @@ class XorgPage extends DiogenesCorePage function run($append_to_id="") { - global $baseurl, $site_dev, $globals, $TIME_BEGIN; + global $globals, $TIME_BEGIN; if ($this->_page_type == NO_SKIN) { $this->display($this->_tpl); } else { @@ -129,9 +129,9 @@ class XorgPage extends DiogenesCorePage $this->caching=false; } $id = $this->make_id($append_to_id); - if ($site_dev) { + if ($globals->debug) { $this->assign('db_trace', $globals->db->trace_format($this, 'database-debug.tpl')); - $this->assign('validate', urlencode($baseurl.'/valid.html')); + $this->assign('validate', urlencode($globals->baseurl.'/valid.html')); $result = $this->fetch('skin/'.$_SESSION['skin'], $id); $total_time = sprintf('Temps total: %.02fs
', microtime_float() - $TIME_BEGIN); @@ -144,7 +144,9 @@ class XorgPage extends DiogenesCorePage if (preg_match("/^X-W3C-Validator-Errors: (\d+)$/", $h, $m)) { if ($m[1]) { echo str_replace("@HOOK@", - "$total_time{$m[1]} ERREUR(S) !!!
", $result); + "$total_time{$m[1]} ERREUR(S) !!!
", + $result); } else { echo str_replace("@HOOK@", "$total_time", $result); } diff --git a/scripts/cron/send_notifs.php b/scripts/cron/send_notifs.php index a6e1019..d277fae 100755 --- a/scripts/cron/send_notifs.php +++ b/scripts/cron/send_notifs.php @@ -19,7 +19,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: send_notifs.php,v 1.4 2004-11-17 11:20:14 x2000habouzit Exp $ + $Id: send_notifs.php,v 1.5 2004-11-21 23:35:33 x2000habouzit Exp $ ***************************************************************************/ require('./connect.db.inc.php'); @@ -34,7 +34,7 @@ foreach($all->_data as $u) { . " Voici les évènements survenus dans la semaine écoulée,\n" . "et depuis ta dernière visite sur le site.\n\n" . "Tu trouveras les mêmes informations sur la page :\n" - . " $baseurl/carnet/panel.php\n\n"; + . " {$globals->baseurl}/carnet/panel.php\n\n"; $text .= "------------------------------------------------------------\n\n"; foreach($u['data'] as $cid=>$d) { $text .= " {$all->_cats[$cid]['mail']} :\n\n"; @@ -48,7 +48,7 @@ foreach($all->_data as $u) { . "Tu recois ce mail car tu as activé la notification\n" . "automatique par mail des évènements que tu surveilles.\n\n" . "Tu peux changer cette option sur :\n" - . " $baseurl/carnet/notifs.php\n\n" + . " {$globals->baseurl}/carnet/notifs.php\n\n" . "-- \n" . "L'équipe de Polytechnique.org";