From 2c6bbb96bdc200518e557fb5906a11b0fb942c39 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 2 Oct 2004 01:23:52 +0000 Subject: Admin adds. --- README | 3 + admin/index.php | 143 +++++++++++++++ config.inc.php | 4 +- functions/admin_functions.php | 2 +- languages/portuguese.inc.php | 397 +++++++++++++++++++++--------------------- templates/default/admin.tpl | 8 +- 6 files changed, 355 insertions(+), 202 deletions(-) create mode 100644 admin/index.php diff --git a/README b/README index 661e1dc..8987238 100644 --- a/README +++ b/README @@ -89,12 +89,15 @@ Changes: -Dutch -Traditional Chinese -Lithuanian + -Portugese -Added iCal specific publish.php. -Fixed stat bug. -PHP5 support added. -Admin page works again. + -Admin page moved to its own folder. -Oct. to Nov. transition more reliable. -RSS handles files with spaces. + -Faster template generation. -Requires PHP 4.1.0 or greater now. -Various Bug fixes. diff --git a/admin/index.php b/admin/index.php new file mode 100644 index 0000000..95f60c7 --- /dev/null +++ b/admin/index.php @@ -0,0 +1,143 @@ +' . $lang['l_delete_error'] . ' ' . urldecode(substr($filename,0,-4)) . '
'; + } else { + $delete_msg = $delete_msg . '' . urldecode(substr($filename,0,-4)) . ' ' . $lang['l_delete_success'] . '
'; + } + } +} + +// 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 . ''.$lang['l_cal_file'].' #'.$filenumber.': '.$lang['l_action_success'].'
'; + } else { + $addupdate_msg = $addupdate_msg . ''.$lang['l_cal_file'].' #'.$filenumber.': '.$lang['l_upload_error'].'
'; + } + } +} + +$calendar_name = $lang['l_admin_header']; + +$page = new Page(BASE.'templates/'.$template.'/admin.tpl'); + +$page->replace_files(array( + 'header' => BASE.'templates/'.$template.'/header.tpl', + 'footer' => BASE.'templates/'.$template.'/footer.tpl' + )); + +$page->replace_tags(array( + 'event_js' => '', + 'charset' => $charset, + 'default_path' => $default_path.'/', + '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' => '', + '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'], + 'l_month' => $lang['l_month'], + 'l_year' => $lang['l_year'], + 'l_admin_header' => $lang['l_admin_header'], + 'l_admin_subhead' => $lang['l_admin_subhead'], + 'l_invalid_login' => $lang['l_invalid_login'], + 'l_username' => $lang['l_username'], + 'l_password' => $lang['l_password'], + 'l_cal_file' => $lang['l_cal_file'], + 'l_delete_cal' => $lang['l_delete_cal'], + 'l_delete' => $lang['l_delete'], + 'l_logout' => $lang['l_logout'], + 'l_login' => $lang['l_login'], + 'l_submit' => $lang['l_submit'], + 'l_addupdate_cal' => $lang['l_addupdate_cal'], + 'l_addupdate_desc' => $lang['l_addupdate_desc'], + 'l_powered_by' => $lang['l_powered_by'], + 'l_this_site_is' => $lang['l_this_site_is'] + )); + +$page->draw_admin(); +$page->output(); + +?> + + + + diff --git a/config.inc.php b/config.inc.php index 90d052a..3dc4512 100644 --- a/config.inc.php +++ b/config.inc.php @@ -19,7 +19,7 @@ $month_event_lines = '1'; // Number of lines to wrap each event title in mo $tomorrows_events_lines = '1'; // Number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines. $allday_week_lines = '1'; // Number of lines to wrap each event title in all-day events in week view, 0 means display all lines. $week_events_lines = '1'; // Number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines. -$timezone = 'US/Pacific'; // Set timezone. Read TIMEZONES file for more information +$timezone = ''; // Set timezone. Read TIMEZONES file for more information $calendar_path = ''; // Leave this blank on most installs, place your full path to calendars if they are outside the phpicalendar folder. $second_offset = ''; // The time in seconds between your time and your server's time. $bleed_time = ''; // This allows events past midnight to just be displayed on the starting date, only good up to 24 hours. Range from '0000' to '2359', or '-1' for no bleed time. Is automatically set to $day_start if left blank. @@ -52,7 +52,7 @@ $phpicalendar_publishing = ''; // Set to '1' to enable remote webdav style pu // 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_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 = '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. diff --git a/functions/admin_functions.php b/functions/admin_functions.php index d52d184..61a9ba5 100644 --- a/functions/admin_functions.php +++ b/functions/admin_functions.php @@ -51,7 +51,7 @@ function login_ftp ($username, $password) { // set up basic connection $conn_id = @ftp_connect($ftp_server); - + if (!$conn_id) exit(error('Cannot connect to FTP server', $filename)); // login with username and password $login_result = @ftp_login($conn_id, $username, $password); diff --git a/languages/portuguese.inc.php b/languages/portuguese.inc.php index 34be7f6..e10fa00 100644 --- a/languages/portuguese.inc.php +++ b/languages/portuguese.inc.php @@ -1,195 +1,202 @@ - + diff --git a/templates/default/admin.tpl b/templates/default/admin.tpl index 1a70f35..b83860b 100644 --- a/templates/default/admin.tpl +++ b/templates/default/admin.tpl @@ -10,10 +10,10 @@
- - - - + + + +
{L_DAY}{L_WEEK}{L_MONTH}{L_YEAR}{L_DAY}{L_WEEK}{L_MONTH}{L_YEAR}
-- cgit v1.2.3