Пример #1
0
    return substr($method, 0, 2) !== '__' && strpos($method, 'insert_') !== 0 && strpos($method, 'table_') !== 0;
});
foreach ($tables as $table_method) {
    $table_name = substr($table_method, 6);
    // Copied from DbTable class
    // Strip out the table name, we might not need it in some cases
    $real_prefix = preg_match('~^("?)(.+?)\\1\\.(.*?)$~', $db_prefix, $match) === 1 ? $match[3] : $db_prefix;
    // With or without the database name, the fullname looks like this.
    $full_table_name = str_replace('{db_prefix}', $real_prefix, $table_name);
    $result = $install_instance->{$table_method}();
    if ($result === false) {
        $incontext['failures'][$table_method] = $db->last_error();
    }
}
foreach ($inserts as $insert_method) {
    $table_name = substr($insert_method, 6);
    if (in_array($table_name, $exists)) {
        $db_wrapper->countMode();
        $incontext['sql_results']['insert_dups'] += $install_instance->{$insert_method}();
        $db_wrapper->countMode(false);
        continue;
    }
    $result = $install_instance->{$insert_method}();
}
// Add the admin user account
require_once SOURCEDIR . '/Subs.php';
require_once SUBSDIR . '/Auth.subs.php';
require_once SUBSDIR . '/Util.class.php';
$request = $db->insert('', $db_prefix . 'members', array('member_name' => 'string-25', 'real_name' => 'string-25', 'passwd' => 'string', 'email_address' => 'string', 'id_group' => 'int', 'posts' => 'int', 'date_registered' => 'int', 'hide_email' => 'int', 'password_salt' => 'string', 'lngfile' => 'string', 'personal_text' => 'string', 'avatar' => 'string', 'member_ip' => 'string', 'member_ip2' => 'string', 'buddy_list' => 'string', 'pm_ignore_list' => 'string', 'message_labels' => 'string', 'website_title' => 'string', 'website_url' => 'string', 'location' => 'string', 'signature' => 'string', 'usertitle' => 'string', 'secret_question' => 'string', 'additional_groups' => 'string', 'ignore_boards' => 'string', 'openid_uri' => 'string'), array('admin', 'admin', validateLoginPassword($password = '******', '', 'admin', true), 'admin@localhost', 1, 0, time(), 0, substr(md5(mt_rand()), 0, 4), '', '', '', '127.0.0.1', '127.0.0.1', '', '', '', '', '', '', '', '', '', '', '', ''), array('id_member'));
// Add some stats
$db->insert('ignore', '{db_prefix}log_activity', array('date' => 'date', 'topics' => 'int', 'posts' => 'int', 'registers' => 'int'), array(strftime('%Y-%m-%d', time()), 1, 1, !empty($incontext['member_id']) ? 1 : 0), array('date'));