Only uses autoload to require validation classes.
authorStéphane Jacob <sj@m4x.org>
Mon, 20 Sep 2010 14:58:45 +0000 (16:58 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 20 Sep 2010 14:58:45 +0000 (16:58 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
20 files changed:
bin/cron/homonyms.php
bin/lists.create_promo.php
include/common.inc.php
include/googleapps.inc.php
include/marketing.inc.php
include/profilefields.inc.php
include/validations/homonymes.inc.php
modules/admin.php
modules/email.php
modules/events.php
modules/lists.php
modules/marketing.php
modules/newsletter.php
modules/profile.php
modules/profile/decos.inc.php
modules/profile/general.inc.php
modules/profile/jobs.inc.php
modules/survey/survey.inc.php
modules/xnetevents.php
modules/xnetgrp.php

index 88a7ee4..6de61bc 100755 (executable)
@@ -25,7 +25,6 @@
  * destruction, a second on the date.
  */
 require 'connect.db.inc.php';
-require_once 'validations/homonymes.inc.php';
 
 $resRobot = XDB::iterator("SELECT  uid, alias, expire
                              FROM  aliases
index 9032a7c..78accf9 100755 (executable)
@@ -2,7 +2,6 @@
 <?php
 
 require_once dirname(__FILE__) . '/connect.db.inc.php';
-require_once 'validations.inc.php';
 
 global $globals;
 
index f93541d..bda3922 100644 (file)
@@ -34,8 +34,9 @@ function __autoload($cls)
         } else if (substr($cls, 0, 3) == 'de_') {
             __autoload('direnum');
             return;
-        } else if (substr($cls, -3, 3) == 'req') {
-            include 'validations.inc.php';
+        } else if ($cls == 'validate' || substr($cls, -3, 3) == 'req'
+                   || substr($cls, -8, 8) == 'validate' || substr($cls, 0, 8) == 'validate') {
+            require_once 'validations.inc.php';
             return;
         } else if (substr($cls, 0, 6) == 'banana') {
             require_once 'banana/hooks.inc.php';
index 5cf6eb6..f23403e 100644 (file)
@@ -193,7 +193,6 @@ class GoogleAppsAccount
     // validation queue.
     private function load_pending_validations()
     {
-        require_once('validations.inc.php');
         $this->pending_validation_unsuspend =
             Validate::get_typed_requests_count($this->user->id(), 'gapps-unsuspend');
     }
@@ -341,7 +340,6 @@ class GoogleAppsAccount
         }
 
         if (!$this->pending_update_suspension && !$this->pending_validation_unsuspend) {
-            require_once('validations.inc.php');
             $unsuspend = new GoogleAppsUnsuspendReq($this->user);
             $unsuspend->submit();
             $this->pending_validation_unsuspend = true;
index a6948ac..18a3fe9 100644 (file)
@@ -135,7 +135,6 @@ class Marketing
                     $this->type, $this->data, $this->personal_notes);
         $this->engine->process($this->user);
         if ($valid) {
-            require_once 'validations.inc.php';
             $sender = User::getSilent($this->sender);
             $valid = new MarkReq($sender, $this->user['user'], $this->user['mail'],
                                  $this->from == 'user', $this->type, $this->data, $this->personal_notes);
index 63c0a6e..8d3d59f 100644 (file)
@@ -207,7 +207,6 @@ class Job
         }
         $this->company = CompanyList::get($this->jobid);
         if (is_null($this->company)) {
-            require_once 'validations.inc.php';
             $entreprise = ProfileValidate::get_typed_requests($this->pid, 'entreprise');
             $this->company = new Company(array('name' =>  $entreprise[$this->id]->name));
         }
index 7144c91..ec8e1fe 100644 (file)
@@ -19,7 +19,6 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once 'validations.inc.php';
 // {{{ class HomonymeReq
 
 class HomonymeReq extends Validate
index c39e2ba..04d17b8 100644 (file)
@@ -1012,7 +1012,6 @@ class AdminModule extends PLModule
         $page->setTitle('Administration - Valider une demande');
         $page->addCssLink('nl.css');
         $page->addJsLink('ajax.js');
-        require_once 'validations.inc.php';
 
         if ($action == 'edit' && !is_null($id)) {
             $page->assign('preview_id', $id);
index bfcbf06..e352e6a 100644 (file)
@@ -106,8 +106,6 @@ class EmailModule extends PLModule
 
     function handler_alias(&$page, $action = null, $value = null)
     {
-        require_once 'validations.inc.php';
-
         global $globals;
 
         $page->changeTpl('emails/alias.tpl');
index 9a4d95e..6a02b23 100644 (file)
@@ -207,7 +207,6 @@ class EventsModule extends PLModule
                 exit;
             }
         } elseif ($eid == 'valid') {
-            require_once 'validations.inc.php';
             $valid = Validate::get_request_by_id($valid);
             if ($valid && $valid->img) {
                 pl_cached_dynamic_content_headers("image/" . $valid->imgtype);
@@ -294,7 +293,6 @@ class EventsModule extends PLModule
         } elseif ($action) {
             S::assert_xsrf_token();
 
-            require_once 'validations.inc.php';
             $evtreq = new EvtReq($titre, $texte, $promo_min, $promo_max,
                                  $expiration, $valid_mesg, S::user(), $upload);
             $evtreq->submit();
index eeeb2d4..f6e0109 100644 (file)
@@ -301,7 +301,6 @@ class ListsModule extends PLModule
         if (!$page->nb_errs()) {
             $page->trigSuccess('Demande de création envoyée&nbsp;!');
             $page->assign('created', true);
-            require_once 'validations.inc.php';
             $req = new ListeReq(S::user(), $asso, $liste, $domain,
                                 Post::v('desc'), Post::i('advertise'),
                                 Post::i('modlevel'), Post::i('inslevel'),
index b878478..96b2cf2 100644 (file)
@@ -243,7 +243,6 @@ class MarketingModule extends PLModule
                 $page->trigError("Il faut que tu ajoutes un commentaire à ta proposition pour justifier le "
                                . "besoin de changer la redirection de {$user->fullName()}.");
             } else {
-                require_once 'validations.inc.php';
                 $valid = new BrokenReq(S::user(), $user, $email, trim(Post::v('comment')));
                 $valid->submit();
                 $page->assign('sent', true);
index 3ed81bc..ec52264 100644 (file)
@@ -87,7 +87,6 @@ class NewsletterModule extends PLModule
             $art = new NLArticle(Post::v('title'), Post::v('body'), Post::v('append'));
             $page->assign('art', $art);
         } elseif (Post::has('valid')) {
-            require_once('validations.inc.php');
             $art = new NLReq(S::user(), Post::v('title'),
                              Post::v('body'), Post::v('append'));
             $art->submit();
index 3b32414..26a5046 100644 (file)
@@ -92,7 +92,6 @@ class ProfileModule extends PLModule
 
         // Retrieve the photo and its mime type.
         if ($req && S::logged()) {
-            include 'validations.inc.php';
             $myphoto = PhotoReq::get_request($profile->id());
             $photo = PlImage::fromData($myphoto->data, $myphoto->mimetype);
         } else {
@@ -179,8 +178,6 @@ class ProfileModule extends PLModule
         $page->changeTpl('profile/trombino.tpl');
         $page->assign('hrpid', $profile->hrid());
 
-        require_once('validations.inc.php');
-
         $trombi_x = '/home/web/trombino/photos' . $profile->promo() . '/' . $profile->hrid() . '.jpg';
         if (Env::has('upload')) {
             S::assert_xsrf_token();
index 5db7017..5c41316 100644 (file)
@@ -38,7 +38,6 @@ class ProfileSettingDeco implements ProfileSetting
             }
 
             // Fetch not yet validated medals
-            require_once 'validations.inc.php';
             $medals = ProfileValidate::get_typed_requests($page->pid(), 'medal');
             foreach ($medals as &$medal) {
                 $value[$medal->mid] = array('grade' => $medal->gid,
@@ -53,8 +52,6 @@ class ProfileSettingDeco implements ProfileSetting
 
     public function save(ProfilePage &$page, $field, $value)
     {
-        require_once 'validations.inc.php';
-
         $orig =& $page->orig[$field];
 
         // Remove old ones
index bfd280d..981d985 100644 (file)
@@ -126,7 +126,6 @@ class ProfileSettingSearchNames implements ProfileSetting
                     $value[] = $sn;
                 } while ($sn = $sn_all->next());
             }
-            require_once 'validations.inc.php';
             $namesRequest = ProfileValidate::get_typed_requests($page->pid(), 'usage');
             if (count($namesRequest) > 0) {
                 Platal::page()->assign('validation', true);
@@ -211,7 +210,6 @@ class ProfileSettingSearchNames implements ProfileSetting
     public function save(ProfilePage &$page, $field, $value)
     {
         require_once 'name.func.inc.php';
-        require_once 'validations.inc.php';
 
         $sn_old = build_sn_pub($page->pid());
         XDB::execute("DELETE FROM  s
@@ -462,8 +460,6 @@ class ProfileSettingPromo implements ProfileSetting
                          $gradYearNew, $page->profile->id());
             Platal::page()->trigSuccess('Ton statut « orange » a été supprimé.');
         } else {
-            require_once 'validations.inc.php';
-
             $myorange = new OrangeReq(S::user(), $page->profile, $gradYearNew);
             $myorange->submit();
             Platal::page()->trigSuccess('Tu pourras changer l\'affichage de ta promotion dès que ta nouvelle promotion aura été validée.');
index f0d30d7..bc7b5f5 100644 (file)
@@ -120,7 +120,6 @@ class ProfileSettingJob implements ProfileSetting
 
     public function value(ProfilePage &$page, $field, $value, &$success)
     {
-        require_once 'validations.inc.php';
         $entreprise = ProfileValidate::get_typed_requests($page->pid(), 'entreprise');
         $entr_val = 0;
 
index 670075e..7057a0d 100644 (file)
@@ -383,7 +383,6 @@ class Survey
     // {{{ static function retrieveSurveyReq() : gets a survey request to validate
     public static function retrieveSurveyReq($id)
     {
-        require_once 'validations.inc.php';
         $surveyreq = Validate::get_request_by_id($id);
         if ($surveyreq == null) {
             return null;
@@ -401,7 +400,6 @@ class Survey
     // {{{ function proposeSurvey() : stores a proposition of survey in database (before validation)
     public function proposeSurvey()
     {
-        require_once 'validations.inc.php';
         $surveyreq = new SurveyReq($this->title, $this->description, $this->end, $this->mode, $this->promos, $this->questions, S::user());
         return $surveyreq->submit();
     }
@@ -421,7 +419,6 @@ class Survey
                      WHERE id={?};';
             return XDB::execute($sql, serialize($this->questions), $this->title, $this->description, $this->end, $this->mode, $this->promos, $this->id);
         } else {
-            require_once 'validations.inc.php';
             $surveyreq = Validate::get_request_by_id($this->id);
             if ($surveyreq == null) {
                 return false;
index b8c0fe6..6e4c418 100644 (file)
@@ -94,7 +94,6 @@ class XnetEventsModule extends PLModule
                          $eid, $globals->asso('id'));
 
             // delete the requests for payments
-            require_once 'validations.inc.php';
             XDB::execute("DELETE FROM  requests
                                 WHERE  type = 'paiements' AND data LIKE {?}",
                          PayReq::same_event($eid, $globals->asso('id')));
@@ -449,7 +448,6 @@ class XnetEventsModule extends PLModule
             }
             // request for a new payment
             if (Post::v('paiement_id') == -1 && $money_defaut >= 0) {
-                require_once 'validations.inc.php';
                 $p = new PayReq(S::user(),
                                 Post::v('intitule')." - ".$globals->asso('nom'),
                                 Post::v('site'), $money_defaut,
@@ -494,7 +492,6 @@ class XnetEventsModule extends PLModule
                       WHERE eid = {?}", $eid);
             $evt = $res->fetchOneAssoc();
             // find out if there is already a request for a payment for this event
-            require_once 'validations.inc.php';
             $res = XDB::query("SELECT  stamp
                                  FROM  requests
                                 WHERE  type = 'paiements' AND data LIKE {?}",
index 0424231..9187c47 100644 (file)
@@ -1148,7 +1148,6 @@ class XnetGrpModule extends PLModule
                                  $aid, $imgtype, $imgx, $imgy, $upload->getContents());
                 }
                 if ($art['xorg']) {
-                    require_once('validations.inc.php');
                     $article = new EvtReq("[{$globals->asso('nom')}] " . $art['titre'], $fulltext,
                                     $art['promo_min'], $art['promo_max'], $art['expiration'], "", S::user(),
                                     $upload);
@@ -1158,7 +1157,6 @@ class XnetGrpModule extends PLModule
                     $upload->rm();
                 }
                 if ($art['nl']) {
-                    require_once('validations.inc.php');
                     $article = new NLReq(S::user(), $globals->asso('nom') . " : " .$art['titre'],
                                          $art['texte'], $art['contact_html']);
                     $article->submit();