|
From: <cl...@us...> - 2004-02-08 22:40:10
|
Update of /cvsroot/phpicalendar/phpicalendar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31637 Modified Files: admin.php config.inc.php Log Message: Tweeks of admin initial wiring of template. Index: admin.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/admin.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** admin.php 26 Nov 2003 01:42:40 -0000 1.10 --- admin.php 8 Feb 2004 22:37:03 -0000 1.11 *************** *** 3,8 **** define('BASE', './'); ! include (BASE.'functions/init.inc.php'); ! include (BASE.'functions/admin_functions.php'); // Redirect if administration is not allowed --- 3,10 ---- define('BASE', './'); ! require_once(BASE.'functions/init.inc.php'); ! require_once(BASE.'functions/admin_functions.php'); ! require_once(BASE.'functions/list_functions.php'); ! require_once(BASE.'functions/template.php'); // Redirect if administration is not allowed *************** *** 42,281 **** } ! $calendar_name = $admin_header_lang; ! include (BASE.'includes/header.inc.php'); ! ! ?> ! <center> ! <table width="640" border="0" cellspacing="0" cellpadding="0" class="calborder"> ! <tr> ! <td align="center" valign="middle"> ! <table width="100%" border="0" cellspacing="0" cellpadding="0"> ! <tr> ! <td align="left" width="120" class="navback"><?php echo '<a href="'.BASE.'"><img src="'.BASE.'styles/'.$style_sheet.'/back.gif" alt=" " border="0" align="left"></a>'; ?></td> ! <td class="navback"> ! <table width="100%" border="0" cellspacing="0" cellpadding="0"> ! <tr> ! <td align="center" class="navback" nowrap valign="middle"><font class="H20"><?php echo "$admin_header_lang"; ?></font></td> ! </tr> ! </table> ! </td> ! <td align="right" width="120" class="navback"> ! <table width="120" border="0" cellpadding="0" cellspacing="0"> ! <tr> ! <td><?php echo '<a class="psf" href="'.BASE.'day.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'styles/'.$style_sheet.'/day_on.gif" alt=" " border="0"></a></td>'; ?> ! <td><?php echo '<a class="psf" href="'.BASE.'week.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'styles/'.$style_sheet.'/week_on.gif" alt=" " border="0"></a></td>'; ?> ! <td><?php echo '<a class="psf" href="'.BASE.'month.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'styles/'.$style_sheet.'/month_on.gif" alt=" " border="0"></a></td>'; ?> ! <td><?php echo '<a class="psf" href="'.BASE.'year.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'styles/'.$style_sheet.'/year_on.gif" alt=" " border="0"></a></td>'; ?> ! </tr> ! </table> ! </td> ! </tr> ! </table> ! </td> ! </tr> ! <tr> ! <td class="dayborder"><img src="images/spacer.gif" width="1" height="5" alt=" "></td> ! </tr> ! <tr> ! <td class="G10" align="right"><?php if ($auth_method != "none" && $is_loged_in == TRUE) { echo "<a href=\"{$HTTP_SERVER_VARS['PHP_SELF']}?action=logout\">{$logout_lang}</a>"; } ?> </td> ! </tr> ! <tr> ! <td> ! <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B"> ! <tr> ! <td width="2%"></td> ! <td width="98%" valign="top" align="left"> ! <?php ! ! ! ! // If User is Not Logged In, Display The Login Page ! if ($is_loged_in == FALSE) { ! if (isset($username) && $username !='') { ! $login_error = "<font color=\"red\">$invalid_login_lang</font>"; ! } else { ! $login_error = ''; ! } ! ! echo <<<EOT ! <form action="{$HTTP_SERVER_VARS['PHP_SELF']}" method="post"> ! <table cellspacing="0" cellpadding="0"> ! <tr> ! <td nowrap>{$username_lang}: </td> ! <td align="left"><input type="text" name="username"></td> ! </tr> ! <tr> ! <td>{$password_lang}: </td> ! <td align="left"><input type="password" name="password"></td> ! </tr> ! <tr> ! <td> </td> ! <td align="left"><input type="submit" value="{$login_lang}"></td> ! </tr> ! <tr> ! <td align="center" colspan="3">{$login_error} </td> ! </tr> ! </table> ! </form> ! EOT; ! ! ! echo " ! </td> ! </tr> ! </table> ! </td> ! </tr> ! </table>"; ! ! include (BASE.'includes/footer.inc.php'); ! ! echo " ! </center> ! </body> ! </html>"; ! ! die(); ! } ! ! ! // The user is logged in if we get here ! ! ! ! // Add or Update a calendar ! $addupdate_msg = ''; ! $delete_msg = ''; ! if ((isset($action)) && ($action == "addupdate")) { ! $addupdate_msg = ""; ! ! for($filenumber=1; $filenumber<6; $filenumber++) { ! $file = $HTTP_POST_FILES['calfile']; ! $addupdate_success = FALSE; ! if (!is_uploaded_file_v4($file['tmp_name'][$filenumber])) { ! $upload_error = get_upload_error($file['error'][$filenumber]); ! } ! elseif (!is_uploaded_ics($file['name'][$filenumber])) { ! $upload_error = $upload_error_type_lang; ! } ! elseif (!copy_cal($file['tmp_name'][$filenumber], $file['name'][$filenumber])) { ! $upload_error = $copy_error_lang . " " . $file['tmp_name'][$filenumber] . " - " . $calendar_path . "/" . $file['name'][$filenumber]; ! } ! else { ! $addupdate_success = TRUE; ! } ! ! if ($addupdate_success) ! $addupdate_msg = $addupdate_msg . "<font color=\"green\">{$cal_file_lang} {$filenumber}: {$action_success_lang}</font><br>"; ! else ! $addupdate_msg = $addupdate_msg . "<font color=\"red\">{$cal_file_lang} {$filenumber}: {$upload_error}</font><br>"; ! } ! } ! // Delete a calendar ! // Not at all secure - need to strip out path info if used by users besides admin in the future ! if ($action == "delete") { ! $delete_msg = ""; ! foreach ($delete_calendar as $filename) { ! if (!delete_cal(urldecode($filename))) { ! $delete_msg = $delete_msg . "<font color=\"red\">" . $delete_error_lang . " " . urldecode(substr($filename,0,-4)) . "</font><br>"; ! } ! else { ! $delete_msg = $delete_msg . "<font color=\"green\">" . urldecode(substr($filename,0,-4)) . " " . $delete_success_lang . "</font><br>"; ! } ! } ! } ?> - <h2><?php echo $addupdate_cal_lang; ?></h2> - <p><?php echo $addupdate_desc_lang; ?></p> - <form action="<?php echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> - <input type="hidden" name="action" value="addupdate"> - <table border="0" cellspacing="0"> - <tr> - <td nowrap><?php echo $cal_file_lang; ?> 1: </td> - <td><input type="file" name="calfile[1]"></td> - </tr> - <tr> - <td nowrap><?php echo $cal_file_lang; ?> 2: </td> - <td><input type="file" name="calfile[2]"></td> - </tr> - <tr> - <td nowrap><?php echo $cal_file_lang; ?> 3: </td> - <td><input type="file" name="calfile[3]"></td> - </tr> - <tr> - <td nowrap><?php echo $cal_file_lang; ?> 4: </td> - <td><input type="file" name="calfile[4]"></td> - </tr> - <tr> - <td nowrap><?php echo $cal_file_lang; ?> 5: </td> - <td><input type="file" name="calfile[5]"></td> - </tr> - <tr> - <td> </td> - <td><input type="submit" value="<?php echo $submit_lang; ?>"></td> - </tr> - <tr> - <td align="center" colspan="2"><?php echo $addupdate_msg; ?> </td> - </tr> - </table> - </form> - - <h2><?php echo $delete_cal_lang; ?></h2> - <form action="<?php echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post"> - <input type="hidden" name="action" value="delete"> - <table border="0" cellspacing="0"> - <?php - - // Print Calendar Checkboxes - // - $COLUMNS_TO_PRINT = 3; - $column = 1; - $filelist = availableCalendarNames('', '', '', true); - foreach ($filelist as $file) { - if ($column > $COLUMNS_TO_PRINT) { - echo "</tr>"; - $column = 1; - } - if ($column == 1) { - echo "<tr>"; - } - - $cal_filename_tmp = substr($file,0,-4); - $cal_tmp = urlencode($file); - $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); - - echo "<td align=\"left\"><input name=\"delete_calendar[]\" value=\"$cal_tmp\" type=\"checkbox\">$cal_displayname_tmp</td>\n"; - - $column++; - } - // Print remaining empty columns if necessary - $number_of_columns = count($filelist); - while (gettype($number_of_columns/$COLUMNS_TO_PRINT) != "integer") { - echo "<td> </td>"; - $number_of_columns++; - } - ?> - </tr> - </table> - <p><input type="submit" value="<?php echo $delete_lang; ?>"></p> - <p><?php echo $delete_msg; ?> </p> - </form> - - </td> - </tr> - </table> - </td> - </tr> - </table> - </center> - - <?php include (BASE.'includes/footer.inc.php'); ?> - --- 44,75 ---- } ! $calendar_name = $lang['l_admin_header']; ! $page = new Page(BASE.'templates/'.$template.'/admin.tpl'); ! $page->replace_tags(array( ! 'header' => BASE.'templates/'.$template.'/header.tpl', ! 'footer' => BASE.'templates/'.$template.'/footer.tpl', ! 'sidebar' => BASE.'templates/'.$template.'/sidebar.tpl', ! 'event_js' => BASE.'functions/event.js', ! 'template' => $template, ! 'cal' => $cal, ! 'getdate' => $getdate, ! 'calendar_name' => $calendar_name, ! 'display_date' => $display_date, ! 'current_view' => $current_view, ! 'sidebar_date' => $sidebar_date, ! 'rss_powered' => $rss_powered, ! 'rss_available' => '', ! 'rss_valid' => '', ! 'todo_js' => '', ! 'show_search' => '' ! )); ! $page->output(); ?> Index: config.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/config.inc.php,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** config.inc.php 4 Feb 2004 22:39:45 -0000 1.139 --- config.inc.php 8 Feb 2004 22:37:03 -0000 1.140 *************** *** 50,54 **** // Administration settings ! $allow_admin = 'no'; // Set to yes to allow the admin page - remember to change the default password if using 'internal' as the $auth_method $auth_method = 'ftp'; // Valid values are: 'ftp', 'internal', or 'none'. 'ftp' uses the ftp server's username and password as well as ftp commands to delete and copy files. 'internal' uses $auth_internal_username and $auth_internal_password defined below - CHANGE the password. 'none' uses NO authentication - meant to be used with another form of authentication such as http basic. $auth_internal_username = 'admin'; // Only used if $auth_method='internal'. The username for the administrator. --- 50,54 ---- // Administration settings ! $allow_admin = 'yes'; // Set to yes to allow the admin page - remember to change the default password if using 'internal' as the $auth_method $auth_method = 'ftp'; // Valid values are: 'ftp', 'internal', or 'none'. 'ftp' uses the ftp server's username and password as well as ftp commands to delete and copy files. 'internal' uses $auth_internal_username and $auth_internal_password defined below - CHANGE the password. 'none' uses NO authentication - meant to be used with another form of authentication such as http basic. $auth_internal_username = 'admin'; // Only used if $auth_method='internal'. The username for the administrator. |