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_install.'.$phpEx) . '">' . $lang['xs_install_styles'] . '</a>'));
43 $lang['xs_install_back'] = str_replace('{URL}', append_sid('xs_install.'.$phpEx), $lang['xs_install_back']);
44 $lang['xs_goto_default'] = str_replace('{URL}', append_sid('xs_styles.'.$phpEx), $lang['xs_goto_default']);
46 // remove timeout. useful for forum with 100+ styles
47 @set_time_limit(XS_MAX_TIMEOUT);
50 if(!empty($HTTP_GET_VARS['style']) && !defined('DEMO_MODE'))
52 $style = stripslashes($HTTP_GET_VARS['style']);
53 $num = intval($HTTP_GET_VARS['num']);
54 $res = xs_install_style($style, $num);
57 if(defined('XS_MODS_CATEGORY_HIERARCHY'))
61 xs_message($lang['Information'], $lang['xs_install_installed'] . '<br /><br />' . $lang['xs_install_back'] . '<br /><br />' . $lang['xs_goto_default']);
63 xs_error($lang['xs_install_error'] . '<br /><br />' . $lang['xs_install_back']);
67 if(!empty($HTTP_POST_VARS['total']) && !defined('DEMO_MODE'))
71 $total = intval($HTTP_POST_VARS['total']);
72 for($i=0; $i<$total; $i++)
74 if(!empty($HTTP_POST_VARS['install_'.$i]))
76 $tpl[] = stripslashes($HTTP_POST_VARS['install_'.$i.'_style']);
77 $num[] = intval($HTTP_POST_VARS['install_'.$i.'_num']);
82 for($i=0; $i<count($tpl); $i++)
84 xs_install_style($tpl[$i], $num[$i]);
86 if(defined('XS_MODS_CATEGORY_HIERARCHY'))
90 xs_message($lang['Information'], $lang['xs_install_installed'] . '<br /><br />' . $lang['xs_install_back'] . '<br /><br />' . $lang['xs_goto_default']);
95 // get all installed styles
96 $sql = 'SELECT themes_id, template_name, style_name FROM ' . THEMES_TABLE . ' ORDER BY template_name';
97 if(!$result = $db->sql_query($sql))
99 xs_error($lang['xs_no_style_info'], __LINE__, __FILE__);
101 $style_rowset = $db->sql_fetchrowset($result);
103 // find all styles to install
104 $res = @opendir('../templates/');
106 while(($file = readdir($res)) !== false)
108 if($file !== '.' && $file !== '..' && @file_exists('../templates/'.$file.'/theme_info.cfg') && @file_exists('../templates/'.$file.'/'.$file.'.cfg'))
110 $arr = xs_get_themeinfo($file);
111 for($i=0; $i<count($arr); $i++)
113 if(isset($arr[$i]['template_name']) && $arr[$i]['template_name'] === $file)
115 $arr[$i]['num'] = $i;
116 $style = $arr[$i]['style_name'];
118 for($j=0; $j<count($style_rowset); $j++)
120 if($style_rowset[$j]['style_name'] == $style)
127 $styles[$arr[$i]['style_name']] = $arr[$i];
137 xs_message($lang['Information'], $lang['xs_install_none'] . '<br /><br />' . $lang['xs_goto_default']);
143 foreach($styles as $var => $value)
145 $row_class = $xs_row_class[$j % 2];
146 $template->assign_block_vars('styles', array(
147 'ROW_CLASS' => $row_class,
148 'STYLE' => htmlspecialchars($value['template_name']),
149 'THEME' => htmlspecialchars($value['style_name']),
150 'U_INSTALL' => append_sid('xs_install.'.$phpEx.'?style='.urlencode($value['template_name']).'&num='.$value['num']),
151 'CB_NAME' => 'install_'.$j,
152 'NUM' => $value['num'],
158 $template->assign_vars(array(
159 'U_INSTALL' => append_sid('xs_install.'.$phpEx),
160 'TOTAL' => count($styles)
163 $template->set_filenames(array('body' => XS_TPL_PATH . 'install.tpl'));
164 $template->pparse('body');