-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathclan.php
93 lines (73 loc) · 2.28 KB
/
clan.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
$pageTitle = 'Clan';
$clanID = ( isset( $_GET[ 'clanid' ] ) && ( $_GET[ 'clanid' ] != '' ) ) ? $_GET[ 'clanid' ]: false;
include_once( 'includes/session.php' );
include_once( 'includes/functions_steam.php' );
include_once( 'includes/functions_clans.php' );
include_once( 'includes/functions_members.php' );
// are we logged in? → grab session
if ( login_check() ) {
$me = $_SESSION['u'];
}
/* check here for POST, for create/delete clan, adjust members, etc */
if ( $clanID == false and isset( $me ) ) {
// clans = getClanList
$yourClans = getPlayerClansDB( $me );
foreach ( $yourClans as $clan ) {
echo $clan[ 'name' ];
}
// if clans
// list
} elseif ( is_numeric( $clanID ) ) {
// fetch clan, and …
$clan = getClanSummaryDB( $clanID );
if ( $clan != false )
$players = getClanPlayersDB( $clan[ 'clanid' ] );
} elseif ( $clanID != false ) {
// assume $clabID is slub url, search clan, and …
$clan = findClanSummaryDB( $clanID );
if ( $clan != false )
$players = getClanPlayersDB( $clan[ 'clanid' ] );
} else {
// assume we’re not logged in + no requested clan
header( 'HTTP/1.0 404 Not Found' );
exit( );
}
if ( $clanID == false and isset( $me ) ) {
// render page for current user
} elseif ( isset( $clan ) ) {
// render page for this clan
$profile = getPlayerSummary( $clan[ 'creator' ] );
if ( !$profile )
$profile = inflatePlayerSummary( $profile );
} else {
// render nothing?
header( 'Location: /' );
exit( );
}
$pageTitle = " – {$clan[ 'name' ]} – Clan Page";
include_once( 'includes/header.php' );
$listMembers = '';
if ( isset( $players ) ) {
foreach ( $players as $member ) {
$listMembers .= $member[ 'clanrole' ] . ': '. $member[ 'steamid' ] . "<br>\n";
}
}
// header( 'Location: ' . str_replace( '//steamlug.org', '', $profile[ 'memberurl' ] ) );
/*
This is WIP, no idea how we want to present it atm…
*/
echo <<<DOCUMENT
<h1 class="text-center">SteamLUG group: </h1>
<article class="panel panel-default person">
<header class="panel-heading">
<h3 class="panel-title">{$clan[ 'name' ]}</h3>
</header>
<div class="panel-body">
Our Clan creator: {$clan[ 'creator' ]}
<img src="{$profile[ 'avatarmedium' ]}" /><br>
{$listMembers}
</div>
</article>
DOCUMENT;
include_once( 'includes/footer.php' );