function getPluginInfo($name, $permissions)
{
    $level = false;
    $fname = "../plugins/" . $name . "/plugin.info";
    if (is_readable($fname)) {
        $lines = file($fname);
        foreach ($lines as $line) {
            $fields = explode(":", $line, 2);
            if (count($fields) == 2) {
                $value = addcslashes(trim($fields[1]), "\\\\'\"\n\r\t");
                $field = trim($fields[0]);
                switch ($field) {
                    case "runlevel":
                        $level = floatval($value);
                        break;
                    case "version":
                        if ($level == false) {
                            $level = 10.0;
                        }
                        break;
                }
            }
        }
        if ($permissions !== false) {
            if (!getFlag($permissions, $name, "enabled")) {
                return false;
            }
        }
    }
    return $level;
}
function getPluginInfo($name, $permissions)
{
    $info = array();
    $fname = "../plugins/" . $name . "/plugin.info";
    if (is_readable($fname)) {
        $lines = file($fname);
        foreach ($lines as $line) {
            $fields = explode(":", $line, 2);
            if (count($fields) == 2) {
                $value = addcslashes(trim($fields[1]), "\\\\'\"\n\r\t");
                $field = trim($fields[0]);
                switch ($field) {
                    case "author":
                    case "description":
                    case "remote":
                        $info[$field] = $value;
                        break;
                    case "need_rtorrent":
                        $info[$field] = intval($value);
                        break;
                    case "version":
                    case "runlevel":
                        $info[$field] = floatval($value);
                        break;
                }
            }
        }
        if (!array_key_exists("need_rtorrent", $info)) {
            $info["need_rtorrent"] = 1;
        }
        if (!array_key_exists("runlevel", $info)) {
            $info["runlevel"] = 10.0;
        }
        if (!array_key_exists("description", $info)) {
            $info["description"] = "";
        }
        if (!array_key_exists("author", $info)) {
            $info["author"] = "unknown";
        }
        if (!array_key_exists("remote", $info)) {
            $info["remote"] = "ok";
        }
        $perms = 0;
        if ($permissions !== false) {
            if (!getFlag($permissions, $name, "enabled")) {
                return false;
            }
            $flags = array("canChangeToolbar" => 0x1, "canChangeMenu" => 0x2, "canChangeOptions" => 0x4, "canChangeTabs" => 0x8, "canChangeColumns" => 0x10);
            foreach ($flags as $flagName => $flagVal) {
                if (!getFlag($permissions, $name, $flagName)) {
                    $perms |= $flagVal;
                }
            }
        }
        $info["perms"] = $perms;
    }
    return array_key_exists("version", $info) ? $info : false;
}
Example #3
0
function getPluginInfo($name, $permissions)
{
    $info = array('rtorrent.php.error' => array(), 'rtorrent.external.error' => array(), 'rtorrent.script.error' => array(), 'rtorrent.version' => 0x802, 'plugin.runlevel' => 10.0, 'plugin.dependencies' => array(), 'php.extensions.error' => array(), 'php.version' => 0x50000, 'plugin.may_be_shutdowned' => 1, 'plugin.may_be_launched' => 1);
    $fname = "../plugins/" . $name . "/plugin.info";
    if (is_readable($fname)) {
        $lines = file($fname);
        foreach ($lines as $line) {
            $fields = explode(":", $line, 2);
            if (count($fields) == 2) {
                $value = addcslashes(trim($fields[1]), "\\\\'\"\n\r\t");
                $field = trim($fields[0]);
                switch ($field) {
                    case "plugin.may_be_shutdowned":
                    case "plugin.may_be_launched":
                        $info[$field] = intval($value);
                        break;
                    case "plugin.version":
                    case "plugin.runlevel":
                        $info[$field] = floatval($value);
                        break;
                    case "rtorrent.version":
                    case "php.version":
                        $version = explode('.', $value);
                        $info[$field] = (intval($version[0]) << 16) + (intval($version[1]) << 8) + intval($version[2]);
                        $info[$field . '.readable'] = $value;
                        break;
                    case "rtorrent.script.error":
                    case "rtorrent.external.error":
                    case "rtorrent.php.error":
                    case "php.extensions.error":
                    case "plugin.dependencies":
                        $info[$field] = explode(',', $value);
                        break;
                        // for compatibility
                    // for compatibility
                    case "version":
                    case "runlevel":
                        $info['plugin.' . $field] = floatval($value);
                        break;
                }
            }
        }
        if ($permissions !== false) {
            if (!getFlag($permissions, $name, "enabled")) {
                return false;
            }
        }
    }
    return array_key_exists("plugin.version", $info) ? $info : false;
}
    function draw($result, $numitems, $width = 100, $align = 'center')
    {
        global $g_options, $game, $realgame, $db;
        $numpages = ceil($numitems / $this->numperpage);
        ?>

<div class="subblock" style="width:<?php 
        echo $width;
        ?>
%;text-align:<?php 
        echo $align;
        ?>
;">

<table class="data-table">

		<tr class="data-table-head">
<?php 
        $totalwidth = 0;
        if ($this->showranking) {
            $totalwidth += 5;
            echo "<td style=\"width:5%;text-align=:right;\" class=\"fSmall\">Rank</td>\n";
        }
        foreach ($this->columns as $col) {
            $totalwidth += $col->width;
            echo "<td style=\"width:{$col->width}%;text-align:{$col->align};\" class=\"fSmall\">";
            if ($col->sort != 'no') {
                echo getSortArrow($this->sort, $this->sortorder, $col->name, $col->title, $this->var_sort, $this->var_sortorder, $this->sorthash, $this->ajax);
            } else {
                echo $col->title;
            }
            echo "</td>\n";
        }
        ?>
		</tr>

<?php 
        if ($totalwidth != 100) {
            error("Warning: Column widths do not add to 100%! (={$totalwidth}%)", false);
        }
        $rank = ($this->page - 1) * $this->numperpage + 1;
        while ($rowdata = $db->fetch_array($result)) {
            echo "<tr>\n";
            $i = 0;
            if ($this->showranking) {
                $c = $i % 2 + 1;
                $i++;
                echo "<td style=\"text-align:right;\" class=\"bg{$c}\">{$rank}</td>\n";
            }
            foreach ($this->columns as $col) {
                $c = $i % 2 + 1;
                $class = "";
                $cellbody = '';
                $colval = $rowdata[$col->name];
                if ($col->align != 'left') {
                    $colalign = " style=\"text-align:{$col->align};\"";
                } else {
                    $colalign = "";
                }
                $class = "bg{$c}";
                if ($col->icon || $col->flag) {
                    $cellbody = '&nbsp;';
                }
                if ($col->link) {
                    if (strpos($col->link, 'javascript:') === false) {
                        $link = str_ireplace('%k', urlencode($rowdata[$this->keycol]), $col->link);
                        $cellbody .= "<a href=\"" . $g_options['scripturl'] . "?{$link}\">";
                    } else {
                        $col->link = str_replace('\\\\', '', $col->link);
                        $link = str_ireplace('%k', $rowdata[$this->keycol], $col->link);
                        $cellbody .= "<a href=\"{$link}\">";
                    }
                }
                if ($col->icon) {
                    $image = getImage("/{$col->icon}");
                    if ($image) {
                        $cellbody .= '<img src="' . $image['url'] . "\" class=\"tableicon\" alt=\"{$col->icon}\" />";
                    }
                } elseif ($col->flag) {
                    #$link = ereg_replace("%f", $col->link);
                    if ($g_options['countrydata'] == 1) {
                        if ($rowdata['flag'] == '') {
                            $rowdata['flag'] = '0';
                            $alt_text = 'No Country';
                        } else {
                            $alt_text = ucfirst(strtolower($rowdata['country']));
                        }
                        $cellbody .= '<img src="' . getFlag($rowdata['flag']) . "\" class=\"tableicon\" alt=\"{$alt_text}\" title=\"{$alt_text}\" />";
                    } else {
                        $col->flag = 'player';
                        $cellbody .= '<img src="' . IMAGE_PATH . "/{$col->flag}.gif\" class=\"tableicon\" alt=\"{$col->icon}.gif\" />";
                    }
                }
                switch ($col->type) {
                    case 'timestamp':
                        $cellbody = timestamp_to_str($colval);
                        break;
                    case 'roleimg':
                        $image = getImage("/games/{$game}/roles/" . strtolower($colval));
                        // check if image exists for game -- otherwise check realgame
                        if ($image) {
                            $cellbody .= '<img src="' . $image['url'] . '" alt="' . $col->fname[$colval] . '" title="' . $col->fname[$colval] . '" />&nbsp;';
                        } elseif ($image = getImage("/games/{$realgame}/roles/" . strtolower($colval))) {
                            $cellbody .= '<img src="' . $image['url'] . '" alt="' . $col->fname[$colval] . '" title="' . $col->fname[$colval] . '" />&nbsp;';
                        }
                        if ($col->fname[$colval] != '') {
                            $cellbody .= '<b>' . $col->fname[$colval] . '</b>';
                        } else {
                            $cellbody .= '<b>' . ucwords(preg_replace('/_/', ' ', $colval)) . '</b>';
                        }
                        break;
                    case 'weaponimg':
                        // Check if game has the image -- if not, failback to real game.  If not, no image.
                        $image = getImage("/games/{$realgame}/weapons/" . strtolower($colval));
                        if ($image) {
                            $cellbody .= '<img src="' . $image['url'] . '" ' . $image['size'] . ' alt="' . $col->fname[$colval] . '" title="' . $col->fname[$colval] . '" />';
                        } elseif ($image = getImage("/games/{$realgame}/weapons/" . strtolower($colval))) {
                            $cellbody .= '<img src="' . $image['url'] . '" ' . $image['size'] . ' alt="' . $col->fname[$colval] . '" title="' . $col->fname[$colval] . '" />';
                        } else {
                            $cellbody .= '<b>' . ($col->fname[$colval] != '' ? $col->fname[$colval] : ucwords(preg_replace('/_/', ' ', $colval))) . '</b>';
                        }
                        break;
                    case 'bargraph':
                        $cellbody .= '<img src="' . IMAGE_PATH . '/bar';
                        if ($colval > 40) {
                            $cellbody .= '6';
                        } elseif ($colval > 30) {
                            $cellbody .= '5';
                        } elseif ($colval > 20) {
                            $cellbody .= '4';
                        } elseif ($colval > 10) {
                            $cellbody .= '3';
                        } elseif ($colval > 5) {
                            $cellbody .= '2';
                        } else {
                            $cellbody .= '1';
                        }
                        $cellbody .= '.gif" style="width:';
                        if ($colval < 1) {
                            $cellbody .= '1';
                        } elseif ($colval > 100) {
                            $cellbody .= '100';
                        } else {
                            $cellbody .= sprintf("%d", $colval + 0.5);
                        }
                        $cellbody .= "%;\" class=\"bargraph\" alt=\"{$colval}%\" />";
                        break;
                    case 'heatmap':
                        $heatmap = getImage("/games/{$game}/heatmaps/{$colval}-kill");
                        $heatmapthumb = getImage("/games/{$game}/heatmaps/{$colval}-kill-thumb");
                        if ($heatmap) {
                            $cellbody .= "<span style=\"text-align: center;\"><a href=\"" . $heatmap['url'] . "\" rel=\"boxed\"><img width=\"20\" height=\"16\" src=\"" . $heatmapthumb['url'] . "\" /></a></span>";
                        } else {
                            $cellbody .= "&nbsp;";
                        }
                        break;
                    default:
                        if ($this->showranking && $rank == 1 && $i == 1) {
                            $cellbody .= '<b>';
                        }
                        if (is_numeric($colval) && $colval >= 1000) {
                            $colval = number_format($colval);
                        }
                        $colval = nl2br(htmlspecialchars($colval, ENT_COMPAT));
                        if ($col->embedlink == 'yes') {
                            $colval = preg_replace(array('/%A%([^ %]+)%/', '/%\\/A%/'), array("<a href=\"\$1\">", '</a>'), $colval);
                        }
                        $cellbody .= $colval;
                        if ($this->showranking && $rank == 1 && $i == 1) {
                            $cellbody .= '</b>';
                        }
                        break;
                }
                if ($col->link) {
                    $cellbody .= '</a>';
                }
                if ($col->append) {
                    $cellbody .= $col->append;
                }
                if ($col->skill_change) {
                    if ($rowdata['last_skill_change'] == '') {
                        $rowdata['last_skill_change'] = 0;
                    }
                    if ($rowdata['last_skill_change'] == 0) {
                        $cellbody .= "&nbsp;<img src=\"" . IMAGE_PATH . "/t1.gif\" alt=\"" . $rowdata['last_skill_change'] . " Points\" />";
                    } elseif ($rowdata['last_skill_change'] > 0) {
                        $cellbody .= "&nbsp;<img src=\"" . IMAGE_PATH . "/t0.gif\" alt=\"" . $rowdata['last_skill_change'] . " Points\" />";
                    } elseif ($rowdata['last_skill_change'] < 0) {
                        $cellbody .= "&nbsp;<img src=\"" . IMAGE_PATH . "/t2.gif\" alt=\"" . $rowdata['last_skill_change'] . " Points\" />";
                    }
                }
                echo "<td{$colalign} class=\"{$class}\">" . $cellbody . "</td>\n";
                $i++;
            }
            echo "</tr>\n\n";
            $rank++;
        }
        ?>
		</table>
</div><br /><br />
<?php 
        if ($numpages > 1) {
            ?>
<div class="subblock" style="text-align:right;">
	<span style="text-align:right;">
<?php 
            echo 'Page: ';
            $start = $this->page - intval($this->maxpagenumbers / 2);
            if ($start < 1) {
                $start = 1;
            }
            $end = $numpages;
            if ($end > $this->maxpagenumbers + $start - 1) {
                $end = $this->maxpagenumbers + $start - 1;
            }
            if ($end - $start + 1 < $this->maxpagenumbers) {
                $start = $end - $this->maxpagenumbers + 1;
            }
            if ($start < 1) {
                $start = 1;
            }
            if ($start > 1) {
                if ($start > 2) {
                    $this->_echoPageNumber(1, "First page", "", " ...");
                } else {
                    $this->_echoPageNumber(1, 1);
                }
            }
            for ($i = $start; $i <= $end; $i++) {
                if ($i == $this->page) {
                    echo "<b>{$i}</b> ";
                } else {
                    $this->_echoPageNumber($i, $i);
                }
                if ($i == $end && $i < $numpages) {
                    if ($i < $numpages - 1) {
                        $this->_echoPageNumber($numpages, "Last page", "... ");
                    } else {
                        $this->_echoPageNumber($numpages, 10);
                    }
                }
            }
            ?>
	</span>
</div><br /><br />
<?php 
        }
    }
