/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $dir;
    $member['ID'] = (int) $_COOKIE['memberID'];
    ob_start();
    $p_arr = getProfileInfo($member['ID']);
    if ($_POST['CHANGE_STATUS']) {
        switch ($_POST['CHANGE_STATUS']) {
            case 'SUSPEND':
                if ($p_arr['Status'] == 'Active') {
                    db_res("UPDATE `Profiles` SET `Status` = 'Suspended' WHERE `ID` = '{$member['ID']}';");
                    modules_block($p_arr['ID']);
                }
                break;
            case 'ACTIVATE':
                if ($p_arr['Status'] == 'Suspended') {
                    db_res("UPDATE `Profiles` SET `Status` = 'Active' WHERE `ID` = {$member['ID']}");
                    // call modules to add user to modules
                    $check_res = checkAction($member['ID'], ACTION_ID_USE_CHAT);
                    if ($check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
                        modules_unblock($p_arr['ID'], 'chat');
                    }
                    $check_res = checkAction($member['ID'], ACTION_ID_USE_FORUM);
                    if ($check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
                        modules_unblock($p_arr['ID'], 'forum');
                    }
                }
                break;
        }
        createUserDataFile($p_arr['ID']);
        reparseObjTags('profile', $member['ID']);
        $p_arr = getProfileInfo($member['ID']);
    }
    echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
    echo _t("_Profile status");
    ?>
: <b><font class=prof_stat_<?php 
    echo $p_arr['Status'];
    ?>
>&nbsp;<?php 
    echo _t("__{$p_arr['Status']}");
    ?>
&nbsp;</font></b><br />
<?php 
    switch ($p_arr['Status']) {
        case 'Active':
            echo _t("_PROFILE_CAN_SUSPEND");
            ?>
<br /><br /><form action="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
" method=post>
<input type=hidden name=CHANGE_STATUS value=SUSPEND>
<center><input class=no type=submit value="<?php 
            echo _t("_Suspend account");
            ?>
"></center>
</form>
<?php 
            break;
        case 'Suspended':
            echo _t("_PROFILE_CAN_ACTIVATE");
            ?>
<br /><br /><form action="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
" method=post>
<input type=hidden name=CHANGE_STATUS value=ACTIVATE>
<center><input class=no type=submit value="<?php 
            echo _t("_Activate account");
            ?>
"></center>
</form>
<?php 
            break;
        default:
            echo _t("_PROFILE_CANT_ACTIVATE/SUSPEND");
            break;
    }
    echo "</td></table>";
    $ret = ob_get_contents();
    ob_end_clean();
    return $ret;
}
        }
        $membership_id = (int) $_POST['MembershipID'];
        $immediately = $_POST['MembershipImmediately'] == 'on';
        $membership_result = setMembership($ID, $membership_id, $membership_days, $immediately);
        if (!$membership_result) {
            $membership_message = "<font color=\"red\">Failed to set membership</font>";
        } else {
            $check_res = checkAction($ID, ACTION_ID_USE_CHAT);
            if ($check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
                modules_unblock($ID, 'chat');
            } else {
                modules_block($ID, 'chat');
            }
            $check_res = checkAction($ID, ACTION_ID_USE_FORUM);
            if ($check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
                modules_unblock($ID, 'forum');
            } else {
                modules_block($ID, 'forum');
            }
        }
    }
}
// fill array with POST values
if (!(($ADMIN && !$demo_mode || $MEMBER) && $_POST['SaveChanges'] == 'YES')) {
    // fill array with POST values
    $respd = db_res("SELECT * FROM ProfilesDesc WHERE `visible` & {$db_vsbl} AND ( FIND_IN_SET('0',show_on_page) OR FIND_IN_SET('" . (int) $_page[name_index] . "',show_on_page)) ORDER BY `order` ASC");
    while ($arrpd = mysql_fetch_array($respd)) {
        $fname = get_input_name($arrpd);
        switch ($arrpd[type]) {
            case 'set':
                // set of checkboxes
示例#3
0
function modules_proceed()
{
    // select all profiles and check who can't use chat or forum
    $p_res = db_res("SELECT `ID` FROM `Profiles`");
    while ($p_arr = mysql_fetch_array($p_res)) {
        $check_res = checkAction($p_arr['ID'], ACTION_ID_USE_CHAT);
        if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
            modules_block($p_arr['ID'], 'chat');
        } else {
            modules_unblock($p_arr['ID'], 'chat');
        }
        $check_res = checkAction($p_arr['ID'], ACTION_ID_USE_FORUM);
        if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
            modules_block($p_arr['ID'], 'forum');
        } else {
            modules_unblock($p_arr['ID'], 'forum');
        }
    }
    echo "\n- Modules check -\n";
    echo "Profiles processed successfully\n";
}
    echo "<br /><p>Fatal error: <b>{$ErrorMessage}</b></p><br />";
    exit($ErrorMessage);
}
if ($argc < 3) {
    FatalError(sprintf(errArgCountNotMatch, $argc));
}
$isAdmin = $argv[1];
for ($argIndex = 2; $argIndex <= $argc - 1; $argIndex++) {
    $userID = $argv[$argIndex];
    if ($isAdmin) {
        modules_update($userID, '', '', 1);
    } else {
        if ($userID != (int) $userID) {
            FatalError(sprintf(errInvalidInputData, " invalid member ID: [{$userID}]"));
        }
        modules_update($userID);
        // User will be added if he does not exist
        $resCheckAction = checkAction($userID, ACTION_ID_USE_CHAT);
        if ($resCheckAction[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
            modules_block($userID, 'chat');
        } else {
            modules_unblock($userID, 'chat');
        }
        $resCheckAction = checkAction($userID, ACTION_ID_USE_FORUM);
        if ($resCheckAction[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
            modules_block($userID, 'forum');
        } else {
            modules_unblock($userID, 'forum');
        }
    }
}