From 024ec1e521fb7b16c72602dc0a85ef60c01bbdf7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 28 Jun 2010 10:15:08 +0200 Subject: [PATCH] Adapts profile validation requests to new classes extending ProfileValidate. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/profile/decos.inc.php | 10 +++++----- modules/profile/general.inc.php | 8 ++++---- modules/profile/jobs.inc.php | 6 ++---- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/modules/profile/decos.inc.php b/modules/profile/decos.inc.php index 10305bf..6dfc8e6 100644 --- a/modules/profile/decos.inc.php +++ b/modules/profile/decos.inc.php @@ -38,8 +38,8 @@ class ProfileSettingDeco implements ProfileSetting } // Fetch not yet validated medals - require_once('validations.inc.php'); - $medals = Validate::get_typed_requests(S::i('uid'), 'medal'); + require_once 'validations.inc.php'; + $medals = ProfileValidate::get_typed_requests($page->pid(), 'medal'); foreach ($medals as &$medal) { $value[$medal->mid] = array('grade' => $medal->gid, 'valid' => '0'); @@ -53,7 +53,7 @@ class ProfileSettingDeco implements ProfileSetting public function save(ProfilePage &$page, $field, $value) { - require_once('validations.inc.php'); + require_once 'validations.inc.php'; $orig =& $page->orig[$field]; @@ -65,7 +65,7 @@ class ProfileSettingDeco implements ProfileSetting WHERE pid = {?} AND mid = {?}", $page->pid(), $id); } else { - $req = MedalReq::get_request(S::i('uid'), $id); + $req = MedalReq::get_request($page->pid(), $id); if ($req) { $req->clean(); } @@ -76,7 +76,7 @@ class ProfileSettingDeco implements ProfileSetting // Add new ones foreach ($value as $id=>&$val) { if (!isset($orig[$id]) || $orig[$id]['grade'] != $val['grade']) { - $req = new MedalReq(S::user(), $id, $val['grade']); + $req = new MedalReq(S::user(), $page->profile, $id, $val['grade']); $req->submit(); sleep(1); } diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index b0bb393..088277c 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -19,8 +19,6 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require_once 'name.func.inc.php'; - class ProfileSettingSearchNames implements ProfileSetting { private $private_name_end; @@ -208,6 +206,8 @@ 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 USING profile_name AS s @@ -218,7 +218,7 @@ class ProfileSettingSearchNames implements ProfileSetting // Only requires validation if modification in public names if ($has_new) { - $new_names = new NamesReq(S::user(), $this->search_names, $this->private_name_end); + $new_names = new NamesReq(S::user(), $this->profile, $this->search_names, $this->private_name_end); $new_names->submit(); Platal::page()->trigWarning('La demande de modification de tes noms a bien été prise en compte.' . ' Tu recevras un email dès que ces changements auront été effectués.'); @@ -416,7 +416,7 @@ class ProfileSettingPromo implements ProfileSetting } else { require_once 'validations.inc.php'; - $myorange = new OrangeReq(S::user(), $gradYearNew); + $myorange = new OrangeReq(S::user(), $this->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 cf11aec..ab64c1d 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -153,13 +153,12 @@ class ProfileSettingJob extends ProfileSettingGeocoding WHERE name = {?}", $job['name']); if ($res->numRows() != 1) { - $user = $page->profile->owner; $this->geocodeAddress($job['hq_address'], $s); if (!$s) { $gmapsGeocoder = new GMapsGeocoder(); $job['hq_address'] = $gmapsGeocoder->stripGeocodingFromAddress($job['hq_address']); } - $req = new EntrReq($user, $jobid, $job['name'], $job['hq_acronym'], $job['hq_url'], + $req = new EntrReq(S::user(), $page->profile, $jobid, $job['name'], $job['hq_acronym'], $job['hq_url'], $job['hq_email'], $job['hq_fixed'], $job['hq_fax'], $job['hq_address']); $req->submit(); $job['jobid'] = null; @@ -181,7 +180,7 @@ class ProfileSettingJob extends ProfileSettingGeocoding public function value(ProfilePage &$page, $field, $value, &$success) { require_once 'validations.inc.php'; - $entreprise = Validate::get_typed_requests($page->profile->owner->id(), 'entreprise'); + $entreprise = ProfileValidate::get_typed_requests($page->pid(), 'entreprise'); $entr_val = 0; $init = false; @@ -225,7 +224,6 @@ class ProfileSettingJob extends ProfileSettingGeocoding // TODO: use address and phone classes to update profile_job_enum and profile_phones once they are done. require_once 'profil.func.inc.php'; - require_once 'validations.inc.php'; XDB::execute("DELETE FROM profile_job WHERE pid = {?}", -- 2.1.4