From 460d8f5533ac4dff9d0df95efe11c399228b8637 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Tue, 19 Aug 2008 23:30:55 +0200 Subject: [PATCH] PlModule::load($file) is soooooooooo good. Signed-off-by: Florent Bruneau --- core | 2 +- modules/auth.php | 2 +- modules/axletter.php | 16 ++++++++-------- modules/carnet.php | 4 ++-- modules/events.php | 2 +- modules/lists.php | 2 +- modules/payment.php | 2 +- modules/platal.php | 2 +- modules/profile.php | 2 +- modules/register.php | 6 +++--- modules/search.php | 4 ++-- modules/survey.php | 20 ++++++++++---------- modules/xnetevents.php | 10 +++++----- modules/xnetgrp.php | 6 +++--- 14 files changed, 40 insertions(+), 40 deletions(-) diff --git a/core b/core index 63f00a3..2417392 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 63f00a3fb4e2c83167b8293d575da8ac1778709b +Subproject commit 24173926fa9e13ef5c3509645fca69e5304b0068 diff --git a/modules/auth.php b/modules/auth.php index 4b21854..1459721 100644 --- a/modules/auth.php +++ b/modules/auth.php @@ -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"]; diff --git a/modules/axletter.php b/modules/axletter.php index 41978e1..0839734 100644 --- a/modules/axletter.php +++ b/modules/axletter.php @@ -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'); diff --git a/modules/carnet.php b/modules/carnet.php index 2675ace..d577057 100644 --- a/modules/carnet.php +++ b/modules/carnet.php @@ -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); } diff --git a/modules/events.php b/modules/events.php index 1d63a4b..36c501e 100644 --- a/modules/events.php +++ b/modules/events.php @@ -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); } diff --git a/modules/lists.php b/modules/lists.php index 7165237..a4ea356 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -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; diff --git a/modules/payment.php b/modules/payment.php index 0cd97f1..7d2493c 100644 --- a/modules/payment.php +++ b/modules/payment.php @@ -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')) { diff --git a/modules/platal.php b/modules/platal.php index 767c63e..4ce3c3c 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -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'; diff --git a/modules/profile.php b/modules/profile.php index 224d9ce..68700f7 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -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'); diff --git a/modules/register.php b/modules/register.php index dab11eb..9a32e60 100644 --- a/modules/register.php +++ b/modules/register.php @@ -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."; diff --git a/modules/search.php b/modules/search.php index a21500c..a89d3f6 100644 --- a/modules/search.php +++ b/modules/search.php @@ -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'); diff --git a/modules/survey.php b/modules/survey.php index ff3bb05..f493b4e 100644 --- a/modules/survey.php +++ b/modules/survey.php @@ -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 diff --git a/modules/xnetevents.php b/modules/xnetevents.php index 6ee5456..10d7259 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -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) { diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 62ff7de..b7a9eef 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -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); } -- 2.1.4