예제 #1
0
        if (defined('DEMO_MODE')) {
            xs_error($lang['xs_permission_denied'] . '<br /><br />' . $lang['xs_import_back']);
        }
        $params = array('import' => $filename);
        $total = intval($HTTP_POST_VARS['total']);
        $params['total'] = $total;
        $params['import_default'] = isset($HTTP_POST_VARS['import_default']) && strlen($HTTP_POST_VARS['import_default']) ? intval($HTTP_POST_VARS['import_default']) : -1;
        for ($i = 0; $i < $total; $i++) {
            $install = empty($HTTP_POST_VARS['import_install_' . $i]) ? 0 : 1;
            $default = $install ? $params['import_default'] == $i ? 1 : 0 : 0;
            $params['import_install_' . $i] = $install;
        }
        if ($return_url) {
            $params['return'] = $return_url;
        }
        if (!get_ftp_config(append_sid('xs_import.' . $phpEx), $params, true)) {
            xs_exit();
        }
        xs_ftp_connect(append_sid('xs_import.' . $phpEx), $params, true);
        if ($ftp === XS_FTP_LOCAL) {
            $write_local = true;
            $write_local_dir = '../templates/';
        }
    }
    include 'xs_include_import2.' . $phpEx;
}
//
// Download from web
//
if (isset($HTTP_GET_VARS['get_web'])) {
    $HTTP_POST_VARS['action'] = 'web';
예제 #2
0
 $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']);
 }
 $write_local = false;
 if (!get_ftp_config(append_sid('xs_export_data.' . PHP_EXT), $params, true)) {
     xs_exit();
 }
 xs_ftp_connect(append_sid('xs_export_data.' . PHP_EXT), $params, true);
 if ($ftp === XS_FTP_LOCAL) {
     $write_local = true;
     $local_filename = '../templates/' . $export . '/theme_info.cfg';
 } else {
     $local_filename = XS_TEMP_DIR . 'export_' . time() . '.tmp';
 }
 // get all themes for style
 $export_list = array();
 for ($i = 0; $i < $total; $i++) {
     if (!empty($_POST['export_check_' . $i])) {
         $export_list[] = intval($_POST['export_id_' . $i]);
     }
예제 #3
0
function xs_ftp_connect($action, $post = array(), $allow_local = false)
{
    global $ftp, $board_config, $HTTP_POST_VARS, $phpEx, $lang, $template;
    $HTTP_POST_VARS['get_ftp_config'] = '';
    if ($allow_local && !empty($board_config['xs_ftp_local'])) {
        $ftp = XS_FTP_LOCAL;
        return true;
    }
    $ftp = @ftp_connect($board_config['xs_ftp_host']);
    if (!$ftp) {
        get_ftp_config($action, $post, $allow_local, str_replace('{HOST}', $board_config['xs_ftp_host'], $lang['xs_ftp_error_connect']));
    }
    $res = @ftp_login($ftp, $board_config['xs_ftp_login'], $board_config['xs_ftp_pass']);
    if (!$res) {
        get_ftp_config($action, $post, $allow_local, $lang['xs_ftp_error_login']);
    }
    $res = @ftp_chdir($ftp, $board_config['xs_ftp_path']);
    if (!$res) {
        get_ftp_config($action, $post, $allow_local, str_replace('{DIR}', $board_config['xs_ftp_path'], $lang['xs_ftp_error_chdir']));
    }
    // check current directory
    $current_dir = @ftp_pwd($ftp);
    $list = @ftp_nlist($ftp, $current_dir);
    for ($i = 0; $i < count($list); $i++) {
        $list[$i] = strtolower(basename($list[$i]));
    }
    // check few files
    $check = array('extension.inc', 'templates', 'xs_mod');
    $found = array(false, false, false);
    for ($i = 0; $i < count($list); $i++) {
        for ($j = 0; $j < count($check); $j++) {
            if ($list[$i] === $check[$j]) {
                $found[$j] = true;
            }
        }
    }
    $error = false;
    for ($i = 0; $i < count($check); $i++) {
        if (!$found[$i]) {
            $error = true;
        }
    }
    if ($error) {
        get_ftp_config($action, $post, $allow_local, $lang['xs_ftp_error_nonphpbbdir']);
    }
    $HTTP_POST_VARS['get_ftp_config'] = '1';
}
예제 #4
0
         $_POST['export_style_name_' . $i] = $_POST['clone_style_name_' . $i];
         // prepare for import
         $_POST['import_install_' . $count] = '1';
         $count++;
     }
 }
 if (!$count) {
     xs_error($lang['xs_clone_no_select'] . '<br /><br />' . $lang['xs_clone_back']);
 }
 $request = array();
 for ($i = 0; $i < sizeof($vars); $i++) {
     $request[$vars[$i]] = stripslashes($_POST[$vars[$i]]);
 }
 // get ftp configuration
 $write_local = false;
 if (!get_ftp_config(append_sid('xs_clone.' . PHP_EXT), $request, true)) {
     xs_exit();
 }
 xs_ftp_connect(append_sid('xs_clone.' . PHP_EXT), $request, true);
 if ($ftp === XS_FTP_LOCAL) {
     $write_local = true;
     $write_local_dir = '../templates/';
 }
 // prepare variables for export
 $export = $old_name;
 $exportas = $new_name;
 // Generate theme_info.cfg
 $sql = "SELECT * FROM " . THEMES_TABLE . " WHERE template_name = '{$export}' AND themes_id IN (" . implode(', ', $list) . ")";
 $db->sql_return_on_error(true);
 $result = $db->sql_query($sql);
 $db->sql_return_on_error(false);
