$do_download = false; $content_type = ''; if (empty($_GET['get_content'])) { if ($ext === '.gif') { $content_type = 'image/gif'; } elseif ($ext === '.jpg' || $ext === '.jpe' || $ext === 'jpeg') { $content_type = 'image/jpeg'; } elseif ($ext === '.png') { $content_type = 'image/png'; } else { $do_download = true; } } else { $do_download = true; } xs_download_file($do_download ? basename($f) : '', $contents, $content_type); xs_exit(); } } else { $list_data[$data['filename']] = $data; } $files[] = $data['filename']; } } if (empty($data['filename']) && $is_file) { $pos = strlen($str); } else { $pos += floor(($data['size'] + 511) / 512) * 512; if ($is_file) { $items[] = $data; }
@unlink($filename); xs_error($lang['xs_ftp_error_login2'] . '<br /><br />' . $lang['xs_export_back']); } if ($ftp_dir) { @ftp_chdir($ftp, $ftp_dir); } $res = @ftp_put($ftp, $ftp_dir . $export_filename, $filename, FTP_BINARY); @unlink($filename); if (!$res) { xs_error($lang['xs_export_error_uploading'] . '<br /><br />' . $lang['xs_export_back']); } set_export_method('ftp', array('host' => $ftp_host, 'login' => $ftp_login, 'ftpdir' => $ftp_dir)); xs_message($lang['Information'], $lang['xs_export_uploaded'] . '<br /><br />' . $lang['xs_export_back']); } // send file xs_download_file($export_filename, $data, 'application/phpbbstyle'); xs_exit(); } $template->set_filenames(array('body' => 'export.tpl')); // // get list of installed styles // $sql = 'SELECT themes_id, template_name, style_name FROM ' . THEMES_TABLE . ' ORDER BY template_name'; if (!($result = $db->sql_query($sql))) { xs_error($lang['xs_no_style_info'], __LINE__, __FILE__); } $style_rowset = $db->sql_fetchrowset($result); $prev_id = -1; $prev_tpl = ''; $style_names = array(); $j = 0;
if (isset($HTTP_GET_VARS['edit'])) { $file = stripslashes($HTTP_GET_VARS['edit']); $fullfile = $current_dir_root . $file; $localfile = '../' . $fullfile; $hash = md5($localfile); if (!@file_exists($localfile)) { xs_error($lang['xs_edit_not_found'] . '<br /><br />' . $return_url); } if (isset($HTTP_GET_VARS['download']) && !defined('DEMO_MODE')) { $content = implode('', @file($localfile)); xs_download_file($file, $content); xs_exit(); } if (isset($HTTP_GET_VARS['downloadbackup']) && !defined('DEMO_MODE')) { $backup_name = XS_TEMP_DIR . XS_BACKUP_PREFIX . $hash . '.' . intval($HTTP_GET_VARS['downloadbackup']) . XS_BACKUP_EXT; xs_download_file($file, implode('', @file($backup_name))); xs_exit(); } $return_file = str_replace('{URL}', append_sid('xs_edit.' . $phpEx . $filter_str . '&dir=' . urlencode($current_dir) . '&edit=' . urlencode($file)), $lang['xs_edittpl_back_edit']); $return_url = $return_file . '<br /><br />' . $return_dir; $template->assign_vars(array('U_ACTION' => append_sid('xs_edit.' . $phpEx), 'U_BROWSE' => append_sid('xs_edit.' . $phpEx . $filter_str . '&dir=' . urlencode($current_dir)), 'U_EDIT' => append_sid('xs_edit.' . $phpEx . $filter_str . '&dir=' . urlencode($current_dir) . '&edit=' . urlencode($file)), 'U_BACKUP' => append_sid('xs_edit.' . $phpEx . $filter_str . '&dobackup=1&dir=' . urlencode($current_dir) . '&edit=' . urlencode($file)), 'U_DOWNLOAD' => append_sid('xs_edit.' . $phpEx . $filter_str . '&download=1&dir=' . urlencode($current_dir) . '&edit=' . urlencode($file)), 'CURRENT_DIR' => htmlspecialchars($current_dir_full), 'DIR' => htmlspecialchars($current_dir), 'FILE' => htmlspecialchars($file), 'FULLFILE' => htmlspecialchars($fullfile), 'CONTENT' => defined('DEMO_MODE') ? 'you cannot edit file in demo mode' : htmlspecialchars(implode('', @file($localfile))))); if ($current_dir_full) { $template->assign_block_vars('nav_left', array('ITEM' => '» <a href="' . append_sid('xs_edit.' . $phpEx . $filter_str . '&dir=' . $current_dir) . '">' . htmlspecialchars($current_dir_full) . '</a>')); } // show tree $arr = array(); $template->assign_block_vars('tree', array('ITEM' => 'phpBB', 'URL' => append_sid('xs_edit.' . $phpEx . $filter_str . '&dir='), 'SEPARATOR' => '')); $back_dir = ''; for ($i = 0; $i < count($dirs); $i++) { $arr[] = $dirs[$i]; $str = implode('/', $arr);
if (isset($HTTP_GET_VARS['edit'])) { $file = stripslashes($HTTP_GET_VARS['edit']); $fullfile = $current_dir_root . $file; $localfile = '../' . $fullfile; $hash = md5($localfile); if (!@file_exists($localfile)) { xs_error($lang['xs_edit_not_found'] . '<br /><br />' . $return_url); } if (isset($HTTP_GET_VARS['download']) && !defined('DEMO_MODE')) { $content = @file_get_contents($localfile); xs_download_file($file, $content); xs_exit(); } if (isset($HTTP_GET_VARS['downloadbackup']) && !defined('DEMO_MODE')) { $backup_name = XS_TEMP_DIR . XS_BACKUP_PREFIX . $hash . '.' . intval($HTTP_GET_VARS['downloadbackup']) . XS_BACKUP_EXT; xs_download_file($file, @file_get_contents($backup_name)); xs_exit(); } $return_file = str_replace('{URL}', append_sid('xs_edit.' . $phpEx . $filter_str . '&dir=' . urlencode($current_dir) . '&edit=' . urlencode($file)), $lang['xs_edittpl_back_edit']); $return_url = $return_file . '<br /><br />' . $return_dir; $template->assign_vars(array('U_ACTION' => append_sid('xs_edit.' . $phpEx), 'U_BROWSE' => append_sid('xs_edit.' . $phpEx . $filter_str . '&dir=' . urlencode($current_dir)), 'U_EDIT' => append_sid('xs_edit.' . $phpEx . $filter_str . '&dir=' . urlencode($current_dir) . '&edit=' . urlencode($file)), 'U_BACKUP' => append_sid('xs_edit.' . $phpEx . $filter_str . '&dobackup=1&dir=' . urlencode($current_dir) . '&edit=' . urlencode($file)), 'U_DOWNLOAD' => append_sid('xs_edit.' . $phpEx . $filter_str . '&download=1&dir=' . urlencode($current_dir) . '&edit=' . urlencode($file)), 'CURRENT_DIR' => htmlspecialchars($current_dir_full), 'DIR' => htmlspecialchars($current_dir), 'FILE' => htmlspecialchars($file), 'FULLFILE' => htmlspecialchars($fullfile), 'CONTENT' => defined('DEMO_MODE') ? 'you cannot edit file in demo mode' : htmlspecialchars(implode('', @file($localfile))))); if ($current_dir_full) { $template->assign_block_vars('nav_left', array('ITEM' => '» <a href="' . append_sid('xs_edit.' . $phpEx . $filter_str . '&dir=' . $current_dir) . '">' . htmlspecialchars($current_dir_full) . '</a>')); } // show tree $arr = array(); $template->assign_block_vars('tree', array('ITEM' => 'phpBB', 'URL' => append_sid('xs_edit.' . $phpEx . $filter_str . '&dir='), 'SEPARATOR' => '')); $back_dir = ''; for ($i = 0; $i < count($dirs); $i++) { $arr[] = $dirs[$i]; $str = implode('/', $arr);