3 /***************************************************************************
6 * copyright : (C) 2003, 2004 CyberAlien
7 * support : http://www.phpbbstyles.com
12 * project revision : 51
13 * last modified : 25 Aug 2004 11:51:48
15 ***************************************************************************/
17 /***************************************************************************
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 ***************************************************************************/
26 define('IN_PHPBB', 1);
27 $phpbb_root_path = "./../";
28 $no_page_header = true;
29 require($phpbb_root_path . 'extension.inc');
30 require('./pagestart.' . $phpEx);
32 // check if mod is installed
33 if(empty($template->xs_version) || $template->xs_version !== 5)
35 message_die(GENERAL_ERROR, 'eXtreme Styles mod is not installed. You forgot to upload includes/template.php');
38 define('IN_XS', true);
39 include_once('xs_include.' . $phpEx);
41 $template->assign_block_vars('nav_left',array('ITEM' => '» <a href="' . append_sid('xs_import.'.$phpEx) . '">' . $lang['xs_import_styles'] . '</a>'));
42 $template->assign_block_vars('nav_left',array('ITEM' => '» <a href="' . append_sid('xs_download.'.$phpEx) . '">' . $lang['xs_download_styles'] . '</a>'));
45 if(isset($HTTP_GET_VARS['url']) && !defined('DEMO_MODE'))
47 $id = intval($HTTP_GET_VARS['url']);
48 $var = 'xs_downloads_' . $id;
50 'host' => $HTTP_SERVER_VARS['HTTP_HOST'],
51 'port' => $HTTP_SERVER_VARS['SERVER_PORT'],
52 'url' => str_replace('xs_download.', 'xs_frameset.', $HTTP_SERVER_VARS['PHP_SELF']),
53 'session' => $userdata['session_id'],
54 'xs' => $template->xs_versiontxt,
55 'style' => STYLE_HEADER_VERSION,
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>';
58 $message = $lang['xs_import_download_warning'] . '<br /><br />' . $str . '<br /><br />' . str_replace('{URL}', append_sid('xs_download.'.$phpEx), $lang['xs_download_back']);
59 xs_message($lang['Information'], $message);
63 if(isset($HTTP_GET_VARS['edit']))
65 $id = intval($HTTP_GET_VARS['edit']);
66 $template->assign_block_vars('edit', array(
68 'TITLE' => $board_config['xs_downloads_title_'.$id],
69 'URL' => $board_config['xs_downloads_'.$id]
73 if(isset($HTTP_POST_VARS['edit']) && !defined('DEMO_MODE'))
75 $id = intval($HTTP_POST_VARS['edit']);
77 if(!empty($HTTP_POST_VARS['edit_delete']))
80 $total = $board_config['xs_downloads_count'];
81 $update['xs_downloads_count'] = $total - 1;
82 for($i=$id; $i<($total-1); $i++)
84 $update['xs_downloads_'.$i] = $update['xs_downloads_'.($i+1)];
85 $update['xs_downloads_title_'.$i] = $update['xs_downloads_title_'.($i+1)];
87 $update['xs_downloads_'.($total-1)] = '';
88 $update['xs_downloads_title_'.($total-1)] = '';
92 $update['xs_downloads_'.$id] = stripslashes($HTTP_POST_VARS['edit_url']);
93 $update['xs_downloads_title_'.$id] = stripslashes($HTTP_POST_VARS['edit_title']);
95 foreach($update as $var => $value)
97 if(isset($board_config[$var]))
99 $sql = "UPDATE " . CONFIG_TABLE . " SET config_value='" . xs_sql($value) . "' WHERE config_name='" . $var . "'";
103 $sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('" . $var . "', '" . xs_sql($value) . "')";
105 $db->sql_query($sql);
106 $board_config[$var] = $value;
110 if(!empty($HTTP_POST_VARS['add_url']) && !defined('DEMO_MODE'))
112 $id = $board_config['xs_downloads_count'];
114 $update['xs_downloads_'.$id] = stripslashes($HTTP_POST_VARS['add_url']);
115 $update['xs_downloads_title_'.$id] = stripslashes($HTTP_POST_VARS['add_title']);
116 $update['xs_downloads_count'] = $board_config['xs_downloads_count'] + 1;
117 foreach($update as $var => $value)
119 if(isset($board_config[$var]))
121 $sql = "UPDATE " . CONFIG_TABLE . " SET config_value='" . xs_sql($value) . "' WHERE config_name='" . $var . "'";
125 $sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('" . $var . "', '" . xs_sql($value) . "')";
127 $db->sql_query($sql);
128 $board_config[$var] = $value;
132 for($i=0; $i<$board_config['xs_downloads_count']; $i++)
134 $row_class = $xs_row_class[$i % 2];
135 $template->assign_block_vars('url', array(
136 'ROW_CLASS' => $row_class,
139 'URL' => htmlspecialchars($board_config['xs_downloads_'.$i]),
140 'TITLE' => htmlspecialchars($board_config['xs_downloads_title_'.$i]),
141 'U_DOWNLOAD' => append_sid('xs_download.'.$phpEx.'?url='.$i),
142 'U_EDIT' => append_sid('xs_download.'.$phpEx.'?edit='.$i),
146 $template->assign_vars(array(
147 'U_POST' => append_sid('xs_download.'.$phpEx)
150 $template->set_filenames(array('body' => XS_TPL_PATH . 'downloads.tpl'));
151 $template->pparse('body');