Changeset 2
- Timestamp:
- 10/17/07 22:27:05 (1 year ago)
- Files:
-
- trunk/chapters/article.inc.php (modified) (1 diff)
- trunk/chapters/frontpage.inc.php (modified) (5 diffs)
- trunk/chapters/gallery.inc.php (modified) (5 diffs)
- trunk/chapters/journal.inc.php (modified) (2 diffs)
- trunk/chapters/showcode.inc.php (modified) (1 diff)
- trunk/classes/html.class.php (modified) (16 diffs)
- trunk/epistula.php (modified) (10 diffs)
- trunk/include/library.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/chapters/article.inc.php
r1 r2 54 54 $page->content .= $return[1]; 55 55 $page->localnav .= $page->subheading($_EP['nameforQV']).getQV($page,$return[0],"article"); 56 $page->localnav .= pageShowAds($page->date,"4546649417"); 56 //$page->localnav .= pageShowAds($page->date,"4546649417"); 57 $page->localnav .= pageShowAds($page->date,"4546649417", "article-".$return[0]); 57 58 } else { 58 59 $page->status = 404; trunk/chapters/frontpage.inc.php
r1 r2 14 14 $page->title = $_EP['tagline']; 15 15 16 if ( $wanted[1]){ // Any arguments are bad arguments16 if (isset($wanted[1])){ // Any arguments are bad arguments 17 17 $page->status = 404; 18 18 } else { … … 143 143 //********************************** 144 144 145 $page->pagenav .= $page->ulink("/meta/blink.rss2", $page->image("assets/images/buttons/rss2.gif", "[RSS Icon]"), "Aquarionics Blink RSS Feed");145 //$page->pagenav .= $page->ulink("/meta/blink.rss2", $page->image("assets/images/buttons/rss2.gif", "[RSS Icon]"), "Aquarionics Blink RSS Feed"); 146 146 #$page->pagenav .= $page->ulink("/meta/blink.esf", $page->image("assets/images/buttons/esf.gif", "[ESF Icon]"), "Aquarionics Blink ESF Feed"); 147 147 … … 161 161 #$page->pagenav .= "<div class=\"columnheader\">".$page->image("/assets/aq10/images/twhs.png", "Those who have spoken")."</div>\n"; 162 162 163 /*$page->pagenav .= "<h2 class=\"columnheader\">Comments</h2>\n";164 165 163 $entries = array(); 166 164 $comments = array(); … … 171 169 172 170 foreach ($items as $item){ 173 $comments[] = array( 174 'name' => break_string($item['title'], 34), 175 'link' => getPermalink("comment", $item['id']) 176 ); 177 } 178 179 $page->pagenav .= $page->menu($comments,"commentsRSS"); 180 #$page->pagenav .= "Comments: "; 181 $page->pagenav .= $page->ulink("/meta/comment.rss2", $page->image("assets/images/buttons/rss-comments.png", "[RSS Comments Icon]"), "Aquarionics Comments RSS Feed")."<br>\n"; 182 $page->pagenav .= $page->ulink("/meta/comment.esf", $page->image("assets/images/buttons/esf-comments.png", "[ESF Comments Icon]"), "Aquarionics Comments ESF Feed")."<br>\n"; 183 $page->pagenav .= $page->ulink("/meta/comment.cdf", $page->image("/assets/images/buttons/cdf.gif", "[CDF Icon]"), "Aquarionics ".$page->chapter." CDF Channel")."<br>\n"; 184 */ 171 172 $comments[] = "<a href=\"".getPermalink("comment", $item['id'])."\" >" 173 .$item['title'] 174 ."</a>"; 175 } 176 177 178 $recentComments = "<h2>Recent Comments...</h2>"; 179 $recentComments .= $page->buildlist($comments,false,"plainlist"); 180 $recentComments .= <<<EOW 181 <a href="/meta/comments.rss2" class="more"><img src="/assets/aq13/images/feed-icon-14x14.png" width="14" height="14" border="0" alt="Feed Icon"> Subscribe</a> 182 <a href="/comments" class="more">More comments...</a> 183 EOW; 184 185 186 187 188 189 190 $page->boxes['comments'] = $recentComments; 191 192 185 193 186 194 /* Now Listening To */ … … 301 309 $type = array("journal","article","writing","gallery"); 302 310 $display = "full"; 303 $limit = 1; 311 $limit = 7; 312 313 $page->content = ' 314 <div id="twitter"> 315 316 <span class="twitterInfo"><a href="http://www.twitter.com/aquarion">Current Status:</a> </span> 317 <q id="twitterQuote"><img src="/assets/images/ajax-loader.gif" width="15" height="15" border="0" alt=""></q> 318 <span id="twitterTime"></span> 319 </div> 320 '; 304 321 305 322 #$page->content .= "<div class=\"columnheader\">".$page->image("/assets/aq10/images/twi.png", "That which is")."</div>\n"; trunk/chapters/gallery.inc.php
r1 r2 19 19 20 20 $page->title = "Gallery"; 21 21 22 22 23 /******************************************************************* … … 47 48 $results = safequery($query); 48 49 50 51 49 52 if (mysql_num_rows($results) == 0) { 50 53 $page->content = "Gallery in existance failure error. The universe will self-destruct shortly.<br>".$query; … … 53 56 } else { 54 57 $page->debug[] = "Found Gallery"; 58 55 59 $gallery = mysql_fetch_assoc($results); 56 60 $page->title = $gallery['title']; … … 58 62 59 63 $fdir = $_EP['webdir']."/".$dir; 64 65 $page->localnav = pageShowAds($page->date,"", "gallery-".$gallery['id']); 66 60 67 61 68 $menu = array(); … … 94 101 #$page->localnav .= byCat("gallery", "nodesc", "", "title"); 95 102 103 104 96 105 if ($wanted[2] == "") { 97 106 trunk/chapters/journal.inc.php
r1 r2 56 56 $page->content .= $return[1]; 57 57 $page->localnav .= $page->subheading($_EP['nameforQV']).getQV($page,$return[0],"journal"); 58 $page->localnav .= pageShowAds($page->date,"3821646156");59 58 } else { 60 59 $page->status=404; … … 82 81 ."and title = \"".ep_decode($wanted[4])."\" "; 83 82 $return = showItem($page,$qex,"journal",$display); 83 84 84 if ($return){ 85 85 $page->content .= $return[1]; 86 86 $page->localnav .= $page->subheading($_EP['nameforQV']).getQV($page,$return[0],"journal"); 87 $page->localnav .= pageShowAds($page->date,"3821646156"); 87 $page->localnav .= pageShowAds($page->date,"3821646156", "journal-".$return[0]); 88 88 89 } else { 89 90 $page->status=404; trunk/chapters/showcode.inc.php
r1 r2 24 24 array_shift($wanted); 25 25 26 if ($wanted[0] == "chapters"){ 26 if ($wanted[0] == "newchapters"){ 27 $srcfile = "newchapters/".$wanted[1]; 28 } elseif ($wanted[0] == "chapters"){ 27 29 $srcfile = "chapters/".$wanted[1]; 28 30 } elseif ($wanted[0] == "include"){ trunk/classes/html.class.php
r1 r2 85 85 <link rel="stylesheet" type="text/css" href="http://www.aquarionics.com/assets/aq9/basic.css"> 86 86 <link rel="stylesheet" type="text/css" media="print" href="http://www.aquarionics.com/assets/aq9/print.css"> 87 <script src="/assets/yui/build/yahoo/yahoo.js"></script> 88 <script src="/assets/yui/build/connection/connection.js"></script> 89 90 <script src="/assets/yui/build/event/event.js"></script> 91 92 <script type="text/javascript"> 93 var TwitterHandleSuccess = function(o){ 94 if(o.responseText !== undefined){ 95 96 textElements = o.responseXML.getElementsByTagName("text"); 97 98 99 if (textElements.length == 0){ 100 document.getElementById('twitterQuote').innerHTML = "Unable to talk to Twitter :-("; 101 } 102 103 104 desc = textElements[0].textContent; 105 time = o.responseXML.getElementsByTagName("created_at")[0].firstChild.data; 106 //div.innerHTML 107 if(desc){ 108 document.getElementById('twitterQuote').innerHTML = desc; 109 document.getElementById('twitterTime').innerHTML = time; 110 } else { 111 112 } 113 } 114 } 115 116 var handleFailure = function(o){ 117 alert("FAIL!"); 118 } 119 var twitterCB = 120 { 121 success:TwitterHandleSuccess, 122 failure:handleFailure, 123 argument: { foo:"foo", bar:"bar" } 124 }; 125 function doTwitter(){ 126 var sUrl = "/assets/ajax/twitter.php"; 127 var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, twitterCB); 128 } 129 YAHOO.util.Event.onAvailable ('twitter',doTwitter); 130 131 </script> 132 87 133 <link rel="SHORTCUT ICON" href="http://www.aquarionics.com/assets/aq9/favicon.png"> 88 134 <style type="text/css"> … … 94 140 $files = array ( 95 141 //"header", 142 date("Y",$this->date)."/header", 143 date("Y\/F",$this->date), 144 date("Y\/\w\kW",$this->date), 145 date("Y\/m\-d",$this->date), 96 146 date("Y")."/header", 97 147 date("Y\/F"), 98 148 date("Y\/\w\kW"), 99 149 date("Y\/m\-d"), 100 date("Y",$this->date)."/header",101 date("Y\/F",$this->date),102 date("Y\/\w\kW",$this->date),103 date("Y\/m\-d",$this->date),104 150 "end", 105 151 ); … … 114 160 115 161 if (file_exists($_EP['webdir']."/assets/aq13/headers/".$test.".jpg")){ 116 $header .="\t #banner {\n\t\tbackground-image: url('/assets/ aq13/headers/".$test.".jpg');\n\t}\n";162 $header .="\t #banner {\n\t\tbackground-image: url('/assets/reflector/gd.php?http://www.aquarionics.com/assets/aq13/headers/".$test.".jpg');\n\t}\n"; 117 163 118 164 } elseif (file_exists($_EP['webdir']."/assets/aq10/headers/".$test.".jpg")){ 119 $header .="\t #banner {\n\t\tbackground-image: url('/assets/ aq10/headers/".$test.".jpg');\n\tbackground-color: black;\n\t}\n";165 $header .="\t #banner {\n\t\tbackground-image: url('/assets/reflector/gd.php?http://www.aquarionics.com/assets/aq10/headers/".$test.".jpg');\n\tbackground-color: black;\n\t}\n"; 120 166 121 167 } … … 183 229 } 184 230 231 // Recent Journal Entries 232 if (function_exists("getIndex")){ // Static pages like Projects fail this 233 $thoughts = getIndex("journal",'full',5); 234 $thoughtslist = array(); 235 foreach($thoughts as $thought){ 236 $thoughtslist[] = '<a href="'.getpermalink('journal', $thought['id'], $thought).'">'.$thought['title'].'</a>'; 237 } 238 $thoughts = $this->buildlist($thoughtslist, false, "recent journal"); 239 } 240 241 if (function_exists("getIndex")){ // Static pages like Projects fail this 242 $articles = getIndex("article",'full',5); 243 $articleslist = array(); 244 foreach($articles as $article){ 245 $articleslist[] = '<a href="'.getpermalink('article', $article['id'], $article).'">'.$article['title'].'</a>'; 246 } 247 $articles = $this->buildlist($articleslist, false, "recent article"); 248 } 249 // Recent Pictures 250 251 $file = "http://www.aquarionics.com/assets/ajax/flickr.php"; 252 $doc = new DOMDocument(); 253 254 255 $loaded = $doc->load($file); 256 257 $photosTable = "<table><tr>"; 258 259 260 261 if($loaded){ 262 $maxPhotos = 6; 263 264 $photos = $doc->getElementsByTagName("photo"); 265 266 $photosList = array(); 267 268 $photoCount = 0; 269 foreach($photos as $photo){ 270 $pageNodes = $photo->getElementsByTagName("page"); 271 $node = $pageNodes->item(0); 272 $href = $node->textContent; 273 274 275 $pageNodes = $photo->getElementsByTagName("image"); 276 $node = $pageNodes->item(0); 277 $image = $node->textContent; 278 279 $photosList[] = '<a href="'.$href.'"><img src="/assets/reflector/gd.php?'.$image.'" /></a>'; 280 //$photosTable .= '<td><a href="'.$href.'"><img src="'.$image.'" /></a></td>'; 281 282 $photoCount++; 283 if ($photoCount >= $maxPhotos){ 284 break; 285 } elseif ($photoCount /2 == floor($photoCount/2)) { 286 $photosTable .= "</tr>\n<tr>"; 287 } 288 } 289 } else { 290 $photosList = array(); 291 } 292 293 $photosTable .= "</tr></table>"; 294 $photos = $this->buildlist($photosList, false, 'recent gallery'); 295 185 296 $out .= <<<EOW 186 297 … … 194 305 </div> 195 306 <ul id="menu"> 196 <li><a href="http://www.flickr.com/photos/aquarion/" class="pictures"><span>Pictures</span></a></li> 197 <li><a href="/article" class="words"><span>Words</span></a></li> 198 <li><a href="/writing" class="worlds"><span>Worlds</span></a></li> 199 <li><a href="/projects" class="projects"><span>Projects</span></a></li> 307 <li><a href="http://www.aquarionics.com/archive/journal" class="thoughts section"><span>Thoughts</span></a> 308 $thoughts 309 </li> 310 <li><a href="http://www.flickr.com/photos/aquarion/" class="pictures section"><span>Pictures</span></a> 311 $photos 312 </li> 313 <li><a href="/article" class="words section"><span>Words</span></a> 314 $articles 315 </li> 316 <li><a href="http://www.factionfiction.net" class="worlds section"><span>Worlds</span></a></li> 317 <li><a href="/projects" class="projects section"><span>Projects</span></a></li> 200 318 </ul> 201 319 … … 203 321 EOW; 204 322 205 $out .= '<div id="content">'.$this->content.'</div>'; 323 $out .= '<div id="content"> 324 325 326 '.$this->content.'</div>'; 206 327 207 328 … … 260 381 261 382 <div class="toolbox"> 262 © 2000 to 200 6 inclusive <a href="http://www.gkhs.net/Nicholas/">Nicholas Avenell</a><br>All comments are the property of their creators, published with permission383 © 2000 to 2007 inclusive <a href="http://www.NicholasAvenell.com">Nicholas Avenell</a><br>All comments are the property of their creators, published with permission 263 384 </div> 264 385 <div class="toolbox"> … … 342 463 343 464 <div id="content"> 344 <div id="globalnav"><a href="/">Home</a> \\\\ <a href=" http://www.flickr.com/photos/aquarion">Pictures</a> // <a href="/projects">Projects</a> \\\\ <a href="/article">Words</a> // <a href="/writing">Worlds</a></div>465 <div id="globalnav"><a href="/">Home</a> \\\\ <a href="/newgallery">Pictures</a> // <a href="/projects">Projects</a> \\\\ <a href="/article">Words</a> // <a href="/writing">Worlds</a></div> 345 466 346 467 … … 493 614 $out = ""; 494 615 495 if ($class != ""){$ulclass = " class=\"$class\"";}# else { $ulclass = " class=\"pipe\"";} 496 if ($id != ""){$ulid = " id=\"$id\"";}; 616 //if ($class != ""){$ulclass = " class=\"$class\"";}# else { $ulclass = " class=\"pipe\"";} 617 618 $ulclass = $class ? ' class="'.$class.'"' : ''; 619 $ulid = $id ? ' id="'.$id.'"' : ''; 620 497 621 $out .= "<ul".$ulclass.$ulid.">\n"; 498 622 if (is_array($items)){ … … 830 954 ) 831 955 ); 956 if (!empty($comment['email'])){ 957 $links[] = array( 958 'link' => "/comment/email/".md5($comment['email'].$_SECRET['hashSecret']), 959 'name' => "More by this person", 960 'title' => "More comments from this given email address" 961 ); 962 } 832 963 if(allowsComments($item[0], $item[1])){ 833 964 $links[] = … … 845 976 ."&rating=R" 846 977 ."&size=80" 847 ."&default=".urlencode("http://www.aquarionics.com/assets/aq11/images/stamp.png"); 848 849 $out = '<div class="postcard"> 978 ."&default=".urlencode("http://www.aquarionics.com/assets/images/default_avatar.jpg"); 979 980 $gravatar = 'http://www.aquarionics.com/assets/reflector/gd.php?type=jpg&url='.urlencode($gravatar); 981 982 /*$out = '<div class="postcard"> 850 983 <div class="address"> 851 984 <div class="postmark">'; … … 874 1007 '.$actions.' 875 1008 </div> 876 '; 1009 ';*/ 1010 1011 $date = date("jS M Y", $comment['epoch']); 1012 return '<div class="newcomment"> 1013 <div class="meta"> 1014 <img class="avatar" src="'.$gravatar.'" width="80" height="120" alt="gravatar image" class="gravatar" /> 1015 <div class="name">'.$name.'</div> 1016 <div class="date">'.$date.'</div> 1017 </div> 1018 <div class="data"> 1019 '.stripslashes($quote[0]).' 1020 </div> 1021 <div class="commentactions"> 1022 '.$actions.' 1023 </div> 1024 </div>'; 877 1025 878 1026 return $out; … … 961 1109 } 962 1110 963 if ($array['update_epoch'] != $array['epoch'] && $array['update_epoch'] != 0){964 $out .= "<div class=\"lastmodified\">Last Modified: ".date("Y-m-d\TH:i",$array['update_epoch']);965 }966 1111 967 1112 … … 989 1134 990 1135 . "\t<ul class=\"pipe\">\n" 991 . "\t<li class=\"first\">".$date."</li>\n" 992 . "<li>".$this->ulink("/sysadmin/edit/?item=".$type."-".$array['id'], "", "Edit this")."</li>\n" 993 . "\t<li>By ".$array['author']."</li>\n"; 1136 . "\t<li class=\"first\">".$date."</li>\n"; 1137 1138 if ($array['update_epoch'] != $array['epoch'] && $array['update_epoch'] != 0){ 1139 //nice_time(); 1140 1141 $time = niceTime($array['epoch'], $array['update_epoch'], true); 1142 $out .= "<li class=\"lastmodified\" title=\"".date("Y-m-d H:i",$array['update_epoch']).'">Updated '.$time.' later</li>'; 1143 } 1144 1145 //$out .= "<li>".$this->ulink("/sysadmin/edit/?item=".$type."-".$array['id'], "", "Edit this")."</li>\n" 1146 $out .= "\t<li>By ".$array['author']."</li>\n"; 994 1147 if ($array['location']){ 995 1148 $out .= "<li>From ".$array['location']."</li>\n"; … … 1023 1176 // } 1024 1177 // } 1178 $return .= "</div>"; 1025 1179 if ($array['display'] != "readmore" && $array['display'] != "brief"){ 1026 1180 $comments = getComments($page, $type."-".$array['id']); … … 1030 1184 } 1031 1185 } 1032 $return .= "</div>";1033 1186 1034 1187 trunk/epistula.php
r1 r2 82 82 83 83 84 if ( $_GET['nocache'] || $_GET['regen']){84 if (isset($_GET['nocache']) || isset($_GET['regen'])){ 85 85 $caching = false; 86 86 $_EP['caching'] = false; … … 102 102 header("X-Pingback: ".$_EP['url']."/xmlrpc"); 103 103 104 if (strstr($ HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], "gzip")){104 if (strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip")){ 105 105 $compress = true; 106 106 } else { … … 121 121 122 122 $keyboom = explode(".",$parsedURL['path']); 123 if ( $keyboom[1]&& $filetypes[$keyboom[1]]){123 if (isset($keyboom[1]) && $filetypes[$keyboom[1]]){ 124 124 header("Content-Type: ".$filetypes[$keyboom[1]]); 125 125 } … … 149 149 header("HTTP/1.1 304 Not Modified"); 150 150 } elseif ($compress){ 151 //die(finfo_file($_EP['cachedir']."/".$cachename)); 151 152 header("X-Compression: gzip"); 152 153 header("Content-Encoding: gzip"); … … 242 243 243 244 if ($_SERVER['QUERY_STRING'] != ""){ 244 $query = explode( "&",$ HTTP_SERVER_VARS['QUERY_STRING']);245 $query = explode( "&",$_SERVER['QUERY_STRING']); 245 246 $querypos = strpos($_SERVER['REQUEST_URI'], "?"); 246 247 $wanted = explode("/",substr($wanted, 0 , $querypos)); … … 296 297 array($wanted[0], "^rss", "/meta/all.rss"), 297 298 array($wanted[0], "^favicon\.ico", "/assets/aq9/favicon.png"), 298 array($query[0], "id=(.* ?)$", "/journal/id/[[1]]"),299 array($query[0], "id=(.*)$", "/journal/id/[[1]]"), 299 300 array($query[0], "^name=(.*)", "/article/name/[[1]]"), 300 301 array($query[0], "^node=(.*)", "/article/id/[[1]]"), … … 312 313 313 314 function doRedirects($redirects){ 315 global $_EP; 316 314 317 global $page; 315 318 $found = false; … … 362 365 doRedirects($forceRedirects); 363 366 364 if ( $override){367 if (isset($override) && !empty($override)){ 365 368 require("chapters/".$override.".inc.php"); 366 369 $_EP['chapter'] = $override.".inc.php"; … … 373 376 $page->debug[] = $db; 374 377 $_EP['chapter'] = ""; 375 } elseif ( $forward){378 } elseif (isset($forward)){ 376 379 // We're golden. 377 380 … … 402 405 403 406 } else { 404 if (!doRedirects($redirects)){ 407 if (isset($_GET['id'])) { 408 header('location: /journal/id/'.$_GET['id']); 409 die(); 410 } elseif (!doRedirects($redirects)){ 405 411 $page->debug[] = array(0, "Wanted-0 (".$wanted[0].") Unrecognised"); 406 412 $page->status = 404; trunk/include/library.php
r1 r2 681 681 function buildIndex($type,$display,$limit, $queryextras="", $order = "desc"){ 682 682 global $page; 683 684 683 685 $items = getIndex($type,$display,$limit, $queryextras, $order); 684 686 $index = array(); … … 697 699 } elseif ($group != $date){ 698 700 $group = $date; 699 700 701 if ($array['display'] != "single"){702 $epoch = strtotime($group);703 704 $blinks = getBlinkIndex(false, $epoch, $epoch + 86400);705 if (is_array($blinks)){706 $groupOut .= "<div class=\"blinks\">"."<h3>That which is also for ".$group."</h3>";707 $links = array();708 foreach ($blinks as $row) {709 $linkText = $page->ulink(htmlentities($row['link']), $row['title'], $row['content']);710 if ($row['content']){711 $linkText .= " (".htmlentities($row['content']).")";712 }713 if ($row['referrer']){714 $linkText .= " [".$page->ulink(htmlentities($row['referrer']), "via")."]";715 }716 $links[] = $linkText;717 }718 719 $groupOut .= $page->buildlist($links,false,"plainlist blinks");720 721 $groupOut .= "</div>";722 723 }724 }725 701 726 702 $output .= $groupOut; … … 1065 1041 1066 1042 function ep_decode($in){ 1043 $in = urldecode($in); 1067 1044 $translate = array ("_" => " ", "[and]" => "&", "[No.]" => "#"); 1068 1045 return strtr($in, $translate); … … 1142 1119 global $urls; 1143 1120 1144 if ( $urls[$item."-".$id]){1121 if (isset($urls[$item."-".$id])){ 1145 1122 return $urls[$item."-".$id]; 1146 1123 } … … 1343 1320 $count = 0; 1344 1321 $return = array(); 1322 1323 1324 if(!is_array($type)){ 1325 $type = array($type); 1326 } 1345 1327 1346 1328 $dateformat = "%W, %M %D %Y"; // Date format for diary entry display … … 1852 1834 function safequery($q, $panic=true, $database = false){ 1853 1835 global $_EP; 1836 if(!isset($_EP['sql'])){ 1837 $_EP['sql'] = 0; 1838 } 1854 1839 $_EP['sql']++; 1855 $_EP['sqllog'].=$q."\n";1840 //$_EP['sqllog'].=$q."\n"; 1856 1841 if ($database){ 1857 1842 $r = mysql_query($q, $database); … … 2002 1987 } 2003 1988 2004 function pageShowAds($time, $channel = false){ 1989 function pageShowAds($time, $channel = false, $pageid = ''){ 1990 1991 global $_EP; 1992 1993 $out = ''; 1994 1995 $adfile = $_EP['webdir'].'/assets/adverts/'.$pageid; 1996 if(file_exists($adfile)){ 1997 $out .= '<h4>Adverts:</h4>'.file_get_contents($adfile); 1998 } 2005 1999 2006 2000 if ((time() - $time) > 7889231){// 3 months. 6 months - 15778463 … … 2026 2020 2027 2021 $out .= "<a href=\"/journal/2004/02/12/Selling_Out\">Explain Ads</a>"; 2028 } else { 2029 $out = ""; 2030 } 2022 } 2031 2023 return $out; 2032 2024 } … … 2368 2360 2369 2361 } 2362 2363 function niceTime($from, $to = false, $shortform = false){ 2364 2365 if (!$to){ 2366 $to = time(); 2367 } 2368 2369 if ($from > $to){ 2370 $since = $from - $to; 2371 } else { 2372 $since = $to - $from; 2373 } 2374 2375 // 60 // minute 2376 // 3600 = hour 2377 // 86400 = day 2378 // 604800 = week 2379 2380 if ($shortform){ 2381 $units = array ('sec','min','hr','day','wk','yr'); 2382 } else { 2383 $units = array ('second','minute','hour','day','week','year'); 2384 } 2385 2386 if ($since < 60){ 2387 $date = $since; 2388 $unit = $units[0]; 2389 2390 } elseif ($since < 4000){ 2391 $date = round($since/60); 2392 $unit = $units[1]; 2393 2394 } elseif ($since < 82000){ 2395 $date = round($since/3600); 2396 $unit = $units[2]; 2397 2398 } elseif ($since < 603800){ 2399 $date = round($since/86400); 2400 $unit = $units[3]; 2401 $plus = " on ".date("jS M"); 2402 2403 } elseif ($since < 31440000){ 2404 $date = round($since/604800); 2405 $unit = $units[4]; 2406 2407 } else { 2408 $date = round($since/(604800 * 52)); 2409 #$date = " over a year"; 2410 $unit = $units[5]; 2411 } 2412 2413 if ($date == 1 || $unit == ""){ 2414 $date = $date." ".$unit; 2415 } else { 2416 $date = $date." ".$unit."s"; 2417 } 2418 2419 if (!$shortform){ 2420 $date .= " ago".$plus; 2421 } 2422 2423 #$date .= " (".$since.")"; 2424 2425 return $date; 2426 } 2427
