3 /***************************************************************************
\r
6 * copyright : (C) 2003 - 2005 CyberAlien
\r
7 * support : http://www.phpbbstyles.com
\r
11 * file revision : 72
\r
12 * project revision : 78
\r
13 * last modified : 05 Dec 2005 13:54:54
\r
15 ***************************************************************************/
\r
17 /***************************************************************************
\r
19 * This program is free software; you can redistribute it and/or modify
\r
20 * it under the terms of the GNU General Public License as published by
\r
21 * the Free Software Foundation; either version 2 of the License, or
\r
22 * (at your option) any later version.
\r
24 ***************************************************************************/
\r
26 define('IN_PHPBB', 1);
\r
27 $phpbb_root_path = "./../";
\r
28 $no_page_header = true;
\r
29 require($phpbb_root_path . 'extension.inc');
\r
30 require('./pagestart.' . $phpEx);
\r
32 // check if mod is installed
\r
33 if(empty($template->xs_version) || $template->xs_version !== 8)
\r
35 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');
\r
38 define('IN_XS', true);
\r
39 include_once('xs_include.' . $phpEx);
\r
41 $template->assign_block_vars('nav_left',array('ITEM' => '» <a href="' . append_sid('xs_import.'.$phpEx) . '">' . $lang['xs_import_styles'] . '</a>'));
\r
42 $template->assign_block_vars('nav_left',array('ITEM' => '» <a href="' . append_sid('xs_download.'.$phpEx) . '">' . $lang['xs_download_styles'] . '</a>'));
\r
45 if(isset($HTTP_GET_VARS['url']) && !defined('DEMO_MODE'))
\r
47 $id = intval($HTTP_GET_VARS['url']);
\r
48 $var = 'xs_downloads_' . $id;
\r
49 $import_data = array(
\r
50 'host' => $HTTP_SERVER_VARS['HTTP_HOST'],
\r
51 'port' => $HTTP_SERVER_VARS['SERVER_PORT'],
\r
52 'url' => str_replace('xs_download.', 'xs_frameset.', $HTTP_SERVER_VARS['PHP_SELF']),
\r
53 'session' => $userdata['session_id'],
\r
54 'xs' => $template->xs_versiontxt,
\r
55 'style' => STYLE_HEADER_VERSION,
\r
57 $str = '<form action="' . $board_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>';
\r
58 $message = $lang['xs_import_download_warning'] . '<br /><br />' . $str . '<br /><br />' . str_replace('{URL}', append_sid('xs_download.'.$phpEx), $lang['xs_download_back']);
\r
59 xs_message($lang['Information'], $message);
\r
63 if(isset($HTTP_GET_VARS['edit']))
\r
65 $id = intval($HTTP_GET_VARS['edit']);
\r
66 $template->assign_block_vars('edit', array(
\r
68 'TITLE' => $board_config['xs_downloads_title_'.$id],
\r
69 'URL' => $board_config['xs_downloads_'.$id]
\r
73 if(isset($HTTP_POST_VARS['edit']) && !defined('DEMO_MODE'))
\r
75 $id = intval($HTTP_POST_VARS['edit']);
\r
77 if(!empty($HTTP_POST_VARS['edit_delete']))
\r
80 $total = $board_config['xs_downloads_count'];
\r
81 $update['xs_downloads_count'] = $total - 1;
\r
82 for($i=$id; $i<($total-1); $i++)
\r
84 $update['xs_downloads_'.$i] = $update['xs_downloads_'.($i+1)];
\r
85 $update['xs_downloads_title_'.$i] = $update['xs_downloads_title_'.($i+1)];
\r
87 $update['xs_downloads_'.($total-1)] = '';
\r
88 $update['xs_downloads_title_'.($total-1)] = '';
\r
92 $update['xs_downloads_'.$id] = stripslashes($HTTP_POST_VARS['edit_url']);
\r
93 $update['xs_downloads_title_'.$id] = stripslashes($HTTP_POST_VARS['edit_title']);
\r
95 foreach($update as $var => $value)
\r
97 if(isset($board_config[$var]))
\r
99 $sql = "UPDATE " . CONFIG_TABLE . " SET config_value='" . xs_sql($value) . "' WHERE config_name='" . $var . "'";
\r
103 $sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('" . $var . "', '" . xs_sql($value) . "')";
\r
105 $db->sql_query($sql);
\r
106 $board_config[$var] = $value;
\r
108 // update config cache
\r
109 if(defined('XS_MODS_CATEGORY_HIERARCHY210'))
\r
111 if(!empty($config))
\r
113 $config->read(true);
\r
118 if(!empty($HTTP_POST_VARS['add_url']) && !defined('DEMO_MODE'))
\r
120 $id = $board_config['xs_downloads_count'];
\r
122 $update['xs_downloads_'.$id] = stripslashes($HTTP_POST_VARS['add_url']);
\r
123 $update['xs_downloads_title_'.$id] = stripslashes($HTTP_POST_VARS['add_title']);
\r
124 $update['xs_downloads_count'] = $board_config['xs_downloads_count'] + 1;
\r
125 foreach($update as $var => $value)
\r
127 if(isset($board_config[$var]))
\r
129 $sql = "UPDATE " . CONFIG_TABLE . " SET config_value='" . xs_sql($value) . "' WHERE config_name='" . $var . "'";
\r
133 $sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('" . $var . "', '" . xs_sql($value) . "')";
\r
135 $db->sql_query($sql);
\r
136 $board_config[$var] = $value;
\r
138 // update config cache
\r
139 if( defined('XS_MODS_CATEGORY_HIERARCHY210') && !empty($config) )
\r
141 $config->read(true);
\r
145 for($i=0; $i<$board_config['xs_downloads_count']; $i++)
\r
147 $row_class = $xs_row_class[$i % 2];
\r
148 $template->assign_block_vars('url', array(
\r
149 'ROW_CLASS' => $row_class,
\r
152 'URL' => htmlspecialchars($board_config['xs_downloads_'.$i]),
\r
153 'TITLE' => htmlspecialchars($board_config['xs_downloads_title_'.$i]),
\r
154 'U_DOWNLOAD' => append_sid('xs_download.'.$phpEx.'?url='.$i),
\r
155 'U_EDIT' => append_sid('xs_download.'.$phpEx.'?edit='.$i),
\r
159 $template->assign_vars(array(
\r
160 'U_POST' => append_sid('xs_download.'.$phpEx)
\r
163 $template->set_filenames(array('body' => XS_TPL_PATH . 'downloads.tpl'));
\r
164 $template->pparse('body');
\r