[php]
<?php
$start_time = microtime(true);
// hack for get_avatar, the only directly accessible file in /public that doesn't go through the controllers
if ( strpos( $_SERVER['PHP_SELF'], 'get_avatar.php' ) !== false )
{
require( 'get_avatar.php' );
die();
}
if ( strpos( $_SERVER['PHP_SELF'], 'favicon.ico' ) !== false )
{
$ico = 'favicon.ico';
// Getting headers sent by the client.
$headers = apache_request_headers();
// Checking if the client is validating cache and if it's current.
if ( isset( $headers['If-Modified-Since'] ) && ( strtotime( $headers['If-Modified-Since'] ) == filemtime( $ico ) ) )
{
// Client's cache IS current, so we just respond '304 Not Modified'.
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', filemtime( $ico ) ) .' GMT', true, 304 );
}
else
{
// Image not cached or cache outdated, we respond '200 OK' and output the image.
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', filemtime( $ico ) ) . ' GMT', true, 200 );
header( 'Content-Length: ' . filesize( $ico ) );
header('Content-Type: image/x-icon');
readfile( $ico );
}
die();
}
if ( strpos ( $_SERVER['PHP_SELF'], 'robots.txt' ) !== false )
{
header( "Content-Type: text/plain" );
echo "User-agent: *\n";
echo "Disallow: /actions/\n";
die();
}
require_once( "../../common/commonutils.php" );
SetCommonIncludePath();
// Set include path for our app so we can find files as "/contollers/...", etc...
set_include_path( get_include_path() . PATH_SEPARATOR . realpath( dirname( __FILE__ ) . '/../' ) );
// include our application config file
require_once( "config/config.php" );
// include the dispatcher class
require_once( "../../common/routing/cdispatcher.php" );
// include common utils for assert / error handline code
require_once( "../../common/commonutils.php" );
set_error_handler( "CommonErrorHandler" );
// include timezone calculation, sets offset to use for all date functions
require_once( "../../common/timezone.php" );
// Setup localization
require_once( "../../common/localization/clocalizationmanager.php" );
// Intialize will check cookied language, and check for 'language' request param to reset language
$rgValidLanguages = Array( 'danish', 'czech', 'dutch', 'english', 'finnish', 'french', 'german', 'hungarian', 'italian', 'japanese', 'korean', 'norwegian', 'polish', 'portuguese', 'romanian', 'russian', 'schinese', 'spanish', 'swedish', 'tchinese', 'thai' );
CLocalizationManager::Initialize( $rgValidLanguages );
CLocalizationManager::SetLocalizationPath( realpath( dirname( __FILE__ ) ) . '/../localization/' );
// We always load english, then we load the set language if it is not english, this allows us to
// fallback to english strings if the localized file hasn't been updated with new strings for everything.
// If the language is english the second call won't actually do any work, so no need to detect that here.
CLocalizationManager::DelayLoadStringsFile( sprintf( LOCALIZATION_FILENAME_FORMAT, "english" ) );
if ( ClocalizationManager::GetLanguage() != "unknown" )
{
CLocalizationManager::DelayLoadStringsFile( sprintf( LOCALIZATION_FILENAME_FORMAT, CLocalizationManager::GetLanguage() ) );
}
// Check for the site being down...
if( file_exists( "../config/site_down.txt" ) )
{
require( "../templates/site_down.php" );
die();
}
// intialize the dispatcher, telling it to use our app level config file
$dispatcher = new CDispatcher( 'config/routing.php' );
$loc_url = $_SERVER['SCRIPT_URL'];
// Remove steamid/customurl from url for localization caching purposes
$loc_url = preg_replace( '/(.*)\/(profiles|id|groups|gid|ogg|games)\/([^\/]+)(.*)/', '$1/$2/_id_$4', $loc_url );
CLocalizationManager::PreloadKeysNeededForPage( $loc_url );
// perform the actual request dispatch
$dispatcher->DispatchRequest( $_SERVER['PHP_SELF'] );
// Have the loc manager remember what keys it used generating the output
CLocalizationManager::CacheKeysNeededForPage( $loc_url );
$end_time = microtime(true);
$end_url_parsing_time = $dispatcher->GetURLParsingCompleteTime();
$end_controller_construct_time = $dispatcher->GetControllerConstructedTime();
// Echo timings applicable for all pages
if ( ( WEB_UNIVERSE != 'public' || BIsFromValveIP() ) && !chkReq( 'xml' ) && ( !isset( $GLOBALS['suppressTimingOutput'] ) || !$GLOBALS['suppressTimingOutput'] ) )
{
echo "<a href=\"#\" onclick=\"var el=document.getElementById('timing_data'); el.style.display='block'; el.scrollIntoView(); return false;\" class=\"perf_timing_link\">Performance Data</a>";
echo "<pre id=\"timing_data\" class=\"perf_timing_data\" style=\"display: none;\">\n";
echo "**** Timing / Memory Data ****\n";
$hostname = `/bin/hostname`;
echo "Host: ".trim($hostname)."\n";
echo "Stripped Loc URL: ".$loc_url."\n";
if ( SPEW_OVERALL_TIMINGS )
{
echo sprintf( "Total time: %0.2f seconds\n", $end_time-$start_time );
echo sprintf( "Time elapsed when URLRouting completed: %0.2f seconds\n", $end_url_parsing_time-$start_time );
echo sprintf( "Time elapsed when Controller::__construct() completed: %0.2f\n\n", $end_controller_construct_time-$start_time );
echo CLocalizationManager::GetStatus()."\n\n";
}
if ( SPEW_WG_TIMINGS )
{
$wg = GetWG();
echo sprintf( "Time spent in WG calls: %0.2f seconds\n", $wg->GetTotalTime() );
foreach ( $wg->GetTimingByRequestType() as $request => $rgTiming )
echo sprintf( "\tRequest '%s' called %d times, total time taken: %0.2f seconds\n", $request, $rgTiming["calls"], $rgTiming["time"] );
echo sprintf( "Total WG calls: %d\n\n", $wg->GetTotalRequests() );
$wg = GetWGNews();
if ( $wg->GetTotalRequests() > 0 )
{
echo sprintf( "Time spent in WGNews calls: %0.2f seconds\n", $wg->GetTotalTime() );
foreach ( $wg->GetTimingByRequestType() as $request => $rgTiming )
echo sprintf( "\tRequest '%s' called %d times, total time taken: %0.2f seconds\n", $request, $rgTiming["calls"], $rgTiming["time"] );
echo sprintf( "Total WGNews calls: %d\n\n", $wg->GetTotalRequests() );
}
}
if ( SPEW_DB_TIMINGS && class_exists( "CDatabase" ) )
{
echo sprintf( "Time spent in DB calls: %0.2f seconds\n", CDatabase::$time_in_db );
echo sprintf( "Total DB calls: %d\n\n", CDatabase::$request_count );
}
if ( SPEW_MEMORY_USAGE )
{
echo sprintf( "MemoryPeak (actual usage reported by OS): %d bytes\n", memory_get_peak_usage( true ) );
echo sprintf( "MemoryPeak (emalloc usage reported by PHP): %d bytes\n", memory_get_peak_usage() );
if ( class_exists( "CGroupCache" ) )
{
echo sprintf( "%d Groups cached, %d GroupLinks cached\n", CGroupCache::GetClassCount(), CGroupCache::GetLinkClassCount() );
}
if ( class_exists( "CPlayerCache" ) )
{
echo sprintf( "%d Players cached, %d PlayerLinks cached\n", CPlayerCache::GetClassCount(), CPlayerCache::GetLinkClassCount() );
}
}
if ( SPEW_WG_REQUEST_DETAILS )
{
echo CWGAccess::GetStats( false );
}
echo "</pre>";
}
[/php]
nothing amazing in there but woops from steamcommunity.
[QUOTE=cani;18570712][php]
---
[/php]
nothing amazing in there but woops from steamcommunity.[/QUOTE]
That indeed is an oops.
Same, shame it doesn't have anything cool in it.
I would have thought such a huge site would have a more strict templating system, so no echoing tags inline and shit, 100% templated.
Someone submit this to The Daily WTF now.
And that at a company like VALVe
There are far more notable companies featured in TDWTF than Valve.
Take for example, [url=http://thedailywtf.com/Articles/Connect-Betterer.aspx]my ISP[/url]
Sorry, you need to Log In to post a reply to this thread.