예제 #1
0
파일: servers.php 프로젝트: Zipcore/SSMS
function checkversion()
{
    $settings = getsettings();
    if ($settings['usegrowl']['config'] == 'yes') {
        require_once 'lib/growl/class.growl.php';
        $growlip = $settings['growlip']['config'];
        $growlpass = $settings['growlpass']['config'];
    }
    if ($settings['usetwitter']['config'] == 'yes') {
        require_once 'lib/twitter/twitter.php';
        $consumerkey = $settings['consumerkey']['config'];
        $consumersecret = $settings['consumersecret']['config'];
        $OAuthToken = $settings['OAuthToken']['config'];
        $OAuthTokenSecret = $settings['OAuthTokenSecret']['config'];
        $twitter = new Twitter("{$consumerkey}", "{$consumersecret}");
        $twitter->setOAuthToken("{$OAuthToken}");
        $twitter->setOAuthTokenSecret("{$OAuthTokenSecret}");
    }
    if ($settings['useboxcar']['config'] == 'yes') {
        require_once 'lib/boxcar/boxcar_api.php';
        $boxemail = $settings['boxemail']['config'];
    }
    $gametypes = gametypes();
    foreach (array_keys($gametypes) as $game) {
        $version = $gametypes[$game][version];
        if (!$version) {
            $version = "1.0";
        }
        $longname = $gametypes[$game][longname];
        $expired = $gametypes[$game][expired];
        $appid = $gametypes[$game][appid];
        $shortname = $gametypes[$game][shortname];
        print "{$game} for {$version}\n";
        // simple feedback part if needed
        try {
            $game = SteamGame::checkUpToDate($appid, $version);
        } catch (Exception $e) {
            echo "Seems {$appid} with version {$version} doesn't like to be probed\n";
            echo "Setting gametype as 'up to date' , dont want to start stuff without proper knowledge\n";
            echo "Seems like this is the error {$e}\n";
            $game = "1";
        }
        if ($expired != "yes") {
            if ($game != "1") {
                mysql_query_trace("UPDATE games SET expired='yes' WHERE shortname = '{$shortname}'");
                if ($settings['useemail']['config'] == 'yes') {
                    $subject = "A update for {$longname} seems to be out, go check out the buzz...";
                    $newstuff = getupdates($appid, 'last');
                    $message = "A update for {$longname} seems to be out, go check out the buzz...\n" . $newstuff;
                    $smtpmails = $settings['emailalert']['config'];
                    $allmails = explode(",", $smtpmails);
                    foreach ($allmails as $sendto) {
                        mail($sendto, $subject, $message, null);
                    }
                }
                if ($settings['usegrowl']['config'] == 'yes') {
                    $growl = new Growl();
                    //$growl->setAddress($growlip, $growlpass);
                    $connection = array('address' => '$growlip', 'password' => '$growlpass');
                    $growl->notify($connection, "{$type}", "UPDATE: {$shortname}", "A update for {$longname} seems to be out, go check out the buzz...");
                }
                if ($settings['usetwitter']['config'] == 'yes') {
                    try {
                        $twitter->statusesUpdate("A update for {$longname} seems to be out, go check out the buzz...");
                    } catch (Exception $e) {
                        echo "{$e} went wrong";
                    }
                }
                if ($settings['useboxcar']['config'] == 'yes') {
                    include "config.php";
                    $b = new boxcar_api($boxcarapi, $boxcarsec);
                    $emails = explode(",", $boxemail);
                    foreach ($emails as $boxalert) {
                        try {
                            $b->notify($boxalert, 'UPDATE', 'A update for ' . $longname . ' seems to be out, go check out the buzz...');
                        } catch (Exception $e) {
                            echo 'something went wrong with boxcar';
                        }
                    }
                }
            }
        }
    }
}
예제 #2
0
파일: gametypes.php 프로젝트: Zipcore/SSMS
                echo '<input type="submit" value="Run Optional update">';
                echo '</form>';

                echo '<form>';
                echo 'A Forced update means that a required update came out but the master servers were not updated yet. Because of this it didn\'t go automatically, below button will fake a update so it will restart all servers which will update. This will <b>NOT</b> check for playercounts on the server but will send out a message to the server\'s players!<br/>';
                echo "Press below button to restart all servers for type " . $gametypes["$gametype"]['longname'];
                echo '<br/><input type="hidden" name="gametype" value="'. $gametype . '">';
                echo '<input type="hidden" name="update" value="update">&nbsp;&nbsp;&nbsp;';
                echo '<input type="submit" value="Force update">';
                echo '</form>';


	echo '</fieldset>';
	echo '</fieldset>';
	echo '<fieldset><legend>Recent updates (Feed from Valve)</legend>';
	getupdates($gametypes["$gametype"]['appid'],'style');
	echo '</fieldset>';
	} else {
	
?>
<div id="piechart1">
    <?php

    $sql = "SELECT * FROM servers";
		$result = mysql_query($sql);
             $data = array();
             while ($row = mysql_fetch_array($result)) {
				$type = $row['type'];
                $current[$type] += (int)$row['currentplayers'];
				
				$total = $total + (int)$row['currentplayers'];