コード例 #1
0
            if ($sql1) {
                $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']);
コード例 #2
0
                if ($urls[$j] === $url) {
                    $found = true;
                }
            }
            if (!$found) {
                $urls[] = $url;
            }
        }
    }
    if (isset($updates[$var1]['data'])) {
        unset($updates[$var1]['data']);
    }
}
// showing error message if there is nothing to update
if (!count($urls)) {
    xs_error($lang['xs_update_nothing']);
}
@set_time_limit(intval($HTTP_POST_VARS['timeout']));
// getting data
for ($i = 0; $i < count($urls); $i++) {
    $arr = @file($urls[$i]);
    if (empty($arr)) {
        // cannot connect. show it as error message
        @reset($items);
        for ($j = 0; $j < count($items); $j++) {
            $item = $updates[$items[$j]];
            if ($item['update_url'] === $urls[$i]) {
                $updates[$items[$j]]['data']['error'] = $lang['xs_update_error_noconnect'];
            }
        }
    } else {
コード例 #3
0
    	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 = '';
$style_names = array();
$j = 0;
for ($i = 0; $i < sizeof($style_rowset); $i++) {
    $item = $style_rowset[$i];
    if ($item['template_name'] === $prev_tpl) {
        $style_names[] = htmlspecialchars($item['style_name']);
    } else {
        if ($prev_id > 0) {
            $str = implode('<br />', $style_names);
            $str2 = urlencode($prev_tpl);
            $row_class = $xs_row_class[$j % 2];
コード例 #4
0
ファイル: xs_import.php プロジェクト: puring0815/OpenKore
    }
    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 {
        $template->assign_block_vars('switch_select_nostyle', array());
    }
    $template->pparse('import');
    xs_exit();
}
$template->set_filenames(array('body' => XS_TPL_PATH . 'import.tpl'));
コード例 #5
0
        }
        if ($board_config[$var] !== $new[$var]) {
            if ($sql = set_config($var, xs_sql($new[$var]))) {
                xs_error(str_replace('{VAR}', $var, $lang['xs_config_sql_error']) . '<br /><br />' . $lang['xs_config_back'], __LINE__, __FILE__);
            }
            if ($var === 'xs_check_switches') {
                $update_time = true;
            }
        }
    }
    if ($update_time) {
        $board_config['xs_template_time'] = time() + 10;
        // set time 10 seconds in future in case if some tpl file would be compiled right now with current settings
        $sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $board_config['xs_template_time'] . "' WHERE config_name = 'xs_template_time'";
        if (!$db->sql_query($sql)) {
            xs_error(str_replace('{VAR}', 'xs_template_time', $lang['xs_config_sql_error']) . '<br /><br />' . $lang['xs_config_back'], __LINE__, __FILE__);
        }
    }
    $template->assign_block_vars('switch_updated', array());
    $template->load_config($template->root, false);
}
// check ftp configuration
$xs_ftp_host = $board_config['xs_ftp_host'];
if (empty($xs_ftp_host) && !empty($HTTP_SERVER_VARS['HTTP_HOST'])) {
    $str = $HTTP_SERVER_VARS['HTTP_HOST'];
    $template->assign_vars(array('HOST_GUESS' => str_replace(array('{HOST}', '{CLICK}'), array($str, 'document.config.xs_ftp_host.value=\'' . $str . '\''), $lang['xs_ftp_host_guess'])));
}
$dir = getcwd();
$xs_ftp_login = $board_config['xs_ftp_login'];
if (empty($xs_ftp_login)) {
    if (substr($dir, 0, 6) === '/home/') {
コード例 #6
0
ファイル: xs_include.php プロジェクト: Nekrofage/FJR
function get_ftp_config($action, $post = array(), $allow_local = false, $show_error = '')
{
    global $template, $board_config, $db, $lang, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
    $board_config['xs_ftp_local'] = false;
    // check if ftp can be used
    if (!@function_exists('ftp_connect')) {
        if ($allow_local && xs_dir_writable('../templates/')) {
            $board_config['xs_ftp_local'] = true;
            return true;
        }
        xs_error($lang['xs_ftp_error_fatal']);
    }
    // check if we have configuration
    if (!empty($HTTP_POST_VARS['get_ftp_config'])) {
        $vars = array('xs_ftp_host', 'xs_ftp_login', 'xs_ftp_path');
        for ($i = 0; $i < count($vars); $i++) {
            $var = $vars[$i];
            if ($board_config[$var] !== $HTTP_POST_VARS[$var]) {
                $board_config[$var] = stripslashes($HTTP_POST_VARS[$var]);
                $sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . xs_sql($board_config[$var]) . "' WHERE config_name = '{$var}'";
                $db->sql_query($sql);
            }
        }
        $board_config['xs_ftp_pass'] = stripslashes($HTTP_POST_VARS['xs_ftp_pass']);
        $board_config['xs_ftp_local'] = empty($HTTP_POST_VARS['xs_ftp_local']) ? false : true;
        // recache config table
        if (defined('XS_MODS_CATEGORY_HIERARCHY210')) {
            global $config;
            if (!empty($config)) {
                $config->read(true);
            }
        }
        return true;
    }
    // check ftp configuration
    $xs_ftp_host = $board_config['xs_ftp_host'];
    if (empty($xs_ftp_host)) {
        $str = $HTTP_SERVER_VARS['HTTP_HOST'];
        $template->assign_vars(array('HOST_GUESS' => str_replace(array('{HOST}', '{CLICK}'), array($str, 'document.ftp.xs_ftp_host.value=\'' . $str . '\''), $lang['xs_ftp_host_guess'])));
    }
    $dir = getcwd();
    $xs_ftp_login = $board_config['xs_ftp_login'];
    if (empty($xs_ftp_login)) {
        if (substr($dir, 0, 6) === '/home/') {
            $str = substr($dir, 6);
            $pos = strpos($str, '/');
            if ($pos) {
                $str = substr($str, 0, $pos);
                $template->assign_vars(array('LOGIN_GUESS' => str_replace(array('{LOGIN}', '{CLICK}'), array($str, 'document.ftp.xs_ftp_login.value=\'' . $str . '\''), $lang['xs_ftp_login_guess'])));
            }
        }
    }
    $xs_ftp_path = $board_config['xs_ftp_path'];
    if (empty($xs_ftp_path)) {
        if (substr($dir, 0, 6) === '/home/') {
        }
        $str = substr($dir, 6);
        $pos = strpos($str, '/');
        if ($pos) {
            $str = substr($str, $pos + 1);
            $pos = strrpos($str, 'admin');
            if ($pos) {
                $str = substr($str, 0, $pos - 1);
                $template->assign_vars(array('PATH_GUESS' => str_replace(array('{PATH}', '{CLICK}'), array($str, 'document.ftp.xs_ftp_path.value=\'' . $str . '\''), $lang['xs_ftp_path_guess'])));
            }
        }
    }
    if ($allow_local && xs_dir_writable('../templates/')) {
        $template->assign_block_vars('xs_ftp_local', array());
    } else {
        $template->assign_block_vars('xs_ftp_nolocal', array());
    }
    $str = '<input type="hidden" name="get_ftp_config" value="1" />';
    foreach ($post as $var => $value) {
        $str .= '<input type="hidden" name="' . htmlspecialchars($var) . '" value="' . htmlspecialchars($value) . '" />';
    }
    $template->assign_vars(array('FORM_ACTION' => $action, 'S_EXTRA_FIELDS' => $str, 'XS_FTP_HOST' => $xs_ftp_host, 'XS_FTP_LOGIN' => $xs_ftp_login, 'XS_FTP_PATH' => $xs_ftp_path));
    if ($show_error) {
        $template->assign_block_vars('error', array('MSG' => $show_error));
    }
    $template->set_filenames(array('config' => XS_TPL_PATH . 'ftp.tpl'));
    $template->pparse('config');
    return false;
}
コード例 #7
0
$filename = $phpbb_root_path . 'templates/' . $tpl . '/xs_config.cfg';
if (empty($tpl)) {
    xs_error($lang['xs_invalid_style_name']);
}
if (!@file_exists($filename)) {
    // remove from config
    $config_name = 'xs_style_' . $tpl;
    $sql = "DELETE FROM " . CONFIG_TABLE . " WHERE config_name='" . addslashes($config_name) . "'";
    $db->sql_query($sql);
    // recache config table for cat_hierarchy 2.1.0
    if (isset($GLOBALS['config']) && is_object($GLOBALS['config'])) {
        global $config;
        $config->read(true);
    }
    $template->assign_block_vars('left_refresh', array('ACTION' => append_sid('index.' . $phpEx . '?pane=left')));
    xs_error($lang['xs_invalid_style_name']);
}
// get configuration
$style_config = array();
include $filename;
$data = $template->get_config($tpl, false);
for ($i = 0; $i < count($style_config); $i++) {
    if (!isset($data[$style_config[$i]['var']])) {
        $data[$style_config[$i]['var']] = $style_config[$i]['default'];
    }
}
// check submitted form
if (isset($HTTP_POST_VARS['tpl']) && !defined('DEMO_MODE')) {
    for ($i = 0; $i < count($style_config); $i++) {
        $item =& $style_config[$i];
        $var = $style_config[$i]['var'];
コード例 #8
0
ファイル: xs_edit.php プロジェクト: puring0815/OpenKore
    $str = implode('/', $arr);
    if (count($dirs) > $i + 1) {
        $back_dir = $str;
    }
    $template->assign_block_vars('tree', array('ITEM' => htmlspecialchars($dirs[$i]), 'URL' => append_sid('xs_edit.' . $phpEx . $filter_str . '&dir=' . urlencode($str)), 'SEPARATOR' => '/'));
}
// get list of files/directories
$list_files = array();
// non-editable files
$list_files_editable = array();
// editable files
$list_dirs = array();
// directories
$res = @opendir('../' . $current_dir_full);
if (!$res) {
    xs_error(str_replace('{DIR}', $current_dir_full, $lang['xs_export_no_open_dir']) . '<br /><br />' . $return_url_root);
}
while (($file = readdir($res)) !== false) {
    if ($file !== '.' && $file !== '..') {
        $filename = '../' . ($current_dir_full ? $current_dir_full . '/' : '') . $file;
        if (is_dir($filename)) {
            $list_dirs[] = $file;
        } else {
            $pos = strrpos($file, '.');
            if ($pos !== false) {
                $ext = strtolower(substr($file, $pos));
                $ext1 = substr($ext, 1);
                if (!$filter_data['ext'] && xs_in_array($ext, $editable) || $ext1 === $filter_data['ext']) {
                    // check filter
                    if ($filter_data['data']) {
                        $content = @implode('', @file($filename));
コード例 #9
0
$result = $db->sql_query($sql);
if (!$result) {
    $total_users = 0;
} else {
    $total = $db->sql_fetchrow($result);
    $total_users = $total['total'];
}
$template->assign_vars(array('U_SCRIPT' => 'xs_styles.' . $phpEx, 'NUM_DEFAULT' => $num_default));
if ($total_users > $num_users) {
    // fix problem
    $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = NULL WHERE user_style NOT IN (' . implode(', ', $style_ids) . ')';
    $db->sql_query($sql);
}
//
// get list of users
//
if (isset($HTTP_GET_VARS['list'])) {
    $id = intval($HTTP_GET_VARS['list']);
    $template->assign_block_vars('list_users', array());
    $sql = "SELECT user_id, username FROM " . USERS_TABLE . " WHERE user_style='{$id}' ORDER BY username ASC";
    if (!($result = $db->sql_query($sql))) {
        xs_error('Could not get users list!', __LINE__, __FILE__);
    }
    $rowset = $db->sql_fetchrowset($result);
    for ($i = 0; $i < count($rowset); $i++) {
        $template->assign_block_vars('list_users.user', array('NUM' => $i + 1, 'ID' => $rowset[$i]['user_id'], 'NAME' => htmlspecialchars($rowset[$i]['username'])));
    }
}
$template->set_filenames(array('body' => 'styles.tpl'));
$template->pparse('body');
xs_exit();
コード例 #10
0
ファイル: xs_chmod.php プロジェクト: Nekrofage/FJR
$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']);
}