Module: appdb Branch: master Commit: 734a4f8a1f5380d84939c4e5483c5290fe4d3963 URL: http://source.winehq.org/git/appdb.git/?a=commit;h=734a4f8a1f5380d84939c4e54...
Author: Alexander Nicolaysen Sørnes alex@thehandofagony.com Date: Mon Nov 5 19:27:17 2007 +0100
Show login form when login is required
---
contact.php | 6 ++++-- include/objectManager.php | 11 +++++------ include/util.php | 14 ++++++++++++++ queueditems.php | 5 ++++- 4 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/contact.php b/contact.php index 993105f..5bd1bef 100644 --- a/contact.php +++ b/contact.php @@ -12,8 +12,10 @@ $oUser = new User($_SESSION['current']->iUserId);
/* Restrict error to logged-in users */ if(!$oUser->isLoggedIn()) - util_show_error_page_and_exit("You need to be <a href="".login_url(). - "">logged in</a>."); +{ + login_form(); + exit; +}
$oRecipient = new User($aClean['iRecipientId']); diff --git a/include/objectManager.php b/include/objectManager.php index 02f40e5..6a282f8 100644 --- a/include/objectManager.php +++ b/include/objectManager.php @@ -164,8 +164,9 @@ class ObjectManager if(!$_SESSION['current']->isLoggedIn() && $this->bIsQueue) { $sQueueText = $this->bIsRejected ? "rejected" : "queued"; - echo '<div align="center">You need to <a href="'.login_url().'">'; - echo "log in</a> in order to process $sQueueText entries</div>\n"; + echo '<div align="center">You need to '; + echo "log in in order to process $sQueueText entries</div>\n"; + login_form(false); return; }
@@ -934,10 +935,8 @@ class ObjectManager if($oObject->allowAnonymousSubmissions() || $_SESSION['current']->isLoggedIn()) return;
- util_show_error_page_and_exit("You need to be <a href="".login_url(). - "">logged in</a>. If you don’t have an ". - "account you can <a href="".BASE."account.php?sCmd=new">register ". - "now</a>, it only takes a few seconds."); + login_form(); + exit; }
private function displayMoveChildren($oObject) diff --git a/include/util.php b/include/util.php index 99362ac..4f6f546 100644 --- a/include/util.php +++ b/include/util.php @@ -55,6 +55,20 @@ function values($arr) return $res; }
+/* Display a login form */ +function login_form($bShowHeader = true) +{ + global $aClean; + $aClean['sReturnTo'] = urlencode($_SERVER['REQUEST_URI']); + + if($bShowHeader) + apidb_header("Login"); + include(BASE."include/"."form_login.php"); + + if($bShowHeader) + apidb_footer(); +} + // print the month, day, year, hour, minute, second function print_date($sTimestamp) { diff --git a/queueditems.php b/queueditems.php index 4a226bc..373bb18 100644 --- a/queueditems.php +++ b/queueditems.php @@ -11,7 +11,10 @@ require_once(BASE."include/appData.php"); $oUser = new User($_SESSION['current']->iUserId);
if(!$oUser->isLoggedIn()) - util_show_error_page_and_exit(); +{ + login_form(); + exit; +}
apidb_header("View Your Queued Items");