|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
* @package install
|
|
|
4c79b5 |
* @version $Id: install_install.php 9041 2008-11-02 11:19:12Z acydburn $
|
|
|
4c79b5 |
* @copyright (c) 2005 phpBB Group
|
|
|
4c79b5 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
if (!defined('IN_INSTALL'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Someone has tried to access the file direct. This is not a good idea, so exit
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!empty($setmodules))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// If phpBB is already installed we do not include this module
|
|
|
4c79b5 |
if (@file_exists($phpbb_root_path . 'config.' . $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
include_once($phpbb_root_path . 'config.' . $phpEx);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (defined('PHPBB_INSTALLED'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
return;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$module[] = array(
|
|
|
4c79b5 |
'module_type' => 'install',
|
|
|
4c79b5 |
'module_title' => 'INSTALL',
|
|
|
4c79b5 |
'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1),
|
|
|
4c79b5 |
'module_order' => 10,
|
|
|
4c79b5 |
'module_subs' => '',
|
|
|
4c79b5 |
'module_stages' => array('INTRO', 'REQUIREMENTS', 'DATABASE', 'ADMINISTRATOR', 'CONFIG_FILE', 'ADVANCED', 'CREATE_TABLE', 'FINAL'),
|
|
|
4c79b5 |
'module_reqs' => ''
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Installation
|
|
|
4c79b5 |
* @package install
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
class install_install extends module
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
function install_install(&$p_master)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$this->p_master = &$p_master;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function main($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $lang, $template, $language, $phpbb_root_path;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ($sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case 'intro':
|
|
|
4c79b5 |
$this->page_title = $lang['SUB_INTRO'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'TITLE' => $lang['INSTALL_INTRO'],
|
|
|
4c79b5 |
'BODY' => $lang['INSTALL_INTRO_BODY'],
|
|
|
4c79b5 |
'L_SUBMIT' => $lang['NEXT_STEP'],
|
|
|
4c79b5 |
'S_LANG_SELECT' => '<select id="language" name="language">' . $this->p_master->inst_language_select($language) . '</select>',
|
|
|
4c79b5 |
'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=requirements&language=$language",
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'requirements':
|
|
|
4c79b5 |
$this->check_server_requirements($mode, $sub);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'database':
|
|
|
4c79b5 |
$this->obtain_database_settings($mode, $sub);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'administrator':
|
|
|
4c79b5 |
$this->obtain_admin_settings($mode, $sub);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'config_file':
|
|
|
4c79b5 |
$this->create_config_file($mode, $sub);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'advanced':
|
|
|
4c79b5 |
$this->obtain_advanced_settings($mode, $sub);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'create_table':
|
|
|
4c79b5 |
$this->load_schema($mode, $sub);
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'final':
|
|
|
4c79b5 |
$this->build_search_index($mode, $sub);
|
|
|
4c79b5 |
$this->add_modules($mode, $sub);
|
|
|
4c79b5 |
$this->add_language($mode, $sub);
|
|
|
4c79b5 |
$this->add_bots($mode, $sub);
|
|
|
4c79b5 |
$this->email_admin($mode, $sub);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Remove the lock file
|
|
|
4c79b5 |
@unlink($phpbb_root_path . 'cache/install_lock');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->tpl_name = 'install_install';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Checks that the server we are installing on meets the requirements for running phpBB
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function check_server_requirements($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $lang, $template, $phpbb_root_path, $phpEx, $language;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->page_title = $lang['STAGE_REQUIREMENTS'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'TITLE' => $lang['REQUIREMENTS_TITLE'],
|
|
|
4c79b5 |
'BODY' => $lang['REQUIREMENTS_EXPLAIN'],
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$passed = array('php' => false, 'db' => false, 'files' => false, 'pcre' => false, 'imagesize' => false,);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Test for basic PHP settings
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang['PHP_SETTINGS'],
|
|
|
4c79b5 |
'LEGEND_EXPLAIN' => $lang['PHP_SETTINGS_EXPLAIN'],
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Test the minimum PHP version
|
|
|
4c79b5 |
$php_version = PHP_VERSION;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (version_compare($php_version, '4.3.3') < 0)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['NO'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$passed['php'] = true;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// We also give feedback on whether we're running in safe mode
|
|
|
4c79b5 |
$result = '' . $lang['YES'];
|
|
|
4c79b5 |
if (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) == 'on')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result .= ', ' . $lang['PHP_SAFE_MODE'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$result .= '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['PHP_VERSION_REQD'],
|
|
|
4c79b5 |
'RESULT' => $result,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check for register_globals being enabled
|
|
|
4c79b5 |
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['NO'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['YES'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['PHP_REGISTER_GLOBALS'],
|
|
|
4c79b5 |
'TITLE_EXPLAIN' => $lang['PHP_REGISTER_GLOBALS_EXPLAIN'],
|
|
|
4c79b5 |
'RESULT' => $result,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => true,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check for url_fopen
|
|
|
4c79b5 |
if (@ini_get('allow_url_fopen') == '1' || strtolower(@ini_get('allow_url_fopen')) == 'on')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['YES'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['NO'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['PHP_URL_FOPEN_SUPPORT'],
|
|
|
4c79b5 |
'TITLE_EXPLAIN' => $lang['PHP_URL_FOPEN_SUPPORT_EXPLAIN'],
|
|
|
4c79b5 |
'RESULT' => $result,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => true,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check for getimagesize
|
|
|
4c79b5 |
if (@function_exists('getimagesize'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$passed['imagesize'] = true;
|
|
|
4c79b5 |
$result = '' . $lang['YES'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['NO'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['PHP_GETIMAGESIZE_SUPPORT'],
|
|
|
4c79b5 |
'TITLE_EXPLAIN' => $lang['PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'],
|
|
|
4c79b5 |
'RESULT' => $result,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => true,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check for PCRE UTF-8 support
|
|
|
4c79b5 |
if (@preg_match('//u', ''))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$passed['pcre'] = true;
|
|
|
4c79b5 |
$result = '' . $lang['YES'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['NO'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['PCRE_UTF_SUPPORT'],
|
|
|
4c79b5 |
'TITLE_EXPLAIN' => $lang['PCRE_UTF_SUPPORT_EXPLAIN'],
|
|
|
4c79b5 |
'RESULT' => $result,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => true,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Better not enabling and adding to the loaded extensions due to the specific requirements needed
|
|
|
4c79b5 |
if (!@extension_loaded('mbstring'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
can_load_dll('mbstring');
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$passed['mbstring'] = true;
|
|
|
4c79b5 |
if (@extension_loaded('mbstring'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Test for available database modules
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang['MBSTRING_CHECK'],
|
|
|
4c79b5 |
'LEGEND_EXPLAIN' => $lang['MBSTRING_CHECK_EXPLAIN'],
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$checks = array(
|
|
|
4c79b5 |
array('func_overload', '&', MB_OVERLOAD_MAIL|MB_OVERLOAD_STRING),
|
|
|
4c79b5 |
array('encoding_translation', '!=', 0),
|
|
|
4c79b5 |
array('http_input', '!=', 'pass'),
|
|
|
4c79b5 |
array('http_output', '!=', 'pass')
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($checks as $mb_checks)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$ini_val = @ini_get('mbstring.' . $mb_checks[0]);
|
|
|
4c79b5 |
switch ($mb_checks[1])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case '&':
|
|
|
4c79b5 |
if (intval($ini_val) & $mb_checks[2])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['NO'] . '';
|
|
|
4c79b5 |
$passed['mbstring'] = false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['YES'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case '!=':
|
|
|
4c79b5 |
if ($ini_val != $mb_checks[2])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['NO'] . '';
|
|
|
4c79b5 |
$passed['mbstring'] = false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$result = '' . $lang['YES'] . '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['MBSTRING_' . strtoupper($mb_checks[0])],
|
|
|
4c79b5 |
'TITLE_EXPLAIN' => $lang['MBSTRING_' . strtoupper($mb_checks[0]) . '_EXPLAIN'],
|
|
|
4c79b5 |
'RESULT' => $result,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => true,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Test for available database modules
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang['PHP_SUPPORTED_DB'],
|
|
|
4c79b5 |
'LEGEND_EXPLAIN' => $lang['PHP_SUPPORTED_DB_EXPLAIN'],
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$available_dbms = get_available_dbms(false, true);
|
|
|
4c79b5 |
$passed['db'] = $available_dbms['ANY_DB_SUPPORT'];
|
|
|
4c79b5 |
unset($available_dbms['ANY_DB_SUPPORT']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($available_dbms as $db_name => $db_ary)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!$db_ary['AVAILABLE'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['DLL_' . strtoupper($db_name)],
|
|
|
4c79b5 |
'RESULT' => '' . $lang['UNAVAILABLE'] . '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['DLL_' . strtoupper($db_name)],
|
|
|
4c79b5 |
'RESULT' => '' . $lang['AVAILABLE'] . '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Test for other modules
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang['PHP_OPTIONAL_MODULE'],
|
|
|
4c79b5 |
'LEGEND_EXPLAIN' => $lang['PHP_OPTIONAL_MODULE_EXPLAIN'],
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($this->php_dlls_other as $dll)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!@extension_loaded($dll))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!can_load_dll($dll))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['DLL_' . strtoupper($dll)],
|
|
|
4c79b5 |
'RESULT' => '' . $lang['UNAVAILABLE'] . '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['DLL_' . strtoupper($dll)],
|
|
|
4c79b5 |
'RESULT' => '' . $lang['AVAILABLE'] . '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Can we find Imagemagick anywhere on the system?
|
|
|
4c79b5 |
$exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$magic_home = getenv('MAGICK_HOME');
|
|
|
4c79b5 |
$img_imagick = '';
|
|
|
4c79b5 |
if (empty($magic_home))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/');
|
|
|
4c79b5 |
$path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH'))));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$locations = array_merge($path_locations, $locations);
|
|
|
4c79b5 |
foreach ($locations as $location)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// The path might not end properly, fudge it
|
|
|
4c79b5 |
if (substr($location, -1, 1) !== '/')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$location .= '/';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (@file_exists($location) && @is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$img_imagick = str_replace('\\', '/', $location);
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$img_imagick = str_replace('\\', '/', $magic_home);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['APP_MAGICK'],
|
|
|
4c79b5 |
'RESULT' => ($img_imagick) ? '' . $lang['AVAILABLE'] . ', ' . $img_imagick . '' : '' . $lang['NO_LOCATION'] . '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check permissions on files/directories we need access to
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang['FILES_REQUIRED'],
|
|
|
4c79b5 |
'LEGEND_EXPLAIN' => $lang['FILES_REQUIRED_EXPLAIN'],
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$directories = array('cache/', 'files/', 'store/');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
umask(0);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$passed['files'] = true;
|
|
|
4c79b5 |
foreach ($directories as $dir)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$exists = $write = false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Try to create the directory if it does not exist
|
|
|
4c79b5 |
if (!file_exists($phpbb_root_path . $dir))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
@mkdir($phpbb_root_path . $dir, 0777);
|
|
|
4c79b5 |
phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Now really check
|
|
|
4c79b5 |
if (file_exists($phpbb_root_path . $dir) && is_dir($phpbb_root_path . $dir))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE);
|
|
|
4c79b5 |
$exists = true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Now check if it is writable by storing a simple file
|
|
|
4c79b5 |
$fp = @fopen($phpbb_root_path . $dir . 'test_lock', 'wb');
|
|
|
4c79b5 |
if ($fp !== false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$write = true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
@fclose($fp);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
@unlink($phpbb_root_path . $dir . 'test_lock');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$passed['files'] = ($exists && $write && $passed['files']) ? true : false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$exists = ($exists) ? '' . $lang['FOUND'] . '' : '' . $lang['NOT_FOUND'] . '';
|
|
|
4c79b5 |
$write = ($write) ? ', ' . $lang['WRITABLE'] . '' : (($exists) ? ', ' . $lang['UNWRITABLE'] . '' : '');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $dir,
|
|
|
4c79b5 |
'RESULT' => $exists . $write,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check permissions on files/directories it would be useful access to
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang['FILES_OPTIONAL'],
|
|
|
4c79b5 |
'LEGEND_EXPLAIN' => $lang['FILES_OPTIONAL_EXPLAIN'],
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$directories = array('config.' . $phpEx, 'images/avatars/upload/');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($directories as $dir)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$write = $exists = true;
|
|
|
4c79b5 |
if (file_exists($phpbb_root_path . $dir))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!@is_writable($phpbb_root_path . $dir))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$write = false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$write = $exists = false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$exists_str = ($exists) ? '' . $lang['FOUND'] . '' : '' . $lang['NOT_FOUND'] . '';
|
|
|
4c79b5 |
$write_str = ($write) ? ', ' . $lang['WRITABLE'] . '' : (($exists) ? ', ' . $lang['UNWRITABLE'] . '' : '');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $dir,
|
|
|
4c79b5 |
'RESULT' => $exists_str . $write_str,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// And finally where do we want to go next (well today is taken isn't it :P)
|
|
|
4c79b5 |
$s_hidden_fields = ($img_imagick) ? '<input type="hidden" name="img_imagick" value="' . addslashes($img_imagick) . '" />' : '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$url = (!in_array(false, $passed)) ? $this->p_master->module_url . "?mode=$mode&sub=database&language=$language" : $this->p_master->module_url . "?mode=$mode&sub=requirements&language=$language ";
|
|
|
4c79b5 |
$submit = (!in_array(false, $passed)) ? $lang['INSTALL_START'] : $lang['INSTALL_TEST'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'L_SUBMIT' => $submit,
|
|
|
4c79b5 |
'S_HIDDEN' => $s_hidden_fields,
|
|
|
4c79b5 |
'U_ACTION' => $url,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Obtain the information required to connect to the database
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function obtain_database_settings($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $lang, $template, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->page_title = $lang['STAGE_DATABASE'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Obtain any submitted data
|
|
|
4c79b5 |
$data = $this->get_submitted_data();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$connect_test = false;
|
|
|
4c79b5 |
$error = array();
|
|
|
4c79b5 |
$available_dbms = get_available_dbms(false, true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Has the user opted to test the connection?
|
|
|
4c79b5 |
if (isset($_POST['testdb']))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!isset($available_dbms[$data['dbms']]) || !$available_dbms[$data['dbms']]['AVAILABLE'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error['db'][] = $lang['INST_ERR_NO_DB'];
|
|
|
4c79b5 |
$connect_test = false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$connect_test = connect_check_db(true, $error, $available_dbms[$data['dbms']], $data['table_prefix'], $data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport']);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang['DB_CONNECTION'],
|
|
|
4c79b5 |
'LEGEND_EXPLAIN' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($connect_test)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['DB_TEST'],
|
|
|
4c79b5 |
'RESULT' => '' . $lang['SUCCESSFUL_CONNECT'] . '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['DB_TEST'],
|
|
|
4c79b5 |
'RESULT' => '' . implode(' ', $error) . '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$connect_test)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Update the list of available DBMS modules to only contain those which can be used
|
|
|
4c79b5 |
$available_dbms_temp = array();
|
|
|
4c79b5 |
foreach ($available_dbms as $type => $dbms_ary)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!$dbms_ary['AVAILABLE'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$available_dbms_temp[$type] = $dbms_ary;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$available_dbms = &$available_dbms_temp;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// And now for the main part of this page
|
|
|
4c79b5 |
$data['table_prefix'] = (!empty($data['table_prefix']) ? $data['table_prefix'] : 'phpbb_');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($this->db_config_options as $config_key => $vars)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!is_array($vars) && strpos($config_key, 'legend') === false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (strpos($config_key, 'legend') !== false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('options', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang[$vars])
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$options = isset($vars['options']) ? $vars['options'] : '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('options', array(
|
|
|
4c79b5 |
'KEY' => $config_key,
|
|
|
4c79b5 |
'TITLE' => $lang[$vars['lang']],
|
|
|
4c79b5 |
'S_EXPLAIN' => $vars['explain'],
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '',
|
|
|
4c79b5 |
'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options),
|
|
|
4c79b5 |
)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// And finally where do we want to go next (well today is taken isn't it :P)
|
|
|
4c79b5 |
$s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
|
|
|
4c79b5 |
$s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />';
|
|
|
4c79b5 |
if ($connect_test)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
foreach ($this->db_config_options as $config_key => $vars)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!is_array($vars))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$url = ($connect_test) ? $this->p_master->module_url . "?mode=$mode&sub=administrator" : $this->p_master->module_url . "?mode=$mode&sub=database";
|
|
|
4c79b5 |
$s_hidden_fields .= ($connect_test) ? '' : '<input type="hidden" name="testdb" value="true" />';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$submit = $lang['NEXT_STEP'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'L_SUBMIT' => $submit,
|
|
|
4c79b5 |
'S_HIDDEN' => $s_hidden_fields,
|
|
|
4c79b5 |
'U_ACTION' => $url,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Obtain the administrator's name, password and email address
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function obtain_admin_settings($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $lang, $template, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->page_title = $lang['STAGE_ADMINISTRATOR'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Obtain any submitted data
|
|
|
4c79b5 |
$data = $this->get_submitted_data();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['dbms'] == '')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Someone's been silly and tried calling this page direct
|
|
|
4c79b5 |
// So we send them back to the start to do it again properly
|
|
|
4c79b5 |
$this->p_master->redirect("index.$phpEx?mode=install");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
|
|
|
4c79b5 |
$passed = false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$data['default_lang'] = ($data['default_lang'] !== '') ? $data['default_lang'] : $data['language'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (isset($_POST['check']))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check the entered email address and password
|
|
|
4c79b5 |
if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email1'] == '' || $data['board_email2'] == '')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = $lang['INST_ERR_MISSING_DATA'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['admin_pass1'] != $data['admin_pass2'] && $data['admin_pass1'] != '')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = $lang['INST_ERR_PASSWORD_MISMATCH'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Test against the default username rules
|
|
|
4c79b5 |
if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) < 3)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = $lang['INST_ERR_USER_TOO_SHORT'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) > 20)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = $lang['INST_ERR_USER_TOO_LONG'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Test against the default password rules
|
|
|
4c79b5 |
if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) < 6)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = $lang['INST_ERR_PASSWORD_TOO_SHORT'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) > 30)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = $lang['INST_ERR_PASSWORD_TOO_LONG'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['board_email1'] != $data['board_email2'] && $data['board_email1'] != '')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = $lang['INST_ERR_EMAIL_MISMATCH'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['board_email1'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email1']))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = $lang['INST_ERR_EMAIL_INVALID'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang['STAGE_ADMINISTRATOR'],
|
|
|
4c79b5 |
'LEGEND_EXPLAIN' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!sizeof($error))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$passed = true;
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['ADMIN_TEST'],
|
|
|
4c79b5 |
'RESULT' => '' . $lang['TESTS_PASSED'] . '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('checks', array(
|
|
|
4c79b5 |
'TITLE' => $lang['ADMIN_TEST'],
|
|
|
4c79b5 |
'RESULT' => '' . implode(' ', $error) . '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_EXPLAIN' => false,
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$passed)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
foreach ($this->admin_config_options as $config_key => $vars)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!is_array($vars) && strpos($config_key, 'legend') === false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (strpos($config_key, 'legend') !== false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('options', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang[$vars])
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$options = isset($vars['options']) ? $vars['options'] : '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('options', array(
|
|
|
4c79b5 |
'KEY' => $config_key,
|
|
|
4c79b5 |
'TITLE' => $lang[$vars['lang']],
|
|
|
4c79b5 |
'S_EXPLAIN' => $vars['explain'],
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '',
|
|
|
4c79b5 |
'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options),
|
|
|
4c79b5 |
)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
foreach ($this->admin_config_options as $config_key => $vars)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!is_array($vars))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$s_hidden_fields .= ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
|
|
|
4c79b5 |
$s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($this->db_config_options as $config_key => $vars)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!is_array($vars))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$submit = $lang['NEXT_STEP'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$url = ($passed) ? $this->p_master->module_url . "?mode=$mode&sub=config_file" : $this->p_master->module_url . "?mode=$mode&sub=administrator";
|
|
|
4c79b5 |
$s_hidden_fields .= ($passed) ? '' : '<input type="hidden" name="check" value="true" />';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'L_SUBMIT' => $submit,
|
|
|
4c79b5 |
'S_HIDDEN' => $s_hidden_fields,
|
|
|
4c79b5 |
'U_ACTION' => $url,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Writes the config file to disk, or if unable to do so offers alternative methods
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function create_config_file($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $lang, $template, $phpbb_root_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->page_title = $lang['STAGE_CONFIG_FILE'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Obtain any submitted data
|
|
|
4c79b5 |
$data = $this->get_submitted_data();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['dbms'] == '')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Someone's been silly and tried calling this page direct
|
|
|
4c79b5 |
// So we send them back to the start to do it again properly
|
|
|
4c79b5 |
$this->p_master->redirect("index.$phpEx?mode=install");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
|
|
|
4c79b5 |
$s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />';
|
|
|
4c79b5 |
$written = false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Create a list of any PHP modules we wish to have loaded
|
|
|
4c79b5 |
$load_extensions = array();
|
|
|
4c79b5 |
$available_dbms = get_available_dbms($data['dbms']);
|
|
|
4c79b5 |
$check_exts = array_merge(array($available_dbms[$data['dbms']]['MODULE']), $this->php_dlls_other);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($check_exts as $dll)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!@extension_loaded($dll))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!can_load_dll($dll))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$load_extensions[] = $dll . '.' . PHP_SHLIB_SUFFIX;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Create a lock file to indicate that there is an install in progress
|
|
|
4c79b5 |
$fp = @fopen($phpbb_root_path . 'cache/install_lock', 'wb');
|
|
|
4c79b5 |
if ($fp === false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// We were unable to create the lock file - abort
|
|
|
4c79b5 |
$this->p_master->error($lang['UNABLE_WRITE_LOCK'], __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
@fclose($fp);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
@chmod($phpbb_root_path . 'cache/install_lock', 0777);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$load_extensions = implode(',', $load_extensions);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Time to convert the data provided into a config file
|
|
|
4c79b5 |
$config_data = "
|
|
|
4c79b5 |
$config_data .= "// phpBB 3.0.x auto-generated configuration file\n// Do not change anything in this file!\n";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$config_data_array = array(
|
|
|
4c79b5 |
'dbms' => $available_dbms[$data['dbms']]['DRIVER'],
|
|
|
4c79b5 |
'dbhost' => $data['dbhost'],
|
|
|
4c79b5 |
'dbport' => $data['dbport'],
|
|
|
4c79b5 |
'dbname' => $data['dbname'],
|
|
|
4c79b5 |
'dbuser' => $data['dbuser'],
|
|
|
4c79b5 |
'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']),
|
|
|
4c79b5 |
'table_prefix' => $data['table_prefix'],
|
|
|
4c79b5 |
'acm_type' => 'file',
|
|
|
4c79b5 |
'load_extensions' => $load_extensions,
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($config_data_array as $key => $value)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$config_data .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
unset($config_data_array);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$config_data .= "\n@define('PHPBB_INSTALLED', true);\n";
|
|
|
4c79b5 |
$config_data .= "// @define('DEBUG', true);\n";
|
|
|
4c79b5 |
$config_data .= "// @define('DEBUG_EXTRA', true);\n";
|
|
|
4c79b5 |
$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Attempt to write out the config file directly. If it works, this is the easiest way to do it ...
|
|
|
4c79b5 |
if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx)) || is_writable($phpbb_root_path))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Assume it will work ... if nothing goes wrong below
|
|
|
4c79b5 |
$written = true;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($fp = @fopen($phpbb_root_path . 'config.' . $phpEx, 'w')))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Something went wrong ... so let's try another method
|
|
|
4c79b5 |
$written = false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!(@fwrite($fp, $config_data)))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Something went wrong ... so let's try another method
|
|
|
4c79b5 |
$written = false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
@fclose($fp);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($written)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// We may revert back to chmod() if we see problems with users not able to change their config.php file directly
|
|
|
4c79b5 |
phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (isset($_POST['dldone']))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Do a basic check to make sure that the file has been uploaded
|
|
|
4c79b5 |
// Note that all we check is that the file has _something_ in it
|
|
|
4c79b5 |
// We don't compare the contents exactly - if they can't upload
|
|
|
4c79b5 |
// a single file correctly, it's likely they will have other problems....
|
|
|
4c79b5 |
if (filesize($phpbb_root_path . 'config.' . $phpEx) > 10)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$written = true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$config_options = array_merge($this->db_config_options, $this->admin_config_options);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($config_options as $config_key => $vars)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!is_array($vars))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$written)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// OK, so it didn't work let's try the alternatives
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (isset($_POST['dlconfig']))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// They want a copy of the file to download, so send the relevant headers and dump out the data
|
|
|
4c79b5 |
header("Content-Type: text/x-delimtext; name=\"config.$phpEx\"");
|
|
|
4c79b5 |
header("Content-disposition: attachment; filename=config.$phpEx");
|
|
|
4c79b5 |
echo $config_data;
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// The option to download the config file is always available, so output it here
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'BODY' => $lang['CONFIG_FILE_UNABLE_WRITE'],
|
|
|
4c79b5 |
'L_DL_CONFIG' => $lang['DL_CONFIG'],
|
|
|
4c79b5 |
'L_DL_CONFIG_EXPLAIN' => $lang['DL_CONFIG_EXPLAIN'],
|
|
|
4c79b5 |
'L_DL_DONE' => $lang['DONE'],
|
|
|
4c79b5 |
'L_DL_DOWNLOAD' => $lang['DL_DOWNLOAD'],
|
|
|
4c79b5 |
'S_HIDDEN' => $s_hidden_fields,
|
|
|
4c79b5 |
'S_SHOW_DOWNLOAD' => true,
|
|
|
4c79b5 |
'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=config_file",
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
return;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'BODY' => $lang['CONFIG_FILE_WRITTEN'],
|
|
|
4c79b5 |
'L_SUBMIT' => $lang['NEXT_STEP'],
|
|
|
4c79b5 |
'S_HIDDEN' => $s_hidden_fields,
|
|
|
4c79b5 |
'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=advanced",
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
return;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Provide an opportunity to customise some advanced settings during the install
|
|
|
4c79b5 |
* in case it is necessary for them to be set to access later
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function obtain_advanced_settings($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $lang, $template, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->page_title = $lang['STAGE_ADVANCED'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Obtain any submitted data
|
|
|
4c79b5 |
$data = $this->get_submitted_data();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['dbms'] == '')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Someone's been silly and tried calling this page direct
|
|
|
4c79b5 |
// So we send them back to the start to do it again properly
|
|
|
4c79b5 |
$this->p_master->redirect("index.$phpEx?mode=install");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
|
|
|
4c79b5 |
$s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// HTTP_HOST is having the correct browser url in most cases...
|
|
|
4c79b5 |
$server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// HTTP HOST can carry a port number...
|
|
|
4c79b5 |
if (strpos($server_name, ':') !== false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$server_name = substr($server_name, 0, strpos($server_name, ':'));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$data['email_enable'] = ($data['email_enable'] !== '') ? $data['email_enable'] : true;
|
|
|
4c79b5 |
$data['server_name'] = ($data['server_name'] !== '') ? $data['server_name'] : $server_name;
|
|
|
4c79b5 |
$data['server_port'] = ($data['server_port'] !== '') ? $data['server_port'] : ((!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'));
|
|
|
4c79b5 |
$data['server_protocol'] = ($data['server_protocol'] !== '') ? $data['server_protocol'] : ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://');
|
|
|
4c79b5 |
$data['cookie_secure'] = ($data['cookie_secure'] !== '') ? $data['cookie_secure'] : ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? true : false);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['script_path'] === '')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
|
|
|
4c79b5 |
if (!$name)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Replace backslashes and doubled slashes (could happen on some proxy setups)
|
|
|
4c79b5 |
$name = str_replace(array('\\', '//', '/install'), '/', $name);
|
|
|
4c79b5 |
$data['script_path'] = trim(dirname($name));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($this->advanced_config_options as $config_key => $vars)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!is_array($vars) && strpos($config_key, 'legend') === false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (strpos($config_key, 'legend') !== false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('options', array(
|
|
|
4c79b5 |
'S_LEGEND' => true,
|
|
|
4c79b5 |
'LEGEND' => $lang[$vars])
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$options = isset($vars['options']) ? $vars['options'] : '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('options', array(
|
|
|
4c79b5 |
'KEY' => $config_key,
|
|
|
4c79b5 |
'TITLE' => $lang[$vars['lang']],
|
|
|
4c79b5 |
'S_EXPLAIN' => $vars['explain'],
|
|
|
4c79b5 |
'S_LEGEND' => false,
|
|
|
4c79b5 |
'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '',
|
|
|
4c79b5 |
'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options),
|
|
|
4c79b5 |
)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$config_options = array_merge($this->db_config_options, $this->admin_config_options);
|
|
|
4c79b5 |
foreach ($config_options as $config_key => $vars)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!is_array($vars))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$submit = $lang['NEXT_STEP'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$url = $this->p_master->module_url . "?mode=$mode&sub=create_table";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'BODY' => $lang['STAGE_ADVANCED_EXPLAIN'],
|
|
|
4c79b5 |
'L_SUBMIT' => $submit,
|
|
|
4c79b5 |
'S_HIDDEN' => $s_hidden_fields,
|
|
|
4c79b5 |
'U_ACTION' => $url,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Load the contents of the schema into the database and then alter it based on what has been input during the installation
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function load_schema($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $db, $lang, $template, $phpbb_root_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->page_title = $lang['STAGE_CREATE_TABLE'];
|
|
|
4c79b5 |
$s_hidden_fields = '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Obtain any submitted data
|
|
|
4c79b5 |
$data = $this->get_submitted_data();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['dbms'] == '')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Someone's been silly and tried calling this page direct
|
|
|
4c79b5 |
// So we send them back to the start to do it again properly
|
|
|
4c79b5 |
$this->p_master->redirect("index.$phpEx?mode=install");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// HTTP_HOST is having the correct browser url in most cases...
|
|
|
4c79b5 |
$server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
|
|
|
4c79b5 |
$referer = (!empty($_SERVER['HTTP_REFERER'])) ? strtolower($_SERVER['HTTP_REFERER']) : getenv('HTTP_REFERER');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// HTTP HOST can carry a port number...
|
|
|
4c79b5 |
if (strpos($server_name, ':') !== false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$server_name = substr($server_name, 0, strpos($server_name, ':'));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$cookie_domain = ($data['server_name'] != '') ? $data['server_name'] : $server_name;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Try to come up with the best solution for cookie domain...
|
|
|
4c79b5 |
if (strpos($cookie_domain, 'www.') === 0)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$cookie_domain = str_replace('www.', '.', $cookie_domain);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// If we get here and the extension isn't loaded it should be safe to just go ahead and load it
|
|
|
4c79b5 |
$available_dbms = get_available_dbms($data['dbms']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!isset($available_dbms[$data['dbms']]))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Someone's been silly and tried providing a non-existant dbms
|
|
|
4c79b5 |
$this->p_master->redirect("index.$phpEx?mode=install");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$dbms = $available_dbms[$data['dbms']]['DRIVER'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Load the appropriate database class if not already loaded
|
|
|
4c79b5 |
include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Instantiate the database
|
|
|
4c79b5 |
$db = new $sql_db();
|
|
|
4c79b5 |
$db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// NOTE: trigger_error does not work here.
|
|
|
4c79b5 |
$db->sql_return_on_error(true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// If mysql is chosen, we need to adjust the schema filename slightly to reflect the correct version. ;)
|
|
|
4c79b5 |
if ($data['dbms'] == 'mysql')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (version_compare($db->sql_server_info(true), '4.1.3', '>='))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$available_dbms[$data['dbms']]['SCHEMA'] .= '_41';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$available_dbms[$data['dbms']]['SCHEMA'] .= '_40';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Ok we have the db info go ahead and read in the relevant schema
|
|
|
4c79b5 |
// and work on building the table
|
|
|
4c79b5 |
$dbms_schema = 'schemas/' . $available_dbms[$data['dbms']]['SCHEMA'] . '_schema.sql';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// How should we treat this schema?
|
|
|
4c79b5 |
$remove_remarks = $available_dbms[$data['dbms']]['COMMENTS'];
|
|
|
4c79b5 |
$delimiter = $available_dbms[$data['dbms']]['DELIM'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_query = @file_get_contents($dbms_schema);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$remove_remarks($sql_query);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_query = split_sql_file($sql_query, $delimiter);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($sql_query as $sql)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
//$sql = trim(str_replace('|', ';', $sql));
|
|
|
4c79b5 |
if (!$db->sql_query($sql))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = $db->sql_error();
|
|
|
4c79b5 |
$this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
unset($sql_query);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Ok tables have been built, let's fill in the basic information
|
|
|
4c79b5 |
$sql_query = file_get_contents('schemas/schema_data.sql');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Deal with any special comments
|
|
|
4c79b5 |
switch ($data['dbms'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case 'mssql':
|
|
|
4c79b5 |
case 'mssql_odbc':
|
|
|
4c79b5 |
$sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query);
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'postgres':
|
|
|
4c79b5 |
$sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query);
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Change prefix
|
|
|
4c79b5 |
$sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Change language strings...
|
|
|
4c79b5 |
$sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', 'adjust_language_keys_callback', $sql_query);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Since there is only one schema file we know the comment style and are able to remove it directly with remove_remarks
|
|
|
4c79b5 |
remove_remarks($sql_query);
|
|
|
4c79b5 |
$sql_query = split_sql_file($sql_query, ';');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($sql_query as $sql)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
//$sql = trim(str_replace('|', ';', $sql));
|
|
|
4c79b5 |
if (!$db->sql_query($sql))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = $db->sql_error();
|
|
|
4c79b5 |
$this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
unset($sql_query);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$current_time = time();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user_ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['script_path'] !== '/')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Adjust destination path (no trailing slash)
|
|
|
4c79b5 |
if (substr($data['script_path'], -1) == '/')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$data['script_path'] = substr($data['script_path'], 0, -1);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$data['script_path'] = str_replace(array('../', './'), '', $data['script_path']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['script_path'][0] != '/')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$data['script_path'] = '/' . $data['script_path'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Set default config and post data, this applies to all DB's
|
|
|
4c79b5 |
$sql_ary = array(
|
|
|
4c79b5 |
'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value)
|
|
|
4c79b5 |
VALUES ('board_startdate', '$current_time')",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value)
|
|
|
4c79b5 |
VALUES ('default_lang', '" . $db->sql_escape($data['default_lang']) . "')",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['img_imagick']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'img_imagick'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['server_name']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'server_name'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['server_port']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'server_port'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['board_email1']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'board_email'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['board_email1']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'board_contact'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($cookie_domain) . "'
|
|
|
4c79b5 |
WHERE config_name = 'cookie_domain'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($lang['default_dateformat']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'default_dateformat'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['email_enable']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'email_enable'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['smtp_delivery']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'smtp_delivery'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['smtp_host']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'smtp_host'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['smtp_auth']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'smtp_auth_method'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['smtp_user']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'smtp_username'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['smtp_pass']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'smtp_password'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['cookie_secure']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'cookie_secure'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['force_server_vars']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'force_server_vars'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['script_path']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'script_path'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['server_protocol']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'server_protocol'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($data['admin_name']) . "'
|
|
|
4c79b5 |
WHERE config_name = 'newest_username'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . md5(mt_rand()) . "'
|
|
|
4c79b5 |
WHERE config_name = 'avatar_salt'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "users
|
|
|
4c79b5 |
SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . (crc32($data['board_email1']) . strlen($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "'
|
|
|
4c79b5 |
WHERE username = 'Admin'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "moderator_cache
|
|
|
4c79b5 |
SET username = '" . $db->sql_escape($data['admin_name']) . "'
|
|
|
4c79b5 |
WHERE username = 'Admin'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "forums
|
|
|
4c79b5 |
SET forum_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "'
|
|
|
4c79b5 |
WHERE forum_last_poster_name = 'Admin'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "topics
|
|
|
4c79b5 |
SET topic_first_poster_name = '" . $db->sql_escape($data['admin_name']) . "', topic_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "'
|
|
|
4c79b5 |
WHERE topic_first_poster_name = 'Admin'
|
|
|
4c79b5 |
OR topic_last_poster_name = 'Admin'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "users
|
|
|
4c79b5 |
SET user_regdate = $current_time",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "posts
|
|
|
4c79b5 |
SET post_time = $current_time, poster_ip = '" . $db->sql_escape($user_ip) . "'",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "topics
|
|
|
4c79b5 |
SET topic_time = $current_time, topic_last_post_time = $current_time",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "forums
|
|
|
4c79b5 |
SET forum_last_post_time = $current_time",
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($db->sql_server_info(true)) . "'
|
|
|
4c79b5 |
WHERE config_name = 'dbms_version'",
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (@extension_loaded('gd') || can_load_dll('gd'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '1'
|
|
|
4c79b5 |
WHERE config_name = 'captcha_gd'";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$ref = substr($referer, strpos($referer, '://') + 3);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!(stripos($ref, $server_name) === 0))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '0'
|
|
|
4c79b5 |
WHERE config_name = 'referer_validation'";
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// We set a (semi-)unique cookie name to bypass login issues related to the cookie name.
|
|
|
4c79b5 |
$cookie_name = 'phpbb3_';
|
|
|
4c79b5 |
$rand_str = md5(mt_rand());
|
|
|
4c79b5 |
$rand_str = str_replace('0', 'z', base_convert($rand_str, 16, 35));
|
|
|
4c79b5 |
$rand_str = substr($rand_str, 0, 5);
|
|
|
4c79b5 |
$cookie_name .= strtolower($rand_str);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config
|
|
|
4c79b5 |
SET config_value = '" . $db->sql_escape($cookie_name) . "'
|
|
|
4c79b5 |
WHERE config_name = 'cookie_name'";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($sql_ary as $sql)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
//$sql = trim(str_replace('|', ';', $sql));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$db->sql_query($sql))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = $db->sql_error();
|
|
|
4c79b5 |
$this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$submit = $lang['NEXT_STEP'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$url = $this->p_master->module_url . "?mode=$mode&sub=final";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'BODY' => $lang['STAGE_CREATE_TABLE_EXPLAIN'],
|
|
|
4c79b5 |
'L_SUBMIT' => $submit,
|
|
|
4c79b5 |
'S_HIDDEN' => build_hidden_fields($data),
|
|
|
4c79b5 |
'U_ACTION' => $url,
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Build the search index...
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function build_search_index($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $db, $lang, $phpbb_root_path, $phpEx, $config;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Obtain any submitted data
|
|
|
4c79b5 |
$data = $this->get_submitted_data();
|
|
|
4c79b5 |
$table_prefix = $data['table_prefix'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// If we get here and the extension isn't loaded it should be safe to just go ahead and load it
|
|
|
4c79b5 |
$available_dbms = get_available_dbms($data['dbms']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!isset($available_dbms[$data['dbms']]))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Someone's been silly and tried providing a non-existant dbms
|
|
|
4c79b5 |
$this->p_master->redirect("index.$phpEx?mode=install");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$dbms = $available_dbms[$data['dbms']]['DRIVER'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Load the appropriate database class if not already loaded
|
|
|
4c79b5 |
include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Instantiate the database
|
|
|
4c79b5 |
$db = new $sql_db();
|
|
|
4c79b5 |
$db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// NOTE: trigger_error does not work here.
|
|
|
4c79b5 |
$db->sql_return_on_error(true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
include_once($phpbb_root_path . 'includes/constants.' . $phpEx);
|
|
|
4c79b5 |
include_once($phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Fill the config array - it is needed by those functions we call
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . CONFIG_TABLE;
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$config = array();
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$config[$row['config_name']] = $row['config_value'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$error = false;
|
|
|
4c79b5 |
$search = new fulltext_native($error);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
|
|
|
4c79b5 |
FROM ' . POSTS_TABLE;
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Populate the module tables
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function add_modules($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $db, $lang, $phpbb_root_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_module = new acp_modules();
|
|
|
4c79b5 |
$module_classes = array('acp', 'mcp', 'ucp');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Add categories
|
|
|
4c79b5 |
foreach ($module_classes as $module_class)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$categories = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Set the module class
|
|
|
4c79b5 |
$_module->module_class = $module_class;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($this->module_categories[$module_class] as $cat_name => $subs)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$module_data = array(
|
|
|
4c79b5 |
'module_basename' => '',
|
|
|
4c79b5 |
'module_enabled' => 1,
|
|
|
4c79b5 |
'module_display' => 1,
|
|
|
4c79b5 |
'parent_id' => 0,
|
|
|
4c79b5 |
'module_class' => $module_class,
|
|
|
4c79b5 |
'module_langname' => $cat_name,
|
|
|
4c79b5 |
'module_mode' => '',
|
|
|
4c79b5 |
'module_auth' => '',
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Add category
|
|
|
4c79b5 |
$_module->update_module_data($module_data, true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check for last sql error happened
|
|
|
4c79b5 |
if ($db->sql_error_triggered)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = $db->sql_error($db->sql_error_sql);
|
|
|
4c79b5 |
$this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$categories[$cat_name]['id'] = (int) $module_data['module_id'];
|
|
|
4c79b5 |
$categories[$cat_name]['parent_id'] = 0;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Create sub-categories...
|
|
|
4c79b5 |
if (is_array($subs))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
foreach ($subs as $level2_name)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$module_data = array(
|
|
|
4c79b5 |
'module_basename' => '',
|
|
|
4c79b5 |
'module_enabled' => 1,
|
|
|
4c79b5 |
'module_display' => 1,
|
|
|
4c79b5 |
'parent_id' => (int) $categories[$cat_name]['id'],
|
|
|
4c79b5 |
'module_class' => $module_class,
|
|
|
4c79b5 |
'module_langname' => $level2_name,
|
|
|
4c79b5 |
'module_mode' => '',
|
|
|
4c79b5 |
'module_auth' => '',
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_module->update_module_data($module_data, true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check for last sql error happened
|
|
|
4c79b5 |
if ($db->sql_error_triggered)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = $db->sql_error($db->sql_error_sql);
|
|
|
4c79b5 |
$this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$categories[$level2_name]['id'] = (int) $module_data['module_id'];
|
|
|
4c79b5 |
$categories[$level2_name]['parent_id'] = (int) $categories[$cat_name]['id'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Get the modules we want to add... returned sorted by name
|
|
|
4c79b5 |
$module_info = $_module->get_module_infos('', $module_class);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($module_info as $module_basename => $fileinfo)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
foreach ($fileinfo['modes'] as $module_mode => $row)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
foreach ($row['cat'] as $cat_name)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!isset($categories[$cat_name]))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$module_data = array(
|
|
|
4c79b5 |
'module_basename' => $module_basename,
|
|
|
4c79b5 |
'module_enabled' => 1,
|
|
|
4c79b5 |
'module_display' => (isset($row['display'])) ? (int) $row['display'] : 1,
|
|
|
4c79b5 |
'parent_id' => (int) $categories[$cat_name]['id'],
|
|
|
4c79b5 |
'module_class' => $module_class,
|
|
|
4c79b5 |
'module_langname' => $row['title'],
|
|
|
4c79b5 |
'module_mode' => $module_mode,
|
|
|
4c79b5 |
'module_auth' => $row['auth'],
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_module->update_module_data($module_data, true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check for last sql error happened
|
|
|
4c79b5 |
if ($db->sql_error_triggered)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = $db->sql_error($db->sql_error_sql);
|
|
|
4c79b5 |
$this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Move some of the modules around since the code above will put them in the wrong place
|
|
|
4c79b5 |
if ($module_class == 'acp')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Move main module 4 up...
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . MODULES_TABLE . "
|
|
|
4c79b5 |
WHERE module_basename = 'main'
|
|
|
4c79b5 |
AND module_class = 'acp'
|
|
|
4c79b5 |
AND module_mode = 'main'";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$row = $db->sql_fetchrow($result);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_module->move_module_by($row, 'move_up', 4);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Move permissions intro screen module 4 up...
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . MODULES_TABLE . "
|
|
|
4c79b5 |
WHERE module_basename = 'permissions'
|
|
|
4c79b5 |
AND module_class = 'acp'
|
|
|
4c79b5 |
AND module_mode = 'intro'";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$row = $db->sql_fetchrow($result);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_module->move_module_by($row, 'move_up', 4);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Move manage users screen module 5 up...
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . MODULES_TABLE . "
|
|
|
4c79b5 |
WHERE module_basename = 'users'
|
|
|
4c79b5 |
AND module_class = 'acp'
|
|
|
4c79b5 |
AND module_mode = 'overview'";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$row = $db->sql_fetchrow($result);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_module->move_module_by($row, 'move_up', 5);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($module_class == 'ucp')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Move attachment module 4 down...
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . MODULES_TABLE . "
|
|
|
4c79b5 |
WHERE module_basename = 'attachments'
|
|
|
4c79b5 |
AND module_class = 'ucp'
|
|
|
4c79b5 |
AND module_mode = 'attachments'";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$row = $db->sql_fetchrow($result);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_module->move_module_by($row, 'move_down', 4);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// And now for the special ones
|
|
|
4c79b5 |
// (these are modules which appear in multiple categories and thus get added manually to some for more control)
|
|
|
4c79b5 |
if (isset($this->module_extras[$module_class]))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
foreach ($this->module_extras[$module_class] as $cat_name => $mods)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql = 'SELECT module_id, left_id, right_id
|
|
|
4c79b5 |
FROM ' . MODULES_TABLE . "
|
|
|
4c79b5 |
WHERE module_langname = '" . $db->sql_escape($cat_name) . "'
|
|
|
4c79b5 |
AND module_class = '" . $db->sql_escape($module_class) . "'";
|
|
|
4c79b5 |
$result = $db->sql_query_limit($sql, 1);
|
|
|
4c79b5 |
$row2 = $db->sql_fetchrow($result);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($mods as $mod_name)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . MODULES_TABLE . "
|
|
|
4c79b5 |
WHERE module_langname = '" . $db->sql_escape($mod_name) . "'
|
|
|
4c79b5 |
AND module_class = '" . $db->sql_escape($module_class) . "'
|
|
|
4c79b5 |
AND module_basename <> ''";
|
|
|
4c79b5 |
$result = $db->sql_query_limit($sql, 1);
|
|
|
4c79b5 |
$row = $db->sql_fetchrow($result);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$module_data = array(
|
|
|
4c79b5 |
'module_basename' => $row['module_basename'],
|
|
|
4c79b5 |
'module_enabled' => (int) $row['module_enabled'],
|
|
|
4c79b5 |
'module_display' => (int) $row['module_display'],
|
|
|
4c79b5 |
'parent_id' => (int) $row2['module_id'],
|
|
|
4c79b5 |
'module_class' => $row['module_class'],
|
|
|
4c79b5 |
'module_langname' => $row['module_langname'],
|
|
|
4c79b5 |
'module_mode' => $row['module_mode'],
|
|
|
4c79b5 |
'module_auth' => $row['module_auth'],
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_module->update_module_data($module_data, true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check for last sql error happened
|
|
|
4c79b5 |
if ($db->sql_error_triggered)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = $db->sql_error($db->sql_error_sql);
|
|
|
4c79b5 |
$this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_module->remove_cache_file();
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Populate the language tables
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function add_language($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $db, $lang, $phpbb_root_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$dir = @opendir($phpbb_root_path . 'language');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$dir)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$this->error('Unable to access the language directory', __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
while (($file = readdir($dir)) !== false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$path = $phpbb_root_path . 'language/' . $file;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (is_dir($path) && file_exists($path . '/iso.txt'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$lang_file = file("$path/iso.txt");
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$lang_pack = array(
|
|
|
4c79b5 |
'lang_iso' => basename($path),
|
|
|
4c79b5 |
'lang_dir' => basename($path),
|
|
|
4c79b5 |
'lang_english_name' => trim(htmlspecialchars($lang_file[0])),
|
|
|
4c79b5 |
'lang_local_name' => trim(htmlspecialchars($lang_file[1], ENT_COMPAT, 'UTF-8')),
|
|
|
4c79b5 |
'lang_author' => trim(htmlspecialchars($lang_file[2], ENT_COMPAT, 'UTF-8')),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $lang_pack));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($db->sql_error_triggered)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = $db->sql_error($db->sql_error_sql);
|
|
|
4c79b5 |
$this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$valid_localized = array(
|
|
|
4c79b5 |
'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply',
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_ary = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . STYLES_IMAGESET_TABLE;
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
while ($imageset_row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (@file_exists("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg"))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg");
|
|
|
4c79b5 |
foreach ($cfg_data_imageset_data as $image_name => $value)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (strpos($value, '*') !== false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (substr($value, -1, 1) === '*')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
list($image_filename, $image_height) = explode('*', $value);
|
|
|
4c79b5 |
$image_width = 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
list($image_filename, $image_height, $image_width) = explode('*', $value);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$image_filename = $value;
|
|
|
4c79b5 |
$image_height = $image_width = 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (strpos($image_name, 'img_') === 0 && $image_filename)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$image_name = substr($image_name, 4);
|
|
|
4c79b5 |
if (in_array($image_name, $valid_localized))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql_ary[] = array(
|
|
|
4c79b5 |
'image_name' => (string) $image_name,
|
|
|
4c79b5 |
'image_filename' => (string) $image_filename,
|
|
|
4c79b5 |
'image_height' => (int) $image_height,
|
|
|
4c79b5 |
'image_width' => (int) $image_width,
|
|
|
4c79b5 |
'imageset_id' => (int) $imageset_row['imageset_id'],
|
|
|
4c79b5 |
'image_lang' => (string) $lang_pack['lang_iso'],
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (sizeof($sql_ary))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($db->sql_error_triggered)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = $db->sql_error($db->sql_error_sql);
|
|
|
4c79b5 |
$this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
closedir($dir);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Add search robots to the database
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function add_bots($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $db, $lang, $phpbb_root_path, $phpEx, $config;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Obtain any submitted data
|
|
|
4c79b5 |
$data = $this->get_submitted_data();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Fill the config array - it is needed by those functions we call
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . CONFIG_TABLE;
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$config = array();
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$config[$row['config_name']] = $row['config_value'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT group_id
|
|
|
4c79b5 |
FROM ' . GROUPS_TABLE . "
|
|
|
4c79b5 |
WHERE group_name = 'BOTS'";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$group_id = (int) $db->sql_fetchfield('group_id');
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// If we reach this point then something has gone very wrong
|
|
|
4c79b5 |
$this->p_master->error($lang['NO_GROUP'], __LINE__, __FILE__);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!function_exists('user_add'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($this->bot_list as $bot_name => $bot_ary)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$user_row = array(
|
|
|
4c79b5 |
'user_type' => USER_IGNORE,
|
|
|
4c79b5 |
'group_id' => $group_id,
|
|
|
4c79b5 |
'username' => $bot_name,
|
|
|
4c79b5 |
'user_regdate' => time(),
|
|
|
4c79b5 |
'user_password' => '',
|
|
|
4c79b5 |
'user_colour' => '9E8DA7',
|
|
|
4c79b5 |
'user_email' => '',
|
|
|
4c79b5 |
'user_lang' => $data['default_lang'],
|
|
|
4c79b5 |
'user_style' => 1,
|
|
|
4c79b5 |
'user_timezone' => 0,
|
|
|
4c79b5 |
'user_dateformat' => $lang['default_dateformat'],
|
|
|
4c79b5 |
'user_allow_massemail' => 0,
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user_id = user_add($user_row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$user_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// If we can't insert this user then continue to the next one to avoid inconsistant data
|
|
|
4c79b5 |
$this->p_master->db_error('Unable to insert bot into users table', $db->sql_error_sql, __LINE__, __FILE__, true);
|
|
|
4c79b5 |
continue;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
|
|
4c79b5 |
'bot_active' => 1,
|
|
|
4c79b5 |
'bot_name' => (string) $bot_name,
|
|
|
4c79b5 |
'user_id' => (int) $user_id,
|
|
|
4c79b5 |
'bot_agent' => (string) $bot_ary[0],
|
|
|
4c79b5 |
'bot_ip' => (string) $bot_ary[1],
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Sends an email to the board administrator with their password and some useful links
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function email_admin($mode, $sub)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->page_title = $lang['STAGE_FINAL'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Obtain any submitted data
|
|
|
4c79b5 |
$data = $this->get_submitted_data();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . CONFIG_TABLE;
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$config = array();
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$config[$row['config_name']] = $row['config_value'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user->session_begin();
|
|
|
4c79b5 |
$auth->login($data['admin_name'], $data['admin_pass1'], false, true, true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// OK, Now that we've reached this point we can be confident that everything
|
|
|
4c79b5 |
// is installed and working......I hope :)
|
|
|
4c79b5 |
// So it's time to send an email to the administrator confirming the details
|
|
|
4c79b5 |
// they entered
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($config['email_enable'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger = new messenger(false);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger->template('installed', $data['language']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger->to($data['board_email1'], $data['admin_name']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
|
|
|
4c79b5 |
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
|
|
|
4c79b5 |
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
|
|
|
4c79b5 |
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger->assign_vars(array(
|
|
|
4c79b5 |
'USERNAME' => htmlspecialchars_decode($data['admin_name']),
|
|
|
4c79b5 |
'PASSWORD' => htmlspecialchars_decode($data['admin_pass1']))
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger->send(NOTIFY_EMAIL);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// And finally, add a note to the log
|
|
|
4c79b5 |
add_log('admin', 'LOG_INSTALL_INSTALLED', $config['version']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'TITLE' => $lang['INSTALL_CONGRATS'],
|
|
|
4c79b5 |
'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&language=' . $data['language']), '../docs/README.html'),
|
|
|
4c79b5 |
'L_SUBMIT' => $lang['INSTALL_LOGIN'],
|
|
|
4c79b5 |
'U_ACTION' => append_sid($phpbb_root_path . 'adm/index.' . $phpEx),
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Generate a list of available mail server authentication methods
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function mail_auth_select($selected_method)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $lang;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
|
|
|
4c79b5 |
$s_smtp_auth_options = '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($auth_methods as $method)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $lang['SMTP_' . str_replace('-', '_', $method)] . '</option>';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
return $s_smtp_auth_options;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Get submitted data
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
function get_submitted_data()
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
return array(
|
|
|
4c79b5 |
'language' => basename(request_var('language', '')),
|
|
|
4c79b5 |
'dbms' => request_var('dbms', ''),
|
|
|
4c79b5 |
'dbhost' => request_var('dbhost', ''),
|
|
|
4c79b5 |
'dbport' => request_var('dbport', ''),
|
|
|
4c79b5 |
'dbuser' => request_var('dbuser', ''),
|
|
|
4c79b5 |
'dbpasswd' => request_var('dbpasswd', '', true),
|
|
|
4c79b5 |
'dbname' => request_var('dbname', ''),
|
|
|
4c79b5 |
'table_prefix' => request_var('table_prefix', ''),
|
|
|
4c79b5 |
'default_lang' => basename(request_var('default_lang', '')),
|
|
|
4c79b5 |
'admin_name' => utf8_normalize_nfc(request_var('admin_name', '', true)),
|
|
|
4c79b5 |
'admin_pass1' => request_var('admin_pass1', '', true),
|
|
|
4c79b5 |
'admin_pass2' => request_var('admin_pass2', '', true),
|
|
|
4c79b5 |
'board_email1' => strtolower(request_var('board_email1', '')),
|
|
|
4c79b5 |
'board_email2' => strtolower(request_var('board_email2', '')),
|
|
|
4c79b5 |
'img_imagick' => request_var('img_imagick', ''),
|
|
|
4c79b5 |
'ftp_path' => request_var('ftp_path', ''),
|
|
|
4c79b5 |
'ftp_user' => request_var('ftp_user', ''),
|
|
|
4c79b5 |
'ftp_pass' => request_var('ftp_pass', ''),
|
|
|
4c79b5 |
'email_enable' => request_var('email_enable', ''),
|
|
|
4c79b5 |
'smtp_delivery' => request_var('smtp_delivery', ''),
|
|
|
4c79b5 |
'smtp_host' => request_var('smtp_host', ''),
|
|
|
4c79b5 |
'smtp_auth' => request_var('smtp_auth', ''),
|
|
|
4c79b5 |
'smtp_user' => request_var('smtp_user', ''),
|
|
|
4c79b5 |
'smtp_pass' => request_var('smtp_pass', ''),
|
|
|
4c79b5 |
'cookie_secure' => request_var('cookie_secure', ''),
|
|
|
4c79b5 |
'force_server_vars' => request_var('force_server_vars', ''),
|
|
|
4c79b5 |
'server_protocol' => request_var('server_protocol', ''),
|
|
|
4c79b5 |
'server_name' => request_var('server_name', ''),
|
|
|
4c79b5 |
'server_port' => request_var('server_port', ''),
|
|
|
4c79b5 |
'script_path' => request_var('script_path', ''),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* The information below will be used to build the input fields presented to the user
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
var $db_config_options = array(
|
|
|
4c79b5 |
'legend1' => 'DB_CONFIG',
|
|
|
4c79b5 |
'dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false),
|
|
|
4c79b5 |
'dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true),
|
|
|
4c79b5 |
'dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true),
|
|
|
4c79b5 |
'dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false),
|
|
|
4c79b5 |
'dbuser' => array('lang' => 'DB_USERNAME', 'type' => 'text:25:100', 'explain' => false),
|
|
|
4c79b5 |
'dbpasswd' => array('lang' => 'DB_PASSWORD', 'type' => 'password:25:100', 'explain' => false),
|
|
|
4c79b5 |
'table_prefix' => array('lang' => 'TABLE_PREFIX', 'type' => 'text:25:100', 'explain' => false),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
var $admin_config_options = array(
|
|
|
4c79b5 |
'legend1' => 'ADMIN_CONFIG',
|
|
|
4c79b5 |
'default_lang' => array('lang' => 'DEFAULT_LANG', 'type' => 'select', 'options' => '$this->module->inst_language_select(\'{VALUE}\')', 'explain' => false),
|
|
|
4c79b5 |
'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true),
|
|
|
4c79b5 |
'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true),
|
|
|
4c79b5 |
'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false),
|
|
|
4c79b5 |
'board_email1' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => false),
|
|
|
4c79b5 |
'board_email2' => array('lang' => 'CONTACT_EMAIL_CONFIRM', 'type' => 'text:25:100', 'explain' => false),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
var $advanced_config_options = array(
|
|
|
4c79b5 |
'legend1' => 'ACP_EMAIL_SETTINGS',
|
|
|
4c79b5 |
'email_enable' => array('lang' => 'ENABLE_EMAIL', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
|
|
4c79b5 |
'smtp_delivery' => array('lang' => 'USE_SMTP', 'type' => 'radio:yes_no', 'explain' => true),
|
|
|
4c79b5 |
'smtp_host' => array('lang' => 'SMTP_SERVER', 'type' => 'text:25:50', 'explain' => false),
|
|
|
4c79b5 |
'smtp_auth' => array('lang' => 'SMTP_AUTH_METHOD', 'type' => 'select', 'options' => '$this->module->mail_auth_select(\'{VALUE}\')', 'explain' => true),
|
|
|
4c79b5 |
'smtp_user' => array('lang' => 'SMTP_USERNAME', 'type' => 'text:25:255', 'explain' => true),
|
|
|
4c79b5 |
'smtp_pass' => array('lang' => 'SMTP_PASSWORD', 'type' => 'password:25:255', 'explain' => true),
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'legend2' => 'SERVER_URL_SETTINGS',
|
|
|
4c79b5 |
'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
|
|
4c79b5 |
'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'type' => 'radio:yes_no', 'explain' => true),
|
|
|
4c79b5 |
'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'type' => 'text:10:10', 'explain' => true),
|
|
|
4c79b5 |
'server_name' => array('lang' => 'SERVER_NAME', 'type' => 'text:40:255', 'explain' => true),
|
|
|
4c79b5 |
'server_port' => array('lang' => 'SERVER_PORT', 'type' => 'text:5:5', 'explain' => true),
|
|
|
4c79b5 |
'script_path' => array('lang' => 'SCRIPT_PATH', 'type' => 'text::255', 'explain' => true),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Specific PHP modules we may require for certain optional or extended features
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
var $php_dlls_other = array('zlib', 'ftp', 'gd', 'xml');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* A list of the web-crawlers/bots we recognise by default
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
* Candidates but not included:
|
|
|
4c79b5 |
* 'Accoona [Bot]' 'Accoona-AI-Agent/'
|
|
|
4c79b5 |
* 'ASPseek [Crawler]' 'ASPseek/'
|
|
|
4c79b5 |
* 'Boitho [Crawler]' 'boitho.com-dc/'
|
|
|
4c79b5 |
* 'Bunnybot [Bot]' 'powered by www.buncat.de'
|
|
|
4c79b5 |
* 'Cosmix [Bot]' 'cfetch/'
|
|
|
4c79b5 |
* 'Crawler Search [Crawler]' '.Crawler-Search.de'
|
|
|
4c79b5 |
* 'Findexa [Crawler]' 'Findexa Crawler ('
|
|
|
4c79b5 |
* 'GBSpider [Spider]' 'GBSpider v'
|
|
|
4c79b5 |
* 'genie [Bot]' 'genieBot ('
|
|
|
4c79b5 |
* 'Hogsearch [Bot]' 'oegp v. 1.3.0'
|
|
|
4c79b5 |
* 'Insuranco [Bot]' 'InsurancoBot'
|
|
|
4c79b5 |
* 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler'
|
|
|
4c79b5 |
* 'ISC Systems [Bot]' 'ISC Systems iRc Search'
|
|
|
4c79b5 |
* 'Jyxobot [Bot]' 'Jyxobot/'
|
|
|
4c79b5 |
* 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/'
|
|
|
4c79b5 |
* 'LinkWalker' 'LinkWalker'
|
|
|
4c79b5 |
* 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html'
|
|
|
4c79b5 |
* 'Naver [Bot]' 'nhnbot@naver.com)'
|
|
|
4c79b5 |
* 'NetResearchServer' 'NetResearchServer/'
|
|
|
4c79b5 |
* 'Nimble [Crawler]' 'NimbleCrawler'
|
|
|
4c79b5 |
* 'Ocelli [Bot]' 'Ocelli/'
|
|
|
4c79b5 |
* 'Onsearch [Bot]' 'onCHECK-Robot'
|
|
|
4c79b5 |
* 'Orange [Spider]' 'OrangeSpider'
|
|
|
4c79b5 |
* 'Sproose [Bot]' 'http://www.sproose.com/bot'
|
|
|
4c79b5 |
* 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)'
|
|
|
4c79b5 |
* 'Tbot [Bot]' 'Tbot/'
|
|
|
4c79b5 |
* 'Thumbshots [Capture]' 'thumbshots-de-Bot'
|
|
|
4c79b5 |
* 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/'
|
|
|
4c79b5 |
* 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)'
|
|
|
4c79b5 |
* 'WissenOnline [Bot]' 'WissenOnline-Bot'
|
|
|
4c79b5 |
* 'WWWeasel [Bot]' 'WWWeasel Robot v'
|
|
|
4c79b5 |
* 'Xaldon [Spider]' 'Xaldon WebSpider'
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
var $bot_list = array(
|
|
|
4c79b5 |
'AdsBot [Google]' => array('AdsBot-Google', ''),
|
|
|
4c79b5 |
'Alexa [Bot]' => array('ia_archiver', ''),
|
|
|
4c79b5 |
'Alta Vista [Bot]' => array('Scooter/', ''),
|
|
|
4c79b5 |
'Ask Jeeves [Bot]' => array('Ask Jeeves', ''),
|
|
|
4c79b5 |
'Baidu [Spider]' => array('Baiduspider+(', ''),
|
|
|
4c79b5 |
'Exabot [Bot]' => array('Exabot/', ''),
|
|
|
4c79b5 |
'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''),
|
|
|
4c79b5 |
'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''),
|
|
|
4c79b5 |
'Francis [Bot]' => array('http://www.neomo.de/', ''),
|
|
|
4c79b5 |
'Gigabot [Bot]' => array('Gigabot/', ''),
|
|
|
4c79b5 |
'Google Adsense [Bot]' => array('Mediapartners-Google', ''),
|
|
|
4c79b5 |
'Google Desktop' => array('Google Desktop', ''),
|
|
|
4c79b5 |
'Google Feedfetcher' => array('Feedfetcher-Google', ''),
|
|
|
4c79b5 |
'Google [Bot]' => array('Googlebot', ''),
|
|
|
4c79b5 |
'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''),
|
|
|
4c79b5 |
'Heritrix [Crawler]' => array('heritrix/1.', ''),
|
|
|
4c79b5 |
'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''),
|
|
|
4c79b5 |
'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''),
|
|
|
4c79b5 |
'ichiro [Crawler]' => array('ichiro/2', ''),
|
|
|
4c79b5 |
'Majestic-12 [Bot]' => array('MJ12bot/', ''),
|
|
|
4c79b5 |
'Metager [Bot]' => array('MetagerBot/', ''),
|
|
|
4c79b5 |
'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''),
|
|
|
4c79b5 |
'MSN [Bot]' => array('msnbot/', ''),
|
|
|
4c79b5 |
'MSNbot Media' => array('msnbot-media/', ''),
|
|
|
4c79b5 |
'NG-Search [Bot]' => array('NG-Search/', ''),
|
|
|
4c79b5 |
'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''),
|
|
|
4c79b5 |
'Nutch/CVS [Bot]' => array('NutchCVS/', ''),
|
|
|
4c79b5 |
'OmniExplorer [Bot]' => array('OmniExplorer_Bot/', ''),
|
|
|
4c79b5 |
'Online link [Validator]' => array('online link validator', ''),
|
|
|
4c79b5 |
'psbot [Picsearch]' => array('psbot/0', ''),
|
|
|
4c79b5 |
'Seekport [Bot]' => array('Seekbot/', ''),
|
|
|
4c79b5 |
'Sensis [Crawler]' => array('Sensis Web Crawler', ''),
|
|
|
4c79b5 |
'SEO Crawler' => array('SEO search Crawler/', ''),
|
|
|
4c79b5 |
'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''),
|
|
|
4c79b5 |
'SEOSearch [Crawler]' => array('SEOsearch/', ''),
|
|
|
4c79b5 |
'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''),
|
|
|
4c79b5 |
'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''),
|
|
|
4c79b5 |
'Synoo [Bot]' => array('SynooBot/', ''),
|
|
|
4c79b5 |
'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''),
|
|
|
4c79b5 |
'TurnitinBot [Bot]' => array('TurnitinBot/', ''),
|
|
|
4c79b5 |
'Voyager [Bot]' => array('voyager/1.0', ''),
|
|
|
4c79b5 |
'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''),
|
|
|
4c79b5 |
'W3C [Linkcheck]' => array('W3C-checklink/', ''),
|
|
|
4c79b5 |
'W3C [Validator]' => array('W3C_*Validator', ''),
|
|
|
4c79b5 |
'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''),
|
|
|
4c79b5 |
'YaCy [Bot]' => array('yacybot', ''),
|
|
|
4c79b5 |
'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''),
|
|
|
4c79b5 |
'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''),
|
|
|
4c79b5 |
'Yahoo [Bot]' => array('Yahoo! Slurp', ''),
|
|
|
4c79b5 |
'YahooSeeker [Bot]' => array('YahooSeeker/', ''),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* Define the module structure so that we can populate the database without
|
|
|
4c79b5 |
* needing to hard-code module_id values
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
var $module_categories = array(
|
|
|
4c79b5 |
'acp' => array(
|
|
|
4c79b5 |
'ACP_CAT_GENERAL' => array(
|
|
|
4c79b5 |
'ACP_QUICK_ACCESS',
|
|
|
4c79b5 |
'ACP_BOARD_CONFIGURATION',
|
|
|
4c79b5 |
'ACP_CLIENT_COMMUNICATION',
|
|
|
4c79b5 |
'ACP_SERVER_CONFIGURATION',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ACP_CAT_FORUMS' => array(
|
|
|
4c79b5 |
'ACP_MANAGE_FORUMS',
|
|
|
4c79b5 |
'ACP_FORUM_BASED_PERMISSIONS',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ACP_CAT_POSTING' => array(
|
|
|
4c79b5 |
'ACP_MESSAGES',
|
|
|
4c79b5 |
'ACP_ATTACHMENTS',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ACP_CAT_USERGROUP' => array(
|
|
|
4c79b5 |
'ACP_CAT_USERS',
|
|
|
4c79b5 |
'ACP_GROUPS',
|
|
|
4c79b5 |
'ACP_USER_SECURITY',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ACP_CAT_PERMISSIONS' => array(
|
|
|
4c79b5 |
'ACP_GLOBAL_PERMISSIONS',
|
|
|
4c79b5 |
'ACP_FORUM_BASED_PERMISSIONS',
|
|
|
4c79b5 |
'ACP_PERMISSION_ROLES',
|
|
|
4c79b5 |
'ACP_PERMISSION_MASKS',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ACP_CAT_STYLES' => array(
|
|
|
4c79b5 |
'ACP_STYLE_MANAGEMENT',
|
|
|
4c79b5 |
'ACP_STYLE_COMPONENTS',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ACP_CAT_MAINTENANCE' => array(
|
|
|
4c79b5 |
'ACP_FORUM_LOGS',
|
|
|
4c79b5 |
'ACP_CAT_DATABASE',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ACP_CAT_SYSTEM' => array(
|
|
|
4c79b5 |
'ACP_AUTOMATION',
|
|
|
4c79b5 |
'ACP_GENERAL_TASKS',
|
|
|
4c79b5 |
'ACP_MODULE_MANAGEMENT',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ACP_CAT_DOT_MODS' => null,
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'mcp' => array(
|
|
|
4c79b5 |
'MCP_MAIN' => null,
|
|
|
4c79b5 |
'MCP_QUEUE' => null,
|
|
|
4c79b5 |
'MCP_REPORTS' => null,
|
|
|
4c79b5 |
'MCP_NOTES' => null,
|
|
|
4c79b5 |
'MCP_WARN' => null,
|
|
|
4c79b5 |
'MCP_LOGS' => null,
|
|
|
4c79b5 |
'MCP_BAN' => null,
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ucp' => array(
|
|
|
4c79b5 |
'UCP_MAIN' => null,
|
|
|
4c79b5 |
'UCP_PROFILE' => null,
|
|
|
4c79b5 |
'UCP_PREFS' => null,
|
|
|
4c79b5 |
'UCP_PM' => null,
|
|
|
4c79b5 |
'UCP_USERGROUPS' => null,
|
|
|
4c79b5 |
'UCP_ZEBRA' => null,
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
var $module_extras = array(
|
|
|
4c79b5 |
'acp' => array(
|
|
|
4c79b5 |
'ACP_QUICK_ACCESS' => array(
|
|
|
4c79b5 |
'ACP_MANAGE_USERS',
|
|
|
4c79b5 |
'ACP_GROUPS_MANAGE',
|
|
|
4c79b5 |
'ACP_MANAGE_FORUMS',
|
|
|
4c79b5 |
'ACP_MOD_LOGS',
|
|
|
4c79b5 |
'ACP_BOTS',
|
|
|
4c79b5 |
'ACP_PHP_INFO',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
'ACP_FORUM_BASED_PERMISSIONS' => array(
|
|
|
4c79b5 |
'ACP_FORUM_PERMISSIONS',
|
|
|
4c79b5 |
'ACP_FORUM_MODERATORS',
|
|
|
4c79b5 |
'ACP_USERS_FORUM_PERMISSIONS',
|
|
|
4c79b5 |
'ACP_GROUPS_FORUM_PERMISSIONS',
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
?>
|