I think stoker is king but changeing the table i dont want to do i just want my home made ACP modules to save to a seperate table in my case phpbb_s5_controls ive allready got 900 lines and that will grow very fast as the latest theme that i did includes loads of features just having trouble with making it all save to a seperate table and not the config one
I hope thats understandable
Thanks
Dave
OK This is my page with loads removed i did leave one function and a couple of vars
What i need is the ability to save in seperate table as mentioned above and parse BBCode input box
Code: Select all
<?php
/**
* @package acp
* @version $Id: v3_modules.xml,v 1.5 2007/12/09 19:45:45 jelly_doughnut Exp $
* @copyright (c) 2007 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
if (!defined('IN_PHPBB'))
{
exit;
}
class acp_s5_controls
{
var $u_action;
function main($id, $mode)
{
global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('mods/acp_s5_controls');
$submit = isset($_POST['submit']) ? true : false;
$form_key = 'acp_s5_controls';
add_form_key($form_key);
$template->assign_vars(array(
'MODE' => $mode,
));
//Global
function s5_effects ($value, $key = '',$s5_effects_options = '')
{
$s5_effects_options .= '<option value="jquery"' . (($value == "jquery") ? ' selected="selected"' : '') . '>jQuery</option>
<option value="s5"' . (($value == "s5") ? ' selected="selected"' : '') . '>S5 Effects</option>';
return $s5_effects_options;
}
function s5_menu ($value, $key = '',$s5_menu_options = '')
{
$s5_menu_options .= '<option value="1"' . (($value == "1") ? ' selected="selected"' : '') . '>S5 Drop In No-MooMenu</option>
<option value="3"' . (($value == "3") ? ' selected="selected"' : '') . '>S5 Fading No-MooMenu</option>
<option value="4"' . (($value == "4") ? ' selected="selected"' : '') . '>S5 Scroll Down No-MooMenu</option>
<option value="2"' . (($value == "2") ? ' selected="selected"' : '') . '>Suckerfish</option>
<option value="5"' . (($value == "5") ? ' selected="selected"' : '') . '>No Menu</option>
';
return $s5_menu_options;
}
//Global
//Avignet
function avignet_board_type ($value, $key = '',$avignet_board_type_options = '')
{
$avignet_board_type_options .= '<option value="fixed"' . (($value == "fixed") ? ' selected="selected"' : '') . '>Fixed</option>
<option value="fluid"' . (($value == "fluid") ? ' selected="selected"' : '') . '>Fluid</option>';
return $avignet_board_type_options;
}
if ($mode == 'avignet')
{
$display_vars = array(
'vars' => array(
'legend1' => 'AVIGNET_LEGEND1',
'avignet_board_type' => array('lang' => 'AVIGNET_BOARD_TYPE','validate' => 'string', 'type' => 'select', 'function' => 'avignet_board_type', 'params' => array('{CONFIG_VALUE}'), 'explain' => true),
)
);
}
// Avignet Dream
// Global
if ($mode == 'global_settings')
{
$display_vars = array(
'vars' => array(
'legend1' => 'GLOBAL_LEGEND1',
'stylesheet_link' => array('lang' => 'STYLE_SHEET_LINK','validate' => 'bool','type' => 'radio:yes_no', 'explain' => true),
)
);
}
if (isset($display_vars['lang']))
{
$user->add_lang($display_vars['lang']);
}
$this->new_config = $config;
$cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
$error = array();
foreach ($display_vars['vars'] as $config_name => $null)
{
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
{
continue;
}
if ($config_name == 'auth_method')
{
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($config_name == 'email_function_name')
{
$this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
$this->new_config['email_function_name'] = (empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name'])) ? 'mail' : $this->new_config['email_function_name'];
$config_value = $this->new_config['email_function_name'];
}
if ($submit)
{
set_config($config_name, $config_value);
}
}
if ($mode == 'auth')
{
$auth_plugins = array();
$dp = @opendir($phpbb_root_path . 'includes/auth');
if ($dp)
{
while (($file = readdir($dp)) !== false)
{
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
{
$auth_plugins[] = basename(preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file));
}
}
closedir($dp);
sort($auth_plugins);
}
$updated_auth_settings = false;
$old_auth_config = array();
foreach ($auth_plugins as $method)
{
if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
{
include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
$method = 'acp_' . $method;
if (function_exists($method))
{
if ($fields = $method($this->new_config))
{
foreach ($fields['config'] as $field)
{
if (!isset($config[$field]))
{
set_config($field, '');
}
if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false)
{
continue;
}
$old_auth_config[$field] = $this->new_config[$field];
$config_value = $cfg_array[$field];
$this->new_config[$field] = $config_value;
if ($submit)
{
$updated_auth_settings = true;
set_config($field, $config_value);
}
}
}
unset($fields);
}
}
}
if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings))
{
$method = basename($cfg_array['auth_method']);
if ($method && in_array($method, $auth_plugins))
{
include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
$method = 'init_' . $method;
if (function_exists($method))
{
if ($error = $method())
{
foreach ($old_auth_config as $config_name => $config_value)
{
set_config($config_name, $config_value);
}
trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
}
}
set_config('auth_method', basename($cfg_array['auth_method']));
}
else
{
trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR);
}
}
}
if ($submit)
{
add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
$this->tpl_name = 'acp_s5_controls';
$template->assign_vars(array(
'S_ERROR' => (sizeof($error)) ? true : false,
'ERROR_MSG' => implode('<br />', $error),
'U_ACTION' => $this->u_action)
);
foreach ($display_vars['vars'] as $config_key => $vars)
{
if (!is_array($vars) && strpos($config_key, 'legend') === false)
{
continue;
}
if (strpos($config_key, 'legend') !== false)
{
$template->assign_block_vars('options', array(
'S_LEGEND' => true,
'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars)
);
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain']))
{
$l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
}
else if ($vars['explain'])
{
$l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
$template->assign_block_vars('options', array(
'KEY' => $config_key,
'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
'S_EXPLAIN' => $vars['explain'],
'TITLE_EXPLAIN' => $l_explain,
'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars),
)
);
unset($display_vars['vars'][$config_key]);
}
if ($mode == 'auth')
{
$template->assign_var('S_AUTH', true);
foreach ($auth_plugins as $method)
{
if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
{
$method = 'acp_' . $method;
if (function_exists($method))
{
$fields = $method($this->new_config);
if ($fields['tpl'])
{
$template->assign_block_vars('auth_tpl', array(
'TPL' => $fields['tpl'])
);
}
unset($fields);
}
}
}
}
}
}
?>
as allways any help is good help
Thanks
Dave