Example #1
0
function getTSChannelInfo($ip, $port, $tPort)
{
    $uArray = getTSChannelUsers($ip, $port, $tPort);
    $pcArray = array();
    $ccArray = array();
    $thisArray = array();
    $listArray = array();
    $usedArray = array();
    $cArray = getChannels($ip, $port, $tPort);
    $z = 0;
    $x = 0;
    for ($i = 0; $i < count($cArray); $i++) {
        $innerArray = $cArray[$i];
        $listArray[$i] = $innerArray[3];
    }
    sort($listArray);
    $cArray = newSort($cArray);
    for ($i = 0; $i < count($listArray); $i++) {
        for ($j = 0; $j < count($cArray); $j++) {
            $innArray = $cArray[$j];
            if ($innArray[3] == $listArray[$i] and usedID($usedArray, $innArray[0])) {
                if ($innArray[2] == -1) {
                    $thisArray[0] = $innArray[0];
                    $thisArray[1] = $innArray[1];
                    $thisArray[2] = $innArray[2];
                    $pcArray[$z] = $thisArray;
                    $usedArray[count($usedArray)] = $innArray[0];
                    $z++;
                } else {
                    $thisArray[0] = $innArray[0];
                    $thisArray[1] = $innArray[1];
                    $thisArray[2] = $innArray[2];
                    $ccArray[$x] = $thisArray;
                    $usedArray[count($usedArray)] = $innArray[0];
                    $x++;
                }
            }
        }
    }
    $channels = array();
    for ($i = 0; $i < count($pcArray); $i++) {
        $innerArray = $pcArray[$i];
        $schannel = array();
        for ($j = 0; $j < count($ccArray); $j++) {
            $innerCCArray = $ccArray[$j];
            if ($innerArray[0] == $innerCCArray[2]) {
                $players = array();
                for ($p = 1; $p < count($uArray); $p++) {
                    $innerUArray = $uArray[$p];
                    if ($innerCCArray[0] == $innerUArray[1]) {
                        $players[] = array('icon' => setUserStatus($innerUArray[12]), 'name' => "<a href=\"#\" class=\"wrapCell\" onclick=\"return load_teamspeak_info(this," . $innerUArray[0] . ",2)\">&nbsp;" . removeChar($innerUArray[14]) . "&nbsp;(" . setPPriv($innerUArray[11]) . "" . setCPriv($innerUArray[10]) . ")&nbsp;</a>");
                    }
                }
                $schannel[] = array('players' => $players, 'name' => "<a href=\"#\" class=\"wrapCell\" onclick=\"return load_teamspeak_info(this," . $innerCCArray[0] . ",1)\">&nbsp;" . removeChar($innerCCArray[1]) . "&nbsp;</a>");
            }
        }
        $players = array();
        for ($k = 1; $k < count($uArray); $k++) {
            $innerUArray = $uArray[$k];
            if ($innerArray[0] == $innerUArray[1]) {
                $players[] = array('icon' => setUserStatus($innerUArray[12]), 'name' => "<a href=\"#\" class=\"wrapCell\" onclick=\"return load_teamspeak_info(this," . $innerUArray[0] . ",2)\">&nbsp;" . removeChar($innerUArray[14]) . "&nbsp;(" . setPPriv($innerUArray[11]) . "" . setCPriv($innerUArray[10]) . ")&nbsp;</a>");
            }
        }
        $channels[] = array('subs' => $schannel, 'players' => $players, 'name' => "<a href=\"#\" class=\"wrapCell\" onclick=\"return load_teamspeak_info(this," . $innerArray[0] . ",1)\">&nbsp;" . removeChar($innerArray[1]) . "&nbsp;" . getFlags($innerArray[0], $ip, $port, $tPort) . "</a>");
    }
    return $channels;
}
 $ccArr = array();
 $thisArr = array();
 $listArr = array();
 $usedArr = array();
 $cArr = getChannels($uip, $port, $tPort);
 $z = 0;
 $x = 0;
 for ($i = 0; $i < count($cArr); $i++) {
     $innerArr = $cArr[$i];
     $listArr[$i] = $innerArr[3];
 }
 sort($listArr);
 for ($i = 0; $i < count($listArr); $i++) {
     for ($j = 0; $j < count($cArr); $j++) {
         $innArr = $cArr[$j];
         if ($innArr[3] == $listArr[$i] && usedID($usedArr, $innArr[0])) {
             if ($innArr[2] == -1) {
                 $thisArr[0] = $innArr[0];
                 $thisArr[1] = $innArr[5];
                 $thisArr[2] = $innArr[2];
                 $pcArr[$z] = $thisArr;
                 $usedArr[count($usedArr)] = $innArr[0];
                 $z++;
             } else {
                 $thisArr[0] = $innArr[0];
                 $thisArr[1] = $innArr[5];
                 $thisArr[2] = $innArr[2];
                 $ccArr[$x] = $thisArr;
                 $usedArr[count($usedArr)] = $innArr[0];
                 $x++;
             }
Example #3
0
function teamspeak2($s)
{
    @set_time_limit(10);
    $fp = @fsockopen($s['ts_ip'], $s['ts_sport'], $errno, $errstr, 2);
    @stream_set_timeout($fp, 2, 0);
    @stream_set_blocking($fp, true);
    if ($fp) {
        fputs($fp, "sel " . $s['ts_port'] . "\n");
        fputs($fp, "si\n");
        fputs($fp, "quit\n");
        while (!feof($fp)) {
            $out .= fgets($fp, 1024);
        }
        $out = str_replace("[TS]", "", $out);
        $out = str_replace("OK", "", $out);
        $out = trim($out);
        $name = substr($out, indexOf($out, "server_name="), strlen($out));
        $name = substr($name, 0, indexOf($name, "server_platform=") - strlen("server_platform="));
        $cAmount = substr($out, indexOf($out, "server_currentchannels="), strlen($out));
        $cAmount = substr($cAmount, 0, indexOf($cAmount, "server_bwinlastsec=") - strlen("server_bwinlastsec="));
        $user = substr($out, indexOf($out, "server_currentusers="), strlen($out));
        $user = substr($user, 0, indexOf($user, "server_currentchannels=") - strlen("server_currentchannels="));
        $max = substr($out, indexOf($out, "server_maxusers="), strlen($out));
        $max = substr($max, 0, indexOf($max, "server_allow_codec_celp51=") - strlen("server_allow_codec_celp51="));
        fclose($fp);
    }
    $uArr = getTSChannelUsers($s['ts_ip'], $s['ts_port'], $s['ts_sport']);
    $pcArr = array();
    $ccArr = array();
    $thisArr = array();
    $listArr = array();
    $usedArr = array();
    $cArr = getChannels($s['ts_ip'], $s['ts_port'], $s['ts_sport']);
    $z = 0;
    $x = 0;
    for ($i = 0; $i < count($cArr); $i++) {
        $innerArr = $cArr[$i];
        $listArr[$i] = $innerArr[3];
    }
    sort($listArr);
    for ($i = 0; $i < count($listArr); $i++) {
        for ($j = 0; $j < count($cArr); $j++) {
            $innArr = $cArr[$j];
            if ($innArr[3] == $listArr[$i] && usedID($usedArr, $innArr[0])) {
                if ($innArr[2] == -1) {
                    $thisArr[0] = $innArr[0];
                    $thisArr[1] = $innArr[5];
                    $thisArr[2] = $innArr[2];
                    $pcArr[$z] = $thisArr;
                    $usedArr[count($usedArr)] = $innArr[0];
                    $z++;
                } else {
                    $thisArr[0] = $innArr[0];
                    $thisArr[1] = $innArr[5];
                    $thisArr[2] = $innArr[2];
                    $ccArr[$x] = $thisArr;
                    $usedArr[count($usedArr)] = $innArr[0];
                    $x++;
                }
            }
        }
    }
    for ($i = 0; $i < count($pcArr); $i++) {
        $innerArr = $pcArr[$i];
        $subchan = "";
        for ($j = 0; $j < count($ccArr); $j++) {
            $innerCCArray = $ccArr[$j];
            if ($innerArr[0] == $innerCCArray[2]) {
                for ($p = 1; $p < count($uArr); $p++) {
                    $subusers = "";
                    for ($p = 1; $p < count($uArr); $p++) {
                        $innerUArray = $uArr[$p];
                        if ($innerCCArray[0] == $innerUArray[1]) {
                            $subusers .= "&nbsp;&nbsp;&nbsp;&nbsp;<img src=\"../inc/images/tsicons/trenner.gif\" alt=\"\" class=\"tsicon\" />" . setUserStatus($innerUArray[12]) . "&nbsp;" . removeChar($innerUArray[14]) . "&nbsp;(" . setPPriv($innerUArray[11]) . "" . setCPriv($innerUArray[10]) . ")<br />";
                        }
                    }
                }
                $subchannels = "<img src=\"../inc/images/tsicons/trenner.gif\" alt=\"\" class=\"tsicon\" /><img src=\"../inc/images/tsicons/channel.gif\" alt=\"\" class=\"tsicon\" />&nbsp;<a href=\"javascript:DZCP.popup('../teamspeak/login.php?cName=" . removeChar($innerCCArray[1]) . "', '420', '100')\" class=\"navTeamspeak\" style=\"font-weight:bold\" title=\"" . removeChar($innerCCArray[1]) . "\">" . removeChar($innerCCArray[1]) . "</a><br /> " . $subusers . "";
                $subchan .= show("menu/teamspeak_subchan", array("subchannels" => $subchannels));
            }
        }
        $users = "";
        for ($k = 1; $k < count($uArr); $k++) {
            $innerUArray = $uArr[$k];
            if ($innerArr[0] == $innerUArray[1]) {
                $users .= "<img src=\"../inc/images/tsicons/trenner.gif\" alt=\"\" class=\"tsicon\" />" . setUserStatus($innerUArray[12]) . "&nbsp;" . removeChar($innerUArray[14]) . "&nbsp;(" . setPPriv($innerUArray[11]) . "" . setCPriv($innerUArray[10]) . ")&nbsp;</span> <br />";
            }
        }
        $channels = "<img src=\"../inc/images/tsicons/channel.gif\"  alt=\"\" class=\"tsicon\" />&nbsp;<a href=\"javascript:DZCP.popup('../teamspeak/login.php?cName=" . removeChar($innerArr[1]) . "', '420', '100')\" class=\"navTeamspeak\" style=\"font-weight:bold\" title=\"" . removeChar($innerArr[1]) . "\">" . removeChar($innerArr[1]) . "</a><br /> " . $users . "";
        $chan .= show("menu/teamspeak_chan", array("channel" => $channels, "subchannels" => $subchan));
        $hostname = '
        <tr>
          <td nowrap="nowrap"><img src="../inc/images/tsicons/ts.gif" alt="" class="tsicon" /> <span class="fontBold">' . $name . '</span></td>
        </tr>
        <tr>
          <td style="height:4px"></td>
        </tr>';
        $teamspeak = show("menu/teamspeak", array("hostname" => $hostname, "channels" => $chan));
    }
    if (empty($teamspeak)) {
        $teamspeak = '<br /><center>' . _error_no_teamspeak . '</center><br />';
    }
    return $teamspeak;
}