Code:
#
# ----------- [ FIND ] ---------------------
#
$sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE group_id = " . $group_id;
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update auth_access', '', __LINE__, __FILE__, $sql);
}
#
# ----------- [ AFTER, ADD ] ---------------------
#
// --- BEGIN : HACK - ADVANCED USER GROUP VER 1.0.0 ---
//
// Delete Nuke Front End Group
//
$sql_group = "DELETE FROM ".$prefix."_groups WHERE id='".$group_id."'";
if (!$db->sql_query($sql_group))
{
message_die(GENERAL_ERROR, 'Could not update PHP Nuke front-end group', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM ".$prefix."_groups_superusers WHERE group_id='".$group_id."'";
if (!$db->sql_query($sql_group))
{
message_die(GENERAL_ERROR, 'Could not update PHP Nuke front-end group superusers', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM ".$prefix."_groups_moderators WHERE group_id='".$group_id."'";
if (!$db->sql_query($sql_group))
{
message_die(GENERAL_ERROR, 'Could not update PHP Nuke front-end group moderators', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM ".$prefix."_groups_langs WHERE group_id='".$group_id."'";
if (!$db->sql_query($sql_group))
{
message_die(GENERAL_ERROR, 'Could not update PHP Nuke front-end group languages', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM ".$prefix."_groups_users WHERE group_id='".$group_id."'";
if (!$db->sql_query($sql_group))
{
message_die(GENERAL_ERROR, 'Could not update PHP Nuke front-end group users', '', __LINE__, __FILE__, $sql);
}
// DELETE 01: access permission group - advertising
// DELETE 02: access permission group - contents
$db->sql_query("DELETE FROM ".$prefix."_pages_access WHERE group_id='".$group_id."'");
// --- END : HACK - ADVANCED USER GROUP VER 1.0.0 ---
#
# ----------- [ FIND ] ---------------------
#
$sql = "UPDATE " . GROUPS_TABLE . "
SET group_type = $group_type, group_name = '" . str_replace("\'", "''", $group_name) . "', group_description = '" . str_replace("\'", "''", $group_description) . "', group_moderator = $group_moderator
WHERE group_id = $group_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update group', '', __LINE__, __FILE__, $sql);
}
#
# ----------- [ AFTER, ADD ] ---------------------
#
// --- BEGIN : HACK - ADVANCED USER GROUP VER 1.0.0 ---
$sql_group = "UPDATE ".$prefix."_groups SET type=$group_type, name='".str_replace("\'", "''", $group_name)."', description='".str_replace("\'", "''", $group_description)."', moderator=$group_moderator WHERE id=$group_id";
if (!$db->sql_query($sql_group))
{
message_die(GENERAL_ERROR, 'Could not update group', '', __LINE__, __FILE__, $sql);
};
$numrows = $db->sql_numrows($db->sql_query("SELECT * ".$prefix."_groups_moderators WHERE user_id='$group_moderator' AND group_id='$group_id'"));
if (!$numrows)
{
$db->sql_query("INSERT INTO ".$prefix."_groups_moderators VALUES ('".$group_moderator."', '".$group_id."')");
};
// --- END : HACK - ADVANCED USER GROUP VER 1.0.0 ---
#
# ----------- [ FIND ] ---------------------
#
else if( $mode == 'newgroup' )
{
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user)
VALUES ($group_type, '" . str_replace("\'", "''", $group_name) . "', '" . str_replace("\'", "''", $group_description) . "', $group_moderator, '0')";
#
# ----------- [ AFTER, ADD ] ---------------------
#
// --- BEGIN : HACK - ADVANCED USER GROUP VER 1.0.0 ---
$sql_group = "INSERT INTO ".$prefix."_groups VALUES (NULL, '$group_type', '".str_replace("\'", "''", $group_name)."', '".str_replace("\'", "''", $group_description)."', $group_moderator, '0', '', '')";
// --- END : HACK - ADVANCED USER GROUP VER 1.0.0 ---
#
# ----------- [ FIND ] ---------------------
#
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES ($new_group_id, $group_moderator, 0)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not insert new user-group info', '', __LINE__, __FILE__, $sql);
}
#
# ----------- [ AFTER, ADD ] ---------------------
#
// --- BEGIN : HACK - ADVANCED USER GROUP VER 1.0.0 ---
if ( !$db->sql_query($sql_group))
{
message_die(GENERAL_ERROR, 'Could not insert new group', '', __LINE__, __FILE__, $sql);
}
$new_nuke_group_id = $db->sql_nextid();
$sql_group = "UPDATE ".$prefix."_groups SET id='$new_group_id' WHERE id='".$new_nuke_group_id."'";
if ( !$db->sql_query($sql_group) )
{
message_die(GENERAL_ERROR, 'Could not insert new user-group info', '', __LINE__, __FILE__, $sql);
}
$db->sql_query("INSERT INTO ".$prefix."_groups_superusers VALUES ('', '".$new_group_id."')");
$db->sql_query("INSERT INTO ".$prefix."_groups_moderators VALUES ('".$group_moderator."', '".$new_group_id."')");
// --- END : HACK - ADVANCED USER GROUP VER 1.0.0 ---
|