', $txt[($context['uninstalling'] ? 'uninstall' : ('install_' . $context['extract_type']))], '

'; if ($context['is_installed']) echo ' ', $txt['package_installed_warning1'], '

', $txt['package_installed_warning2'], '

'; echo $txt['package_installed_warning3'], '

'; if (!empty($context['package_blacklist_found'])) echo '
', $txt['package_validation_blacklist_found'], '
'; // Do errors exist in the install? If so light them up like a christmas tree. if ($context['has_failure']) echo '
', sprintf($txt['package_will_fail_title'], $txt['package_' . ($context['uninstalling'] ? 'uninstall' : 'install')]), '
', sprintf($txt['package_will_fail_warning'], $txt['package_' . ($context['uninstalling'] ? 'uninstall' : 'install')]), !empty($context['failure_details']) ? '

' . $context['failure_details'] . '' : '', '
'; // Validation info? if (!empty($context['validation_tests'])) { echo '

', $txt['package_validaiton_results'], '

'; foreach ($context['validation_tests'] as $id_server => $result) { echo ' '; } echo '
', $context['package_servers'][$id_server]['name'], ' ', $txt[isset($result[$context['package_sha256_hash']]) ? $result[$context['package_sha256_hash']] : 'package_validation_status_unknown'], '

'; } // Display the package readme if one exists if (isset($context['package_readme'])) { echo '

', $txt['package_' . ($context['uninstalling'] ? 'un' : '') . 'install_readme'], '

', $context['package_readme'], ' ', $txt['package_available_readme_language'], '

'; } // Did they specify a license to display? if (isset($context['package_license'])) { echo '

', $txt['package_install_license'], '

', $context['package_license'], ' ', $txt['package_available_license_language'], '

'; } echo '

', $context['uninstalling'] ? $txt['package_uninstall_actions'] : $txt['package_install_actions'], ' "', $context['package_name'], '"

'; // Are there data changes to be removed? if ($context['uninstalling'] && !empty($context['database_changes'])) { // This is really a special case so we're adding style inline echo '
', $txt['package_db_uninstall_actions'], ':
    '; foreach ($context['database_changes'] as $change) echo '
  • ', $change, '
  • '; echo '
'; } echo '
'; if (empty($context['actions']) && empty($context['database_changes'])) echo '
', $txt['corrupt_compatible'], '
'; else { echo ' ', $txt['perform_actions'], '
'; $i = 1; $j = 1; $action_num = 1; $js_operations = array(); foreach ($context['actions'] as $packageaction) { // Did we pass or fail? Need to now for later on. $js_operations[$action_num] = isset($packageaction['failed']) ? $packageaction['failed'] : 0; echo ' '; // Is there water on the knee? Operation! if (isset($packageaction['operations'])) { echo ' '; // Increase it. $action_num++; } } echo '
', $txt['package_install_type'], ' ', $txt['package_install_action'], ' ', $txt['package_install_desc'], '
', isset($packageaction['operations']) ? '' : '', ' ', $i++, '. ', $packageaction['type'], ' ', $packageaction['action'], ' ', $packageaction['description'], '
'; // Show the operations. $operation_num = 1; foreach ($packageaction['operations'] as $operation) { // Determine the position text. $operation_text = $operation['position'] == 'replace' ? 'operation_replace' : ($operation['position'] == 'before' ? 'operation_after' : 'operation_before'); echo ' '; } echo '
', $operation_num++, '. ', $txt[$operation_text], ' ', $operation['action'], ' ', $operation['description'], !empty($operation['ignore_failure']) ? ' (' . $txt['operation_ignore'] . ')' : '', '
'; // What if we have custom themes we can install into? List them too! if (!empty($context['theme_actions'])) { echo '

', $context['uninstalling'] ? $txt['package_other_themes_uninstall'] : $txt['package_other_themes'], '

