Beispiel #1
0
    if ($header['filesize'] != strlen($str)) {
        xs_error($lang['xs_style_header_error_incomplete2'] . '<br /><br />' . $lang['xs_import_back']);
    }
    $f = @fopen(XS_TEMP_DIR . $dst, 'wb');
    if (!$f) {
        xs_error(str_replace('{FILE}', $dst, $lang['xs_error_cannot_create_tmp']) . '<br /><br />' . $lang['xs_import_back']);
    }
    fwrite($f, $str);
    fclose($f);
    xs_error(str_replace('{URL}', append_sid('xs_import.' . $phpEx . '?importstyle=' . urlencode($dst)), $lang['xs_import_uploaded4']) . '<br /><br />' . $lang['xs_import_back']);
}
//
// Show import page
//
if (!empty($HTTP_GET_VARS['importstyle'])) {
    $file = xs_tpl_name($HTTP_GET_VARS['importstyle']);
    $header = xs_get_style_header(XS_TEMP_DIR . $file);
    if ($header === false) {
        xs_error($lang['xs_style_header_error_reason'] . $xs_header_error . '<br /><br />' . $lang['xs_import_back']);
    }
    if (@filesize(XS_TEMP_DIR . $file) != $header['filesize']) {
        xs_error($lang['xs_style_header_error_incomplete2'] . '<br /><br />' . $lang['xs_import_back']);
    }
    $template->set_filenames(array('import' => XS_TPL_PATH . 'import2.tpl'));
    $template->assign_vars(array('FORM_ACTION' => append_sid('xs_import.' . $phpEx), 'S_RETURN' => $return_url ? '<input type="hidden" name="return" value="' . htmlspecialchars($return_url) . '" />' : '', 'IMPORT_FILENAME' => htmlspecialchars($file), 'STYLE_TEMPLATE' => htmlspecialchars($header['template']), 'STYLE_FILENAME' => htmlspecialchars($file), 'STYLE_COMMENT' => htmlspecialchars($header['comment']), 'DATE' => create_date($board_config['default_dateformat'], $header['date'], $board_config['board_timezone']), 'STYLE_SIZE' => $header['filesize'], 'STYLE_NAME' => htmlspecialchars($header['styles'][0]), 'TOTAL' => count($header['styles']), 'L_XS_IMPORT_TPL' => str_replace('{TPL}', htmlspecialchars($header['template']), $lang['xs_import_tpl'])));
    if (count($header['styles']) > 1) {
        $template->assign_block_vars('switch_select_style', array());
        for ($i = 0; $i < count($header['styles']); $i++) {
            $template->assign_block_vars('switch_select_style.style', array('NUM' => $i, 'NAME' => htmlspecialchars($header['styles'][$i])));
        }
    } else {
Beispiel #2
0
        $_POST['export_total'] = '1';
        $_POST['export_id_0'] = $theme_rowset[0]['themes_id'];
        $_POST['export_check_0'] = 'checked';
    } else {
        $template->set_filenames(array('body' => XS_TPL_PATH . 'export_data2.tpl'));
        $template->assign_vars(array('TOTAL' => sizeof($theme_rowset), 'EXPORT' => htmlspecialchars($export), 'U_ACTION' => append_sid("xs_export_data." . PHP_EXT)));
        for ($i = 0; $i < sizeof($theme_rowset); $i++) {
            $row_class = $xs_row_class[$i % 2];
            $template->assign_block_vars('styles', array('ROW_CLASS' => $row_class, 'NUM' => $i, 'ID' => $theme_rowset[$i]['themes_id'], 'STYLE' => htmlspecialchars($theme_rowset[$i]['style_name'])));
        }
        $template->pparse('body');
        xs_exit();
    }
}
if (!empty($_POST['export']) && !defined('DEMO_MODE')) {
    $export = xs_tpl_name($_POST['export']);
    // get ftp configuration
    $params = array('export' => $export);
    $total = intval($_POST['export_total']);
    $count = 0;
    for ($i = 0; $i < $total; $i++) {
        if (!empty($_POST['export_check_' . $i])) {
            $params['export_id_' . $count] = intval($_POST['export_id_' . $i]);
            $params['export_check_' . $count] = 'checked';
            $count++;
        }
    }
    $params['export_total'] = $count;
    if (!$count) {
        xs_error($lang['xs_export_noselect_themes'] . '<br /><br />' . $lang['xs_export_data_back']);
    }
Beispiel #3
0
            $values[] = $db->sql_escape($value);
        }
    }
    $sql = "INSERT INTO " . THEMES_TABLE . " (" . implode(', ', $vars) . ") VALUES ('" . implode("','", $values) . "')";
    $db->sql_return_on_error(true);
    $result = $db->sql_query($sql);
    $db->sql_return_on_error(false);
    if (!$result) {
        xs_error($lang['xs_error_new_row'] . '<br /><br />' . $lang['xs_clone_back'], __LINE__, __FILE__);
    }
    xs_message($lang['Information'], $lang['xs_theme_cloned'] . '<br /><br />' . $lang['xs_clone_back']);
}
// clone template
if (!empty($_POST['clone_tpl']) && !defined('DEMO_MODE')) {
    $old_name = xs_tpl_name($_POST['clone_tpl']);
    $new_name = xs_tpl_name($_POST['clone_style_name']);
    if (empty($new_name) || $new_name === $old_name) {
        xs_error($lang['xs_invalid_style_name'] . '<br /><br />' . $lang['xs_clone_back']);
    }
    // check if template exists
    if (@file_exists('../templates/' . $new_name)) {
        xs_error($lang['xs_clone_style_exists'] . '<br /><br />' . $lang['xs_clone_back']);
    }
    // check variables
    $total = intval($_POST['total']);
    $vars = array('clone_tpl', 'clone_style_name', 'total');
    $count = 0;
    $list = array();
    for ($i = 0; $i < $total; $i++) {
        $vars[] = 'clone_style_id_' . $i;
        $vars[] = 'clone_style_' . $i;
Beispiel #4
0
        xs_error($lang['xs_style_header_error_incomplete2'] . '<br /><br />' . $lang['xs_import_back']);
    }
    $f = @fopen(XS_TEMP_DIR . $dst, 'wb');
    if (!$f) {
        xs_error(str_replace('{FILE}', $dst, $lang['xs_error_cannot_create_tmp']) . '<br /><br />' . $lang['xs_import_back']);
    }
    fwrite($f, $str);
    fclose($f);
    //xs_error(str_replace('{URL}', append_sid('xs_import.' . PHP_EXT . '?importstyle=' . urlencode($dst)), $lang['xs_import_uploaded4']) . '<br /><br />' . $lang['xs_import_back']);
    xs_message($lang['Information'], str_replace('{URL}', append_sid('xs_import.' . PHP_EXT . '?importstyle=' . urlencode($dst)), $lang['xs_import_uploaded4']) . '<br /><br />' . $lang['xs_import_back']);
}
//
// Show import page
//
if (!empty($_GET['importstyle'])) {
    $file = xs_tpl_name($_GET['importstyle']);
    $header = xs_get_style_header(XS_TEMP_DIR . $file);
    if ($header === false) {
        xs_error($lang['xs_style_header_error_reason'] . $xs_header_error . '<br /><br />' . $lang['xs_import_back']);
    }
    if (@filesize(XS_TEMP_DIR . $file) != $header['filesize']) {
        xs_error($lang['xs_style_header_error_incomplete2'] . '<br /><br />' . $lang['xs_import_back']);
    }
    $template->set_filenames(array('import' => XS_TPL_PATH . 'import2.tpl'));
    $template->assign_vars(array('FORM_ACTION' => append_sid('xs_import.' . PHP_EXT), 'S_RETURN' => $return_url ? '<input type="hidden" name="return" value="' . htmlspecialchars($return_url) . '" />' : '', 'IMPORT_FILENAME' => htmlspecialchars($file), 'STYLE_TEMPLATE' => htmlspecialchars($header['template']), 'STYLE_FILENAME' => htmlspecialchars($file), 'STYLE_COMMENT' => htmlspecialchars($header['comment']), 'DATE' => create_date($config['default_dateformat'], $header['date'], $config['board_timezone']), 'STYLE_SIZE' => $header['filesize'], 'STYLE_NAME' => htmlspecialchars($header['styles'][0]), 'TOTAL' => sizeof($header['styles']), 'L_XS_IMPORT_TPL' => str_replace('{TPL}', htmlspecialchars($header['template']), $lang['xs_import_tpl'])));
    if (sizeof($header['styles']) > 1) {
        $template->assign_block_vars('switch_select_style', array());
        for ($i = 0; $i < sizeof($header['styles']); $i++) {
            $template->assign_block_vars('switch_select_style.style', array('NUM' => $i, 'NAME' => htmlspecialchars($header['styles'][$i])));
        }
    } else {
$export = xs_tpl_name($export);
if (!empty($export) && @file_exists($phpbb_root_path . $template_dir . $export . '/theme_info.cfg') && !defined('DEMO_MODE')) {
    $total = intval($HTTP_POST_VARS['total']);
    $comment = substr(stripslashes($HTTP_POST_VARS['export_comment']), 0, 255);
    $list = array();
    for ($i = 0; $i < $total; $i++) {
        if (!empty($HTTP_POST_VARS['export_style_' . $i])) {
            $list[] = intval($HTTP_POST_VARS['export_style_id_' . $i]);
        }
    }
    if (!count($list)) {
        xs_error($lang['xs_export_noselect_themes'] . '<br /><br /> ' . $lang['xs_export_back']);
    }
    // Export as...
    $exportas = empty($HTTP_POST_VARS['export_template']) ? $export : $HTTP_POST_VARS['export_template'];
    $exportas = xs_tpl_name($exportas);
    // Generate theme_info.cfg
    $sql = "SELECT * FROM " . THEMES_TABLE . " WHERE template_name = '{$export}' AND themes_id IN (" . implode(', ', $list) . ")";
    if (!($result = $db->sql_query($sql))) {
        xs_error($lang['xs_no_theme_data'] . $lang['xs_export_back']);
    }
    $theme_rowset = $db->sql_fetchrowset($result);
    if (count($theme_rowset) == 0) {
        xs_error($lang['xs_no_themes'] . '<br /><br />' . $lang['xs_export_back']);
    }
    $theme_data = xs_generate_themeinfo($theme_rowset, $export, $exportas, $total);
    // prepare to pack
    $pack_error = '';
    $pack_list = array();
    $pack_replace = array('./theme_info.cfg' => $theme_data);
    // pack style
        $HTTP_POST_VARS['export_total'] = '1';
        $HTTP_POST_VARS['export_id_0'] = $theme_rowset[0]['themes_id'];
        $HTTP_POST_VARS['export_check_0'] = 'checked';
    } else {
        $template->set_filenames(array('body' => 'export_data2.tpl'));
        $template->assign_vars(array('TOTAL' => count($theme_rowset), 'EXPORT' => htmlspecialchars($export), 'U_ACTION' => append_sid("xs_export_data.{$phpEx}")));
        for ($i = 0; $i < count($theme_rowset); $i++) {
            $row_class = $xs_row_class[$i % 2];
            $template->assign_block_vars('styles', array('ROW_CLASS' => $row_class, 'NUM' => $i, 'ID' => $theme_rowset[$i]['themes_id'], 'STYLE' => htmlspecialchars($theme_rowset[$i]['style_name'])));
        }
        $template->pparse('body');
        xs_exit();
    }
}
if (!empty($HTTP_POST_VARS['export']) && !defined('DEMO_MODE')) {
    $export = xs_tpl_name($HTTP_POST_VARS['export']);
    // get ftp configuration
    $params = array('export' => $export);
    $total = intval($HTTP_POST_VARS['export_total']);
    $count = 0;
    for ($i = 0; $i < $total; $i++) {
        if (!empty($HTTP_POST_VARS['export_check_' . $i])) {
            $params['export_id_' . $count] = intval($HTTP_POST_VARS['export_id_' . $i]);
            $params['export_check_' . $count] = 'checked';
            $count++;
        }
    }
    $params['export_total'] = $count;
    if (!$count) {
        xs_error($lang['xs_export_noselect_themes'] . '<br /><br />' . $lang['xs_export_data_back']);
    }
Beispiel #7
0
    if (defined('XS_MODS_CATEGORY_HIERARCHY210')) {
        if (empty($themes)) {
            $themes = new themes();
        }
        if (!empty($themes)) {
            $themes->read(true);
        }
    }
    xs_message($lang['Information'], $lang['xs_theme_cloned'] . '<br /><br />' . $lang['xs_clone_back']);
}
//
// clone template
//
if (!empty($HTTP_POST_VARS['clone_tpl']) && !defined('DEMO_MODE')) {
    $old_name = xs_tpl_name($HTTP_POST_VARS['clone_tpl']);
    $new_name = xs_tpl_name($HTTP_POST_VARS['clone_style_name']);
    if (empty($new_name) || $new_name === $old_name) {
        xs_error($lang['xs_invalid_style_name'] . '<br /><br />' . $lang['xs_clone_back']);
    }
    // check if template exists
    if (@file_exists('../templates/' . $new_name)) {
        xs_error($lang['xs_clone_style_exists'] . '<br /><br />' . $lang['xs_clone_back']);
    }
    // check variables
    $total = intval($HTTP_POST_VARS['total']);
    $vars = array('clone_tpl', 'clone_style_name', 'total');
    $count = 0;
    $list = array();
    for ($i = 0; $i < $total; $i++) {
        $vars[] = 'clone_style_id_' . $i;
        $vars[] = 'clone_style_' . $i;