From 8cf0cfa904dbc81496e07b8258efcf5446f1c272 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sun, 8 Feb 2004 22:37:03 +0000 Subject: Tweeks of admin initial wiring of template. --- admin.php | 262 ++++---------------------------------- config.inc.php | 2 +- languages/english.inc.php | 30 +++-- templates/default/admin.tpl | 70 +++++----- templates/default/preferences.tpl | 2 +- 5 files changed, 82 insertions(+), 284 deletions(-) diff --git a/admin.php b/admin.php index 2ea8b1b..d4ad90f 100644 --- a/admin.php +++ b/admin.php @@ -2,8 +2,10 @@ session_start(); define('BASE', './'); -include (BASE.'functions/init.inc.php'); -include (BASE.'functions/admin_functions.php'); +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 if ($allow_admin != "yes") { @@ -41,241 +43,33 @@ else { } } -$calendar_name = $admin_header_lang; -include (BASE.'includes/header.inc.php'); +$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(); ?> -
- - - - - - - - - - - - - -
- - - - - - -
-
{$logout_lang}"; } ?> 
- - - - - -
-$invalid_login_lang"; - } else { - $login_error = ''; - } - - echo << - - - - - - - - - - - - - - - - -
{$username_lang}:
{$password_lang}:
 
{$login_error} 
- -EOT; - - - echo " -
-
"; - - include (BASE.'includes/footer.inc.php'); - - echo " -
- - "; - - 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 . "{$cal_file_lang} {$filenumber}: {$action_success_lang}
"; - else - $addupdate_msg = $addupdate_msg . "{$cal_file_lang} {$filenumber}: {$upload_error}
"; - } -} - -// 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 . "" . $delete_error_lang . " " . urldecode(substr($filename,0,-4)) . "
"; - } - else { - $delete_msg = $delete_msg . "" . urldecode(substr($filename,0,-4)) . " " . $delete_success_lang . "
"; - } - } -} - -?> - - -

-

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1:
2:
3:
4:
5:
 
 
-
- -

-
- - - $COLUMNS_TO_PRINT) { - echo ""; - $column = 1; - } - if ($column == 1) { - echo ""; - } - - $cal_filename_tmp = substr($file,0,-4); - $cal_tmp = urlencode($file); - $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); - - echo "\n"; - - $column++; - } - // Print remaining empty columns if necessary - $number_of_columns = count($filelist); - while (gettype($number_of_columns/$COLUMNS_TO_PRINT) != "integer") { - echo ""; - $number_of_columns++; - } - ?> - -
$cal_displayname_tmp 
-

-

 

-
- - - - - - - - - - - - diff --git a/config.inc.php b/config.inc.php index 68e73df..11d4deb 100644 --- a/config.inc.php +++ b/config.inc.php @@ -49,7 +49,7 @@ $allow_login = 'no'; // Set to yes to prompt for login to unlock calendars. $phpicalendar_publishing = ''; // Set to '1' to enable remote webdav style publish. See 'calendars/publish.php' for complete information; // 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 +$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. diff --git a/languages/english.inc.php b/languages/english.inc.php index c3934d4..6a41ce3 100644 --- a/languages/english.inc.php +++ b/languages/english.inc.php @@ -100,23 +100,25 @@ $lang['l_delete_cal'] = 'Delete a Calendar'; $lang['l_logout'] = 'Logout'; $lang['l_cal_file'] = 'Calendar File'; $lang['l_php_error'] = 'PHP Error'; -$upload_error_gen_lang = 'There was a problem with your upload.'; -$upload_error_lang[0] = 'There was a problem with your upload.'; -$upload_error_lang[1] = 'The file you are trying to upload is too big.'; -$upload_error_lang[2] = 'The file you are trying to upload is too big.'; -$upload_error_lang[3] = 'The file you are trying upload was only partially uploaded.'; -$upload_error_lang[4] = 'You must select a file for upload.'; -$upload_error_type_lang = 'Only .ics files may be uploaded.'; -$copy_error_lang = 'Failed to copy file'; -$delete_error_lang = 'Failed to delete file'; -$delete_success_lang = 'was deleted successfully.'; -$action_success_lang = 'Your action was successful.'; -$submit_lang = 'Submit'; -$delete_lang = 'Delete'; +$upload_error_gen_lang = 'There was a problem with your upload.'; +$upload_error_lang[0] = 'There was a problem with your upload.'; +$upload_error_lang[1] = 'The file you are trying to upload is too big.'; +$upload_error_lang[2] = 'The file you are trying to upload is too big.'; +$upload_error_lang[3] = 'The file you are trying upload was only partially uploaded.'; +$upload_error_lang[4] = 'You must select a file for upload.'; +$lang['l_upload_error_type'] = 'Only .ics files may be uploaded.'; +$lang['l_copy_error'] = 'Failed to copy file'; +$lang['l_delete_error'] = 'Failed to delete file'; +$lang['l_delete_success'] = 'was deleted successfully.'; +$lang['l_action_success'] = 'Your action was successful.'; +$lang['l_submit'] = 'Submit'; +$lang['l_delete'] = 'Delete'; $all_cal_comb_lang = 'All calendars combined'; // New for 2.0 -$lang['l_legend'] = 'Legend'; +$lang['l_legend'] = 'Legend'; +$lang['l_admin_subhead'] = 'Manage your calendars from this page'; +$lang['l_prefs_subhead'] = 'Sets a cookie for visiting this site'; // - navigation $back_lang = 'Back'; diff --git a/templates/default/admin.tpl b/templates/default/admin.tpl index ccea1b8..acf3169 100644 --- a/templates/default/admin.tpl +++ b/templates/default/admin.tpl @@ -1,29 +1,24 @@ {HEADER}
- +
@@ -31,9 +26,9 @@ - @@ -45,23 +40,23 @@
- - - - + + - +
+ - {LOGOUT_LANG}  + {L_LOGOUT} 
- {INVALID_LOGIN_LANG} + {L_INVALID_LOGIN}
- + - + - + @@ -74,36 +69,36 @@ - {CAL_FILE_LANG} {FILENUMBER}: {ACTION_MSG}
+ {L_CAL_FILE} {FILENUMBER}: {ACTION_MSG}
-

{ADDUPDATE_CAL_LANG}

-

{ADDUPDATE_DESC_LANG}

+ {L_ADDUPDATE_CAL} +

{L_ADDUPDATE_DESC}

{USERNAME_LANG}: {L_USERNAME}:
{PASSWORD_LANG}: {L_PASSWORD}:
 
{LOGIN_ERROR} 
- + - + - + - + - + - + @@ -111,11 +106,11 @@
{CAL_FILE_LANG} 1: {L_CAL_FILE} 1:
{CAL_FILE_LANG} 2: {L_CAL_FILE} 2:
{CAL_FILE_LANG} 3: {L_CAL_FILE} 3:
{CAL_FILE_LANG} 4: {L_CAL_FILE} 4:
{CAL_FILE_LANG} 5: {L_CAL_FILE} 5:
 
{ADDUPDATE_MSG}  
-

{DELETE_CAL_LANG}

+ {L_DELETE_CAL}
{DELETE_TABLE} -

+

{DELETE_MSG}  

@@ -126,6 +121,13 @@
+ + + + + + +
{FOOTER} diff --git a/templates/default/preferences.tpl b/templates/default/preferences.tpl index 0914c4a..1cac501 100644 --- a/templates/default/preferences.tpl +++ b/templates/default/preferences.tpl @@ -5,7 +5,7 @@ - +