Example #5
0
function getPluginInfo($name, $permissions)
{
    $info = array('rtorrent.need' => 1, 'rtorrent.remote' => 'ok', 'rtorrent.external.warning' => array(), 'rtorrent.external.error' => array(), 'rtorrent.script.error' => array(), 'rtorrent.php.error' => array(), 'rtorrent.version' => 0x802, 'rtorrent.version.readable' => '0.8.2', 'plugin.may_be_shutdowned' => 1, 'plugin.may_be_launched' => 1, 'plugin.runlevel' => 10.0, 'plugin.description' => '', 'plugin.author' => 'unknown', 'plugin.dependencies' => array(), 'php.version' => 0x50000, 'php.version.readable' => '5.0.0', 'php.extensions.warning' => array(), 'php.extensions.error' => array(), 'web.external.warning' => array(), 'web.external.error' => array(), 'plugin.help' => '');
    $fname = "../plugins/" . $name . "/plugin.info";
    if (is_readable($fname)) {
        $lines = file($fname);
        foreach ($lines as $line) {
            $fields = explode(":", $line, 2);
            if (count($fields) == 2) {
                $value = addcslashes(trim($fields[1]), "\\\\'\"\n\r\t");
                $field = trim($fields[0]);
                switch ($field) {
                    case "plugin.help":
                    case "plugin.author":
                    case "plugin.description":
                    case "rtorrent.remote":
                        $info[$field] = $value;
                        break;
                    case "plugin.may_be_shutdowned":
                    case "plugin.may_be_launched":
                    case "rtorrent.need":
                        $info[$field] = intval($value);
                        break;
                    case "plugin.version":
                    case "plugin.runlevel":
                        $info[$field] = floatval($value);
                        break;
                    case "rtorrent.version":
                    case "php.version":
                        $version = explode('.', $value);
                        $info[$field] = (intval($version[0]) << 16) + (intval($version[1]) << 8) + intval($version[2]);
                        $info[$field . '.readable'] = $value;
                        break;
                    case "plugin.dependencies":
                    case "rtorrent.external.warning":
                    case "rtorrent.external.error":
                    case "rtorrent.script.error":
                    case "rtorrent.php.error":
                    case "web.external.warning":
                    case "web.external.error":
                    case "php.extensions.warning":
                    case "php.extensions.error":
                        $info[$field] = explode(',', $value);
                        break;
                        // for compatibility
                    // for compatibility
                    case "author":
                    case "description":
                        $info['plugin.' . $field] = $value;
                        break;
                    case "remote":
                        $info['rtorrent.remote'] = $value;
                        break;
                    case "need_rtorrent":
                        $info['rtorrent.need'] = intval($value);
                        break;
                    case "version":
                    case "runlevel":
                        $info['plugin.' . $field] = floatval($value);
                        break;
                }
            }
        }
        $perms = 0;
        if ($permissions !== false) {
            if (!getFlag($permissions, $name, "enabled")) {
                return false;
            }
            $flags = array("canChangeToolbar" => 0x1, "canChangeMenu" => 0x2, "canChangeOptions" => 0x4, "canChangeTabs" => 0x8, "canChangeColumns" => 0x10, "canChangeStatusBar" => 0x20, "canChangeCategory" => 0x40, "canBeShutdowned" => 0x80);
            foreach ($flags as $flagName => $flagVal) {
                if (!getFlag($permissions, $name, $flagName)) {
                    $perms |= $flagVal;
                }
            }
            if (!$info["plugin.may_be_shutdowned"]) {
                $perms |= $flags["canBeShutdowned"];
            }
        }
        $info["perms"] = $perms;
    }
    return array_key_exists("plugin.version", $info) ? $info : false;
}
function printserverstats($server_id)
{
    global $db, $g_options;
    $query = "\r\n            SELECT\r\n                SUM(kills),\r\n                SUM(headshots),\r\n                count(serverId)     \r\n            FROM\r\n                hlstats_Servers\r\n\t\t\tWHERE \r\n\t\t\t\tserverId='{$server_id}'\r\n      ";
    $result = $db->query($query);
    list($total_kills, $total_headshots) = $db->fetch_row($result);
    $query = "\r\n            SELECT\r\n                serverId,\r\n                name,\r\n                IF(publicaddress != '',\r\n                    publicaddress,\r\n                    concat(address, ':', port)\r\n                ) AS addr,\r\n                statusurl,\r\n                kills,\r\n                players,\r\n                rounds, suicides, \r\n                headshots, \r\n                bombs_planted, \r\n                bombs_defused, \r\n                ct_wins, \r\n                ts_wins, \r\n                ct_shots, \r\n                ct_hits, \r\n                ts_shots, \r\n                ts_hits,      \r\n                act_players,                                \r\n                max_players,\r\n                act_map,\r\n                map_started,\r\n                map_ct_wins,\r\n                map_ts_wins,\r\n\t\t\t\tgame                 \r\n            FROM\r\n                hlstats_Servers\r\n            WHERE\r\n                serverId='{$server_id}'\r\n        ";
    $result = $db->query($query);
    $servers = array();
    $servers[] = $db->fetch_array($result);
    ?>



<?php 
    $i = 0;
    for ($i = 0; $i < count($servers); $i++) {
        $rowdata = $servers[$i];
        $server_id = $rowdata['serverId'];
        $game = $rowdata['game'];
        $c = $i % 2 + 1;
        $addr = $rowdata["addr"];
        $kills = $rowdata['kills'];
        $headshots = $rowdata['headshots'];
        $player_string = $rowdata['act_players'] . "/" . $rowdata['max_players'];
        $map_teama_wins = $rowdata['map_ct_wins'];
        $map_teamb_wins = $rowdata['map_ts_wins'];
        $mode = 'playerinfo';
        if (strpos($_SERVER['PHP_SELF'], 'ingame') !== FALSE) {
            $mode = 'statsme';
        }
        //style="border:1px solid; margin-bottom:40px;margin-left:auto;margin-right:auto;"
        ?>

<table class="livestats-table">
	<tr class="data-table-head">
		<td class="fSmall" style="width:2%;">&nbsp;#</td>
		<td class="fSmall" style="width:42%;text-align:left;">&nbsp;Player</td>
		<td class="fSmall" colspan="3" style="width:5%;">&nbsp;Kills</td>
		<td class="fSmall" style="width:4%;">&nbsp;Hs</td>
		<td class="fSmall" style="width:8%;">&nbsp;HS:K</td>
		<td class="fSmall" style="width:6%;">&nbsp;Acc</td>
		<td class="fSmall" style="width:6%;">&nbsp;Lat</td>
		<td class="fSmall" style="width:10%;">&nbsp;Time</td>
		<td class="fSmall" style="width:6%;">&nbsp;+/-</td>
		<td class="fSmall" style="width:6%;">&nbsp;Skill</td>
	</tr>

<?php 
        unset($team_colors);
        $statsdata = $db->query("\r\n\t\t\tSELECT \r\n\t\t\t\tteam, \r\n\t\t\t\tname, \r\n\t\t\t\tteamkills, \r\n\t\t\t\tteamdeaths, \r\n\t\t\t\tteamheadshots, \r\n\t\t\t\tteamping, \r\n\t\t\t\tteamskill, \r\n\t\t\t\tteamshots, \r\n\t\t\t\tteamhits, \r\n\t\t\t\tteamjointime, \r\n\t\t\t\tIFNULL(playerlist_bgcolor,'#D5D5D5') as playerlist_bgcolor, \r\n\t\t\t\tIFNULL(playerlist_color,'#050505') AS playerlist_color, \r\n\t\t\t\tIFNULL( playerlist_index, 99 ) AS playerlist_index\r\n\t\t\tFROM \r\n\t\t\t\thlstats_Teams\r\n\t\t\tRIGHT JOIN\r\n\t\t\t\t(SELECT \r\n\t\t\t\t\tteam, \r\n\t\t\t\t\tsum( kills ) AS teamkills, \r\n\t\t\t\t\tsum( deaths ) AS teamdeaths, \r\n\t\t\t\t\tsum( headshots ) AS teamheadshots, \r\n\t\t\t\t\tavg( ping /2 ) AS teamping, \r\n\t\t\t\t\tavg( skill ) AS teamskill, \r\n\t\t\t\t\tsum( shots ) AS teamshots, \r\n\t\t\t\t\tsum( hits ) AS teamhits, \r\n\t\t\t\t\tsum( unix_timestamp( NOW( ) ) - connected ) AS teamjointime\r\n\t\t\t\tFROM \r\n\t\t\t\t\thlstats_Livestats\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tserver_id = {$server_id}\r\n\t\t\t\t\tAND connected >0\r\n\t\t\t\tGROUP BY \r\n\t\t\t\t\tteam\r\n\t\t\t\tORDER BY \r\n\t\t\t\t\tteamkills\r\n\t\t\t\t) teaminfo\r\n\t\t\tON\r\n\t\t\t\tcode = team\r\n\t\t\tAND\r\n\t\t\t\thlstats_Teams.game = '{$game}'\r\n\t\t\tORDER BY \r\n\t\t\t\tplayerlist_index\r\n\t\t\tLIMIT 0 , 30\r\n\t\t\t");
        $teamdata = array();
        $playerdata = array();
        $teamno = 0;
        while ($thisteam = $db->fetch_array($statsdata)) {
            $teamname = $db->escape($thisteam['team']);
            $teamdata[$teamno] = $thisteam;
            #jballou: Updated query to not display bots
            $pldata = $db->query("\r\n\t\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\t\tplayer_id, \r\n\t\t\t\t\t\t\t\t\tname, \r\n\t\t\t\t\t\t\t\t\tkills, \r\n\t\t\t\t\t\t\t\t\tdeaths, \r\n\t\t\t\t\t\t\t\t\theadshots, \r\n\t\t\t\t\t\t\t\t\tping, \r\n\t\t\t\t\t\t\t\t\tskill, \r\n\t\t\t\t\t\t\t\t\tshots, \r\n\t\t\t\t\t\t\t\t\thits, \r\n\t\t\t\t\t\t\t\t\tconnected, \r\n\t\t\t\t\t\t\t\t\tskill_change, \r\n\t\t\t\t\t\t\t\t\tcli_flag,\r\n\t\t\t\t\t\t\t\t\tsteam_id\r\n\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\thlstats_Livestats \r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\tserver_id = {$server_id} \r\n\t\t\t\t\t\t\t\t\tAND team = '{$teamname}'\r\n\t\t\t\t\t\t\t\t\tAND steam_id != 'BOT'\r\n\t\t\t\t\t\t\t\tORDER BY \r\n\t\t\t\t\t\t\t\t\tkills DESC\r\n\t\t\t\t");
            while ($thisplayer = $db->fetch_array($pldata)) {
                $playerdata[$teamno][] = $thisplayer;
            }
            $teamno++;
        }
        $curteam = 0;
        while (isset($teamdata[$curteam])) {
            $j = 0;
            $thisteam = $teamdata[$curteam];
            $teamcolor = 'background:' . $thisteam['playerlist_bgcolor'] . ';color:' . $thisteam['playerlist_color'];
            $bordercolor = 'background:' . ${$thisteam}['playerlist_bgcolor'] . ';color:' . $thisteam['playerlist_color'] . ';border-top:1px ' . $thisteam['playerlist_color'] . ' solid';
            $team_display_name = htmlspecialchars($thisteam['name']);
            while (isset($playerdata[$curteam][$j])) {
                $thisplayer = $playerdata[$curteam][$j];
                ?>
	<tr style="<?php 
                echo $teamcolor;
                ?>
">
		<td class="fSmall"><?php 
                if (isset($thisplayer) && $team_display_name) {
                    echo $j + 1;
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="text-align:left;<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    if (strlen($thisplayer['name']) > 50) {
                        $thisplayer['name'] = substr($thisplayer['name'], 0, 50);
                    }
                    if ($g_options['countrydata'] == 1) {
                        echo '<img src="' . getFlag($thisplayer['cli_flag']) . '" alt="' . ucfirst(strtolower($thisplayer['cli_country'])) . '" title="' . ucfirst(strtolower($thisplayer['cli_country'])) . '" />&nbsp;';
                    }
                    echo '<a style="color:' . $thisteam['playerlist_color'] . '" href="' . $g_options['scripturl'] . '?mode=' . $mode . '&amp;player=' . $thisplayer['player_id'] . '">';
                    echo htmlspecialchars($thisplayer['name'], ENT_COMPAT) . '</a>';
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="text-align:right;width:2%;<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    echo $thisplayer['kills'];
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="width:1%;<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    echo ':';
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="text-align:left;width:2%;<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    echo $thisplayer['deaths'];
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    echo $thisplayer['headshots'];
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    $hpk = sprintf('%.2f', 0);
                    if ($thisplayer['kills'] > 0) {
                        $hpk = sprintf('%.2f', $thisplayer['headshots'] / $thisplayer['kills']);
                    }
                    echo $hpk;
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    $acc = sprintf('%.0f', 0);
                    if ($thisplayer['shots'] > 0) {
                        $acc = sprintf('%.0f', $thisplayer['hits'] / $thisplayer['shots'] * 100);
                    }
                    echo "{$acc}%";
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    echo sprintf('%.0f', $thisplayer['ping'] / 2);
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    if ($thisplayer['connected'] > 0) {
                        $stamp = time() - $thisplayer['connected'];
                        $hours = sprintf('%02d', floor($stamp / 3600));
                        $min = sprintf('%02d', floor($stamp % 3600 / 60));
                        $sec = sprintf('%02d', floor($stamp % 60));
                        echo $hours . ':' . $min . ':' . $sec;
                    } else {
                        echo 'Unknown';
                    }
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    echo $thisplayer['skill_change'];
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $teamcolor;
                ?>
" class="fSmall"><?php 
                if (isset($thisplayer)) {
                    echo number_format($thisplayer['skill']);
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
	</tr>

<?php 
                $j++;
            }
            if ($team_display_name) {
                ?>
	<tr style="<?php 
                echo $teamcolor;
                ?>
">
		<td style="<?php 
                echo $bordercolor;
                ?>
" class="fSmall">&nbsp;</td>
		<td style="text-align:left;<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                echo "<strong>{$team_display_name}</strong>";
                if ($map_teama_wins > 0 || $map_teamb_wins > 0) {
                    echo '&nbsp;(' . $map_teama_wins . ' wins)';
                }
                ?>
		</td>
		<td style="width:2%;text-align:right;<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                if (count($teamdata[$curteam]) > 0) {
                    echo $teamdata[$curteam]['teamkills'];
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="width:1%;<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                if (count($teamdata[$curteam]) > 0) {
                    echo ':';
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="width:2%;text-align:left;<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                if (count($teamdata[$curteam]) > 0) {
                    echo $teamdata[$curteam]['teamdeaths'];
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                if (count($teamdata[$curteam]) > 0) {
                    echo $teamdata[$curteam]['teamheadshots'];
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                if (count($teamdata[$curteam]) > 0) {
                    $hpk = sprintf('%.2f', 0);
                    if ($teama_kills > 0) {
                        $hpk = sprintf('%.2f', $teamdata[$curteam]['headshots'] / $teamdata[$curteam]['kills']);
                    }
                    echo $hpk;
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                if (count($teamdata[$curteam]) > 0) {
                    $acc = sprintf('%.0f', 0);
                    if ($teama_shots > 0) {
                        $acc = sprintf('%.0f', $teamdata[$curteam]['teamhits'] / $teamdata[$curteam]['teamshots'] * 100);
                    }
                    echo "{$acc}%";
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
		<td style="<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                if (count($teamdata[$curteam]) > 0) {
                    echo sprintf('%.0f', $teamdata[$curteam]['teamping'] / count($teamdata[$curteam]));
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                if (count($teamdata[$curteam]) > 0) {
                    if ($teamdata[$curteam]['teamjointime'] > 0) {
                        $stamp = $teamdata[$curteam]['teamjointime'];
                        $hours = sprintf('%02d', floor($stamp / 3600));
                        $min = sprintf('%02d', floor($stamp % 3600 / 60));
                        $sec = sprintf('%02d', floor($stamp % 60));
                        echo $hours . ':' . $min . ':' . $sec;
                    } else {
                        echo 'Unknown';
                    }
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
		<td style="<?php 
                echo $bordercolor;
                ?>
" class="fSmall">-</td>
		<td style="<?php 
                echo $bordercolor;
                ?>
" class="fSmall"><?php 
                if (count($teamdata[$curteam]) > 0) {
                    echo number_format(sprintf('%.0f', $teamdata[$curteam]['teamskill']));
                } else {
                    echo '&nbsp;';
                }
                ?>
		</td>
	</tr>

<?php 
            }
            $curteam++;
        }
        //while i for teams
        if (count($teamdata) == 0) {
            ?>
	<tr>
		<td style="background:#EFEFEF;color:black"><?php 
            echo '&nbsp;';
            ?>
		</td>
		<td colspan="11" style="text-align:left;background:#EFEFEF;color:black"><?php 
            echo "No Players";
            ?>
		</td>
	</tr>
<?php 
        }
        ?>
</table>
<?php 
    }
    // for servers
}
Example #7
0
     while ($player = $db->fetch_array()) {
         echo '<tr><td align="left" width="85%" style="padding-left:2px" class="' . $fsize . '">';
         $cut_pos = 15;
         if ($small_fonts == 1) {
             $cut_pos += 10;
         }
         $display_name = $player['lastName'];
         if (strlen($player['lastName']) > $cut_pos) {
             $display_name = substr($player['lastName'], 0, $cut_pos);
         }
         echo '<a target="_blank" href="' . $g_options["scriptbase"] . '/hlstats.php?mode=playerinfo&amp;player=' . $player['playerId'] . '" title="Player Details">';
         if ($show_flags == 1) {
             if ($player['country'] == '') {
                 $player['country'] = 'Unknown Country';
             }
             echo '<img src="' . getFlag($player['flag']) . '" alt="' . ucfirst($player['country']) . '" title="' . ucfirst($player['country']) . '">&nbsp;';
         } else {
             if ($players_images == 1) {
                 echo '<img src="' . IMAGE_PATH . '/player.gif" />&nbsp;';
             }
         }
         echo '<span style="vertical-align:middle;">' . htmlspecialchars($display_name, ENT_COMPAT) . '</span></a>';
         echo '</td><td align="right" width="15%" style="padding-right:2px;" class="' . $fsize . '">';
         echo $player['skill'];
         echo '</td></tr>';
     }
     echo '</table></td></tr>';
 }
 echo '</table>';
 echo '</body>';
 echo '</html>';
        $i = 0;
    }
    if ($i == 0) {
        echo '<tr class="bg1">';
    }
    if ($image = getImage("/games/{$game}/dawards/" . strtolower($r['awardType'] . '_' . $r['code']))) {
        $img = $image['url'];
    } elseif ($image = getImage("/games/{$realgame}/dawards/" . strtolower($r['awardType'] . '_' . $r['code']))) {
        $img = $image['url'];
    } else {
        $img = IMAGE_PATH . '/award.png';
    }
    $weapon = '<a href="hlstats.php?mode=dailyawardinfo&amp;award=' . $r['awardId'] . "&amp;game={$game}\"><img src=\"{$img}\" alt=\"" . $r['code'] . '" /></a>';
    if ($r['d_winner_id'] > 0) {
        if ($g_options['countrydata'] == 1) {
            $imagestring = '<img src="' . getFlag($r['flag']) . '" alt="' . $r['flag'] . '" />&nbsp;&nbsp;';
        } else {
            $imagestring = '';
        }
        $winnerstring = '<strong>' . htmlspecialchars($r['d_winner_name'], ENT_COMPAT) . '</strong>';
        $achvd = "{$imagestring} <a href=\"hlstats.php?mode=playerinfo&amp;player={$r['d_winner_id']}&amp;game={$game}\">{$winnerstring}</a>";
        $wincount = $r['d_winner_count'];
    } else {
        $achvd = "<em>No Award Winner</em>";
        $wincount = "0";
    }
    echo "<td style=\"text-align:center;vertical-align:top;width:{$colwidth}%;\">\n\t\t\t<strong>" . $r['name'] . '</strong><br /><br />' . "{$weapon}<br /><br />" . "{$achvd}<br />" . '<span class="fSmall">' . $wincount . ' ' . htmlspecialchars($r['verb']) . '</span>
			</td>';
    $i++;
}
if ($i != 0) {
} else {
    if ($avatar_full == '' || $playerdata['blockavatar'] == '1') {
        $avatar_full = IMAGE_PATH . "/unknown.jpg";
    }
}
if ($status == '') {
    $status = '(Unknown)';
}
echo "<img src=\"{$avatar_full}\" style=\"height:158px;width:158px;\" alt=\"Steam Community Avatar\" />";
?>
					</td>
				</tr>
				<tr class="bg2">
					<td>
						<?php 
echo '<img src="' . getFlag($playerdata['flag']) . '" alt="' . $playerdata['country'] . '" title="' . $playerdata['country'] . '" />&nbsp;';
echo '<strong>' . htmlspecialchars($playerdata['lastName'], ENT_COMPAT) . ' </strong>';
?>
					</td>
				</tr>
				<tr class="bg1">
					<td>
						<?php 
if ($playerdata['country']) {
    echo 'Location: ';
    if ($playerdata['city']) {
        echo htmlspecialchars($playerdata['city'], ENT_COMPAT) . ', ';
    }
    echo '<a href="' . $g_options['scripturl'] . '?mode=countryclansinfo&amp;flag=' . $playerdata['flag'] . "&amp;game={$game}\">" . $playerdata['country'] . '</a>';
} else {
    echo 'Location: (Unknown)';
Example #10
0
 function calculateAttentionScore()
 {
     global $user;
     logit(INFO, "Starting Attention Score Calculator");
     $att = new AttentionAlerts();
     $med = new Meds();
     $user = new User();
     $trends = new UserMetrics();
     //check for flag
     if ($time = getFlag("MetiAttentionRun")) {
         $e = round((time() - $time) / 60, 2);
         //get hours
         if ($e > 360) {
             logit(WARN, "Error: calculateAttentionScore says it's been running for 6 hours " . __FILE__ . " on line: " . __LINE__);
         }
         logit(REPORT, " MetiAttention run aborted because it says it's still running. (Runtime: {$e} minutes, flag: MetiAttentionRun) in " . __FILE__ . " on line: " . __LINE__);
         return false;
     } else {
         setFlag("MetiAttentionRun", time());
     }
     //ok flags are fine let's run this. Round up them doggies
     $sql = "SELECT * FROM users WHERE userType = 1 AND disabled = 0 ";
     if ($rc = dbQuery($sql)) {
         while ($row = dbFetch($rc)) {
             if (CLI_ECHO) {
                 logit(INFO, "uRec: {$row["uRec"]}");
             }
             $uRec = $row["uRec"];
             $user->setUser($uRec);
             $user->getUser();
             //$trends->setUser();
             //$trends->getLatestSurveyCats();
             $this->attentionAggregate = array();
             $this->attentionAggregate["meds"] = 0;
             $this->attentionAggregate["survey"] = 0;
             $this->attentionAggregate["activity"] = 0;
             $this->attentionAggregate["medsAbs"] = 0;
             //remove med related scres
             $sql = "DELETE FROM attentionFlags WHERE uRec = '{$uRec}' AND (type = '{$att->attentionMeds}' OR type = '{$att->attentionMedAbs}') ";
             if ($rctemp = dbQuery($sql)) {
                 //calc med score.
                 $sql = "SELECT * FROM userMedCompliance WHERE uRec = '{$uRec}' AND period = '30' AND days = '30' ";
                 if ($rcMed = dbQuery($sql)) {
                     $med30 = array();
                     $med30Abs = array();
                     while ($rowMed = dbFetch($rcMed)) {
                         $med30[$rowMed["medId"]] = $rowMed["taken"] / $rowMed["doses"];
                         //if patient has reported more than 50% record med compliance
                         if ($rowMed["doses"] and $rowMed["unreported"] / $rowMed["doses"] < 0.5) {
                             $med30Abs[$rowMed["medId"]] = $rowMed["taken"] / $rowMed["doses"];
                         }
                     }
                 } else {
                     logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
                 }
                 //calculate abs med compliance
                 if (is_array($med30) or is_array($med30Abs)) {
                     $med->setUser();
                     $med->getUserMeds(TRUE, FALSE);
                 }
                 if (is_array($med30Abs)) {
                     $temp = array();
                     //let's write flags for each
                     foreach ($med30Abs as $key => $value) {
                         $score = 0;
                         if ($value < 0.8) {
                             if ($value < 0.6) {
                                 $score = 3;
                             } elseif ($value < 0.7) {
                                 $score = 2;
                             } else {
                                 $score = 1;
                             }
                             $temp[] = $score;
                             $in = "";
                             $in["uRec"] = $uRec;
                             $in["ref"] = $key;
                             $in["weight"] = $score;
                             $in["type"] = $att->attentionMedAbs;
                             $in["note"] = $med->userMeds[$key]["medOther"] . " compliance is " . round($value * 100, 0) . "%";
                             $in["expire"] = dbDate("+7 days");
                             $sql = "INSERT INTO attentionFlags " . makeSql($in, "insert");
                             if ($rcTemp = dbQuery($sql)) {
                             } else {
                                 logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
                             }
                         }
                     }
                     //end for
                     //get highest score
                     if (count($temp) > 0) {
                         $this->attentionAggregate["medsAbs"] = max($temp);
                     }
                 }
                 $medAlertList = array();
                 //calculate window trend for med compliance
                 //ok we got all of the 30s now let's get the 7s
                 if (is_array($med30)) {
                     foreach ($med30 as $key => $value) {
                         $sql = "SELECT * FROM userMedCompliance WHERE medId = '{$key}' AND uRec = '{$uRec}' AND period = '7' AND days = '7' ";
                         if ($rcMed = dbQuery($sql)) {
                             while ($rowMed = dbFetch($rcMed)) {
                                 $med7 = $rowMed["taken"] / $rowMed["doses"];
                                 if ($value > 0) {
                                     $d = ($med7 - $value) / $value;
                                     $delta = round($d * 100);
                                 } else {
                                     $delta = 0;
                                 }
                                 //got the delta, now let's calc att score
                                 $medScore = 0;
                                 if (is_numeric($delta) and $delta < -19) {
                                     if ($delta < -60) {
                                         $medScore = 3;
                                     } elseif ($delta < -40) {
                                         $medScore = 2;
                                     } else {
                                         $medScore = 1;
                                     }
                                     $this->attentionAggregate["meds"] = max($this->attentionAggregate["meds"], $medScore);
                                     //save score for this med.
                                     $in = "";
                                     $in["uRec"] = $uRec;
                                     $in["ref"] = $key;
                                     $in["weight"] = $medAlertList[] = $medScore;
                                     $in["type"] = $att->attentionMeds;
                                     $in["note"] = $med->userMeds[$key]["medOther"] . " compliance has declined by " . abs($delta) . "%";
                                     $in["expire"] = dbDate("+7 days");
                                     $sql = "INSERT INTO attentionFlags " . makeSql($in, "insert");
                                     if ($rcTemp = dbQuery($sql)) {
                                     } else {
                                         logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
                                     }
                                 }
                             }
                         } else {
                             logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
                         }
                     }
                     //end med 30 loop
                 }
                 //aggregate meds
                 //if (count($medAlertList) > 0 ) $this->attentionAggregate["meds"] = array_sum($medAlertList) / count($medAlertList);
             } else {
                 logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
             }
             //lookup survey
             $sql = "DELETE FROM attentionFlags WHERE uRec = '{$uRec}' AND type = '{$att->attentionSurvey}' ";
             if ($rctemp = dbQuery($sql)) {
                 $trends->setUser();
                 $s = $trends->getLatestSurveyCats();
                 $delta = $s["min"];
                 $surveyScore = 0;
                 if (is_numeric($delta) and $delta < -11) {
                     if ($delta < -39) {
                         $surveyScore = 3;
                     } elseif ($delta < -19) {
                         $surveyScore = 2;
                     } else {
                         $surveyScore = 1;
                     }
                     $this->attentionAggregate["survey"] = max($this->attentionAggregate["survey"], $surveyScore);
                     //save score
                     $in = "";
                     $in["uRec"] = $uRec;
                     $in["ref"] = 0;
                     $in["weight"] = $surveyScore;
                     $in["type"] = $att->attentionSurvey;
                     $in["note"] = "We\\'ve noticed a drop in some survey answers in the past 30 days.";
                     $in["expire"] = dbDate("+7 days");
                     $sql = "INSERT INTO attentionFlags " . makeSql($in, "insert");
                     if ($rcTemp = dbQuery($sql)) {
                     } else {
                         logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
                     }
                 }
             } else {
                 logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
             }
             //lookup activity
             $sql = "DELETE FROM attentionFlags WHERE uRec = '{$uRec}' AND type = '{$att->attentionActivity}' ";
             if ($rctemp = dbQuery($sql)) {
                 $delta = $row["activityChange"];
                 $activityScore = 0;
                 if (is_numeric($delta) and $delta < -19) {
                     if ($delta < -59) {
                         $activityScore = 3;
                     } elseif ($delta < -39) {
                         $activityScore = 2;
                     } else {
                         $activityScore = 1;
                     }
                     $this->attentionAggregate["activity"] = $activityScore;
                     //save score
                     $in = "";
                     $in["uRec"] = $uRec;
                     $in["ref"] = 0;
                     $in["weight"] = $activityScore;
                     $in["type"] = $att->attentionActivity;
                     $in["note"] = "C3HealthLink interaction has dropped by " . abs($delta) . "% in the past 30 days.";
                     $in["expire"] = dbDate("+7 days");
                     $sql = "INSERT INTO attentionFlags " . makeSql($in, "insert");
                     if ($rcTemp = dbQuery($sql)) {
                     } else {
                         logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
                     }
                 }
             }
             //let's get the other alert scores
             $sqlArr = array();
             $sqlArr["attentionDiaryRank"] = "SELECT MAX(weight) FROM attentionFlags WHERE uRec= {$uRec} AND type = {$att->attentionDiaryRank} ";
             $sqlArr["attentionDiaryKeyword"] = "SELECT MAX(weight) FROM attentionFlags WHERE uRec= {$uRec} AND type = {$att->attentionDiaryKeyword} ";
             $sqlArr["attentionSideEffect"] = "SELECT MAX(weight) FROM attentionFlags WHERE uRec= {$uRec} AND type = {$att->attentionSideEffect} ";
             $sqlArr["attentionMedComment"] = "SELECT MAX(weight) FROM attentionFlags WHERE uRec= {$uRec} AND type = {$att->attentionMedComment} ";
             foreach ($sqlArr as $key => $value) {
                 $this->attentionAggregate[$key] = 0;
                 if ($rcTemp = dbQuery($value)) {
                     if ($rowTemp = dbFetch($rcTemp)) {
                         $t = array_pop($rowTemp);
                         if ($t) {
                             $this->attentionAggregate[$key] = $t;
                         }
                         //logit(INFO,"$key : {$this->attentionAggregate[$key]}");
                     }
                 } else {
                     logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
                 }
             }
             //logit(INFO,"ME: ".print_r($this->attentionAggregate,1));
             //calculate
             /*
             	The max score is 18 but it's very rare anyone will hit max in all six categories so we assume anything above 6 is a red alert
             */
             $attAggTotal = array_sum($this->attentionAggregate);
             if ($attAggTotal > 0 and $attAggTotal < 4) {
                 $attScore = 2;
             } elseif ($attAggTotal > 3 and $attAggTotal < 7) {
                 $attScore = 3;
             } elseif ($attAggTotal > 6) {
                 $attScore = 4;
             } elseif ($user->active) {
                 $attScore = 1;
             } else {
                 $attScore = 0;
             }
             //logit(INFO,"SCORE: $attScore\t MEAN: $attAggMean\tTOTAL: $attAggTotal\tMAX: $attMax");
             //				$sql = "UPDATE users SET attScore = $attScore WHERE uRec = '$uRec' ";
             //				if (!$rcTemp = dbQuery($sql)) logit(WARN,"Error:  in ".__FILE__." on line: ".__LINE__);
         }
         //urec loop
     } else {
         logit(WARN, " DB Error:  {$sql} in " . __FILE__ . " on line: " . __LINE__);
     }
     clearFlag("MetiAttentionRun");
     logit(INFO, "Ending Attention Score Calculator");
     return true;
 }
Example #11
0
 $caption_color = imagecolorallocate($image, $caption_color['red'], $caption_color['green'], $caption_color['blue']);
 $link_color = imagecolorallocate($image, $link_color['red'], $link_color['green'], $link_color['blue']);
 //$font_colorb		= imagecolorallocate($image, $colorb['red'], $colorb['green'], $colorb['blue']);
 //$caption_colorb	= imagecolorallocate($image, $caption_colorb['red'], $caption_colorb['green'], $caption_colorb['blue']);
 //$link_colorb		= imagecolorallocate($image, $link_colorb['red'], $link_colorb['green'], $link_colorb['blue']);
 $background_img = imagecreatefrompng($hlx_sig);
 if ($background_img) {
     imagecopy($image, $background_img, 0, 0, 0, 0, 400, 75);
     imagedestroy($background_img);
 }
 if ($background == 0) {
     imagerectangle($image, 0, 0, 400, 75, $bgray);
 }
 $start_header_name = 9;
 if ($show_flags > 0) {
     $flag = imagecreatefromgif(getFlag($playerdata['flag'], 'path'));
     if ($flag) {
         imagecopy($image, $flag, 8, 4, 0, 0, 18, 12);
         $start_header_name += 22;
         imagedestroy($flag);
     }
 }
 imagealphablending($image, true);
 $timestamp = $playerdata['connection_time'];
 $days = floor($timestamp / 86400);
 $hours = $days * 24;
 $hours += floor($timestamp / 3600 % 24);
 if ($hours < 10) {
     $hours = '0' . $hours;
 }
 $min = floor($timestamp / 60 % 60);
Example #12
0
$db->query("SELECT name FROM hlstats_Games WHERE code='{$game}'");
if ($db->num_rows() != 1) {
    $gamename = ucfirst($game);
} else {
    list($gamename) = $db->fetch_row();
}
?>
	<table class="data-table">
		<tr class="data-table-head">
			<td colspan="3" class="fSmall">Statistics Summary</td>
        </tr>
        <tr class="bg1">
            <td class="fSmall">Name:</td>
            <td colspan="2" class="fSmall"><?php 
if ($g_options['countrydata'] == 1) {
    echo '<img src="' . getFlag($playerdata['flag']) . '" alt="' . strtolower($playerdata['country']) . '" title="' . strtolower($playerdata['country']) . '">&nbsp;';
}
echo '<strong>' . htmlspecialchars($playerdata['lastName'], ENT_COMPAT) . '</strong>';
?>
</td>
        </tr>
        <tr class="bg2">
			<td class="fSmall">Member of Clan:</td>
			<td colspan="2" class="fSmall"><?php 
if ($playerdata['clan']) {
    echo '&nbsp;<a href="' . $g_options['scripturl'] . '?mode=claninfo&amp;clan=' . $playerdata['clan'] . '">' . htmlspecialchars($playerdata['clan_name'], ENT_COMPAT) . '</a>';
} else {
    echo '(None)';
}
?>
</td>
Example #13
0
                    <tr>
                        <td><?php 
            echo $row[0]->mriTestParentFields->testParentFieldName;
            ?>
</td>
                        <td><?php 
            echo $row[0]->parentResultValue;
            ?>
</td>
                        <td><?php 
            echo $row[1]->unit;
            ?>
</td>
                        <td>
                            <?php 
            echo getFlag($report_data, $row);
            ?>
                        </td>
                    </tr>
                    <?php 
            $distinct[] = $row[0]->mriTestParentFields->testParentFieldId;
        }
    }
}
//Clean & Merge
//echo json_encode($report_data).'<br/>';
$_report_data = json_decode(json_encode($report_data), true);
for ($i = 0; $i < count($_report_data); $i++) {
    unset($_report_data[$i][0]['mriTestParentFields']['mriLaboratoryTest']['mriLaboratory']);
    $tempPatientData = $_report_data[$i][0]['mriTestRequest']['mriPatient'];
    unset($_report_data[$i][0]['mriTestRequest']);
Example #14
0
function displayMarkAsUnseen($uid, $pid)
{
    ?>
    <form method="post" action="form-submit.php">
        <input type="hidden" name="pid" value="<?php 
    echo $pid;
    ?>
" />
        <input type="hidden" name="uid" value="<?php 
    echo $uid;
    ?>
" />
        <strong>Highlight until next time you post:</strong>
        <input type="checkbox" name="flag" value="yes" <?php 
    if (getFlag($uid, $pid)) {
        echo "checked";
    }
    ?>
 />
        <input type="submit" name="setflag" value="Update" />
or simply
        <input type="submit" name="markunseen" value="Mark unread for now" />
    </form>
<?php 
    return;
}
Example #15
0
            echo $colour;
            ?>
">
	<td style="width:40%;"><?php 
            echo '<a href="' . $g_options['scripturl'] . '?mode=dailyawardinfo&amp;award=' . $awarddata['awardId'] . "&amp;game={$game}\">" . htmlspecialchars($awarddata['name']) . '</a>';
            ?>
</td>
	<td style="width:60%;"><?php 
            if ($awarddata['d_winner_id']) {
                if ($g_options['countrydata'] == 1) {
                    $flag = '0.gif';
                    $alt = 'Unknown Country';
                    if ($awarddata['flag'] != '') {
                        $alt = ucfirst(strtolower($awarddata['country']));
                    }
                    echo "<img src=\"" . getFlag($awarddata['flag']) . "\" hspace=\"4\" alt=\"{$alt}\" title=\"{$alt}\" /><a href=\"{$g_options['scripturl']}?mode=playerinfo&amp;player={$awarddata['d_winner_id']}\"><b>" . htmlspecialchars($awarddata['d_winner_name'], ENT_COMPAT) . "</b></a> ({$awarddata['d_winner_count']} " . htmlspecialchars($awarddata['verb']) . ")";
                } else {
                    echo "<img src=\"" . IMAGE_PATH . "/player.gif\" hspace=\"4\" alt=\"Player\" /><a href=\"{$g_options['scripturl']}?mode=playerinfo&amp;player={$awarddata['d_winner_id']}\"><b>" . htmlspecialchars($awarddata['d_winner_name'], ENT_COMPAT) . "</b></a> ({$awarddata['d_winner_count']} " . htmlspecialchars($awarddata['verb']) . ")";
                }
            } else {
                echo '&nbsp;&nbsp; <em>No Award Winner</em>';
            }
            ?>
</td>
</tr>

<?php 
        }
        ?>
</table>
</div></div>