', $txt['package_other_themes_desc'], '
'; // Loop through each theme and display it's name, and then it's details. foreach ($context['theme_actions'] as $id => $theme) { // Pass? $js_operations[$action_num] = !empty($theme['has_failure']); echo ' '; foreach ($theme['actions'] as $action) { echo ' '; // Is there water on the knee? Operation! if (isset($action['operations'])) { echo ' '; // Increase it. $action_num++; } } } echo '
'; if (!empty($context['themes_locked'])) echo ' '; echo ' ', $theme['name'], '
', isset($packageaction['operations']) ? '' : '', ' ', $action['type'], ' ', $action['action'], ' ', $action['description'], '
'; $operation_num = 1; foreach ($action['operations'] as $operation) { // Determine the position text. $operation_text = $operation['position'] == 'replace' ? 'operation_replace' : ($operation['position'] == 'before' ? 'operation_after' : 'operation_before'); echo ' '; } echo '
', $operation_num++, '. ', $txt[$operation_text], ' ', $operation['action'], ' ', $operation['description'], !empty($operation['ignore_failure']) ? ' (' . $txt['operation_ignore'] . ')' : '', '
'; } } // Are we effectively ready to install? if (!$context['ftp_needed'] && (!empty($context['actions']) || !empty($context['database_changes']))) echo '
'; // If we need ftp information then demand it! elseif ($context['ftp_needed']) echo '

', $txt['package_ftp_necessary'], '

', template_control_chmod(), '
'; echo ' ', (isset($context['form_sequence_number']) && !$context['ftp_needed']) ? ' ' : '', '
'; // Toggle options. echo ' '; } /** * Extract package contents */ function template_extract_package() { global $context, $txt, $scripturl; echo '

'; if (empty($context['redirect_url'])) echo $context['uninstalling'] ? $txt['uninstall'] : $txt['extracting']; else echo $txt['package_installed_redirecting']; echo '

'; // If we are going to redirect we have a slightly different agenda. if (!empty($context['redirect_url'])) echo ' ', $context['redirect_text'], '

', $txt['package_installed_redirect_go_now'], ' | ', $txt['package_installed_redirect_cancel'], ' '; elseif ($context['uninstalling']) echo ' ', $txt['package_uninstall_done'] .'
', '', $txt['package_keep'], '', '', $txt['package_delete2'], ''; elseif ($context['install_finished']) { if ($context['extract_type'] == 'avatar') echo ' ', $txt['avatars_extracted']; elseif ($context['extract_type'] == 'language') echo ' ', $txt['language_extracted']; else echo ' ', $txt['package_installed_done']; } else echo ' ', $txt['corrupt_compatible']; echo '
'; // Show the "restore permissions" screen? if (function_exists('template_show_list') && !empty($context['restore_file_permissions']['rows'])) { echo '
'; template_show_list('restore_file_permissions'); } } /** * List files in a package */ function template_list() { global $context, $txt, $scripturl; echo '

', $txt['list_file'], '

', $txt['files_archive'], ' ', $context['filename'], ':

    '; foreach ($context['files'] as $fileinfo) echo '
  1. ', $fileinfo['filename'], ' (', $fileinfo['size'], ' ', $txt['package_bytes'], ')
  2. '; echo '

[ ', $txt['back'], ' ]
'; } /** * Examine a single file within a package */ function template_examine() { global $context, $txt, $scripturl; echo '

', $txt['package_examine_file'], '

', $txt['package_file_contents'], ' ', $context['filename'], ':

', $context['filedata'], '
[ ', $txt['list_files'], ' ]
'; } /** * List all packages */ function template_browse() { global $context, $txt, $scripturl, $modSettings; echo '

', $txt['packages_adding_title'], '

', $txt['packages_adding'], '
'; if (empty($modSettings['disable_smf_js'])) echo ' '; // This sets the announcements and current versions themselves ;). echo ' '; echo '
'; if ($context['available_packages'] == 0) echo '
', $txt['no_packages'], '
'; else { foreach ($context['modification_types'] as $type) if (!empty($context['packages_lists_' . $type]['rows'])) template_show_list('packages_lists_' . $type); echo '
'; } // The advanced (emulation) box, collapsed by default echo '

', $txt['package_emulate_desc'], '

', $txt['package_emulate'], ':
', $txt['package_emulate_revert'], '
'; } /** * List package servers */ function template_servers() { global $context, $txt, $scripturl; if (!empty($context['package_ftp']['error'])) echo '
', $context['package_ftp']['error'], '
'; echo '

', $txt['package_upload_title'], '

', $txt['package_upload_select'], ':

', $txt['download_new_package'], '

'; if ($context['package_download_broken']) { echo '

