Page 1 of 1

Help Needed Plaese Two Questions (Textbox & Database)

Posted: 19 Jun 2010, 11:24
by MrDave10
OK i have two questions really and i hoping this is where i will get my answer lol
So i have my admin panel a big admin panel but several pages
my question is on the acp module i have a command like this

'aurora_dawn_modules_html1_block' => array('lang' => 'AURORA_DAWN_MODULES_HTML1_BLOCK', 'validate' => 'string','type' => 'text:57:5000:5','explain' => true),

this works and gives me a textbox
but i would like a textbox say 5 lines high so its easier to see the content thats in it
for example i have this
Image

but i would like this
Image

and my other question is currenty all my acp commands are stored in phpbb_config table
does any one have a script that will save all the vaiables to a custom table say phpbb_custom

Thanks
Dave :D

Re: Help Needed Plaese Two Questions (Textbox & Database)

Posted: 19 Jun 2010, 15:11
by cisco007
i don't know about the first question, but as for the second question if you did that then i think you would have to re-edit all the phpbb files that use the phpbb_config table and change it to phpbb_custom, since all the information for the settings come from the config table and so do the majority of the mods that get installed, otherwise you will just end up with problems!

Re: Help Needed Plaese Two Questions (Textbox & Database)

Posted: 21 Jun 2010, 15:04
by MrDave10
Thanks for replying i found the answer to my first question is was
validate' => 'string','type' => 'text:15:5000','explain' => true),
validate' => 'string','type' => 'textarea:15:5000','explain' => true),

yes thats what i thought and yes they are all stored in phpbb_config if i post my code could you tell me where to change or if anyone has a sample script that saves in a custom table that would be great but i have another question i need one of the admin options to parse BB code i know its possible and ive looked though loads of code but still cant get it to work

Thanks for your help
Dave

Re: Help Needed Plaese Two Questions (Textbox & Database)

Posted: 21 Jun 2010, 16:21
by MrDave10
or another idea is to make a sample script on this post and when its complete put it in the tutorials section but that will proberly require more than two people lol

Re: Help Needed Plaese Two Questions (Textbox & Database)

Posted: 21 Jun 2010, 17:29
by cisco007
like i said before if you change the phpbb_config table to something else you will have to go trough dozens of file to change that, i don't know if there is or if there could be a script to change it on all those files, maybe Stoker might have an answer I think he is part of the phpbb.com team!

Re: Help Needed Plaese Two Questions (Textbox & Database)

Posted: 21 Jun 2010, 17:47
by MrDave10
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

Re: Help Needed Plaese Two Questions (Textbox & Database)

Posted: 23 Jun 2010, 15:54
by MrDave10
OK 32 hours trying to get it to work still no luck i think i can get it to save in a seperate table just cant get it to parse bbcode like [img] and that please help me its really peeing me off lol

Re: Help Needed Plaese Two Questions (Textbox & Database)

Posted: 23 Jun 2010, 17:06
by cisco007
i have stated previously you will have to re-edit the majority of the files in the phpbb package so that it will pick up the new table, your best bet is to join the phpbb.com team and get with them!
:lol:

Re: Help Needed Plaese Two Questions (Textbox & Database)

Posted: 23 Jun 2010, 17:31
by MrDave10
OK thanks but i stated above i need to parse bbcode i dont think it would require that much editing surely lol
i just wish someone had a sample acp module with a bbcode box in it that whatever bbcode you put in it appears on my index page in a box
But thanks for your help ill ask at phpbb
Thanks
Dave