Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Commit

Permalink
Fix on submit form return url. Clip_Util::url defaults to main if the…
Browse files Browse the repository at this point in the history
…re's no valid pub to display
  • Loading branch information
matheo committed Mar 30, 2012
1 parent 437aeb0 commit 4e643d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/modules/Clip/lib/Clip/Form/Handler/User/Pubedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public function initialize(Zikula_Form_View $view)

// stores the first referer and the item URL
if (!$view->getStateData('referer')) {
$displayurl = Clip_Util::url($this->pub, 'display', array(), null, null, true);
$view->setStateData('referer', System::serverGetVar('HTTP_REFERER', $displayurl));
$returnurl = Clip_Util::url($this->pub, $this->pub->core_pid ? 'display' : 'main', array(), null, null, true);
$view->setStateData('referer', System::serverGetVar('HTTP_REFERER', $returnurl));
}

return true;
Expand Down
12 changes: 8 additions & 4 deletions src/modules/Clip/lib/Clip/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,15 @@ public static function url($obj, $func, $args = array(), $ssl = null, $fragment
} else if ($obj instanceof Clip_Doctrine_Pubdata) {
$args['tid'] = $obj['core_tid'];
if ($func == 'display' || $func == 'edit') {
$args['pid'] = $obj['core_pid'];
if ($func == 'edit') {
$args['id'] = $obj['id'];
if ($obj['core_pid']) {
$args['pid'] = $obj['core_pid'];
if ($func == 'edit') {
$args['id'] = $obj['id'];
}
$args['urltitle'] = $obj['core_urltitle'];
} else {
$func = 'main';
}
$args['urltitle'] = $obj['core_urltitle'];
}

} else if (is_numeric($obj)) {
Expand Down

0 comments on commit 4e643d8

Please sign in to comment.