From c76545c351fae4e2298624ff9ee5bf854dc5a5b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 20 Sep 2010 16:58:45 +0200 Subject: [PATCH] Only uses autoload to require validation classes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- bin/cron/homonyms.php | 1 - bin/lists.create_promo.php | 1 - include/common.inc.php | 5 +++-- include/googleapps.inc.php | 2 -- include/marketing.inc.php | 1 - include/profilefields.inc.php | 1 - include/validations/homonymes.inc.php | 1 - modules/admin.php | 1 - modules/email.php | 2 -- modules/events.php | 2 -- modules/lists.php | 1 - modules/marketing.php | 1 - modules/newsletter.php | 1 - modules/profile.php | 3 --- modules/profile/decos.inc.php | 3 --- modules/profile/general.inc.php | 4 ---- modules/profile/jobs.inc.php | 1 - modules/survey/survey.inc.php | 3 --- modules/xnetevents.php | 3 --- modules/xnetgrp.php | 2 -- 20 files changed, 3 insertions(+), 36 deletions(-) diff --git a/bin/cron/homonyms.php b/bin/cron/homonyms.php index 88a7ee4..6de61bc 100755 --- a/bin/cron/homonyms.php +++ b/bin/cron/homonyms.php @@ -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 diff --git a/bin/lists.create_promo.php b/bin/lists.create_promo.php index 9032a7c..78accf9 100755 --- a/bin/lists.create_promo.php +++ b/bin/lists.create_promo.php @@ -2,7 +2,6 @@ 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; diff --git a/include/marketing.inc.php b/include/marketing.inc.php index a6948ac..18a3fe9 100644 --- a/include/marketing.inc.php +++ b/include/marketing.inc.php @@ -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); diff --git a/include/profilefields.inc.php b/include/profilefields.inc.php index 63c0a6e..8d3d59f 100644 --- a/include/profilefields.inc.php +++ b/include/profilefields.inc.php @@ -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)); } diff --git a/include/validations/homonymes.inc.php b/include/validations/homonymes.inc.php index 7144c91..ec8e1fe 100644 --- a/include/validations/homonymes.inc.php +++ b/include/validations/homonymes.inc.php @@ -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 diff --git a/modules/admin.php b/modules/admin.php index c39e2ba..04d17b8 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -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); diff --git a/modules/email.php b/modules/email.php index bfcbf06..e352e6a 100644 --- a/modules/email.php +++ b/modules/email.php @@ -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'); diff --git a/modules/events.php b/modules/events.php index 9a4d95e..6a02b23 100644 --- a/modules/events.php +++ b/modules/events.php @@ -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(); diff --git a/modules/lists.php b/modules/lists.php index eeeb2d4..f6e0109 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -301,7 +301,6 @@ class ListsModule extends PLModule if (!$page->nb_errs()) { $page->trigSuccess('Demande de création envoyée !'); $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'), diff --git a/modules/marketing.php b/modules/marketing.php index b878478..96b2cf2 100644 --- a/modules/marketing.php +++ b/modules/marketing.php @@ -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); diff --git a/modules/newsletter.php b/modules/newsletter.php index 3ed81bc..ec52264 100644 --- a/modules/newsletter.php +++ b/modules/newsletter.php @@ -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(); diff --git a/modules/profile.php b/modules/profile.php index 3b32414..26a5046 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -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(); diff --git a/modules/profile/decos.inc.php b/modules/profile/decos.inc.php index 5db7017..5c41316 100644 --- a/modules/profile/decos.inc.php +++ b/modules/profile/decos.inc.php @@ -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 diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index bfd280d..981d985 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -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.'); diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php index f0d30d7..bc7b5f5 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -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; diff --git a/modules/survey/survey.inc.php b/modules/survey/survey.inc.php index 670075e..7057a0d 100644 --- a/modules/survey/survey.inc.php +++ b/modules/survey/survey.inc.php @@ -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; diff --git a/modules/xnetevents.php b/modules/xnetevents.php index b8c0fe6..6e4c418 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -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 {?}", diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 0424231..9187c47 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -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(); -- 2.1.4