<?php
/**************************************************
  CPG Photo Shop Plugin for Coppermine Photo Gallery
  *************************************************
  Copyright (c) 2006 Thomas Lange <stramm@gmx.net>
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  *************************************************
  Coppermine version: 1.4.5
  Photo Shop version: 1.0
  $Revision: 1.0 $
  $Author: stramm $
***************************************************/
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

 $thisplugin->add_action('page_start','loginform_start');

 
function loginform_start()
{
    global $template_sub_menu;
    $template_sub_menu .= plugin_loginform();
}

function plugin_loginform() {
	global $CONFIG, $REFERER;
	if (!USER_ID) {
  	$loginFormHtml = <<<EOT
	<span style="float:right">
		<ins>
		    	<form action="login.php?referer=$REFERER" method="post" name="loginbox" style="margin:0; padding:0;">
		        <table cellpadding="0" cellspacing="3" border="0">
		        <tr>
		            <td><input type="text" class="textinput" name="username" size="10" /></td>
		            <td><input type="password" class="textinput" name="password" size="10" /></td>
		            <td><input name="submitted" type="submit" value="Login" />
		            <input name="remember_me" type="hidden" class="checkbox" value="1" checked="checked" /></td>
		        </tr>
		        <tr>
		        <td class="smallfont">Username</td>
		        <td class="smallfont">Password</td>
		        <td></td>
				</tr>
		        </table>
		        </form>
		</ins>
	</span>
EOT;
	} else {
		$loginFormHtml = "<div align=\"right\" class=\"smallfont\">Welcome back <strong>".(USER_NAME)."</strong><br />";
	}
  return $loginFormHtml;
}
?>