From: <cl...@us...> - 2004-10-01 22:27:14
|
Update of /cvsroot/phpicalendar/phpicalendar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16282 Modified Files: README admin.php config.inc.php Log Message: Continued work on admin functions. Needs testing. Index: README =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/README,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** README 6 Sep 2004 23:05:31 -0000 1.79 --- README 1 Oct 2004 22:26:25 -0000 1.80 *************** *** 87,90 **** --- 87,91 ---- -Fixed stat bug. -PHP5 support added. + -Admin page works again. -Requires PHP 4.1.0 or greater now. -Various Bug fixes. Index: admin.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/admin.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** admin.php 2 Sep 2004 18:43:32 -0000 1.22 --- admin.php 1 Oct 2004 22:26:25 -0000 1.23 *************** *** 16,23 **** if($_GET) {extract($_GET, EXTR_PREFIX_SAME, "get_");} - if (!isset($action)) $action = ''; - // Logout by clearing session variables ! if ((isset($action)) && ($action == "logout")) { $_SESSION['phpical_loggedin'] = FALSE; unset($_SESSION['phpical_username']); --- 16,21 ---- if($_GET) {extract($_GET, EXTR_PREFIX_SAME, "get_");} // Logout by clearing session variables ! if ((isset($_GET['action'])) && ($_GET['action'] == 'logout')) { $_SESSION['phpical_loggedin'] = FALSE; unset($_SESSION['phpical_username']); *************** *** 27,31 **** // if $auth_method == 'none', don't do any authentication ! if ($auth_method == "none") { $is_loged_in = TRUE; } else { --- 25,32 ---- // if $auth_method == 'none', don't do any authentication ! $username = $_POST['username']; ! $password = $_POST['password']; ! ! if ($auth_method == 'none') { $is_loged_in = TRUE; } else { *************** *** 35,43 **** $is_loged_in = TRUE; } ! if (isset($username) && $action != "logout") { $is_loged_in = login ($username, $password); } } $calendar_name = $lang['l_admin_header']; --- 36,86 ---- $is_loged_in = TRUE; } ! ! if (isset($username) && $_GET['action'] != 'logout') { $is_loged_in = login ($username, $password); } } + $login_good = ($is_loged_in) ? '' : 'oops'; + $login_bad = ((!$is_loged_in) && ($_GET['action'] == 'login')) ? 'oops' : ''; + + // Delete a calendar + // Not at all secure - need to strip out path info if used by users besides admin in the future + $delete_msg = ''; + if ($_POST['action'] == 'delete') { + foreach ($delete_calendar as $filename) { + if (!delete_cal(urldecode($filename))) { + $delete_msg = $delete_msg . '<font color="red">' . $lang['l_delete_error'] . ' ' . urldecode(substr($filename,0,-4)) . '</font><br />'; + } else { + $delete_msg = $delete_msg . '<font color="green">' . urldecode(substr($filename,0,-4)) . ' ' . $lang['l_delete_success'] . '</font><br />'; + } + } + } + + // Add or Update a calendar + $addupdate_msg = ''; + if ((isset($_POST['action'])) && ($_POST['action'] == 'addupdate')) { + 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 == TRUE) { + $addupdate_msg = $addupdate_msg . '<font color="green">'.$lang['l_cal_file'].' #'.$filenumber.': '.$lang['l_action_success'].'</font><br />'; + } else { + $addupdate_msg = $addupdate_msg . '<font color="red">'.$lang['l_cal_file'].' #'.$filenumber.': '.$lang['l_upload_error'].'</font><br />'; + } + } + } + $calendar_name = $lang['l_admin_header']; *************** *** 64,67 **** --- 107,114 ---- 'rss_valid' => '', 'show_search' => '', + 'login_error' => $login_bad, + 'display_login' => $login_good, + 'delete_msg' => $delete_msg, + 'addupdate_msg' => $addupdate_msg, 'l_day' => $lang['l_day'], 'l_week' => $lang['l_week'], Index: config.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/config.inc.php,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** config.inc.php 21 Sep 2004 06:34:02 -0000 1.154 --- config.inc.php 1 Oct 2004 22:26:25 -0000 1.155 *************** *** 53,59 **** // Administration settings (admin.php) $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. ! $auth_internal_password = 'default'; // Only used if $auth_method='internal'. The password for the administrator. $ftp_server = 'localhost'; // Only used if $auth_method='ftp'. The ftp server name. 'localhost' will work for most servers. $ftp_calendar_path = ''; // Only used if $auth_method='ftp'. The full path to the calendar directory on the ftp server. If = '', will attempt to deduce the path based on $calendar_path, but may not be accurate depending on ftp server config. --- 53,59 ---- // Administration settings (admin.php) $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 = 'internal'; // 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. ! $auth_internal_password = 'admin'; // Only used if $auth_method='internal'. The password for the administrator. $ftp_server = 'localhost'; // Only used if $auth_method='ftp'. The ftp server name. 'localhost' will work for most servers. $ftp_calendar_path = ''; // Only used if $auth_method='ftp'. The full path to the calendar directory on the ftp server. If = '', will attempt to deduce the path based on $calendar_path, but may not be accurate depending on ftp server config. |