Пример #1
0
 /**
  * hasilnya berupa detik
  * detik 1
  */
 function time_diff($timea, $timeb)
 {
     $detik1 = time_convert($timea);
     $detik2 = time_convert($timeb);
     $hasil = $detik2 - $detik1;
     return $hasil;
 }
function renderInterfacesStats($object_id)
{
    global $nextorder;
    global $port_use_age;
    addCSS("/* Live Interfaces */\n\t\t.text_green  { color: #00cc00; }\n\t\t.text_yellow { color: #ff9900; }\n\t\t.text_red    { color: #ff0000; }", TRUE);
    startPortlet('Interfaces statistics');
    //get data: show version
    try {
        $uptime = queryDevice($object_id, 'getuptime');
    } catch (RackTablesError $e) {
    }
    echo "<table width='100%'><tr>";
    if (permitted(NULL, NULL, 'get_link_status')) {
        //get data: show interfaces
        try {
            $interfaces = queryDevice($object_id, 'getinterfaces');
        } catch (RackTablesError $e) {
        }
        if (!empty($interfaces)) {
            $last_reboot = time_convert($uptime);
            echo "<td";
            echo $last_reboot < $port_use_age ? " class='text_red'>" : $last_reboot > 262080 ? " class='text_green'>" : ">";
            echo $uptime . "</tr>";
            echo "<table width='80%' class='widetable' cellspacing=0 cellpadding='5px' align='center'><tr><th>Port<th>Link status<th>Last input<th>Last clear<th>Input packets<th>Output packets<th>Description</tr>";
            $order = 'even';
            foreach ($interfaces as $pn => $int) {
                echo "<tr class='row_{$order}'>";
                $order = $nextorder[$order];
                echo '<td>' . $pn . '<td';
                echo $int['status'] == "connected" ? " class='text_green'>" : ">";
                echo $int['status'] . '<td';
                echo time_convert($int['last']) > $port_use_age ? " class='text_yellow'>" : ">";
                echo $int['last'] . '<td';
                echo time_convert($int['clear']) > 0 ? time_convert($int['clear']) < $port_use_age ? " class='text_red'>" : ">" : ">";
                echo $int['clear'];
                echo '<td>' . $int['in_pkts'];
                echo '<td>' . $int['out_pkts'];
                echo '<td>' . $int['desc'];
                echo '</tr>';
            }
            echo "</table></td>";
        }
    }
    echo "</td></tr></table>";
    finishPortlet();
}
 public function userstats()
 {
     $udata = $this->_userDatas;
     usort($udata, array($this, "sortUsers"));
     for ($i = 0; $i <= count($udata) - 1; $i++) {
         $class = $color % 2 ? "bg2" : "bg1";
         $color++;
         $cdata = $this->_channelDatas;
         $cid = $udata[$i]['cid'];
         foreach ($cdata as $channel) {
             if ($channel["cid"] == $cid) {
                 $searchpatterns = array("#\\[spacer.]#siU", "#\\[spacer]#siU", "#\\[Spacer.]#siU", "#\\[Spacer]#siU", "#\\[.spacer.]#siU", "#\\[.spacer]#siU", "#\\[.Spacer.]#siU", "#\\[.Spacer]#siU");
                 $channeld = preg_replace($searchpatterns, null, $channel['channel_name']);
             }
         }
         $icon = "16x16_player_off.png";
         if ($udata[$i]["client_away"] == 1) {
             $icon = "16x16_away.png";
         } else {
             if ($udata[$i]["client_flag_talking"] == 1) {
                 $icon = "16x16_player_on.png";
             } else {
                 if ($udata[$i]["client_output_hardware"] == 0) {
                     $icon = "16x16_hardware_output_muted.png";
                 } else {
                     if ($udata[$i]["client_output_muted"] == 1) {
                         $icon = "16x16_output_muted.png";
                     } else {
                         if ($udata[$i]["client_input_hardware"] == 0) {
                             $icon = "16x16_hardware_input_muted.png";
                         } else {
                             if ($udata[$i]["client_input_muted"] == 1) {
                                 $icon = "16x16_input_muted.png";
                             }
                         }
                     }
                 }
             }
         }
         $player = '<img src="' . $this->imagePath . $icon . '" /> ' . $udata[$i]['client_nickname'];
         if ($udata[$i]['client_nickname'] != 'HLSTATSX:CE-TS3-Viewer') {
             $userstats .= show("/userstats3", array("player" => $player, "channel" => $channeld, "misc1" => $udata[$i]['cid'], "class" => $class, "misc2" => '', "misc3" => time_convert(), "misc4" => time_convert()));
         }
     }
     //echo "<pre>";
     //print_r($udata);
     //echo "</pre>";
     return $userstats;
 }
