<?php
/*======================================================================*\
|| #################################################################### ||
|| # Message Popup v 1.0 by 7beebi.com                                # ||
|| #################################################################### ||
\*======================================================================*/

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('CVS_REVISION', '$RCSfile: mwaextraadmin3_msgpopup.php,v $ - $Revision: 1.0 $');

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// ######################## CHECK ADMIN PERMISSIONS #######################
if (!can_administer('canadminusers'))
{
        print_cp_no_permission();
}

// ############################# LOG ACTION ###############################
log_admin_action();

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
// Disable done popup
$mwaextraadmin3_msgpopupsdone = $db->query_read("
            SELECT id, active
            FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopup
            WHERE active = 1
");

while ($mwaextraadmin3_msgpopupdone = $db->fetch_array($mwaextraadmin3_msgpopupsdone))
{
             $popupdone = $db->query_first("
             SELECT msgid, done
             FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
             WHERE msgid = " . $mwaextraadmin3_msgpopupdone['id'] . "
             AND done = 0
             ");

             if (!$popupdone)
             {
                  $db->query_write("UPDATE " . TABLE_PREFIX . "mwaextraadmin3_msgpopup SET active = 0 WHERE id = " . $mwaextraadmin3_msgpopupdone['id'] . "");
             }
}
// end Disable

print_cp_header($vbphrase['mwaextraadmin3_msgpopup']);

if (empty($_REQUEST['do']))
{

        $mwaextraadmin3_msgpopups = $db->query_read("
        SELECT *
        FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopup
        ORDER BY id ASC
        ");

        print_form_header('mwaextraadmin3_msgpopup', 'add', $vbphrase['mwaextraadmin3_msgpopup']);
        print_table_header($vbphrase['add_mwaextraadmin3_msgpopup']);
        print_textarea_row("<b>" . $vbphrase['text'] . "</b>", 'msg', '', 8, 60);
        print_membergroup_row("<b>" . $vbphrase['usergroups'] . "</b>", 'usergroup', 2, NULL);
        print_input_row("<b>" . $vbphrase['user'] . "</b>", 'user', '');
        print_input_row("<b>" . $vbphrase['refarelink'] . "</b>", 'refarelink', '');
        print_input_row("<b>" . $vbphrase['timeout'] . "</b>", 'timeout', 0);
        print_yes_no_row("<b>" . $vbphrase['mwaextraadmin3_msgpopup_active'] . "</b>", 'active', '1');
        print_submit_row($vbphrase['save'], false);
        print_table_footer();

        print_form_header("mwaextraadmin3_msgpopup");
        print_table_header($vbphrase['mwaextraadmin3_msgpopup'],8);
                $header = array();
                $header[] = $vbphrase['text'];
                $header[] = $vbphrase['usergroup'];
                $header[] = $vbphrase['user'];
                $header[] = $vbphrase['refarelink'];
                $header[] = $vbphrase['state'];
                $header[] = $vbphrase['time'];
                $header[] = 'وقت الإنتهاء';
                $header[] = '';
                print_cells_row($header, 1, 0, 1);
                $cell = array();
                while ($mwaextraadmin3_msgpopup = $db->fetch_array($mwaextraadmin3_msgpopups))
                {
                        $cell[] = $mwaextraadmin3_msgpopup['msg'];
                        $cell[] = $mwaextraadmin3_msgpopup['usergroup'];
                        $cell[] = $mwaextraadmin3_msgpopup['user'];
                        $cell[] = $mwaextraadmin3_msgpopup['refarelink'];
                        $cell[] = iif($mwaextraadmin3_msgpopup['active'] != 0,$vbphrase['mwaextraadmin3_msgpopup_active'],$vbphrase['mwaextraadmin3_msgpopup_disable']);
                        $cell[] = vbdate($vbulletin->options['dateformat'], $mwaextraadmin3_msgpopup['dateline'], 1)."  ".vbdate($vbulletin->options['timeformat'], $mwaextraadmin3_msgpopup['dateline']);
                        $cell[] = $mwaextraadmin3_msgpopup['timeout'] . " ساعة / ساعات";
                        $cell[] = iif($mwaextraadmin3_msgpopup['id'] == 0 ,'','<a href="mwaextraadmin3_msgpopup.php?do=delete&id=' . $mwaextraadmin3_msgpopup['id'] . '">' . $vbphrase['delete'] . '</a> <a href="mwaextraadmin3_msgpopup.php?do=edit&id=' . $mwaextraadmin3_msgpopup['id'] . '">' . $vbphrase['edit'] . '</a>');
                        print_cells_row($cell, 0, 0, 1, 1, 0, 1);
                        unset($cell);
                        $cell = array();
                }
        print_table_footer();
}

elseif ($_REQUEST['do'] == 'edit')
{
        $vbulletin->input->clean_array_gpc('r', array
        (
                'id'  => TYPE_INT,
        ));

        $mwaextraadmin3_msgpopup = $db->query_first("SELECT *
        FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopup
        WHERE id = " . $vbulletin->GPC['id'] . "
        ");

        $usergroup['membergroupids'] = $mwaextraadmin3_msgpopup['usergroup'];

        print_form_header('mwaextraadmin3_msgpopup', 'update',$vbphrase['mwaextraadmin3_msgpopup']);
        print_table_header($vbphrase['edit_mwaextraadmin3_msgpopup']);
        print_textarea_row("<b>" . $vbphrase['text'] . "</b>",'msg',$mwaextraadmin3_msgpopup['msg'], 8, 60);
        print_membergroup_row("<b>" . $vbphrase['usergroups'] . "</b>", 'usergroup', 2, $usergroup);
        print_input_row("<b>" . $vbphrase['user'] . "</b>", 'user', $mwaextraadmin3_msgpopup['user']);
        print_input_row("<b>" . $vbphrase['refarelink'] . "</b>", 'refarelink', $mwaextraadmin3_msgpopup['refarelink']);
        print_input_row("<b>" . $vbphrase['timeout'] . "</b>",'timeout',$mwaextraadmin3_msgpopup['timeout']);
        print_yes_no_row("<b>" . $vbphrase['mwaextraadmin3_msgpopup_active'] . "</b>", 'active', $mwaextraadmin3_msgpopup['active']);
        construct_hidden_code('id', $mwaextraadmin3_msgpopup['id']);
        print_submit_row($vbphrase['save'],false);
        print_table_footer();

}

elseif ($_REQUEST['do'] == 'update' OR $_REQUEST['do'] == 'add')
{
        $vbulletin->input->clean_array_gpc('r', array
        (
                'id'           => TYPE_INT,
                'msg'          => TYPE_STR,
                'usergroup'    => TYPE_ARRAY_INT,
                'user'         => TYPE_STR,
                'refarelink'   => TYPE_STR,
                'active'       => TYPE_INT,
                'timeout'      => TYPE_INT,

        ));

        if (empty($vbulletin->GPC['msg']))
        {
                print_cp_message($vbphrase['write_msg'], 'mwaextraadmin3_msgpopup.php');
        }
        elseif (empty($vbulletin->GPC['usergroup']) AND empty($vbulletin->GPC['user']))
        {
                print_cp_message($vbphrase['select_group_users'], 'mwaextraadmin3_msgpopup.php', 3);
        }
        else
        {
                $groupsid = '';

                if (!empty($vbulletin->GPC['usergroup']))
                {
                   foreach($vbulletin->GPC['usergroup'] as $group)
                   {
                      if ($groupsid == "")
                      {
                          $groupsid = $group;
                      }

                      else
                      {
                          $groupsid .= ",$group";
                      }

                   }
                }

                if ($vbulletin->GPC['id'] == 0)
                {
                     $db->query_write("
                        INSERT INTO " . TABLE_PREFIX . "mwaextraadmin3_msgpopup
                                (msg, usergroup, user, refarelink, active, dateline, timeout)
                        VALUES
                                ('" . $vbulletin->GPC['msg'] . "', '" . $groupsid . "', '" . $vbulletin->GPC['user'] . "', '" . $vbulletin->GPC['refarelink'] . "', '" . $vbulletin->GPC['active'] . "', '" . TIMENOW . "', '" . $vbulletin->GPC['timeout'] . "')"
                     );

                     $mwaextraadmin3_msgpopups = $db->query_read("
                                  SELECT id
                                  FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopup
                                  ");

                     while ($mwaextraadmin3_msgpopup = $db->fetch_array($mwaextraadmin3_msgpopups))
                     {
                         $msgid = $mwaextraadmin3_msgpopup['id'];
                     }
                }
                else
                {
                    $db->query_write("UPDATE " . TABLE_PREFIX . "mwaextraadmin3_msgpopup
                        SET  msg = '" . $vbulletin->GPC['msg'] . "', usergroup = '$groupsid', user = '" . $vbulletin->GPC['user'] . "', refarelink = '" . $vbulletin->GPC['refarelink'] . "', active = " . $vbulletin->GPC['active'] . ", dateline = '" . TIMENOW . "', timeout = '" . $vbulletin->GPC['timeout'] . "'
                        WHERE id = " . $vbulletin->GPC['id'] . "
                        ");

                    $db->query_write("DELETE FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser WHERE msgid = " . $vbulletin->GPC['id'] . "");
                }

                if (!empty($vbulletin->GPC['usergroup']) AND empty($vbulletin->GPC['user']))
                {
                    $users = $db->query_read("
                    SELECT userid
                    FROM " . TABLE_PREFIX . "user
                    WHERE usergroupid IN (" . $groupsid . ")
                    ORDER BY userid DESC
                    ");
                }
                elseif (empty($vbulletin->GPC['usergroup']) AND !empty($vbulletin->GPC['user']))
                {
                    $users = $db->query_read("
                    SELECT userid
                    FROM " . TABLE_PREFIX . "user
                    WHERE userid IN (" . $vbulletin->GPC['user'] . ")
                    ORDER BY userid DESC
                    ");
                }
                elseif (!empty($vbulletin->GPC['usergroup']) AND !empty($vbulletin->GPC['user']))
                {
                    $usersg = $db->query_read("
                    SELECT userid
                    FROM " . TABLE_PREFIX . "user
                    WHERE usergroupid IN (" . $groupsid . ")
                    ORDER BY userid DESC
                    ");

                    $usersu = $db->query_read("
                    SELECT userid
                    FROM " . TABLE_PREFIX . "user
                    WHERE usergroupid NOT IN (" . $groupsid . ")
                    AND userid IN (" . $vbulletin->GPC['user'] . ")
                    ORDER BY userid DESC
                    ");
                }

                if (!empty($vbulletin->GPC['usergroup']) AND !empty($vbulletin->GPC['user']))
                {

                   while ($user = $db->fetch_array($usersg))
                   {
                                      $db->query_write("
                                      INSERT INTO " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
                                             (userid, msgid)
                                      VALUES
                                            (" . $user['userid'] . ", " . iif($vbulletin->GPC['id'] == 0, $msgid, $vbulletin->GPC['id']). ")
                                      ");
                   }

                   while ($user = $db->fetch_array($usersu))
                   {
                                      $db->query_write("
                                      INSERT INTO " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
                                             (userid, msgid)
                                      VALUES
                                            (" . $user['userid'] . ", " . iif($vbulletin->GPC['id'] == 0, $msgid, $vbulletin->GPC['id']). ")
                                      ");
                   }
                }
                else
                {
                   while ($user = $db->fetch_array($users))
                   {
                                      $db->query_write("
                                      INSERT INTO " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
                                             (userid, msgid)
                                      VALUES
                                            (" . $user['userid'] . ", " . iif($vbulletin->GPC['id'] == 0, $msgid, $vbulletin->GPC['id']). ")
                                      ");
                   }
                }

                iif($vbulletin->GPC['id'] == 0, print_cp_message($vbphrase['msgbeenadded'], 'mwaextraadmin3_msgpopup.php'), print_cp_message($vbphrase['msgupdated'], 'mwaextraadmin3_msgpopup.php'));

        }
}

elseif ($_REQUEST['do'] == 'delete')
{
        $vbulletin->input->clean_array_gpc('r', array
        (
                'id'  => TYPE_INT,
        ));

        $db->query_write("DELETE FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopup WHERE id = " . $vbulletin->GPC['id'] . "");

        $db->query_write("DELETE FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser WHERE msgid = " . $vbulletin->GPC['id'] . "");

        print_cp_message($vbphrase['msgdeleted'], 'mwaextraadmin3_msgpopup.php');
}

elseif ($_REQUEST['do'] == 'statistics')
{
        $mwaextraadmin3_msgpopups = $db->query_read("
        SELECT *
        FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopup
        ORDER BY id ASC"
        );

        print_form_header();
        print_table_header($vbphrase['statistics'],5);
                $header = array();
                $header[] = $vbphrase['text'];
                $header[] = $vbphrase['unread'];
                $header[] = $vbphrase['read'];
                $header[] = $vbphrase['ignore'];
                $header[] = '';
                print_cells_row($header, 1, 0, 1);
                $cell = array();
                while ($mwaextraadmin3_msgpopup = $db->fetch_array($mwaextraadmin3_msgpopups))
                {
                        $unread = $db->query_first("
                        SELECT COUNT(*) AS a
                        FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
                        WHERE msgid = " . $mwaextraadmin3_msgpopup['id'] . "
                        AND done = 0
                        ");

                        $read = $db->query_first("
                        SELECT COUNT(*) AS b
                        FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
                        WHERE msgid = " . $mwaextraadmin3_msgpopup['id'] . "
                        AND done = 1
                        ");

                        $ignore = $db->query_first("
                        SELECT COUNT(*) AS c
                        FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
                        WHERE msgid = " . $mwaextraadmin3_msgpopup['id'] . "
                        AND done = 2
                        ");

                        $cell[] = $mwaextraadmin3_msgpopup['msg'];
                        $cell[] = "<a href=mwaextraadmin3_msgpopup.php?do=list&id=" . $mwaextraadmin3_msgpopup['id'] . "&type=0>" . $unread['a'] . "</a>";
                        $cell[] = "<a href=mwaextraadmin3_msgpopup.php?do=list&id=" . $mwaextraadmin3_msgpopup['id'] . "&type=1>" . $read['b'] . "</a>";
                        $cell[] = "<a href=mwaextraadmin3_msgpopup.php?do=list&id=" . $mwaextraadmin3_msgpopup['id'] . "&type=2>" . $ignore['c'] . "</a>";
                        $cell[] = '<a href="mwaextraadmin3_msgpopup.php?do=refresh&id=' . $mwaextraadmin3_msgpopup['id'] . '">' . $vbphrase['rebuild'] . '</a>';
                        print_cells_row($cell, 0, 0, 1, 1, 0, 1);
                        unset($cell);
                        $cell = array();
                }
        print_table_footer();
}

elseif ($_REQUEST['do'] == 'refresh')
{
        $vbulletin->input->clean_array_gpc('r', array
        (
                'id'  => TYPE_INT,
        ));

        $mwaextraadmin3_msgpopup = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopup WHERE id = " . $vbulletin->GPC['id'] . "");
        
        if (empty($mwaextraadmin3_msgpopup['usergroup']) AND empty($mwaextraadmin3_msgpopup['user']))
        {
                print_cp_message('غير مسموح', 'mwaextraadmin3_msgpopup.php', 3);
        }

        $db->query_write("UPDATE " . TABLE_PREFIX . "mwaextraadmin3_msgpopup SET  active = 1, dateline = '" . TIMENOW . "' WHERE id = " . $vbulletin->GPC['id'] . "");

        $db->query_write("DELETE FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser WHERE msgid = " . $vbulletin->GPC['id'] . "");

        if (!empty($mwaextraadmin3_msgpopup['usergroup']) AND empty($mwaextraadmin3_msgpopup['user']))
        {
                    $users = $db->query_read("
                    SELECT userid
                    FROM " . TABLE_PREFIX . "user
                    WHERE usergroupid IN (" . $mwaextraadmin3_msgpopup['usergroup'] . ")
                    ORDER BY userid DESC
                    ");
        }
        elseif (empty($mwaextraadmin3_msgpopup['usergroup']) AND !empty($mwaextraadmin3_msgpopup['user']))
        {
                    $users = $db->query_read("
                    SELECT userid
                    FROM " . TABLE_PREFIX . "user
                    WHERE userid IN (" . $mwaextraadmin3_msgpopup['user'] . ")
                    ORDER BY userid DESC
                    ");
        }
        elseif (!empty($mwaextraadmin3_msgpopup['usergroup']) AND !empty($mwaextraadmin3_msgpopup['user']))
        {
                    $usersg = $db->query_read("
                    SELECT userid
                    FROM " . TABLE_PREFIX . "user
                    WHERE usergroupid IN (" . $mwaextraadmin3_msgpopup['usergroup'] . ")
                    ORDER BY userid DESC
                    ");

                    $usersu = $db->query_read("
                    SELECT userid
                    FROM " . TABLE_PREFIX . "user
                    WHERE usergroupid NOT IN (" . $mwaextraadmin3_msgpopup['usergroup'] . ")
                    AND userid IN (" . $mwaextraadmin3_msgpopup['user'] . ")
                    ORDER BY userid DESC
                    ");
        }

        if (!empty($mwaextraadmin3_msgpopup['usergroup']) AND !empty($mwaextraadmin3_msgpopup['user']))
        {

                   while ($user = $db->fetch_array($usersg))
                   {
                                      $db->query_write("
                                      INSERT INTO " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
                                             (userid, msgid)
                                      VALUES
                                            (" . $user['userid'] . ", " . $vbulletin->GPC['id'] . ")
                                      ");
                   }

                   while ($user = $db->fetch_array($usersu))
                   {
                                      $db->query_write("
                                      INSERT INTO " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
                                             (userid, msgid)
                                      VALUES
                                            (" . $user['userid'] . ", " . $vbulletin->GPC['id'] . ")
                                      ");
                   }
       }
       else
       {
                   while ($user = $db->fetch_array($users))
                   {
                                      $db->query_write("
                                      INSERT INTO " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
                                             (userid, msgid)
                                      VALUES
                                            (" . $user['userid'] . ", " . $vbulletin->GPC['id'] . ")
                                      ");
                   }
       }

       print_cp_message($vbphrase['msgupdated'], 'mwaextraadmin3_msgpopup.php?do=statistics');
}

elseif ($_REQUEST['do'] == 'list')
{
        $vbulletin->input->clean_array_gpc('r', array
        (
                'id'           => TYPE_INT,
                'type'         => TYPE_INT,
                'limitstart'   => TYPE_INT,
                'limitnumber'  => TYPE_INT,
        ));

        if (empty($vbulletin->GPC['limitstart']))
        {
             $vbulletin->GPC['limitstart'] = 0;
        }
        else
        {
             $vbulletin->GPC['limitstart']--;
        }

        if (empty($vbulletin->GPC['limitnumber']) OR $vbulletin->GPC['limitnumber'] == 0)
        {
            $vbulletin->GPC['limitnumber'] = 30;
        }

        $countusers = $db->query_first("SELECT COUNT(*) AS users FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser AS mwaextraadmin3_msgpopupuser WHERE msgid = " . $vbulletin->GPC['id'] . " AND done = " . $vbulletin->GPC['type'] . "");
        $limitfinish = $vbulletin->GPC['limitstart'] + $vbulletin->GPC['limitnumber'];

        $mwaextraadmin3_msgpopups = $db->query_read("
        SELECT *
        FROM " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser
        WHERE msgid = " . $vbulletin->GPC['id'] . "
        AND done = " . $vbulletin->GPC['type'] . "
        ORDER BY id DESC
        LIMIT " . $vbulletin->GPC['limitstart'] . ", " . $vbulletin->GPC['limitnumber'] ."
        ");

        print_form_header('mwaextraadmin3_msgpopup','list');
        print_table_header($vbphrase['statistics'], iif($vbulletin->GPC['type'] != 1,3,2));

                $header = array();
                $header[] = $vbphrase['user'];
                $header[] = $vbphrase['state'];
                if($vbulletin->GPC['type'] != 1)
                $header[] = '';

                print_cells_row($header, 1, 0, 1);

                $cell = array();

                while ($mwaextraadmin3_msgpopup = $db->fetch_array($mwaextraadmin3_msgpopups))
                {
                        $user = $db->query_first("
                        SELECT userid, username
                        FROM " . TABLE_PREFIX . "user
                        WHERE userid = " . $mwaextraadmin3_msgpopup['userid'] . "
                        ");

                        $cell[] = "<a href=user.php?do=edit&u=" . $user['userid'] . " target=_blank>" . $user['username'] . "</a>";
                        if ($vbulletin->GPC['type'] == 0)
                        {
                            $cell[] = $vbphrase['unread'];
                            $cell[] = "<a href=mwaextraadmin3_msgpopup.php?do=changestate&id=" . $mwaextraadmin3_msgpopup['id'] . "&type=" . $vbulletin->GPC['type'] . ">تجاهل هذا العضو</a>";
                        }
                        elseif ($vbulletin->GPC['type'] == 1)
                        {
                            $cell[] = vbdate($vbulletin->options['dateformat'], $mwaextraadmin3_msgpopup['dateline'], 1)."  ".vbdate($vbulletin->options['timeformat'], $mwaextraadmin3_msgpopup['dateline']);
                        }
                        elseif ($vbulletin->GPC['type'] == 2)
                        {
                            $cell[] = $vbphrase['ignore'];
                            $cell[] = "<a href=mwaextraadmin3_msgpopup.php?do=changestate&id=" . $mwaextraadmin3_msgpopup['id'] . "&type=" . $vbulletin->GPC['type'] . ">إلغاء التجاهل</a>";
                        }
                        print_cells_row($cell, 0, 0, 1, 1, 0, 1);
                        unset($cell);
                        $cell = array();
                }

        construct_hidden_code('id', $vbulletin->GPC['id']);
        construct_hidden_code('type', $vbulletin->GPC['type']);
        construct_hidden_code('limitnumber', $vbulletin->GPC['limitnumber']);

        if ($vbulletin->GPC['limitstart'] == 0 AND $countusers['users'] > $vbulletin->GPC['limitnumber'])
        {
            construct_hidden_code('limitstart', $vbulletin->GPC['limitstart'] + $vbulletin->GPC['limitnumber'] + 1);
            print_submit_row($vbphrase['next_page'], 0, $colspan);
        }
        else if ($limitfinish < $countusers['users'])
        {
            construct_hidden_code('limitstart', $vbulletin->GPC['limitstart'] + $vbulletin->GPC['limitnumber'] + 1);
            print_submit_row($vbphrase['next_page'], 0, $colspan, $vbphrase['prev_page'], '', true);
        }
        else if ($limitfinish >= $countusers['users'])
        {
            print_submit_row($vbphrase['first_page'], 0, $colspan, $vbphrase['prev_page'], '', true);
        }

        print_table_footer();
}

elseif ($_REQUEST['do'] == 'changestate')
{
        $vbulletin->input->clean_array_gpc('r', array
        (
                'id'   => TYPE_INT,
                'type' => TYPE_INT,
        ));

        $db->query_write("UPDATE " . TABLE_PREFIX . "mwaextraadmin3_msgpopupuser SET done = " . iif($vbulletin->GPC['type'] == 0,2,0) . " WHERE id = " . $vbulletin->GPC['id'] . "");

        print_cp_message($vbphrase['msgupdated'], 'mwaextraadmin3_msgpopup.php?do=statistics');
}

print_cp_footer();

?>
