+++ /dev/null
-<?php\r
-\r
-/***************************************************************************\r
- * xs_style_config.php\r
- * -------------------\r
- * copyright : (C) 2003 - 2005 CyberAlien\r
- * support : http://www.phpbbstyles.com\r
- *\r
- * version : 2.3.1\r
- *\r
- * file revision : 72\r
- * project revision : 78\r
- * last modified : 05 Dec 2005 13:54:54\r
- *\r
- ***************************************************************************/\r
-\r
-/***************************************************************************\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- ***************************************************************************/\r
-\r
-define('IN_PHPBB', 1);\r
-$phpbb_root_path = "./../";\r
-$no_page_header = true;\r
-require($phpbb_root_path . 'extension.inc');\r
-require('./pagestart.' . $phpEx);\r
-\r
-// check if mod is installed\r
-if(empty($template->xs_version) || $template->xs_version !== 8)\r
-{\r
- 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
-}\r
-\r
-define('IN_XS', true);\r
-include_once('xs_include.' . $phpEx);\r
-\r
-$tpl = isset($HTTP_POST_VARS['tpl']) ? $HTTP_POST_VARS['tpl'] : (isset($HTTP_GET_VARS['tpl']) ? $HTTP_GET_VARS['tpl'] : '');\r
-$filename = $phpbb_root_path . 'templates/' . $tpl . '/xs_config.cfg';\r
-\r
-if(empty($tpl))\r
-{\r
- xs_error($lang['xs_invalid_style_name']);\r
-}\r
-if(!@file_exists($filename))\r
-{\r
- // remove from config\r
- $config_name = 'xs_style_' . $tpl;\r
- $sql = "DELETE FROM " . CONFIG_TABLE . " WHERE config_name='" . addslashes($config_name) . "'";\r
- $db->sql_query($sql);\r
- // recache config table for cat_hierarchy 2.1.0\r
- if(isset($GLOBALS['config']) && is_object($GLOBALS['config']))\r
- {\r
- global $config;\r
- $config->read(true);\r
- }\r
- $template->assign_block_vars('left_refresh', array(\r
- 'ACTION' => append_sid('index.' . $phpEx . '?pane=left')\r
- ));\r
- xs_error($lang['xs_invalid_style_name']);\r
-}\r
-\r
-// get configuration\r
-$style_config = array();\r
-include($filename);\r
-$data = $template->get_config($tpl, false);\r
-for($i=0; $i<count($style_config); $i++)\r
-{\r
- if(!isset($data[$style_config[$i]['var']]))\r
- {\r
- $data[$style_config[$i]['var']] = $style_config[$i]['default'];\r
- }\r
-}\r
-\r
-\r
-// check submitted form\r
-if(isset($HTTP_POST_VARS['tpl']) && !defined('DEMO_MODE'))\r
-{\r
- for($i=0; $i<count($style_config); $i++)\r
- {\r
- $item = &$style_config[$i];\r
- $var = $style_config[$i]['var'];\r
- if($item['type'] === 'list')\r
- {\r
- $value = isset($HTTP_POST_VARS['cfg_' . $var]) && is_array($HTTP_POST_VARS['cfg_' . $var]) ? $HTTP_POST_VARS['cfg_' . $var] : array();\r
- $list = array();\r
- foreach($value as $var1 => $value1)\r
- {\r
- $list[] = $var1;\r
- }\r
- $value = implode(',', $list);\r
- }\r
- else\r
- {\r
- $value = isset($HTTP_POST_VARS['cfg_' . $var]) ? stripslashes($HTTP_POST_VARS['cfg_' . $var]) : 0;\r
- }\r
- $data[$var] = $value;\r
- }\r
- // update config\r
- $str = $template->_serialize($data);\r
- $config_name = 'xs_style_' . $tpl;\r
- if(isset($board_config[$config_name]))\r
- {\r
- $sql = "UPDATE " . CONFIG_TABLE . " SET config_value='" . addslashes($str) . "' WHERE config_name='" . addslashes($config_name) . "'";\r
- }\r
- else\r
- {\r
- $sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('" . addslashes($config_name) . "', '" . addslashes($str) . "')";\r
- }\r
- $db->sql_query($sql);\r
- $board_config[$config_name] = $str;\r
- // recache config table for cat_hierarchy 2.1.0\r
- if(isset($config) && is_object($config))\r
- {\r
- $config->read(true);\r
- }\r
-}\r
-\r
-\r
-// show form\r
-$last_cat = '';\r
-for($i=0; $i<count($style_config); $i++)\r
-{\r
- $item = &$style_config[$i];\r
- $var = $style_config[$i]['var'];\r
- $template->assign_block_vars('item', array(\r
- 'VAR' => 'cfg_' . $var,\r
- 'VALUE' => htmlspecialchars($data[$var]),\r
- 'DEF' => $item['default'],\r
- 'TYPE' => $item['type'],\r
- 'TEXT' => htmlspecialchars($item['text']),\r
- 'EXPLAIN' => isset($item['explain']) ? $item['explain'] : '',\r
- ));\r
- if($item['type'] === 'select')\r
- {\r
- foreach($item['selection'] as $var1 => $value1)\r
- {\r
- $template->assign_block_vars('item.select', array(\r
- 'VALUE' => htmlspecialchars($var1),\r
- 'TEXT' => htmlspecialchars($value1),\r
- 'SELECTED' => $data[$var] === $var1 ? 1 : 0,\r
- ));\r
- }\r
- }\r
- if($item['type'] === 'list')\r
- {\r
- $values = explode(',', $data[$var]);\r
- foreach($item['selection'] as $var => $value)\r
- {\r
- $selected = false;\r
- for($j=0; $j<count($values); $j++)\r
- {\r
- if($values[$j] === $var)\r
- {\r
- $selected = true;\r
- }\r
- }\r
- $template->assign_block_vars('item.list', array(\r
- 'VALUE' => htmlspecialchars($var),\r
- 'TEXT' => htmlspecialchars($value),\r
- 'SELECTED' => $selected,\r
- ));\r
- $num++;\r
- }\r
- }\r
- if(!empty($item['cat']) && $item['cat'] !== $last_cat)\r
- {\r
- $template->assign_block_vars('item.cat', array(\r
- 'TEXT' => htmlspecialchars($item['cat'])\r
- ));\r
- $last_cat = $item['cat'];\r
- }\r
-}\r
-\r
-$template->assign_vars(array(\r
- 'TPL' => htmlspecialchars($tpl),\r
- 'U_FORM' => 'xs_style_config.'.$phpEx.'?sid='.$userdata['session_id'],\r
- ));\r
-\r
-$template->assign_block_vars('nav_left',array('ITEM' => '» <a href="' . append_sid('xs_style_config.'.$phpEx.'?tpl='.urlencode($tpl)) . '">' . $lang['xs_style_configuration'] . ': ' . $tpl . '</a>'));\r
-\r
-$template->set_filenames(array('body' => XS_TPL_PATH . 'style_config.tpl'));\r
-$template->pparse('body');\r
-xs_exit();\r
-\r
-?>
\ No newline at end of file