Пример #4
0
        }
        if (isset($_GET['cID'])) {
            $cID = $_GET['cID'];
            $type = $_GET['type'];
        } else {
            $cID = 0;
            $type = 0;
        }
        if ($s['serverType'] == "0") {
            $outp_str = show("teamspeak", array("name" => $name, "os" => $os, "uptime" => time_convert($uptime), "user" => $user, "t_name" => "Server name", "t_os" => "Operating system", "uchannels" => $chan, "info" => $info, "t_uptime" => "Uptime", "t_channels" => "Channels", "t_user" => "Users", "head" => "Teamspeak Overview", "users_head" => "User Information", "player" => "User", "channel" => "Channel", "channel_head" => "Channel Information", "max" => $max, "channels" => $cAmount, "logintime" => "Login time", "idletime" => "Idle time", "channelstats" => $channelstats, "userstats" => $userstats));
        } elseif ($s['serverType'] == "2") {
            $tsstatus = new TSStatus($uip, $tPort, $port);
            $tsstatus->imagePath = IMAGE_PATH . "/teamspeak3/";
            $tsstatus->showNicknameBox = false;
            $tsstatus->decodeUTF8 = false;
            $tsstatus->timeout = 2;
            function ts3_get_data($was, $data)
            {
                global $tsstatus;
                $data = $tsstatus->serverdata();
                return $data[$was];
            }
            $channels = '<link rel="stylesheet" type="text/css" href="' . IMAGE_PATH . '/teamspeak3/ts3.css" />' . $tsstatus->render();
            $outp_str = show("teamspeak3", array("name" => ts3_get_data('virtualserver_name'), "os" => ts3_get_data('virtualserver_platform'), "uptime" => time_convert(ts3_get_data('virtualserver_uptime')), "user" => ts3_get_data('virtualserver_clientsonline'), "t_name" => "Server name", "t_os" => "Operating system", "uchannels" => $channels, "info" => $tsstatus->info($uip), "t_uptime" => "Uptime", "t_channels" => "Channels", "t_user" => "Users", "head" => "Teamspeak Overview", "users_head" => "User Information", "player" => "User", "channel" => "Channel", "channel_head" => "Channel Information", "max" => $max, "channels" => ts3_get_data('virtualserver_channelsonline'), "logintime" => "Login time", "idletime" => "Idle time", "channelstats" => $channelstats, "userstats" => $tsstatus->userstats()));
            $tsstatus->disconn();
        }
        echo $outp_str;
    }
} else {
    echo "Error, function fopen not found";
}
Пример #5
0
                        if (isset($tsstatus->_channelGroupFlags[$user['client_channel_group_id']])) {
                            $flags[] = $tsstatus->_channelGroupFlags[$user['client_channel_group_id']];
                        }
                        $serverGroups = explode(",", $user['client_servergroups']);
                        foreach ($serverGroups as $serverGroup) {
                            if (isset($tsstatus->_serverGroupFlags[$serverGroup])) {
                                $flags[] = $tsstatus->_serverGroupFlags[$serverGroup];
                            }
                        }
                        $p = '<img src="../inc/images/tsicons/' . $icon . '" alt="" class="tsicon" />' . rep2($user['client_nickname']) . '&nbsp;' . $tsstatus->renderFlags($flags);
                        $class = $color % 2 ? "contentMainSecond" : "contentMainFirst";
                        $color++;
                        $userstats .= show($dir . "/userstats", array("player" => $p, "channel" => $tsstatus->getChannelInfos($user['cid']), "misc1" => '', "class" => $class, "misc2" => '', "misc3" => '-', "misc4" => '-'));
                    }
                }
                $index = show($dir . "/teamspeak", array("name" => $tsstatus->_serverDatas['virtualserver_name'], "os" => $tsstatus->_serverDatas['virtualserver_platform'], "uptime" => time_convert($tsstatus->_serverDatas['virtualserver_uptime'], true), "user" => $users, "t_name" => _ts_name, "t_os" => _ts_os, "uchannels" => $tstree, "info" => $tsstatus->welcome($settings, intval($_GET['cID'])), "t_uptime" => _ts_uptime, "t_channels" => _ts_channels, "t_user" => _ts_user, "head" => _ts_head, "users_head" => _ts_users_head, "player" => _ts_player, "channel" => _ts_channel, "channel_head" => _ts_channel_head, "max" => $max, "channels" => $tsstatus->_serverDatas['virtualserver_channelsonline'], "logintime" => _ts_logintime, "idletime" => _ts_idletime, "channelstats" => $channelstats, "userstats" => $userstats));
                break;
        }
        $fp = @fopen(basePath . '/__cache/teamspeak_' . $language . '.html', 'w');
        @fwrite($fp, $index);
        @fclose($fp);
    } else {
        $index = @file_get_contents(basePath . '/__cache/teamspeak_' . $language . '.html');
    }
} else {
    $index = error(_fopen, 1);
}
## SETTINGS ##
$time_end = generatetime();
$time = round($time_end - $time_start, 4);
page($index, $title, $where, $time);
Пример #6
0
$uip = $s['addr'];
$port = $s['queryPort'];
$password = $s['password'];
if (strlen($password < 1)) {
    $password = '';
}
$stat = new CVentriloStatus();
$stat->m_cmdcode = 2;
// Detail mode.
$stat->m_cmdhost = $uip;
// Assume ventrilo server on same machine.
$stat->m_cmdport = $port;
// Port to be statused.
$stat->m_cmdpass = $password;
// Status password if necessary.
$rc = $stat->Request();
if ($rc) {
    error("No Ventrilo", 1);
    echo "CVentriloStatus->Request() failed. <strong>{$stat->m_error}</strong><br><br>\n";
} else {
    $name = $stat->m_name;
    $os = $stat->m_platform;
    $uptime = $stat->m_uptime;
    $cAmount = $stat->m_channelcount;
    $user = $stat->m_clientcount;
    $max = $stat->m_maxclients;
    $channels = VentriloDisplayEX1($stat, 'nil232143241432432131', 0, 0);
    $chan .= show("channel", array("channel" => $channels, "subchannels" => $subchan));
}
$outp_str = show("ventrilo", array("name" => $name, "os" => $os, "uptime" => time_convert($uptime), "user" => $user, "t_name" => "Server name", "t_os" => "Operating system", "uchannels" => $chan, "info" => $info, "t_uptime" => "Uptime", "t_channels" => "Channels", "t_user" => "Users", "head" => "Ventrilo Overview", "users_head" => "User Information", "player" => "User", "channel" => "Channel", "channel_head" => "Channel Information", "max" => $max, "channels" => $cAmount, "logintime" => "Login time", "idletime" => "Idle time", "channelstats" => $channelstats, "userstats" => $userstats));
echo $outp_str;