', $txt['package_ftp_necessary'], '

', $txt['package_ftp_why_download'], '

'; } echo '
' . $txt['package_servers'] . '
' . $txt['add_server'] . '
' . $txt['server_name'] . ':
' . $txt['serverurl'] . ':
', $txt['package_download_by_url'], '
' . $txt['serverurl'] . ':
', $txt['package_download_filename'], ':

', $txt['package_download_filename_info'], '
'; } /** * Confirm package operation */ function template_package_confirm() { global $context, $txt; echo '

', $context['page_title'], '

', $context['confirm_message'], '

[ ', $txt['package_confirm_proceed'], ' ] [ ', $txt['package_confirm_go_back'], ' ]
'; } /** * List packages. */ function template_package_list() { global $context, $txt, $smcFunc; echo '

', $context['page_title'], '

'; // No packages, as yet. if (empty($context['package_list'])) echo ' '; // List out the packages... else { echo ' '; } echo '
'; // Now go through and turn off all the sections. if (!empty($context['package_list'])) { $section_count = count($context['package_list']); echo ' '; } } /** * Confirmation page showing a package was uploaded/downloaded successfully. */ function template_downloaded() { global $context, $txt, $scripturl; echo '

', $context['page_title'], '

', (empty($context['package_server']) ? $txt['package_uploaded_successfully'] : $txt['package_downloaded_successfully']), '



[ ', $txt['back'], ' ]

'; } /** * Installation options - FTP info and backup settings */ function template_install_options() { global $context, $txt, $scripturl; if (!empty($context['saved_successful'])) echo '
', $txt['settings_saved'], '
'; echo '

', $txt['package_install_options'], '

', $txt['package_install_options_ftp_why'], '
'; } /** * CHMOD control form * * @return bool False if nothing to do. */ function template_control_chmod() { global $context, $txt; // Nothing to do? Brilliant! if (empty($context['package_ftp'])) return false; if (empty($context['package_ftp']['form_elements_only'])) { echo ' ', sprintf($txt['package_ftp_why'], 'document.getElementById(\'need_writable_list\').style.display = \'\'; return false;'), '
', $txt['package_ftp_why_file_list'], ' '; if (!$context['server']['is_windows']) echo '
', $txt['package_chmod_linux'], '
# chmod a+w ', implode(' ', $context['notwritable_files']), ''; echo '
'; } echo '
', !empty($context['package_ftp']['error']) ? $context['package_ftp']['error'] : '', '
'; if (!empty($context['package_ftp']['destination'])) echo '
'; echo '
'; if (empty($context['package_ftp']['form_elements_only'])) echo '
'; if (!empty($context['package_ftp']['destination'])) echo '
'; // Hide the details of the list. if (empty($context['package_ftp']['form_elements_only'])) echo ' '; // Quick generate the test button. echo ' '; // Make sure the button gets generated last. $context['insert_after_template'] .= ' '; } /** * Wrapper for the above template function showing that FTP is required */ function template_ftp_required() { global $txt; echo '
', $txt['package_ftp_necessary'], '
', template_control_chmod(), '
'; } /** * View operation details. */ function template_view_operations() { global $context, $txt, $settings, $modSettings; echo ' ', $txt['operation_title'], ' ', template_css(); template_javascript(); echo '
', $context['operations']['search'], '
', $context['operations']['replace'], '
'; } /** * The file permissions page. */ function template_file_permissions() { global $txt, $scripturl, $context; // This will handle expanding the selection. echo ' '; echo '
', $txt['package_file_perms_warning'], ':
    ', $txt['package_file_perms_warning_desc'], '

', $txt['package_file_perms'], '', $txt['package_file_perms_new_status'], '

'; foreach ($context['file_tree'] as $name => $dir) { echo ' '; if (!empty($dir['contents'])) template_permission_show_contents($name, $dir['contents'], 1); } echo '
', $txt['package_file_perms_name'], ' ', $txt['package_file_perms_status'], ' ', $txt['package_file_perms_status_read'], ' ', $txt['package_file_perms_status_write'], ' ', $txt['package_file_perms_status_execute'], ' ', $txt['package_file_perms_status_custom'], ' ', $txt['package_file_perms_status_no_change'], '
'; if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) echo ' '; echo ' ', $name, ' ', ($dir['perms']['chmod'] ? $txt['package_file_perms_writable'] : $txt['package_file_perms_not_writable']), ' ', ($dir['perms']['perms'] ? ' (' . $txt['package_file_perms_chmod'] . ': ' . substr(sprintf('%o', $dir['perms']['perms']), -4) . ')' : ''), '

