Пример #1
0
function acceptConnection($userid,$connectionid) {
	global $_CB_framework, $ueConfig;

	if(!$ueConfig['allowConnections']) {			// do not test, needed if rules changed! || !$ueConfig['useMutualConnections']
		echo _UE_FUNCTIONALITY_DISABLED;
		return;
	}
	if (! ( $_CB_framework->myId() > 0 ) ) {
		cbNotAuth();
		return;
	}

	$cbCon=new cbConnection($userid);
	$cbCon->acceptConnection($userid,$connectionid);

	echo "<script type=\"text/javascript\"> alert('".addslashes($cbCon->getUserMSG())."'); window.history.go(-1); </script>\n";			//TBD solve this as a redirect to ???
}
Пример #2
0
function acceptConnection($userid, $connectionid, $act = 'connections')
{
    global $_CB_framework, $ueConfig, $_PLUGINS;
    if (!$ueConfig['allowConnections']) {
        $msg = CBTxt::Th('UE_FUNCTIONALITY_DISABLED', 'This functionality is currently disabled.');
    } elseif (!($_CB_framework->myId() > 0)) {
        cbNotAuth(true);
        return;
    } else {
        $msg = null;
    }
    $_PLUGINS->loadPluginGroup('user');
    $_PLUGINS->trigger('onBeforeAcceptConnectionRequest', array($userid, $connectionid, &$msg, $act));
    if ($msg) {
        $_CB_framework->enqueueMessage($msg, 'error');
        return;
    }
    $cbCon = new cbConnection($userid);
    if ($cbCon->isConnectionPending($userid, $connectionid) === false) {
        $_CB_framework->enqueueMessage(CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!'), 'error');
        return;
    } else {
        if (!$cbCon->acceptConnection($userid, $connectionid)) {
            $msg = $cbCon->getErrorMSG();
        } else {
            $msg = $cbCon->getUserMSG();
        }
    }
    if ($act == 'connections') {
        cbRedirectToProfile($userid, $msg, null, 'getConnectionTab');
    } elseif ($act == 'manage') {
        cbRedirectToProfile($connectionid, $msg, 'manageconnections', 'cbtabconnections');
    } else {
        cbRedirectToProfile($connectionid, $msg);
    }
}