A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Untitled - Stikked
From Emerald Leech, 12 Years ago, written in PHP.
Embed
  1. <?php
  2. function time2str($ts)
  3. {
  4.     if(!ctype_digit($ts))
  5.         $ts = strtotime($ts);
  6.  
  7.     $diff = time() - $ts;
  8.     if($diff == 0)
  9.         return 'now';
  10.     elseif($diff > 0)
  11.     {
  12.         $day_diff = floor($diff / 86400);
  13.         if($day_diff == 0)
  14.         {
  15.             if($diff < 60) return 'just now';
  16.             if($diff < 120) return '1 minute ago';
  17.             if($diff < 3600) return floor($diff / 60) . ' minutes ago';
  18.             if($diff < 7200) return '1 hour ago';
  19.             if($diff < 86400) return floor($diff / 3600) . ' hours ago';
  20.         }
  21.         if($day_diff == 1) return 'Yesterday';
  22.         if($day_diff < 7) return $day_diff . ' days ago';
  23.         if($day_diff < 31) return ceil($day_diff / 7) . ' weeks ago';
  24.         if($day_diff < 60) return 'last month';
  25.         return date('F Y', $ts);
  26.     }
  27.     else
  28.     {
  29.         $diff = abs($diff);
  30.         $day_diff = floor($diff / 86400);
  31.         if($day_diff == 0)
  32.         {
  33.             if($diff < 120) return 'in a minute';
  34.             if($diff < 3600) return 'in ' . floor($diff / 60) . ' minutes';
  35.             if($diff < 7200) return 'in an hour';
  36.             if($diff < 86400) return 'in ' . floor($diff / 3600) . ' hours';
  37.         }
  38.         if($day_diff == 1) return 'Tomorrow';
  39.         if($day_diff < 4) return date('l', $ts);
  40.         if($day_diff < 7 + (7 - date('w'))) return 'next week';
  41.         if(ceil($day_diff / 7) < 4) return 'in ' . ceil($day_diff / 7) . ' weeks';
  42.         if(date('n', $ts) == date('n') + 1) return 'next month';
  43.         return date('F Y', $ts);
  44.     }
  45. }