if ($_REQUEST['action'] == 'deny') {
        Network::deny(PA::$network_info->network_id, $_REQUEST['uid']);
        $message = 7023;
    }
    if ($_REQUEST['action'] == 'multiple_approve') {
        if (is_array($_REQUEST['uid'])) {
            foreach ($_REQUEST['uid'] as $uid) {
                Network::approve(PA::$network_info->network_id, $uid);
            }
            $message = 7022;
        }
    }
    if ($_REQUEST['action'] == 'multiple_deny') {
        if (is_array($_REQUEST['uid'])) {
            foreach ($_REQUEST['uid'] as $uid) {
                Network::deny(PA::$network_info->network_id, $uid);
            }
            $message = 7023;
        }
    }
}
function setup_module($column, $module, $obj)
{
    global $paging, $super_user_and_mothership;
    switch ($module) {
        case 'NetworkModerateUserModule':
            if (@$_GET['sort_by'] == 'alphabetic') {
                $obj->sort_by = 'U.login_name';
                $obj->direction = 'ASC';
            } else {
                $obj->sort_by = 'U.created';
 function testNetworkCreation()
 {
     // check that we can create networks
     $can = Network::can_network_be_created();
     $this->assertFalse($can['error'], $can['error_msg']);
     // get network owner user and figure out name etc
     $user = Test::get_test_user();
     $name = "testnet" . rand(10000, 99999);
     $network_basic_controls = array();
     // with crossed fingers, we hope that it will succeed without any of the detail here!
     // make a new network
     $net = new Network();
     $net->set_params(array('user_id' => $user->user_id, 'name' => "auto-test network ({$name})", 'address' => $name, 'tagline' => "not much of a tagline", 'category_id' => 8, 'type' => 0, 'description' => "This network has been created automatically by a PHPUnit test.  If the test succeeds, it will be deleted, too!", 'extra' => serialize($network_basic_controls), 'created' => time(), 'changed' => time()));
     $net->save();
     //default_page_setting($net->address);
     // read it in again and see if it still works
     $net_read = Network::get_network_by_address($net->address);
     $this->assertEquals($net_read->network_id, $net->network_id);
     $this->assertEquals($net_read->type, 0);
     $this->assertEquals($net_read->member_count, 1);
     $this->assertEquals($net_read->owner_id, $user->user_id);
     // a user joins
     $user2 = Test::get_test_user(2);
     Network::join($net->network_id, $user2->user_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 2);
     // a user leaves
     Network::leave($net->network_id, $user2->user_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 1);
     // make it into a moderated network
     $net->type = 2;
     $net->save();
     // check that it really is moderated
     $net_read = Network::get_network_by_address($net->address);
     $this->assertEquals($net_read->network_id, $net->network_id);
     $this->assertEquals($net_read->type, 2);
     // a user requests
     Network::join($net->network_id, $user2->user_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 1);
     // request approved
     Network::approve($net->network_id, $user2->user_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 2);
     // user leaves
     Network::leave($net->network_id, $user2->user_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 1);
     // user requests
     Network::join($net->network_id, $user2->user_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 1);
     // all requests accepted (of course, there will only be the one)
     Network::approve_all($net->network_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 2);
     // user leaves
     Network::leave($net->network_id, $user2->user_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 1);
     // user requests
     Network::join($net->network_id, $user2->user_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 1);
     // request denied
     Network::deny($net->network_id, $user2->user_id);
     $this->assertEquals(Network::get_network_by_address($net->address)->member_count, 1);
     // delete network
     Network::delete($net->network_id);
 }
Ejemplo n.º 3
0
    if ($_REQUEST['action'] == 'deny') {
        Network::deny($network_info->network_id, $_REQUEST['uid']);
        $message = 7023;
    }
    if ($_REQUEST['action'] == 'multiple_approve') {
        if (is_array($_REQUEST['uid'])) {
            foreach ($_REQUEST['uid'] as $uid) {
                Network::approve($network_info->network_id, $uid);
            }
            $message = 7022;
        }
    }
    if ($_REQUEST['action'] == 'multiple_deny') {
        if (is_array($_REQUEST['uid'])) {
            foreach ($_REQUEST['uid'] as $uid) {
                Network::deny($network_info->network_id, $uid);
            }
            $message = 7023;
        }
    }
}
function setup_module($column, $module, $obj)
{
    global $paging, $configure_permission, $super_user_and_mothership;
    //if(!$configure_permission) return 'skip';
    switch ($module) {
        case 'NetworkModerateUserModule':
            if (!$configure_permission) {
                return 'skip';
            }
            if ($_GET['sort_by'] == 'alphabetic') {