Пример #1
0
function gang_view()
{
    global $gvars;
    if (!isset($_REQUEST['gang_id']) or intval($_REQUEST['gang_id']) < 1) {
        echo "<h3>Which {$gvars->name_sl} are you looking for?</h3>";
        return;
    }
    $gang_id = intval($_REQUEST['gang_id']);
    // gangID, gangNAME, gangDESC, gangPREF, gangSUFF, gangMONEY, gangCRYSTALS, gangRESPECT, gangPRESIDENT,
    // gangVICEPRES, gangCAPACITY, gangCRIME, gangCHOURS, gangAMENT
    $q_get = sprintf('select g.gangNAME, g.gangDESC, g.gangRESPECT, g.gangPRESIDENT, g.gangVICEPRES, g.gangCAPACITY
		from gangs as g where g.gangID = %d', $gang_id);
    $q_get = mysql_query($q_get);
    if (!$q_get or mysql_num_rows($q_get) < 1) {
        echo "<h3>The {$gvars->name_sl} you selected could not be found.</h3>";
        return;
    }
    list($gang_name, $desc, $respect, $pres_id, $vice_id, $capacity) = mysql_fetch_row($q_get);
    $desc = nl2br($desc);
    $pres_name = 'N/A';
    $vice_name = 'N/A';
    $q_get = sprintf('select userid, username, daysingang, level from users where gang = %d', $gang_id);
    $q_get = mysql_query($q_get);
    if (!$q_get or mysql_num_rows($q_get) < 1) {
        echo "<h3>The {$gvars->name_sl} you selected does not have any members.</h3>";
        _gang_delete($gang_id);
        return;
    }
    $user_list = '';
    $member_count = mysql_num_rows($q_get);
    while (list($them_id, $them_name, $daysingang, $level) = mysql_fetch_row($q_get)) {
        $profile = gang_get_profile_link($them_id, $them_name);
        if ($pres_id == $them_id) {
            $pres_name = $profile;
        }
        if ($vice_id == $them_id) {
            $vice_name = $profile;
        }
        $user_list .= <<<EOT
\t\t<tr class="right">
\t\t\t<td class="left">
\t\t\t{$profile}
\t\t\t</td>
\t\t\t<td>
\t\t\t{$level}
\t\t\t</td>
\t\t\t<td>
\t\t\t{$daysingang}
\t\t\t</td>
\t\t</tr>

EOT;
    }
    if ($gvars->ir['gang']) {
        $app_link = '';
    } else {
        $app_link = sprintf('<p class="center"><a href="gangs.php?action=gang_app&gang_id=%d">Apply</a></p>', $gang_id);
    }
    echo <<<EOT
\t<h3>{$gang_name}</h3>
\t{$app_link}
\t<table style="width:400px;">
\t\t<tr>
\t\t\t<th>
\t\t\t{$gvars->pres}
\t\t\t</th>
\t\t\t<th>
\t\t\t{$gvars->vice_pres}
\t\t\t</th>
\t\t\t<th>
\t\t\tMembers
\t\t\t</th>
\t\t\t<th>
\t\t\tRespect Level
\t\t\t</th>
\t\t</tr>
\t\t<tr class="right">
\t\t\t<td class="left">
\t\t\t{$pres_name}
\t\t\t</td>
\t\t\t<td class="left">
\t\t\t{$vice_name}
\t\t\t</td>
\t\t\t<td>
\t\t\t{$member_count}
\t\t\t</td>
\t\t\t<td>
\t\t\t{$respect}
\t\t\t</td>
\t\t</tr>
\t\t<tr>
\t\t\t<th colspan="4">
\t\t\tDescription
\t\t\t</th>
\t\t</tr>
\t\t<tr>
\t\t\t<td colspan="4">
\t\t\t{$desc}
\t\t\t</td>
\t\t</tr>
\t</table>
\t
\t<h3>User List</h3>
\t<table style="width:400px;">
\t\t<tr>
\t\t\t<th>
\t\t\tUser
\t\t\t</th>
\t\t\t<th>
\t\t\tLevel
\t\t\t</th>
\t\t\t<th>
\t\t\tDays In Gang
\t\t\t</th>
\t\t</tr>
\t\t{$user_list}
\t</table>
EOT;
}
Пример #2
0
function sgang_leadership()
{
    global $gvars;
    if (!gang_auth_all($gvars->userid, array('pres', 'vice'))) {
        echo "<h3>You are not authorized to access this portion of the staff panel.</h3>";
        gang_go_back('yourgang.php?action=sgang_home');
        return;
    }
    $user_ids = array($gvars->data['gangPRESIDENT'], $gvars->data['gangVICEPRES']);
    $q_get = sprintf('select userid, username from users where userid in (%s)', implode(', ', $user_ids));
    $q_get = mysql_query($q_get);
    if (!$q_get or mysql_num_rows($q_get) < 1) {
        echo "<h3>This gang has no leadership and will be deleted..</h3>";
        _gang_delete($gvars->ir['gang']);
        return;
    }
    $leadership = '';
    $ranks = array(0 => 'Select one...', 'pres' => $gvars->pres, 'vice' => $gvars->vice_pres, 'remove' => 'Remove...');
    $count = 0;
    while (list($them_id, $them_name) = mysql_fetch_array($q_get)) {
        switch ($them_id) {
            case $gvars->data['gangPRESIDENT']:
                $rank_name = $gvars->pres;
                break;
            case $gvars->data['gangVICEPRES']:
                $rank_name = $gvars->vice_pres;
                break;
            default:
                $rank_name = 'N/A';
                break;
        }
        $them_p = gang_get_profile_link($them_id, $them_name);
        $options = '';
        foreach ($ranks as $key => $rank) {
            if ($rank == $rank_name) {
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $options .= <<<EOT
<option value="{$key}"{$selected}>{$rank}</option>

EOT;
        }
        $leadership .= <<<EOT
\t\t<tr>
\t\t\t<td>
\t\t\t{$them_p}
\t\t\t</td>
\t\t\t<td>
\t\t\t<form method="post" action="yourgang.php?action=sgang_alter_staff">
\t\t\t\t<input type="hidden" name="them_id" value="{$them_id}">
\t\t\t\t<select name="rank">
{$options}
\t\t\t\t</select>
\t\t\t\t<input type="submit" value="Save">
\t\t\t</form>
\t\t\t</td>
\t\t</tr>

EOT;
        $count++;
    }
    $q_get = sprintf('select u.userid, u.username from users as u
		where u.gang = %d
		order by u.username', $gvars->ir['gang']);
    $q_get = mysql_query($q_get);
    $member_list = '';
    while (list($them_id, $them_name) = mysql_fetch_row($q_get)) {
        if (in_array($them_id, $user_ids)) {
            continue;
        }
        $member_list .= <<<EOT
<option value="{$them_id}">{$them_name}</option>

EOT;
    }
    $options = '';
    array_pop($ranks);
    foreach ($ranks as $key => $rank) {
        $options .= <<<EOT
<option value="{$key}"{$selected}>{$rank}</option>

EOT;
    }
    echo <<<EOT
\t<h2>{$gvars->name_su} Leadership</h2>
\t<table style="width: 300px">
\t\t<tr>
\t\t\t<th>
\t\t\tStaff Member
\t\t\t</th>
\t\t\t<th>
\t\t\tRank
\t\t\t</th>
\t\t</tr>
{$leadership}
\t</table>
\t
<br>
<br>
<br>

\t<p class="bold center">Promote a member to staff</p>
\t<form method="post" action="yourgang.php?action=sgang_alter_staff">
\t\t<table style="width: 300px">
\t\t\t<tr>
\t\t\t\t<th>
\t\t\t\tPromote:
\t\t\t\t<select name="them_id">
<option value="0">Select one...</option>
{$member_list}
\t\t\t\t</select>
\t\t\t\tTo:
\t\t\t\t<select name="rank">
{$options}
\t\t\t\t</select>
\t\t\t\t</th>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<th>
\t\t\t\t<input type="submit" value="Promote">
\t\t\t\t</th>
\t\t\t</tr>
\t\t</table>
\t</form>
EOT;
}