示例#1
0
function manageConnections($userid) {
	global $_CB_framework, $ueConfig;

	if(!$ueConfig['allowConnections']) {
		echo _UE_FUNCTIONALITY_DISABLED;
		return;
	}
	if ( $_CB_framework->myId() != $userid || $_CB_framework->myId() == 0) {
		cbNotAuth();
		return;
	}

	$cbCon			=	new cbConnection( $userid );

	$connections	=	$cbCon->getActiveConnections( $userid );
	$tabs			=	new cbTabs( 0, $_CB_framework->getUi() );
	$tabs->element	=	'';
	$pagingParams	=	$tabs->_getPaging( array(), array( 'connections_' ) );

	$perpage		=	20;		//TBD unhardcode and get the code below better
	$total			=	$cbCon->getConnectionsCount( $userid, true );

	if ( $pagingParams["connections_limitstart"] === null ) {
		$pagingParams["connections_limitstart"]	=	0;
	}
	if ( $pagingParams["connections_limitstart"] > $total ) {
		$pagingParams["connections_limitstart"]	=	0;
	}
	$offset			=	( $pagingParams["connections_limitstart"] ? (int) $pagingParams["connections_limitstart"] : 0 );
	$connections	=	$cbCon->getActiveConnections( $userid, $offset, $perpage );

	$actions		=	$cbCon->getPendingConnections( $userid );

	$connecteds		=	$cbCon->getConnectedToMe( $userid );

	HTML_comprofiler::manageConnections( $connections, $actions, $total, $tabs, $pagingParams, $perpage, $connecteds );
}
示例#2
0
function manageConnections($userid)
{
    global $_CB_framework, $ueConfig, $_PLUGINS;
    if (!$ueConfig['allowConnections']) {
        $msg = CBTxt::Th('UE_FUNCTIONALITY_DISABLED', 'This functionality is currently disabled.');
    } elseif ($_CB_framework->myId() != $userid || $_CB_framework->myId() == 0) {
        $msg = CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!');
    } else {
        $msg = null;
    }
    $_PLUGINS->loadPluginGroup('user');
    $_PLUGINS->trigger('onBeforeManageConnectionsRequest', array($userid, &$msg));
    if ($msg) {
        $_CB_framework->enqueueMessage($msg, 'error');
        return;
    }
    $cbCon = new cbConnection($userid);
    $tabs = new cbTabs(0, $_CB_framework->getUi());
    $tabs->element = '';
    $pagingParams = $tabs->_getPaging(array(), array('connections_'));
    $perpage = 20;
    //TBD unhardcode and get the code below better
    $total = $cbCon->getConnectionsCount($userid, true);
    if ($pagingParams["connections_limitstart"] === null) {
        $pagingParams["connections_limitstart"] = 0;
    }
    if ($pagingParams["connections_limitstart"] > $total) {
        $pagingParams["connections_limitstart"] = 0;
    }
    $offset = $pagingParams["connections_limitstart"] ? (int) $pagingParams["connections_limitstart"] : 0;
    $connections = $cbCon->getActiveConnections($userid, $offset, $perpage);
    $actions = $cbCon->getPendingConnections($userid);
    $connecteds = $cbCon->getConnectedToMe($userid);
    HTML_comprofiler::manageConnections($connections, $actions, $total, $tabs, $pagingParams, $perpage, $connecteds);
}