projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Humpf. It seems amount (as 15.00 EUR) is require in payments...
[platal.git]
/
modules
/
profile.php
diff --git
a/modules/profile.php
b/modules/profile.php
index
e3239d2
..
be8648e
100644
(file)
--- a/
modules/profile.php
+++ b/
modules/profile.php
@@
-139,25
+139,25
@@
class ProfileModule extends PLModule
exit;
}
exit;
}
- /** Tries to return the correct user from given hrpid
- * Will redirect to $returnurl$hrpid if $hrpid was empty
+ /** Tries to return the correct profile from a given hrpid.
*/
*/
- private function findProfile($
returnurl, $
hrpid = null)
+ private function findProfile($hrpid = null)
{
if (is_null($hrpid)) {
$user = S::user();
if (!$user->hasProfile()) {
return PL_NOT_FOUND;
} else {
{
if (is_null($hrpid)) {
$user = S::user();
if (!$user->hasProfile()) {
return PL_NOT_FOUND;
} else {
-
pl_redirect($returnurl . $user->profile()->hrid()
);
+
$profile = $user->profile(
);
}
} else {
$profile = Profile::get($hrpid);
}
} else {
$profile = Profile::get($hrpid);
- if (!$profile) {
- return PL_NOT_FOUND;
- } else if (!S::user()->canEdit($profile) && Platal::notAllowed()) {
- return PL_FORBIDDEN;
- }
+ }
+
+ if (!$profile) {
+ return PL_NOT_FOUND;
+ } else if (!S::user()->canEdit($profile) && Platal::notAllowed()) {
+ return PL_FORBIDDEN;
}
return $profile;
}
}
return $profile;
}
@@
-165,10
+165,13
@@
class ProfileModule extends PLModule
function handler_photo_change(&$page, $hrpid = null)
{
global $globals;
function handler_photo_change(&$page, $hrpid = null)
{
global $globals;
- $profile = $this->findProfile(
'photo/change/',
$hrpid);
+ $profile = $this->findProfile($hrpid);
if (! ($profile instanceof Profile) && ($profile == PL_NOT_FOUND || $profile == PL_FORBIDDEN)) {
return $profile;
}
if (! ($profile instanceof Profile) && ($profile == PL_NOT_FOUND || $profile == PL_FORBIDDEN)) {
return $profile;
}
+ if (is_null($hrpid)) {
+ pl_redirect('photo/change/' . $profile->hrid());
+ }
$page->changeTpl('profile/trombino.tpl');
$page->assign('hrpid', $profile->hrid());
$page->changeTpl('profile/trombino.tpl');
$page->assign('hrpid', $profile->hrid());
@@
-310,10
+313,19
@@
class ProfileModule extends PLModule
{
global $globals;
{
global $globals;
- $profile = $this->findProfile('profile/edit/', $hrpid);
+ if (in_array($hrpid, array('general', 'adresses', 'emploi', 'poly', 'deco', 'skill', 'mentor'))) {
+ $aux = $opened_tab;
+ $opened_tab = $hrpid;
+ $hrpid = $aux;
+ $url_error = true;
+ }
+ $profile = $this->findProfile($hrpid);
if (! ($profile instanceof Profile) && ($profile == PL_NOT_FOUND || $profile == PL_FORBIDDEN)) {
return $profile;
}
if (! ($profile instanceof Profile) && ($profile == PL_NOT_FOUND || $profile == PL_FORBIDDEN)) {
return $profile;
}
+ if (is_null($hrpid) || $url_error) {
+ pl_redirect('profile/edit/' . $profile->hrid() . (is_null($opened_tab) ? '' : '/' . $opened_tab));
+ }
// Build the page
$page->addJsLink('ajax.js');
// Build the page
$page->addJsLink('ajax.js');