Esempio n. 1
0
                $sql1 .= ', ';
                $sql2 .= ', ';
            }
            $sql1 .= $db->sql_escape($var);
            $sql2 .= "'" . $db->sql_escape($value) . "'";
        }
        $sql = "INSERT INTO " . THEMES_TABLE . " (" . $sql1 . ") VALUES (" . $sql2 . ")";
    }
    $db->sql_return_on_error(true);
    $result = $db->sql_query($sql);
    $db->sql_return_on_error(false);
    if (!$result) {
        if (defined('XS_CLONING')) {
            @unlink($tmp_filename);
        }
        xs_error($lang['xs_import_notinstall5'] . '<br /><br />' . $lang['xs_import_back']);
    }
    if ($default_name === $style_name) {
        $sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '{$installed}' WHERE config_name = 'default_style'";
        $config['default_style'] = $installed;
        $db->sql_query($sql);
    }
}
if (defined('XS_CLONING')) {
    @unlink($tmp_filename);
}
if (sizeof($install)) {
    $db->clear_cache('styles_');
}
xs_message($lang['Information'], $lang['xs_import_installed'] . '<br /><br />' . $lang['xs_import_back']);
Esempio n. 2
0
        xs_error($lang['xs_style_header_error_invalid2'] . '<br /><br />' . $lang['xs_import_back']);
    }
    $header = xs_get_style_header('', substr($str, 0, 10240));
    if ($header === false) {
        xs_error($lang['xs_style_header_error_reason'] . $xs_header_error . '<br /><br />' . $lang['xs_import_back']);
    }
    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']) . $lang['xs_import_back']);
    }
    fwrite($f, $str);
    fclose($f);
    xs_message($lang['Information'], str_replace('{URL}', append_sid('xs_import.' . $phpEx . '?importstyle=' . urlencode($dst)), $lang['xs_import_uploaded3']) . '<br /><br />' . $lang['xs_import_back']);
}
//
// Upload
//
if (isset($HTTP_POST_VARS['action']) && $HTTP_POST_VARS['action'] === 'upload' && !defined('DEMO_MODE')) {
    if (empty($HTTP_POST_FILES['source']['tmp_name']) || !@file_exists($HTTP_POST_FILES['source']['tmp_name'])) {
        xs_error($lang['xs_import_nodownload3'] . '<br /><br />' . $lang['xs_import_back']);
    }
    $src = $HTTP_POST_FILES['source']['tmp_name'];
    $dst = generate_style_name('upload');
    $str = @implode('', @file($src));
    if (empty($str)) {
        xs_error(str_replace('{URL}', $src, $lang['xs_import_nodownload2']) . '<br /><br />' . $lang['xs_import_back']);
    }
    if (substr($str, 0, strlen(STYLE_HEADER_START)) !== STYLE_HEADER_START) {
Esempio n. 3
0
    // chdir to template directory
    $actions[] = array('command' => 'chdir', 'dir' => 'templates');
    $actions[] = array('command' => 'chdir', 'dir' => $export);
    $actions[] = array('command' => 'upload', 'local' => $local_filename, 'remote' => 'templates/' . $export . '/theme_info.cfg');
    $ftp_log = array();
    $ftp_error = '';
    $res = ftp_myexec($actions);
    /*	echo "<!--\n\n";
    	echo "\$actions dump:\n\n";
    	print_r($actions);
    	echo "\n\n\$ftp_log dump:\n\n";
    	print_r($ftp_log);
    	echo "\n\n -->"; */
    @unlink($local_filename);
    if ($res) {
        xs_message($lang['Information'], $lang['xs_export_data_saved'] . '<br /><br />' . $lang['xs_export_data_back']);
    }
    xs_error($ftp_error . '<br /><br />' . $lang['xs_export_data_back']);
}
$template->set_filenames(array('body' => XS_TPL_PATH . 'export_data.tpl'));
// get list of installed styles
$sql = 'SELECT themes_id, template_name, style_name FROM ' . THEMES_TABLE . ' ORDER BY template_name';
$db->sql_return_on_error(true);
$result = $db->sql_query($sql);
$db->sql_return_on_error(false);
if (!$result) {
    xs_error($lang['xs_no_style_info'], __LINE__, __FILE__);
}
$style_rowset = $db->sql_fetchrowset($result);
$prev_id = -1;
$prev_tpl = '';
Esempio n. 4
0
    for ($i = 0; $i < count($dirs); $i++) {
        $actions[] = array('command' => 'chdir', 'dir' => $dirs[$i]);
    }
    $actions[] = array('command' => 'upload', 'local' => $local_filename, 'remote' => $fullfile);
    $ftp_log = array();
    $ftp_error = '';
    $res = ftp_myexec($actions);
    echo "<!--\n\n";
    echo "\$actions dump:\n\n";
    print_r($actions);
    echo "\n\n\$ftp_log dump:\n\n";
    print_r($ftp_log);
    echo "\n\n -->";
    @unlink($local_filename);
    if ($res) {
        xs_message($lang['Information'], $lang['xs_edit_file_saved'] . '<br /><br />' . $return_url);
    }
    xs_error($ftp_error . '<br /><br />' . $return_url);
}
/*
* show edit form
*/
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')) {
Esempio n. 5
0
    $vars = array('style_name');
    $values = array($db->sql_escape($new_name));
    foreach ($theme as $var => $value) {
        if (!is_integer($var) && $var !== 'style_name' && $var !== 'themes_id') {
            $vars[] = $var;
            $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');
Esempio n. 6
0
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
$no_page_header = true;
require 'pagestart.' . PHP_EXT;
define('IN_XS', true);
include_once 'xs_include.' . PHP_EXT;
$template->assign_block_vars('nav_left', array('ITEM' => '&raquo; <a href="' . append_sid('xs_import.' . PHP_EXT) . '">' . $lang['xs_import_styles'] . '</a>'));
$template->assign_block_vars('nav_left', array('ITEM' => '&raquo; <a href="' . append_sid('xs_download.' . PHP_EXT) . '">' . $lang['xs_download_styles'] . '</a>'));
// submit url
if (isset($_GET['url']) && !defined('DEMO_MODE')) {
    $id = intval($_GET['url']);
    $var = 'xs_downloads_' . $id;
    $import_data = array('host' => $_SERVER['HTTP_HOST'], 'port' => $_SERVER['SERVER_PORT'], 'url' => str_replace('xs_download.', 'xs_frameset.', $_SERVER['SCRIPT_NAME']), 'session' => $user->data['session_id'], 'xs' => $template->xs_versiontxt, 'style' => STYLE_HEADER_VERSION);
    $str = '<form action="' . $config[$var] . '" method="post" style="display: inline;" target="main"><input type="hidden" name="data" value="' . htmlspecialchars(serialize($import_data)) . '" /><input type="submit" value="' . $lang['xs_continue'] . '" class="post" /></form>';
    $message = $lang['xs_import_download_warning'] . '<br /><br />' . $str . '<br /><br />' . str_replace('{URL}', append_sid('xs_download.' . PHP_EXT), $lang['xs_download_back']);
    xs_message($lang['Information'], $message);
}
if (isset($_GET['edit'])) {
    $id = intval($_GET['edit']);
    $template->assign_block_vars('edit', array('ID' => $id, 'TITLE' => $config['xs_downloads_title_' . $id], 'URL' => $config['xs_downloads_' . $id]));
}
if (isset($_POST['edit']) && !defined('DEMO_MODE')) {
    $id = intval($_POST['edit']);
    $update = array();
    if (!empty($_POST['edit_delete'])) {
        // delete link
        $total = $config['xs_downloads_count'];
        $update['xs_downloads_count'] = $total - 1;
        for ($i = $id; $i < $total - 1; $i++) {
            $update['xs_downloads_' . $i] = $update['xs_downloads_' . ($i + 1)];
            $update['xs_downloads_title_' . $i] = $update['xs_downloads_title_' . ($i + 1)];
Esempio n. 7
0
            if (isset($arr[$i]['template_name']) && $arr[$i]['template_name'] === $file) {
                $arr[$i]['num'] = $i;
                $style = $arr[$i]['style_name'];
                $found = false;
                for ($j = 0; $j < count($style_rowset); $j++) {
                    if ($style_rowset[$j]['style_name'] == $style) {
                        $found = true;
                    }
                }
                if (!$found) {
                    $styles[$arr[$i]['style_name']] = $arr[$i];
                }
            }
        }
    }
}
closedir($res);
if (!count($styles)) {
    xs_message($lang['Information'], $lang['xs_install_none'] . '<br /><br />' . $lang['xs_goto_default']);
}
ksort($styles);
$j = 0;
foreach ($styles as $var => $value) {
    $row_class = $xs_row_class[$j % 2];
    $template->assign_block_vars('styles', array('ROW_CLASS' => $row_class, 'STYLE' => htmlspecialchars($value['template_name']), 'THEME' => htmlspecialchars($value['style_name']), 'U_INSTALL' => append_sid('xs_install.' . $phpEx . '?style=' . urlencode($value['template_name']) . '&num=' . $value['num']), 'CB_NAME' => 'install_' . $j, 'NUM' => $value['num']));
    $j++;
}
$template->assign_vars(array('U_INSTALL' => append_sid('xs_install.' . $phpEx), 'TOTAL' => count($styles)));
$template->set_filenames(array('body' => XS_TPL_PATH . 'install.tpl'));
$template->pparse('body');
xs_exit();
Esempio n. 8
0
        }
        $res = @ftp_login($ftp, $ftp_login, $ftp_pass);
        if (!$res) {
            @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;
Esempio n. 9
0
$lang['xs_chmod_error1'] .= $lang['xs_chmod_return'];
if (defined('DEMO_MODE')) {
    xs_error($lang['xs_permission_denied']);
}
if (!get_ftp_config(append_sid('xs_chmod.' . $phpEx), array(), false)) {
    exit;
}
xs_ftp_connect(append_sid('xs_chmod.' . $phpEx), array(), true);
if ($ftp === XS_FTP_LOCAL) {
    @mkdir('../cache', 0777);
    @chmod('../cache', 0777);
    if (xs_dir_writable('../cache')) {
        xs_message($lang['Information'], $lang['xs_chmod_message1']);
    }
    xs_error($lang['xs_chmod_error1']);
}
$str = ftp_pwd($ftp);
if (strlen($str) && substr($str, strlen($str) - 1) !== '/') {
    $str .= '/';
}
$res = @ftp_site($ftp, "CHMOD 0777 {$str}cache");
if (!$res) {
    @ftp_mkdir($ftp, 'cache');
    $res = @ftp_site($ftp, "CHMOD 0777 {$str}cache");
}
@ftp_quit($ftp);
if ($res) {
    xs_message($lang['Information'], $lang['xs_chmod_message1']);
} else {
    xs_error($lang['xs_chmod_error1']);
}
Esempio n. 10
0
    if (!is_array($item)) {
        $sql = "INSERT INTO " . THEMES_NAME_TABLE . " (" . implode(',', $data_name_insert_vars) . ") VALUES ('" . implode("', '", $data_name_insert_values) . "')";
    } else {
        $sql = "UPDATE " . THEMES_NAME_TABLE . " SET " . implode(',', $data_name_update) . " WHERE themes_id='{$id}'";
    }
    $db->sql_query($sql);
    // regen themes cache
    if (defined('XS_MODS_CATEGORY_HIERARCHY210')) {
        if (empty($themes)) {
            $themes = new themes();
        }
        if (!empty($themes)) {
            $themes->read(true);
        }
    }
    xs_message($lang['Information'], $lang['xs_edittpl_style_updated'] . '<br /><br />' . $lang['xs_edittpl_back_edit'] . '<br /><br />' . $lang['xs_edittpl_back_list']);
}
//
// edit style
//
if (!empty($HTTP_GET_VARS['edit'])) {
    $id = intval($HTTP_GET_VARS['edit']);
    $sql = "SELECT * FROM " . THEMES_TABLE . " WHERE themes_id='{$id}'";
    if (!($result = $db->sql_query($sql))) {
        xs_error($lang['xs_no_style_info'], __LINE__, __FILE__);
    }
    $item = $db->sql_fetchrow($result);
    if (empty($item['themes_id'])) {
        xs_error($lang['xs_invalid_style_id'] . '<br /><br />' . $lang['xs_edittpl_back_list']);
    }
    $sql = "SELECT * FROM " . THEMES_NAME_TABLE . " WHERE themes_id='{$id}'";