예제 #5
0
    // remove files
    if (!empty($remove_dir)) {
        $remove_tpl = $row['template_name'];
    }
    // remove config
    if (empty($nocfg) && isset($config['xs_style_' . $row['template_name']])) {
        $sql = "DELETE FROM " . CONFIG_TABLE . " WHERE config_name='" . $db->sql_escape("xs_style_{$row['template_name']}") . "'";
        $db->sql_query($sql);
        $template->assign_block_vars('left_refresh', array('ACTION' => append_sid('index.' . PHP_EXT . '?pane=left')));
    }
}
// remove files
if (!empty($remove_tpl) && !defined('DEMO_MODE')) {
    $remove = $remove_tpl;
    $params = array('remove' => $remove);
    if (!get_ftp_config(append_sid('xs_uninstall.' . PHP_EXT), $params, true)) {
        xs_exit();
    }
    xs_ftp_connect(append_sid('xs_uninstall.' . PHP_EXT), $params, true);
    $write_local = false;
    if ($ftp === XS_FTP_LOCAL) {
        $write_local = true;
        $write_local_dir = '../templates/';
    }
    if (!$write_local) {
        // Generate actions list
        $actions = array();
        // chdir to templates directory
        $actions[] = array('command' => 'chdir', 'dir' => 'templates');
        // chdir to template
        $actions[] = array('command' => 'chdir', 'dir' => $remove);
예제 #6
0
                remove_all($str);
                @rmdir($str);
            } else {
                @unlink($str);
            }
        }
    }
    closedir($res);
}
//
// remove files
//
if (isset($HTTP_POST_VARS['remove']) && !defined('DEMO_MODE')) {
    $remove = stripslashes($HTTP_POST_VARS['remove']);
    $params = array('remove' => $remove);
    if (!get_ftp_config(append_sid('xs_uninstall.' . $phpEx), $params, true)) {
        xs_exit();
    }
    xs_ftp_connect(append_sid('xs_uninstall.' . $phpEx), $params, true);
    $write_local = false;
    if ($ftp === XS_FTP_LOCAL) {
        $write_local = true;
        $write_local_dir = '../templates/';
    }
    if (!$write_local) {
        //
        // Generate actions list
        //
        $actions = array();
        // chdir to templates directory
        $actions[] = array('command' => 'chdir', 'dir' => 'templates');
예제 #7
0
        if (defined('DEMO_MODE')) {
            xs_error($lang['xs_permission_denied'] . '<br /><br />' . $lang['xs_import_back']);
        }
        $params = array('import' => $filename);
        $total = intval($_POST['total']);
        $params['total'] = $total;
        $params['import_default'] = isset($_POST['import_default']) && strlen($_POST['import_default']) ? intval($_POST['import_default']) : -1;
        for ($i = 0; $i < $total; $i++) {
            $install = empty($_POST['import_install_' . $i]) ? 0 : 1;
            $default = $install ? $params['import_default'] == $i ? 1 : 0 : 0;
            $params['import_install_' . $i] = $install;
        }
        if ($return_url) {
            $params['return'] = $return_url;
        }
        if (!get_ftp_config(append_sid('xs_import.' . PHP_EXT), $params, true)) {
            xs_exit();
        }
        xs_ftp_connect(append_sid('xs_import.' . PHP_EXT), $params, true);
        if ($ftp === XS_FTP_LOCAL) {
            $write_local = true;
            $write_local_dir = '../templates/';
        }
    }
    include 'xs_include_import2.' . PHP_EXT;
}
//
// Download from web
//
if (isset($_GET['get_web'])) {
    $_POST['action'] = 'web';
예제 #8
0
파일: xs_chmod.php 프로젝트: Nekrofage/FJR
require './pagestart.' . $phpEx;
// check if mod is installed
if (empty($template->xs_version) || $template->xs_version !== 8) {
    message_die(GENERAL_ERROR, isset($lang['xs_error_not_installed']) ? $lang['xs_error_not_installed'] : 'eXtreme Styles mod is not installed. You forgot to upload includes/template.php');
}
define('IN_XS', true);
include_once 'xs_include.' . $phpEx;
$template->assign_block_vars('nav_left', array('ITEM' => '&raquo; <a href="' . append_sid('xs_config.' . $phpEx) . '">' . $lang['xs_configuration'] . '</a>'));
$template->assign_block_vars('nav_left', array('ITEM' => '&raquo; <a href="' . append_sid('xs_chmod.' . $phpEx) . '">' . $lang['xs_chmod'] . '</a>'));
$lang['xs_chmod_return'] = str_replace('{URL}', append_sid('xs_config.' . $phpEx), $lang['xs_chmod_return']);
$lang['xs_chmod_message1'] .= $lang['xs_chmod_return'];
$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 .= '/';
}
예제 #9
0
 $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']);
 }
 $write_local = false;
 if (!get_ftp_config(append_sid('xs_export_data.' . $phpEx), $params, true)) {
     xs_exit();
 }
 xs_ftp_connect(append_sid('xs_export_data.' . $phpEx), $params, true);
 if ($ftp === XS_FTP_LOCAL) {
     $write_local = true;
     $local_filename = '../templates/' . $export . '/theme_info.cfg';
 } else {
     $local_filename = XS_TEMP_DIR . 'export_' . time() . '.tmp';
 }
 // get all themes for style
 $export_list = array();
 for ($i = 0; $i < $total; $i++) {
     if (!empty($HTTP_POST_VARS['export_check_' . $i])) {
         $export_list[] = intval($HTTP_POST_VARS['export_id_' . $i]);
     }
예제 #10
0
         $HTTP_POST_VARS['export_style_name_' . $i] = $HTTP_POST_VARS['clone_style_name_' . $i];
         // prepare for import
         $HTTP_POST_VARS['import_install_' . $count] = '1';
         $count++;
     }
 }
 if (!$count) {
     xs_error($lang['xs_clone_no_select'] . '<br /><br />' . $lang['xs_clone_back']);
 }
 $request = array();
 for ($i = 0; $i < count($vars); $i++) {
     $request[$vars[$i]] = stripslashes($HTTP_POST_VARS[$vars[$i]]);
 }
 // get ftp configuration
 $write_local = false;
 if (!get_ftp_config(append_sid('xs_clone.' . $phpEx), $request, true)) {
     xs_exit();
 }
 xs_ftp_connect(append_sid('xs_clone.' . $phpEx), $request, true);
 if ($ftp === XS_FTP_LOCAL) {
     $write_local = true;
     $write_local_dir = '../templates/';
 }
 // prepare variables for export
 $export = $old_name;
 $exportas = $new_name;
 // 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_clone_back']);
 }
예제 #11
0
if (!defined('PHP_EXT')) {
    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_config.' . PHP_EXT) . '">' . $lang['xs_configuration'] . '</a>'));
$template->assign_block_vars('nav_left', array('ITEM' => '&raquo; <a href="' . append_sid('xs_chmod.' . PHP_EXT) . '">' . $lang['xs_chmod'] . '</a>'));
$lang['xs_chmod_return'] = str_replace('{URL}', append_sid('xs_config.' . PHP_EXT), $lang['xs_chmod_return']);
$lang['xs_chmod_message1'] .= $lang['xs_chmod_return'];
$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.' . PHP_EXT), array(), false)) {
    exit;
}
xs_ftp_connect(append_sid('xs_chmod.' . PHP_EXT), 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 .= '/';
}