', $txt['package_file_perms_change'], '

', $txt['package_file_perms_custom'], ': (?)
', $txt['package_file_perms_predefined_note'], '
'; // Likely to need FTP? if (empty($context['ftp_connected'])) echo '

', $txt['package_file_perms_ftp_details'], ':

', template_control_chmod(), '
', $txt['package_file_perms_ftp_retain'], '
'; echo '
'; // Any looks fors we've already done? foreach ($context['look_for'] as $path) echo ' '; echo '

'; } /** * Shows permissions for items within a directory (called from template_file_permissions) * * @param string $ident A unique ID - typically the directory name * @param array $contents An array of items within the directory * @param int $level How far to go inside the directory * @param bool $has_more Whether there are more files to display besides what's in $contents */ function template_permission_show_contents($ident, $contents, $level, $has_more = false) { global $txt, $scripturl, $context; $js_ident = preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident); // Have we actually done something? $drawn_div = false; foreach ($contents as $name => $dir) { if (isset($dir['perms'])) { if (!$drawn_div) { $drawn_div = true; echo ' '; } $cur_ident = preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident . '/' . $name); echo ' ' . str_repeat(' ', $level * 5), ' ', (!empty($dir['type']) && $dir['type'] == 'dir_recursive') || !empty($dir['list_contents']) ? '' : ''; if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) echo ' '; echo ' ', $name, ' ', (!empty($dir['type']) && $dir['type'] == 'dir_recursive') || !empty($dir['list_contents']) ? '' : '', ' ', ($dir['perms']['chmod'] ? $txt['package_file_perms_writable'] : $txt['package_file_perms_not_writable']), ' ', ($dir['perms']['perms'] ? ' (' . $txt['package_file_perms_chmod'] . ': ' . substr(sprintf('%o', $dir['perms']['perms']), -4) . ')' : ''), ' '; if (!empty($dir['contents'])) template_permission_show_contents($ident . '/' . $name, $dir['contents'], $level + 1, !empty($dir['more_files'])); } } // We have more files to show? if ($has_more) echo ' ' . str_repeat(' ', $level * 5), ' ', $txt['package_file_perms_more_files'], ' '; if ($drawn_div) { // Hide anything too far down the tree. $isFound = false; foreach ($context['look_for'] as $tree) if (substr($tree, 0, strlen($ident)) == $ident) $isFound = true; if ($level > 1 && !$isFound) echo ' '; } } /** * A progress page showing what permissions changes are being applied */ function template_action_permissions() { global $txt, $scripturl, $context; $countDown = 3; echo '

', $txt['package_file_perms_applying'], '

'; if (!empty($context['skip_ftp'])) echo '
', $txt['package_file_perms_skipping_ftp'], '
'; // How many have we done? $remaining_items = count($context['method'] == 'individual' ? $context['to_process'] : $context['directory_list']); $progress_message = sprintf($context['method'] == 'individual' ? $txt['package_file_perms_items_done'] : $txt['package_file_perms_dirs_done'], $context['total_items'] - $remaining_items, $context['total_items']); $progress_percent = round(($context['total_items'] - $remaining_items) / $context['total_items'] * 100, 1); echo '
', $progress_message, '
', $progress_percent, '%
'; // Second progress bar for a specific directory? if ($context['method'] != 'individual' && !empty($context['total_files'])) { $file_progress_message = sprintf($txt['package_file_perms_files_done'], $context['file_offset'], $context['total_files']); $file_progress_percent = round($context['file_offset'] / $context['total_files'] * 100, 1); echo '
', $file_progress_message, '
', $file_progress_percent, '%
'; } echo '
'; // Put out the right hidden data. if ($context['method'] == 'individual') echo ' '; else echo ' '; // Are we not using FTP for whatever reason. if (!empty($context['skip_ftp'])) echo ' '; // Retain state. foreach ($context['back_look_data'] as $path) echo ' '; echo '
'; // Just the countdown stuff echo ' '; } ?>