mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
use user_add function for bot adding
git-svn-id: file:///svn/phpbb/trunk@6056 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
e1437d7a21
commit
81d7bbff36
5 changed files with 24 additions and 25 deletions
|
@ -126,7 +126,7 @@ function user_add($user_row, $cp_data = false)
|
|||
{
|
||||
global $db, $config;
|
||||
|
||||
if (empty($user_row['username']) || !isset($user_row['group_id']) || empty($user_row['user_email']) || !isset($user_row['user_type']))
|
||||
if (empty($user_row['username']) || !isset($user_row['group_id']) || !isset($user_row['user_email']) || !isset($user_row['user_type']))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -182,6 +182,8 @@ function user_add($user_row, $cp_data = false)
|
|||
'user_sig' => '',
|
||||
'user_sig_bbcode_uid' => '',
|
||||
'user_sig_bbcode_bitfield' => 0,
|
||||
|
||||
'user_rank' => 0,
|
||||
);
|
||||
|
||||
// Now fill the sql array with not required variables
|
||||
|
|
|
@ -25,8 +25,8 @@ if (!empty($setmodules))
|
|||
}
|
||||
|
||||
/**
|
||||
* @package install
|
||||
* Installation
|
||||
* @package install
|
||||
*/
|
||||
class install_install extends module
|
||||
{
|
||||
|
@ -1379,11 +1379,13 @@ class install_install extends module
|
|||
*/
|
||||
function add_bots($mode, $sub)
|
||||
{
|
||||
global $db;
|
||||
global $db, $phpbb_root_path, $phpEx;
|
||||
|
||||
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . "
|
||||
WHERE group_name = 'BOTS'";
|
||||
$result = $db->sql_query($sql);
|
||||
$group_id = (int) $db->sql_fetchfield('group_id', 0, $result);
|
||||
$group_id = (int) $db->sql_fetchfield('group_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$group_id)
|
||||
|
@ -1392,39 +1394,32 @@ class install_install extends module
|
|||
$this->p_master->error($lang['NO_GROUP'], __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
if (!function_exists('user_add'))
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
}
|
||||
|
||||
foreach ($this->bot_list as $bot_name => $bot_ary)
|
||||
{
|
||||
$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
$user_row = array(
|
||||
'user_type' => GROUP_HIDDEN,
|
||||
'group_id' => $group_id,
|
||||
'username' => $bot_name,
|
||||
'user_regdate' => time(),
|
||||
'user_password' => '',
|
||||
'user_lang' => 'en',
|
||||
'user_style' => 1,
|
||||
'user_rank' => 0,
|
||||
'user_colour' => '9E8DA7',
|
||||
));
|
||||
'user_email' => ''
|
||||
);
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$user_id = user_add($user_row);
|
||||
|
||||
if (!$result)
|
||||
if (!$user_id)
|
||||
{
|
||||
// If we can't insert this user then continue to the next one to avoid inconsistant data
|
||||
$this->p_master->db_error('Unable to insert bot into users table', $sql, __LINE__, __FILE__, true);
|
||||
continue;
|
||||
}
|
||||
|
||||
$user_id = $db->sql_nextid();
|
||||
|
||||
$sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
'group_id' => $group_id,
|
||||
'user_id' => $user_id,
|
||||
'group_leader' => 0,
|
||||
'user_pending' => 0,
|
||||
));
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
'bot_active' => 1,
|
||||
'bot_name' => $bot_name,
|
||||
|
@ -1770,7 +1765,7 @@ class install_install extends module
|
|||
'COMMENTS' => 'remove_remarks'
|
||||
),
|
||||
'mssql' => array(
|
||||
'LABEL' => 'MS SQL Server 7/2000',
|
||||
'LABEL' => 'MS SQL Server 2000+',
|
||||
'SCHEMA' => 'mssql',
|
||||
'MODULE' => 'mssql',
|
||||
'DELIM' => 'GO',
|
||||
|
|
|
@ -25,8 +25,8 @@ if (!empty($setmodules))
|
|||
}
|
||||
|
||||
/**
|
||||
* @package install
|
||||
* Main Tab - Installation
|
||||
* @package install
|
||||
*/
|
||||
class install_main extends module
|
||||
{
|
||||
|
|
|
@ -68,6 +68,7 @@ $lang = array_merge($lang, array(
|
|||
'AVATAR_INVALID_FILENAME' => '%s is an invalid filename',
|
||||
'AVATAR_NOT_UPLOADED' => 'Avatar could not be uploaded.',
|
||||
'AVATAR_NO_SIZE' => 'Could not obtain width or height of linked avatar, please enter them manually.',
|
||||
'AVATAR_PARTIAL_UPLOAD' => 'The uploaded file was only partially uploaded',
|
||||
'AVATAR_PHP_SIZE_NA' => 'The avatar\'s filesize is too large.<br />Could not determine the maximum size defined by PHP in php.ini.',
|
||||
'AVATAR_PHP_SIZE_OVERRUN' => 'The avatar\'s filesize is too large, maximum upload size is %d MB.<br />Please note this is set in php.ini and cannot be overriden.',
|
||||
'AVATAR_URL_INVALID' => 'The URL you specified is invalid.',
|
||||
|
|
|
@ -124,6 +124,7 @@ $lang = array_merge($lang, array(
|
|||
'NO_POST' => 'The requested post does not exist.',
|
||||
'NO_POST_MODE' => 'No post mode specified',
|
||||
|
||||
'PARTIAL_UPLOAD' => 'The uploaded file was only partially uploaded',
|
||||
'PHP_SIZE_NA' => 'The attachment\'s filesize is too large.<br />Could not determine the maximum size defined by PHP in php.ini.',
|
||||
'PHP_SIZE_OVERRUN' => 'The attachment\'s filesize is too large, the maximum upload size is %d MB.<br />Please note this is set in php.ini and cannot be overriden.',
|
||||
'PLACE_INLINE' => 'Place inline',
|
||||
|
|
Loading…
Add table
Reference in a new issue