Show login form when login is required

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-11-05 19:27:17 +01:00
committed by Chris Morgan
parent 70e4306e2b
commit 734a4f8a1f
4 changed files with 27 additions and 9 deletions

View File

@@ -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']);

View File

@@ -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&#8217;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)

View File

@@ -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)
{

View File

@@ -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");