|
From: <jo...@us...> - 2003-11-22 21:16:14
|
Update of /cvsroot/phpicalendar/phpicalendar/includes
In directory sc8-pr-cvs1:/tmp/cvs-serv505/includes
Modified Files:
calendar_nav.php sidebar.php
Added Files:
login.php
Log Message:
Added username/password login to access locked calendars. Moved
calendar availability logic (with support for login) to a
calendar_functions.php file.
RSS feeds support the login feature when determining which calendars
to return.
Styles updated for the login box.
--- NEW FILE: login.php ---
<?php
// Hide the login block if logged in or there are no lock usernames.
if (!isset($username) && $allow_login == 'yes') {
// Set the login table width if not set.
if (!isset($login_width)) $login_width = "100%";
// Remove the username, password, and action values from the form action.
$form_action = preg_replace("/(username|password|action)=[^&]+/", "", $REQUEST_URI);
?>
<form style="margin-bottom:0;" action="<?php echo $form_action; ?>" method="POST">
<input type="hidden" name="action" value="login">
<?php
foreach (array_keys($HTTP_GET_VARS) as $key) {
if ($key == 'action' ||
$key == 'username' ||
$key == 'password')
{
continue;
}
echo "<input type=\"hidden\" name=\"$key\" value=\"$HTTP_GET_VARS[$key]\">\n";
}
?>
<table cellpadding="0" cellspacing="0" border="0" width="<?php echo $login_width; ?>" class="calborder">
<tr>
<td bgcolor="#FFFFFF" valign="middle" align="center">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left" valign="top" width="1%" class="sideback"><img src="images/spacer.gif" width="1" height="20" alt=" "></td>
<td colspan="3" align="center" width="98%" class="sideback"><font class="G10BOLD">Login</font></td>
<td align="right" valign="top" width="1%" class="sideback"><img src="images/spacer.gif" width="1" height="20" alt=" "></td>
</tr>
<tr>
<td colspan="5"><img src="images/spacer.gif" width="148" height="6" alt=" "></td>
</tr>
<tr>
<td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
<td width="48%"><font class="G10B">Username:</font></td>
<td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
<td width="48%"><input class="login_style" type="text" size="8" name="username"></td>
<td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
</tr>
<tr>
<td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
<td width="48%"><font class="G10B">Password:</font></td>
<td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
<td width="48%"><input class="login_style" type="password" size="8" name="password"></td>
<td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
</tr>
<tr>
<td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
<td colspan="3" align="center"><input class="login_style" type="submit" value="Login"></td>
<td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><img src="images/spacer.gif" width="148" height="6" alt=" "></td>
</tr>
</table>
</form>
<img src="images/spacer.gif" width="1" height="10" alt=" "><br>
<?php
}
?>
Index: calendar_nav.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/includes/calendar_nav.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** calendar_nav.php 14 Nov 2003 22:36:54 -0000 1.14
--- calendar_nav.php 22 Nov 2003 21:16:10 -0000 1.15
***************
*** 21,24 ****
--- 21,28 ----
?>
<br>
+ <?php
+ $login_width = 737;
+ include(BASE.'includes/login.php');
+ ?>
<table border="0" width="737" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="calborder">
<tr>
***************
*** 147,150 ****
--- 151,160 ----
if ($allow_preferences != 'no') echo "<a class=\"psf\" href=\"preferences.php?cal=$cal&getdate=$getdate\">$preferences_lang</a><br>\n";
if ($cal != $ALL_CALENDARS_COMBINED && $subscribe_path != '' && $download_filename != '') echo "<a class=\"psf\" href=\"$subscribe_path\">$subscribe_lang</a> | <a class=\"psf\" href=\"$download_filename\">$download_lang</a>\n";
+ if (isset($username)) {
+ $querys = preg_replace("/action=[^&]+/", "action=logout", $QUERY_STRING);
+ if ($querys == $QUERY_STRING) $querys .= '&action=logout";
+ $querys = preg_replace("/(username|password)=[^&]+/", "", $querys);
+ echo "<a class=\"psf\" href=\"$SCRIPT_NAME?$querys\">Logout $username</a><br>\n";
+ }
?>
</td>
Index: sidebar.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/includes/sidebar.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** sidebar.php 22 Nov 2003 09:30:41 -0000 1.28
--- sidebar.php 22 Nov 2003 21:16:10 -0000 1.29
***************
*** 17,20 ****
--- 17,24 ----
?>
+ <?php
+ $login_width = 170;
+ include(BASE.'includes/login.php');
+ ?>
<table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
<tr>
***************
*** 36,39 ****
--- 40,49 ----
if ($allow_preferences != 'no') echo "<a class=\"psf\" href=\"preferences.php?cal=$cal&getdate=$getdate\">$preferences_lang</a><br>\n";
if ($cal != $ALL_CALENDARS_COMBINED && $subscribe_path != '' && $download_filename != '') echo "<a class=\"psf\" href=\"$subscribe_path\">$subscribe_lang</a> | <a class=\"psf\" href=\"$download_filename\">$download_lang</a>\n";
+ if (isset($username)) {
+ $querys = preg_replace("/action=[^&]+/", "action=logout", $QUERY_STRING);
+ if ($querys == $QUERY_STRING) $querys .= '&action=logout';
+ $querys = preg_replace("/(username|password)=[^&]+/", "", $querys);
+ echo "<br>\n<a class=\"psf\" href=\"$SCRIPT_NAME?$querys\">Logout $username</a>\n";
+ }
echo '</span></div>';
?>
|