PlModule::load($file) is soooooooooo good.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 19 Aug 2008 21:30:55 +0000 (23:30 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 19 Aug 2008 21:30:55 +0000 (23:30 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
14 files changed:
core
modules/auth.php
modules/axletter.php
modules/carnet.php
modules/events.php
modules/lists.php
modules/payment.php
modules/platal.php
modules/profile.php
modules/register.php
modules/search.php
modules/survey.php
modules/xnetevents.php
modules/xnetgrp.php

diff --git a/core b/core
index 63f00a3..2417392 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 63f00a3fb4e2c83167b8293d575da8ac1778709b
+Subproject commit 24173926fa9e13ef5c3509645fca69e5304b0068
index 4b21854..1459721 100644 (file)
@@ -132,7 +132,7 @@ class AuthModule extends PLModule
 
     function handler_groupex(&$page, $charset = 'utf8')
     {
-        require_once dirname(__FILE__).'/auth/auth.inc.php';
+        $this->load('auth.inc.php');
         $page->assign('referer', true);
 
         $gpex_pass = $_GET["pass"];
index 41978e1..0839734 100644 (file)
@@ -43,14 +43,14 @@ class AXLetterModule extends PLModule
                 return $this->handler_index($page, 'out');
             }
         }
-        require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
+        $this->load('axletter.inc.php');
         $page->changeTpl('axletter/unsubscribe.tpl');
         $page->assign('success', AXLetter::unsubscribe($hash, true));
     }
 
     function handler_index(&$page, $action = null)
     {
-        require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
+        $this->load('axletter.inc.php');
 
         $page->changeTpl('axletter/index.tpl');
         $page->setTitle('Envois de l\'AX');
@@ -73,7 +73,7 @@ class AXLetterModule extends PLModule
 
     function handler_submit(&$page, $action = null)
     {
-        require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
+        $this->load('axletter.inc.php');
         if (!AXLetter::hasPerms()) {
             return PL_FORBIDDEN;
         }
@@ -149,7 +149,7 @@ class AXLetterModule extends PLModule
 
             switch (@Post::v('valid')) {
               case 'Aperçu':
-                require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
+                $this->load('axletter.inc.php');
                 $al = new AXLetter(array($id, $short_name, $subject, $title, $body, $signature,
                                          $promo_min, $promo_max, $echeance, 0, 'new'));
                 $al->toHtml($page, S::v('prenom'), S::v('nom'), S::v('femme'));
@@ -225,7 +225,7 @@ class AXLetterModule extends PLModule
 
     function handler_cancel(&$page, $force = null)
     {
-        require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
+        $this->load('axletter.inc.php');
         if (!AXLetter::hasPerms() || !S::has_xsrf_token()) {
             return PL_FORBIDDEN;
         }
@@ -245,7 +245,7 @@ class AXLetterModule extends PLModule
 
     function handler_valid(&$page, $force = null)
     {
-        require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
+        $this->load('axletter.inc.php');
         if (!AXLetter::hasPerms() || !S::has_xsrf_token()) {
             return PL_FORBIDDEN;
         }
@@ -265,7 +265,7 @@ class AXLetterModule extends PLModule
 
     function handler_show(&$page, $nid = 'last')
     {
-        require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
+        $this->load('axletter.inc.php');
         $page->changeTpl('axletter/show.tpl');
 
         $nl  = new AXLetter($nid);
@@ -283,7 +283,7 @@ class AXLetterModule extends PLModule
 
     function handler_admin(&$page, $action = null, $uid = null)
     {
-        require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
+        $this->load('axletter.inc.php');
         if (Post::has('action')) {
             $action = Post::v('action');
             $uid    = Post::v('uid');
index 2675ace..d577057 100644 (file)
@@ -278,7 +278,7 @@ class CarnetModule extends PLModule
 
     function handler_pdf(&$page, $arg0 = null, $arg1 = null)
     {
-        require_once dirname(__FILE__).'/carnet/contacts.pdf.inc.php';
+        $this->load('contacts.pdf.inc.php');
         require_once 'user.func.inc.php';
 
         Platal::session()->close();
@@ -313,7 +313,7 @@ class CarnetModule extends PLModule
 
     function handler_rss(&$page, $user = null, $hash = null)
     {
-        require_once dirname(__FILE__) . '/carnet/feed.inc.php';
+        $this->load('feed.inc.php');
         $feed = new CarnetFeed();
         return $feed->run($page, $user, $hash);
     }
index 1d63a4b..36c501e 100644 (file)
@@ -233,7 +233,7 @@ class EventsModule extends PLModule
 
     function handler_rss(&$page, $user = null, $hash = null)
     {
-        require_once dirname(__FILE__) . '/events/feed.inc.php';
+        $this->load('feed.inc.php');
         $feed = new EventFeed();
         return $feed->run($page, $user, $hash);
     }
index 7165237..a4ea356 100644 (file)
@@ -56,7 +56,7 @@ class ListsModule extends PLModule
     {
         global $globals;
 
-        require_once dirname(__FILE__).'/lists/lists.inc.php';
+        $this->load('lists.inc.php');
 
         $this->client = new MMList(S::v('uid'), S::v('password'));
         return $globals->mail->domain;
index 0cd97f1..7d2493c 100644 (file)
@@ -105,7 +105,7 @@ class PaymentModule extends PLModule
         global $globals;
 
         require_once 'profil.func.inc.php' ;
-        require_once dirname(__FILE__).'/payment/money.inc.php' ;
+        $this->load('money.inc.php');
 
         if (!empty($GLOBALS['IS_XNET_SITE'])) {
             if (!$globals->asso('id')) {
index 767c63e..4ce3c3c 100644 (file)
@@ -449,7 +449,7 @@ Adresse de secours : " . Post::v('email') : ""));
 
     function handler_review(&$page, $action = null, $mode = null) 
     {
-        require_once dirname(__FILE__) . '/platal/review.inc.php';
+        $this->load('review.inc.php');
         $dom = 'Review';
         if (@$GLOBALS['IS_XNET_SITE']) {
             $dom .= 'Xnet';
index 224d9ce..68700f7 100644 (file)
@@ -318,7 +318,7 @@ class ProfileModule extends PLModule
         $page->addJsLink('profile.js');
         $page->addJsLink('jquery.autocomplete.js');
         $wiz = new PlWizard('Profil', PlPage::getCoreTpl('plwizard.tpl'), true, true);
-        require_once dirname(__FILE__) . '/profile/page.inc.php';
+        $this->load('page.inc.php');
         $wiz->addPage('ProfileGeneral', 'Général', 'general');
         $wiz->addPage('ProfileAddresses', 'Adresses personnelles', 'adresses');
         $wiz->addPage('ProfileGroups', 'Groupes X - Binets', 'poly');
index dab11eb..9a32e60 100644 (file)
@@ -89,7 +89,7 @@ class RegisterModule extends PLModule
                     $sub_state['step'] = 1;
                     if (isset($sub_state['hash'])) {
                         $sub_state['step'] = 3;
-                        require_once(dirname(__FILE__) . '/register/register.inc.php');
+                        $this->load('register.inc.php');
                         create_aliases($sub_state);
                     }
                 }
@@ -119,7 +119,7 @@ class RegisterModule extends PLModule
 
             case 2:
                 if (count($_POST)) {
-                    require_once(dirname(__FILE__) . '/register/register.inc.php');
+                    $this->load('register.inc.php');
                     $sub_state['prenom'] = Post::v('prenom');
                     $sub_state['nom']    = Post::v('nom');
                     $sub_state['mat']    = Post::v('mat');
@@ -136,7 +136,7 @@ class RegisterModule extends PLModule
 
             case 3:
                 if (count($_POST)) {
-                    require_once(dirname(__FILE__) . '/register/register.inc.php');
+                    $this->load('register.inc.php');
                     require_once 'emails.inc.php';
                     if (!isvalid_email(Post::v('email'))) {
                         $err[] = "Le champ 'E-mail' n'est pas valide.";
index a21500c..a89d3f6 100644 (file)
@@ -152,7 +152,7 @@ class SearchModule extends PLModule
             $page->addJsLink('ajax.js');
         }
 
-        require_once dirname(__FILE__) . '/search/search.inc.php';
+        $this->load('search.inc.php');
         $page->changeTpl('search/index.tpl');
         $page->setTitle('Annuaire');
     }
@@ -161,7 +161,7 @@ class SearchModule extends PLModule
     {
         global $globals;
         require_once 'geoloc.inc.php';
-        require_once dirname(__FILE__) . '/search/search.inc.php';
+        $this->load('search.inc.php');
         $page->assign('advanced',1);
         $page->addJsLink('jquery.autocomplete.js');
 
index ff3bb05..f493b4e 100644 (file)
@@ -41,7 +41,7 @@ class SurveyModule extends PLModule
     // {{{ function handler_index() : lists all available surveys
     function handler_index(&$page, $action = null)
     {
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         $page->changeTpl('survey/index.tpl');
         $page->assign('survey_current', Survey::retrieveList('c'));
         $page->assign('survey_old', Survey::retrieveList('o'));
@@ -59,7 +59,7 @@ class SurveyModule extends PLModule
         if ($id == -1) {
             return $this->show_error($page, "Un identifiant de sondage doit être précisé.", 'survey');
         }
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         $survey = Survey::retrieveSurvey($id); // retrieves the survey object structure
         if ($survey == null || !$survey->isValid()) {
             return $this->show_error($page, "Sondage ".$id." introuvable.", 'survey');
@@ -98,7 +98,7 @@ class SurveyModule extends PLModule
         if ($id == -1) {
             return $this->show_error($page, "Un identifiant de sondage doit être précisé.", 'survey');
         }
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         $survey = Survey::retrieveSurvey($id); // retrieves the survey object structure
         if ($survey == null || !$survey->isValid()) {
             return $this->show_error($page, "Sondage ".$id." introuvable.", 'survey');
@@ -122,7 +122,7 @@ class SurveyModule extends PLModule
     // {{{ function handler_admin() : index of admin mode
     function handler_admin(&$page, $id = -1)
     {
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         $this->clear_session();
         if ($id == -1) {
             $page->changeTpl('survey/admin.tpl');
@@ -148,7 +148,7 @@ class SurveyModule extends PLModule
         if ($id == -1 || ($id == 'req' && $req == -1)) {
             return $this->show_error($page, "Un identifiant de sondage doit être précisé.", 'survey/admin');
         }
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         $this->clear_session(); // cleans session (in case there would have been a problem before)
         if ($id == 'req') {
             $survey = Survey::retrieveSurveyReq($req);
@@ -180,7 +180,7 @@ class SurveyModule extends PLModule
             return $this->show_error($page, "Un identifiant de sondage doit être précisé.", 'survey/admin');
         }
         $id = intval($id);
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         $surveyInfo = Survey::retrieveSurveyInfo($id); // retrieves information about the survey (does not retrieve and unserialize the object structure)
         if ($surveyInfo == null) {
             return $this->show_error($page, "Sondage ".$id." introuvable.", 'survey/admin');
@@ -209,7 +209,7 @@ class SurveyModule extends PLModule
             return $this->show_error($page, "Un identifiant de sondage doit être précisé.", 'survey/admin');
         }
         $id = intval($id);
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         $surveyInfo = Survey::retrieveSurveyInfo($id); // retrieves information about the survey (does not retrieve and unserialize the object structure)
         if ($surveyInfo == null) {
             return $this->show_error($page, "Sondage ".$id." introuvable.", 'survey/admin');
@@ -229,7 +229,7 @@ class SurveyModule extends PLModule
     // {{{ function handler_edit() : edits a survey (in normal mode unless called by handler_adminEdit() )
     function handler_edit(&$page, $action = 'show', $qid = 'root')
     {
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         $action = Post::v('survey_action', $action);
         $qid    = Post::v('survey_qid', $qid);
         if (Post::has('survey_cancel')) { // after cancelling changes, shows the survey
@@ -363,7 +363,7 @@ class SurveyModule extends PLModule
     // {{{ function handler_ajax() : some ajax in editing a new question (for now, there may be a little more later)
     function handler_ajax(&$page, $type)
     {
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         header('Content-Type: text/html; charset="UTF-8"');
         if (Survey::isType($type)) { // when type has been chosen, the form is updated to fit exactly the type of question chosen
             $page->changeTpl('survey/edit_new.tpl', NO_SKIN);
@@ -398,7 +398,7 @@ class SurveyModule extends PLModule
     // {{{ function check_surveyPerms() : checks the particular surveys access permissions
     function check_surveyPerms(&$page, $survey)
     {
-        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        $this->load('survey.inc.php');
         if (!$survey->isMode(Survey::MODE_ALL)) { // if the survey is reserved to alumni
             global $globals;
             if (!call_user_func(array($globals->session, 'doAuth'))) { // checks authentification
index 6ee5456..10d7259 100644 (file)
@@ -179,7 +179,7 @@ class XnetEventsModule extends PLModule
 
     function handler_sub(&$page, $eid = null)
     {
-        require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
+        $this->load('xnetevents.inc.php');
         $page->changeTpl('xnetevents/subscribe.tpl');
 
         $evt = get_event_detail($eid);
@@ -266,7 +266,7 @@ class XnetEventsModule extends PLModule
 
     function handler_csv(&$page, $eid = null, $item_id = null)
     {
-        require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
+        $this->load('xnetevents.inc.php');
 
         if (!is_numeric($item_id)) {
             $item_id = null;
@@ -301,7 +301,7 @@ class XnetEventsModule extends PLModule
     {
         global $globals;
 
-        require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
+        $this->load('xnetevents.inc.php');
         $evt = get_event_detail($eid);
         if (!$evt) {
             return PL_FORBIDDEN;
@@ -366,7 +366,7 @@ class XnetEventsModule extends PLModule
         if (Post::v('intitule')) {
             S::assert_xsrf_token();
 
-            require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
+            $this->load('xnetevents.inc.php');
             $short_name = event_change_shortname($page, $eid,
                                                  $infos['short_name'],
                                                  Env::v('short_name', ''));
@@ -517,7 +517,7 @@ class XnetEventsModule extends PLModule
     {
         global $globals;
 
-        require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
+        $this->load('xnetevents.inc.php');
 
         $evt = get_event_detail($eid, $item_id);
         if (!$evt) {
index 62ff7de..b7a9eef 100644 (file)
@@ -320,7 +320,7 @@ class XnetGrpModule extends PLModule
             $mls = array_keys(Env::v('ml', array()));
             $mbr = array_keys(Env::v('membres', array()));
 
-            require_once dirname(__FILE__) . '/xnetgrp/mail.inc.php';
+            $this->load('mail.inc.php');
             set_time_limit(120);
             $tos = get_all_redirects($mbr,  $mls, $mmlist);
             $upload = PlUpload::get($_FILES['uploaded'], S::v('forlife'), 'xnet.emails', true);
@@ -735,7 +735,7 @@ class XnetGrpModule extends PLModule
     {
         global $globals;
 
-        require_once dirname(__FILE__) . '/xnetgrp/mail.inc.php';
+        $this->load('mail.inc.php');
         $page->changeTpl('xnetgrp/annuaire-admin.tpl');
         $mmlist = new MMList(S::v('uid'), S::v('password'),
                              $globals->asso('mail_domain'));
@@ -1185,7 +1185,7 @@ class XnetGrpModule extends PLModule
         global $globals;
         $page->assign('asso', $globals->asso());
 
-        require_once dirname(__FILE__) . '/xnetgrp/feed.inc.php';
+        $this->load('feed.inc.php');
         $feed = new XnetGrpEventFeed();
         return $feed->run($page, $user, $hash, false);
     }