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_install.'.$phpEx) . '">' . $lang['xs_install_styles'] . '</a>'));
\r
43 $lang['xs_install_back'] = str_replace('{URL}', append_sid('xs_install.'.$phpEx), $lang['xs_install_back']);
\r
44 $lang['xs_goto_default'] = str_replace('{URL}', append_sid('xs_styles.'.$phpEx), $lang['xs_goto_default']);
\r
46 // remove timeout. useful for forum with 100+ styles
\r
47 @set_time_limit(XS_MAX_TIMEOUT);
\r
50 if(!empty($HTTP_GET_VARS['style']) && !defined('DEMO_MODE'))
\r
52 $style = stripslashes($HTTP_GET_VARS['style']);
\r
53 $num = intval($HTTP_GET_VARS['num']);
\r
54 $res = xs_install_style($style, $num);
\r
55 if(defined('REFRESH_NAVBAR'))
\r
57 $template->assign_block_vars('left_refresh', array(
\r
58 'ACTION' => append_sid('index.' . $phpEx . '?pane=left')
\r
63 if(defined('XS_MODS_CATEGORY_HIERARCHY'))
\r
67 xs_message($lang['Information'], $lang['xs_install_installed'] . '<br /><br />' . $lang['xs_install_back'] . '<br /><br />' . $lang['xs_goto_default']);
\r
69 xs_error($lang['xs_install_error'] . '<br /><br />' . $lang['xs_install_back']);
\r
73 if(!empty($HTTP_POST_VARS['total']) && !defined('DEMO_MODE'))
\r
77 $total = intval($HTTP_POST_VARS['total']);
\r
78 for($i=0; $i<$total; $i++)
\r
80 if(!empty($HTTP_POST_VARS['install_'.$i]))
\r
82 $tpl[] = stripslashes($HTTP_POST_VARS['install_'.$i.'_style']);
\r
83 $num[] = intval($HTTP_POST_VARS['install_'.$i.'_num']);
\r
88 for($i=0; $i<count($tpl); $i++)
\r
90 xs_install_style($tpl[$i], $num[$i]);
\r
92 if(defined('REFRESH_NAVBAR'))
\r
94 $template->assign_block_vars('left_refresh', array(
\r
95 'ACTION' => append_sid('index.' . $phpEx . '?pane=left')
\r
98 if(defined('XS_MODS_CATEGORY_HIERARCHY'))
\r
102 xs_message($lang['Information'], $lang['xs_install_installed'] . '<br /><br />' . $lang['xs_install_back'] . '<br /><br />' . $lang['xs_goto_default']);
\r
107 // get all installed styles
\r
108 $sql = 'SELECT themes_id, template_name, style_name FROM ' . THEMES_TABLE . ' ORDER BY template_name';
\r
109 if(!$result = $db->sql_query($sql))
\r
111 xs_error($lang['xs_no_style_info'], __LINE__, __FILE__);
\r
113 $style_rowset = $db->sql_fetchrowset($result);
\r
115 // find all styles to install
\r
116 $res = @opendir('../templates/');
\r
118 while(($file = readdir($res)) !== false)
\r
120 if($file !== '.' && $file !== '..' && @file_exists('../templates/'.$file.'/theme_info.cfg') && @file_exists('../templates/'.$file.'/'.$file.'.cfg'))
\r
122 $arr = xs_get_themeinfo($file);
\r
123 for($i=0; $i<count($arr); $i++)
\r
125 if(isset($arr[$i]['template_name']) && $arr[$i]['template_name'] === $file)
\r
127 $arr[$i]['num'] = $i;
\r
128 $style = $arr[$i]['style_name'];
\r
130 for($j=0; $j<count($style_rowset); $j++)
\r
132 if($style_rowset[$j]['style_name'] == $style)
\r
139 $styles[$arr[$i]['style_name']] = $arr[$i];
\r
147 if(!count($styles))
\r
149 xs_message($lang['Information'], $lang['xs_install_none'] . '<br /><br />' . $lang['xs_goto_default']);
\r
155 foreach($styles as $var => $value)
\r
157 $row_class = $xs_row_class[$j % 2];
\r
158 $template->assign_block_vars('styles', array(
\r
159 'ROW_CLASS' => $row_class,
\r
160 'STYLE' => htmlspecialchars($value['template_name']),
\r
161 'THEME' => htmlspecialchars($value['style_name']),
\r
162 'U_INSTALL' => append_sid('xs_install.'.$phpEx.'?style='.urlencode($value['template_name']).'&num='.$value['num']),
\r
163 'CB_NAME' => 'install_'.$j,
\r
164 'NUM' => $value['num'],
\r
170 $template->assign_vars(array(
\r
171 'U_INSTALL' => append_sid('xs_install.'.$phpEx),
\r
172 'TOTAL' => count($styles)
\r
175 $template->set_filenames(array('body' => XS_TPL_PATH . 'install.tpl'));
\r
176 $template->pparse('body');
\r