2011-10-04 04:36:02 -04:00
< ? php
// retrieve cached data
$data = json_decode ( file_get_contents ( '../data/index.txt' ));
// retrieve links from database
$db_config = json_decode ( file_get_contents ( '../conf/database.conf' ));
include ( 'lib/database.php' );
2011-10-04 05:13:01 -04:00
$db = new Database ( $db_config -> hostname , $db_config -> username , $db_config -> password , $db_config -> database );
2011-10-04 04:36:02 -04:00
$links = $db -> query ( " SELECT id,url,text,status,released_date FROM wia_links WHERE status = 2 OR status = 3 ORDER BY released_date DESC LIMIT 15 " );
?> <!DOCTYPE HTML>
< html lang = " en " >
< head >
< meta charset = " utf-8 " />
< title > Who is Andrew ? </ title >
2011-10-14 03:38:15 -04:00
< link rel = " stylesheet " type = " text/css " href = " css/main.css?v=2 " />
2011-10-04 04:36:02 -04:00
< link rel = " shortcut icon " href = " favicon.ico " />
</ head >
< body >
2011-10-14 03:38:15 -04:00
<!--< div id = " header " >-->< h1 > who is andrew ? </ h1 ><!--</ div >-->
2011-10-04 04:36:02 -04:00
< br />< br />
< div id = " content " >
< div id = " column1a " >
< h2 > contact </ h2 >
< div id = " contacts " class = " box center " >
2011-10-14 03:38:15 -04:00
< img src = " img/badges/email.png " class = " contact " alt = " Email Andrew Tomaka " title = " atomaka@gmail.com " />
< img src = " img/badges/aim.png " class = " contact " alt = " AIM Andrew Tomaka " title = " atomaka " />
< img src = " img/badges/yahoo.png " class = " contact " alt = " Yahoo! Andrew Tomaka " title = " atomaka " />
< img src = " img/badges/msn.png " class = " contact " alt = " MSN Andrew Tomaka " title = " atomaka@hotmail.com " />
< img src = " img/badges/icq.png " class = " contact " alt = " ICQ Andrew Tomaka " title = " 12534325 " />
< img src = " img/badges/google.png " class = " contact " alt = " Google Messaging Andrew Tomaka " title = " atomaka@gmail.com " />
< img src = " img/badges/skype.png " class = " contact " alt = " Skype Andrew Tomaka " title = " andrewtomaka " />
2011-10-04 04:36:02 -04:00
< div id = " contact " ></ div >
</ div >
< br />
< h2 > twitter </ h2 >
2011-10-04 07:07:26 -04:00
< div id = " twitter " class = " box iconized " >
2011-10-14 03:38:15 -04:00
< span class = " right " >< a href = " http://www.twitter.com/atomaka " >< img src = " img/badges/twitter.png " class = " icon " alt = " Follow Andrew Tomaka on Twitter " /></ a ></ span >
2011-10-04 04:36:02 -04:00
< span class = " tweet " >< ? php echo $data -> twitter -> text ?> </span><br/>
2011-10-04 05:28:55 -04:00
< ? php if ( $data -> twitter -> time != 0 ) { echo time_since ( $data -> twitter -> time ) ?> ago <?php } ?>
2011-10-04 04:36:02 -04:00
</ div >
< br />
< h2 > github </ h2 >
2011-10-04 07:07:26 -04:00
< div id = " github " class = " box iconized " >
2011-10-14 03:38:15 -04:00
< span class = " right " >< a href = " http://www.github.com/atomaka " >< img src = " img/badges/github.png " class = " icon " alt = " Follow Andrew Tomaka on Github " /></ a ></ span >
2011-10-04 04:36:02 -04:00
Committed & quot ; < ? php echo $data -> github -> commit ?> "
2011-10-04 07:07:26 -04:00
on < a href = " <?php echo $data->github ->url ?> " >< ? php echo $data -> github -> repo ?> </a>.
2011-10-04 04:36:02 -04:00
</ div >
2011-10-04 07:07:26 -04:00
2011-10-04 04:36:02 -04:00
< br />
< h2 > projects </ h2 >
< h3 > project 1 </ h3 >
< div id = " projects " >
<!--< div id = " tomtvgrid " class = " box " >
< table class = " formatting " >
< tr >
< td class = " top " >
< a href = " /projects/TomTVGrid " > TomTVGrid </ a >< br />< br />
Takes your Hulu subscriptions and creates a grid displaying when your shows air live .
</ td >
< td class = " formatting " >
< img src = " img/projects/tomtvgrid.jpg " width = " 64 " alt = " sc2mmr " />
</ td >
</ tr >
</ table >
</ div >-->
</ div >
</ div >
< div id = " column1b " >
< h2 > random </ h2 >
< div id = " random " >
< ? php
2011-10-14 02:54:29 -04:00
while ( $link = $links -> fetch_object ()) {
$link_text = $link -> text ;
$link_text = preg_replace ( '/\[/' , '<a href="' . htmlentities ( $link -> url ) . '">' , $link_text );
$link_text = preg_replace ( '/\]/' , '</a>' , $link_text );
echo ' <p class="box">' . $link_text . '</p>' . " \n " ;
}
2011-10-04 04:36:02 -04:00
?>
</ div >
</ div >
< div id = " column1c " >
< h2 > fitness </ h2 >
< div id = " fitness " class = " box " >
Collecting data .
</ div >
< h2 > media </ h2 >
< div id = " lastfm " class = " box " >
< table class = " formatting " >
< tr >
< td class = " formatting " >
< img src = " <?php echo $data->lastfm ->cover; ?> " class = " cover " alt = " <?php echo $data->lastfm ->artist ?> - <?php echo $data->lastfm ->name ?> " />
</ td >
< td class = " top " >
2011-10-14 03:38:15 -04:00
< span class = " right " >< a href = " http://last.fm/user/atomaka " >< img src = " img/badges/lastfm.png " class = " icon " alt = " Andrew Tomaka's Last.fm " /></ a ></ span >
2011-10-04 04:36:02 -04:00
< a href = " <?php echo $data->lastfm ->url ?> " >< ? php echo $data -> lastfm -> song ?> </a><br/>
by < ? php echo $data -> lastfm -> artist ?> <br/><br/>
2011-10-14 05:27:58 -04:00
< ? php echo ( $data -> lastfm -> time == 0 ) ? 'currently playing' : time_since ( $data -> lastfm -> time ) . ' ago' ?> <br/>
2011-10-04 04:36:02 -04:00
</ td >
</ tr >
</ table >
</ div >
< div id = " hulu " class = " box " >
< table class = " formatting " >
< tr >
< td class = " formatting " >
< img src = " <?php echo $data->hulu ->thumb ?> " class = " cover " alt = " <?php echo $data->hulu ->title ?> - <?php echo $data->hulu ->series ?> " />
</ td >
< td class = " top " >
2011-10-14 03:38:15 -04:00
< span class = " right " >< a href = " http://www.hulu.com/profiles/atomaka " >< img src = " img/badges/hulu.png " class = " icon " alt = " Andrew Tomaka's Hulu " /></ a ></ span >
2011-10-14 01:10:57 -04:00
< a href = " <?php echo $data->hulu ->url ?> " >< ? php echo $data -> hulu -> title ?> </a><br/>
from < ? php echo $data -> hulu -> series ?> <br/><br/>
2011-10-04 05:28:55 -04:00
< ? php echo time_since ( $data -> hulu -> time ) ?> ago<br/>
2011-10-04 04:36:02 -04:00
</ td >
</ tr >
</ table >
</ div >
< br />
< h2 > games </ h2 >
< h3 > World of Warcraft </ h3 >
< div id = " wow " class = " box " >
< table class = " formatting " >
< tr >
< td class = " gamesformatting " >< a href = " http://battle.net/wow " >< img src = " img/badges/wow.jpg " alt = " World of Warcraft " /></ a ></ td >
< td class = " top " >
2011-10-14 02:54:29 -04:00
< table class = " classformatting " >
< tr >
< ? php
foreach ( $data -> wow as $character ) {
echo sprintf ( ' <td class="classformatting"><a href="%s"><img src="http://wow.zamimg.com/images/wow/icons/small/class_%s.jpg" alt="%s" /></a></td>' . " \n " , $character -> armory , $character -> class , $character -> name );
}
?>
</ tr >
< tr >
< ? php
foreach ( $data -> wow as $character ) {
echo sprintf ( ' <td class="classformatting"><img src="http://wow.zamimg.com/images/wow/icons/small/%s.jpg" alt="%s" /></td>' . " \n " , $character -> spec_icon , $character -> class , $character -> spec_name );
}
?>
</ tr >
</ table >
2011-10-04 04:36:02 -04:00
</ td >
</ tr >
</ table >
</ div >
< h3 > Starcraft 2 </ h3 >
< div id = " sc2 " class = " box " >
< table class = " formatting " >
< tr >
< td class = " gamesformatting " >< a href = " http://battle.net/sc2 " >< img src = " img/badges/sc2.jpg " alt = " Starcraft 2 " /></ a ></ td >
< td class = " top " >
< a href = " http://us.battle.net/sc2/en/profile/1680730/1/Gaffer/ " > Gaffer . 888 </ a >< br />
< ? php echo $data -> sc2ranks -> division ?> <br/>
< ? php echo $data -> sc2ranks -> points ?> points, Rank <?php echo $data->sc2ranks->rank ?><br/>
< ? php echo $data -> sc2ranks -> wins ?> wins<br/>
</ td >
< td class = " right,top " >< img src = " img/sc2/<?php echo $data->sc2ranks ->league ?>.png " alt = " <?php echo ucfirst( $data->sc2ranks ->league) ?> League " /></ td >
</ tr >
</ table >
</ div >
< h3 > Steam </ h3 >
< div id = " steam " class = " box " >
< table class = " formatting " >
< tr >
< td class = " gamesformatting " >< a href = " http://steamcommunity.com/ " >< img src = " img/badges/steam.jpg " alt = " Steam " /></ a ></ td >
< td class = " top " >
< a href = " http://steamcommunity.com/id/toppazz " > Toppazz </ a >< br />
< ? php echo $data -> steam -> hours ?> hours in the last two weeks.<br/>
< ? php
foreach ( $data -> steam -> recent as $game ) {
?>
< a href = " <?php echo $game->link ?> " >< ? php echo $game -> name ?> </a>: <?php echo $game->hours ?> hours.<br/>
< ?
}
?>
</ td >
</ tr >
</ table >
</ div >
</ div >
< div class = " clear " >& nbsp ; </ div >
</ div >
< br />
< div id = " copyright " >& copy ; Andrew Tomaka 2010 - 2011. [ < a href = " admin " > admin </ a > ] </ div >
< br />< br />
< script src = " http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js " type = " text/javascript " ></ script >
< script type = " text/javascript " src = " js/jquery.qtip-1.0.0-rc3.min.js " ></ script >
2011-10-04 07:07:26 -04:00
< script type = " text/javascript " src = " js/jquery.corner.js " ></ script >
2011-10-04 04:36:02 -04:00
< script type = " text/javascript " >
$ ( document ) . ready ( function () {
$ ( 'img[title]' ) . qtip ({
style : {
tip : true ,
border : {
width : 0 ,
radius : 5 ,
color : '#74aa81'
},
color : '#216332'
}
2011-10-04 07:07:26 -04:00
});
$ ( '#content' ) . corner ();
$ ( '.box' ) . corner ( '5px' );
2011-10-04 04:36:02 -04:00
});
</ script >
</ body >
2011-10-04 05:28:55 -04:00
</ html >< ? php
function time_since ( $time ) {
$periods = array (
'minute' => 60 ,
'hour' => 60 * 60 ,
'day' => 60 * 60 * 24 ,
'week' => 60 * 60 * 24 * 7 ,
'month' => 60 * 60 * 24 * 30 ,
'year' => 60 * 60 * 24 * 365 ,
);
$now = time ();
$since = $now - $time ;
$formatted_since = array ( $since , 'seconds' );
foreach ( $periods as $period => $seconds ) {
$quotient = floor ( $since / $seconds );
if ( $quotient >= 1 ) $formatted_since = array ( $quotient , $period );
else break ;
}
if ( $formatted_since [ 0 ] > 1 ) $formatted_since [ 1 ] .= 's' ;
return implode ( ' ' , $formatted_since );
}
?>