diff options
author | Wesley Miaw <josuah@users.sourceforge.net> | 2003-11-22 21:16:10 +0000 |
---|---|---|
committer | Wesley Miaw <josuah@users.sourceforge.net> | 2003-11-22 21:16:10 +0000 |
commit | 3b3487be53650bb9b39d9ed8c7afd1c04b943b60 (patch) | |
tree | c0ab013a59cebcbdbc024a99b8050b54b4d4fce8 /includes | |
parent | 3fa43afd25ab763d3540fc5ddaa4c164b2af33c1 (diff) | |
download | phpicalendar-3b3487be53650bb9b39d9ed8c7afd1c04b943b60.tar.gz phpicalendar-3b3487be53650bb9b39d9ed8c7afd1c04b943b60.tar.bz2 phpicalendar-3b3487be53650bb9b39d9ed8c7afd1c04b943b60.zip |
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.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/calendar_nav.php | 10 | ||||
-rw-r--r-- | includes/login.php | 65 | ||||
-rw-r--r-- | includes/sidebar.php | 10 |
3 files changed, 85 insertions, 0 deletions
diff --git a/includes/calendar_nav.php b/includes/calendar_nav.php index 4cd4bcc..b08d50a 100644 --- a/includes/calendar_nav.php +++ b/includes/calendar_nav.php @@ -20,6 +20,10 @@ $fake_getdate_time = strtotime($this_year.'-'.$this_month.'-15'); ?> <br> +<?php + $login_width = 737; + include(BASE.'includes/login.php'); +?> <table border="0" width="737" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="calborder"> <tr> <td align="left" valign="top" width="1%" class="sideback"><?php echo "<a class=\"psf\" href=\"month.php?cal=$cal&getdate=$prev_day\"><img src=\"styles/$style_sheet/left_arrows.gif\" alt=\"[$last_day_lang]\" border=\"0\" align=\"left\"></a>"; ?></td> @@ -146,6 +150,12 @@ echo "<a class=\"psf\" href=\"print.php?cal=$cal&getdate=$getdate&printview=$current_view\">$goprint_lang</a><br>\n"; 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> </tr> diff --git a/includes/login.php b/includes/login.php new file mode 100644 index 0000000..14cc96c --- /dev/null +++ b/includes/login.php @@ -0,0 +1,65 @@ +<?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 + } +?> diff --git a/includes/sidebar.php b/includes/sidebar.php index 009ace0..fbbf43f 100644 --- a/includes/sidebar.php +++ b/includes/sidebar.php @@ -16,6 +16,10 @@ if (strlen($cal_displayname2) > 24) { $search_box = '<form style="margin-bottom:0;" action="search.php" method="GET"><input type="hidden" name="cal" value="'.$cal.'"><input type="hidden" name="getdate" value="'.$getdate.'"><input type="text" style="font-size:10px" size="15" class="search_style" name="query" value="'.$search_lang.'" onfocus="javascript:if(this.value==\''.$search_lang.'\') {this.value=\'\';}" onblur="javascript:if(this.value==\'\') {this.value=\''.$search_lang.'\'}"><INPUT type="image" src="styles/'.$style_sheet.'/search.gif" name="submit" value="Search"></form>'; ?> +<?php + $login_width = 170; + include(BASE.'includes/login.php'); +?> <table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder"> <tr> <td align="left" valign="top" width="24" class="sideback"><?php echo "<a class=\"psf\" href=\"day.php?cal=$cal&getdate=$yesterdays_date\"><img src=\"styles/$style_sheet/left_arrows.gif\" alt=\"[$prev_lang]\" width=\"16\" height=\"20\" border=\"0\" align=\"left\"></a>"; ?></td> @@ -35,6 +39,12 @@ $search_box = '<form style="margin-bottom:0;" action="search.php" method="GET">< echo "<a class=\"psf\" href=\"print.php?cal=$cal&getdate=$getdate&printview=$current_view\">$goprint_lang</a><br>\n"; 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>'; ?> </td> |