Exemplo n.º 1
0
    } else {
        $group_id = $_GET['group_id'];
    }
    // Setup API
    if (!($db = new Connection())) {
        throw new Exception("Couldn't connect to database!");
    }
    if (!($loginSys = new LoginSystem($db))) {
        throw new Exception("Couldn't connect to login system!");
    }
    if (!($groupSys = new GroupSystem($db))) {
        throw new Exception("Couldn't connect to group system!");
    }
    // Get Group Member Ids
    if (!($memberIds = $groupSys->GetMembers($group_id))) {
        throw new Exception("Couldn't retreive group members!");
    }
    // Get Member Details
    if (!($members = $loginSys->GetUsers($memberIds))) {
        throw new Exception("Couldn't retreive member details!");
    }
    // Prepare output array
    $output = array();
    foreach ($members as $member) {
        array_push($output, array('id' => $member['id'], 'handle' => $member['handle']));
    }
} catch (Exception $e) {
    $error_msg = $e->getMessage();
    $success = false;
}
echo json_encode(array('success' => $success, 'error_msg' => $error_msg, 'members' => $output));
Exemplo n.º 2
0
<!doctype html>
<html>
    <head>
        <meta http-equiv="refresh" content="0; url=/"/>
    </head>
    <body></body>
</html>

<?php 
    // Logged in
} else {
    // Get Associated groups
    $groups = $groupSys->GetUserGroups($loginSys->user['id']);
    // Get Group Members
    $members = $loginSys->GetUsers($groupSys->GetMembers($loginSys->group_id));
    // Get group posts
    $posts = $postSys->GetPosts($loginSys->group_id);
    ?>
<!doctype html>
<html>
    <head>
        <title>BranchFeed</title>
        
        <meta charset="utf-8"/>
        
        <link rel="stylesheet" type="text/css" href="css/home.css"/>
    </head>
    <body>
        
        <div id="wrapper">