X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile.php;h=7c270468a8e02695184f1628c2791acbbb899560;hb=3af21f99b63b468a5327c36d7ed3a13303c7a06f;hp=562ebc4d9fcffb6d5a3b213c5d7352d07f250c9d;hpb=efe597c5795234724bc3df508bd628f9860a9c32;p=platal.git diff --git a/modules/profile.php b/modules/profile.php index 562ebc4..7c27046 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -331,10 +331,26 @@ class ProfileModule extends PLModule http_redirect("http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&anc_id=$mat"); } - function handler_p_edit(&$page, $opened_tab = null, $mode = null) + function handler_p_edit(&$page, $user = null, $opened_tab = null, $mode = null) { global $globals; + if (is_null($user)) { + $user = S::user(); + if (!$user->hasProfile()) { + return PL_NOT_FOUND; + } else { + pl_redirect('profile/edit/' . $user->profile()->hrid()); + } + } else { + $user = Profile::get($user); + if (!$user) { + return PL_NOT_FOUND; + } else if (!S::user()->canEdit($user) && Platal::notAllowed()) { + return PL_FORBIDDEN; + } + } + // AX Synchronization require_once 'synchro_ax.inc.php'; if (is_ax_key_missing()) { @@ -360,7 +376,7 @@ class ProfileModule extends PLModule $wiz->addPage('ProfileJobs', 'Informations professionnelles', 'emploi'); $wiz->addPage('ProfileSkills', 'Compétences diverses', 'skill'); $wiz->addPage('ProfileMentor', 'Mentoring', 'mentor'); - $wiz->apply($page, 'profile/edit', $opened_tab, $mode); + $wiz->apply($page, 'profile/edit/' . $user->hrid(), $opened_tab, $mode); // Misc checks $res = XDB::query("SELECT user_id