PHP Code:
/ Human Verification options and permissions
if ($vbulletin->options['hvcheck_registration']
OR $vbulletin->options['hvcheck_post']
OR $vbulletin->options['hvcheck_search']
OR $vbulletin->options['hvcheck_contactus']
OR $vbulletin->options['hvcheck_lostpw'])
{
$hvcheck = 0;
$hvcheck += ($vbulletin->options['hvcheck_registration'] ? $vbulletin->bf_misc_hvcheck['register'] : 0);
$hvcheck += ($vbulletin->options['hvcheck_post'] ? $vbulletin->bf_misc_hvcheck['post'] : 0);
$hvcheck += ($vbulletin->options['hvcheck_search'] ? $vbulletin->bf_misc_hvcheck['search'] : 0);
$hvcheck += ($vbulletin->options['hvcheck_contactus'] ? $vbulletin->bf_misc_hvcheck['contactus'] : 0);
$hvcheck += ($vbulletin->options['hvcheck_lostpw'] ? $vbulletin->bf_misc_hvcheck['lostpw'] : 0);
$upgrade->run_query(
$upgrade_phrases['upgrade_300b3.php']['updating_usergroup_permissions'],
"UPDATE " . TABLE_PREFIX . "usergroup SET
genericpermissions = genericpermissions | " . $vbulletin->bf_ugp_genericoptions['requirehvcheck'] . "
WHERE usergroupid = 1"
);
}
else
{
$hvcheck = array_sum($vbulletin->bf_misc_hvcheck);
}
$upgrade->run_query(
$upgrade_phrases['upgrade_380a2.php']['update_hv_options'],
"REPLACE INTO " . TABLE_PREFIX . "setting
(varname, grouptitle, value, volatile, product)
VALUES ('hvcheck', 'humanverification', $hvcheck, 1, 'vbulletin')"
);
// Give permissions
$upgrade->run_query(
sprintf($upgrade_phrases['upgrade_380a2.php']['granting_permissions'], 'usergroup', 1, 1),
"UPDATE " . TABLE_PREFIX . "usergroup SET
usercsspermissions = usercsspermissions |
IF(forumpermissions & " . $vbulletin->bf_ugp_genericpermissions['canmodifyprofile'] . ", " . $vbulletin->bf_ugp_usercsspermissions['caneditprivacy'] . ", 0),
forumpermissions = forumpermissions |
IF(forumpermissions & " . $vbulletin->bf_ugp_forumpermissions['cangetattachment'] . ", " . $vbulletin->bf_ugp_forumpermissions['canseethumbnails'] . ", 0),
genericoptions = genericoptions |
IF(usergroupid = 1," . $vbulletin->bf_ugp_genericoptions['requirehvcheck'] . ", 0),
socialgrouppermissions = socialgrouppermissions |
IF(forumpermissions & " . $vbulletin->bf_ugp_forumpermissions['canreplyown'] . ", " . $vbulletin->bf_ugp_socialgrouppermissions['canpostmessage'] . ", 0) |
IF(adminpermissions & " . $vbulletin->bf_ugp_adminpermissions['ismoderator'] . ", " . $vbulletin->bf_ugp_socialgrouppermissions['canalwayspostmessage'] . ", 0) |
IF(forumpermissions & " . $vbulletin->bf_ugp_forumpermissions['canpostnew'] . ", " . $vbulletin->bf_ugp_socialgrouppermissions['cancreatediscussion'] . ", 0) |
IF(adminpermissions & " . $vbulletin->bf_ugp_adminpermissions['ismoderator'] . ", " . $vbulletin->bf_ugp_socialgrouppermissions['canalwayscreatediscussion'] . ", 0) |
IF(forumpermissions & " . $vbulletin->bf_ugp_forumpermissions['canopenclose'] . ", " . $vbulletin->bf_ugp_socialgrouppermissions['canlimitdiscussion'] . ", 0) |
IF(forumpermissions & " . $vbulletin->bf_ugp_forumpermissions['candeletethread'] . ", " . $vbulletin->bf_ugp_socialgrouppermissions['canmanagediscussions'] . ", 0) |
IF(genericpermissions & " . $vbulletin->bf_ugp_genericpermissions['canprofilepic'] . ", " . $vbulletin->bf_ugp_socialgrouppermissions['canuploadgroupicon'] . ", 0) |
IF(genericpermissions & " . $vbulletin->bf_ugp_genericpermissions['cananimateprofilepic'] . ", " . $vbulletin->bf_ugp_socialgrouppermissions['cananimategroupicon'] . ", 0),
groupiconmaxsize = profilepicmaxsize,
pmthrottlequantity = 0,
maximumsocialgroups = 5
"
);
$upgrade->run_query(
sprintf($upgrade_phrases['upgrade_380a2.php']['granting_permissions'], 'forumpermission', 1, 1),
"UPDATE " . TABLE_PREFIX . "forumpermission SET
forumpermissions = forumpermissions |
IF(forumpermissions & " . $vbulletin->bf_ugp_forumpermissions['cangetattachment'] . ", " . $vbulletin->bf_ugp_forumpermissions['canseethumbnails'] . ", 0)
"
);
// Give moderator permissions
$upgrade->run_query(
sprintf($upgrade_phrases['upgrade_300b3.php']['altering_x_table'], 'moderator', 1, 1),
"UPDATE " . TABLE_PREFIX . "moderator SET
permissions2 = permissions2 |
IF(permissions & " . $vbulletin->bf_misc_moderatorpermissions2['caneditgroupmessages'] . ", " . $vbulletin->bf_misc_moderatorpermissions2['caneditsocialgroups'] . ", 0) |
IF(permissions & " . $vbulletin->bf_misc_moderatorpermissions2['candeletegroupmessages'] . ", " . $vbulletin->bf_misc_moderatorpermissions2['candeletediscussions'] . ", 0) |
IF(permissions & " . $vbulletin->bf_misc_moderatorpermissions2['candeletesocialgroups'] . ", " . $vbulletin->bf_misc_moderatorpermissions2['cantransfersocialgroups'] . ", 0) |
IF(permissions & " . $vbulletin->bf_misc_moderatorpermissions2['canremovegroupmessages'] . ", " . $vbulletin->bf_misc_moderatorpermissions2['canremovediscussions'] . ", 0) |
IF(permissions & " . $vbulletin->bf_misc_moderatorpermissions2['canmoderategroupmessages'] . ", " . $vbulletin->bf_misc_moderatorpermissions2['canmoderatediscussions'] . ", 0)
"
);
// Update latest albums
$upgrade->show_message($upgrade_phrases['upgrade_380a2.php']['update_album_update_counters']);
$upgrade->execute();
require_once(DIR . '/includes/functions_album.php');
$vbulletin->options['album_recentalbumdays'] = 7;
exec_rebuild_album_updates();
}
// FINAL step (notice the SCRIPTCOMPLETE define)
if ($vbulletin->GPC['step'] == 5)
{
$db->query_write("
DELETE FROM " . TABLE_PREFIX . "phrase
WHERE varname LIKE 'notice\_%\_title'
AND fieldname = 'global'
");
require_once(DIR . '/includes/adminfunctions_prefix.php');
build_prefix_datastore();
build_forum_permissions();
// tell log_upgrade_step() that the script is done
define('SCRIPTCOMPLETE', true);
}