Esempio n. 1
0
$list_only					= true if only list files
$get_file						= filename to get. empty if do not return any files
$_POST['total']								= total number of themes
$_POST['import_install_0']		= non-empty if install theme
$_POST['import_default']			= number of default style or -1 or empty
*/
if (empty($list_only)) {
    $list_only = false;
}
$lang['xs_import_back'] = str_replace('{URL}', append_sid('xs_import.' . PHP_EXT), $lang['xs_import_back']);
// list of text types. only last 4 characters of filename
$text_types = array('.tpl', '.htm', 'html', '.txt', '.css', '.cfg', '.php', '.xml');
// list of image types. if you add type make sure you add content-type header in code below
$img_types = array('.gif', '.jpg', '.jpe', 'jpeg', '.png');
$file = XS_TEMP_DIR . xs_fix_dir($filename);
$header = xs_get_style_header($file);
if ($header === false) {
    if (defined('XS_CLONING')) {
        @unlink($tmp_filename);
    }
    xs_error($lang['xs_style_header_error_reason'] . $xs_header_error . '<br /><br />' . $lang['xs_import_back']);
}
if ($header['filesize'] != filesize($file)) {
    if (defined('XS_CLONING')) {
        @unlink($tmp_filename);
    }
    xs_error($lang['xs_style_header_error_incomplete'] . '<br /><br />' . $lang['xs_import_back']);
}
$f = @fopen($file, 'rb');
if (!$f) {
    if (defined('XS_CLONING')) {
Esempio n. 2
0
    } else {
        $template->assign_block_vars('switch_select_nostyle', array());
    }
    $template->pparse('import');
    xs_exit();
}
$template->set_filenames(array('body' => XS_TPL_PATH . 'import.tpl'));
//
// Get list of available styles
//
$dir = @opendir(XS_TEMP_DIR);
$files = array();
if ($dir) {
    while (($file = readdir($dir)) !== false) {
        if (substr($file, strlen($file) - strlen(STYLE_EXTENSION)) === STYLE_EXTENSION) {
            $items = xs_get_style_header(XS_TEMP_DIR . $file);
            if (is_array($items)) {
                $items['file'] = $file;
                $items['file2'] = substr($file, 0, strlen($file) - strlen(STYLE_EXTENSION));
                if (@filesize(XS_TEMP_DIR . $file) != $items['filesize']) {
                    $items['error'] = $lang['xs_import_incomplete_file'];
                }
                $files[] = $items;
            } else {
                $items = array('filename' => XS_TEMP_DIR . $file, 'filesize' => @filesize(XS_TEMP_DIR . $file), 'date' => filemtime(XS_TEMP_DIR . $file), 'file' => $file, 'file2' => substr($file, 0, strlen($file) - strlen(STYLE_EXTENSION)), 'error' => $lang['xs_import_invalid_file'], 'template' => '-', 'styles' => array('-'), 'comment' => '', 'offset' => 0);
                $files[] = $items;
            }
        }
    }
    closedir($dir);
}