110 |
|
function uptime($until) { |
111 |
|
$day = date('z', $until); |
112 |
|
$hour = date('G', $until); |
113 |
< |
$hour = $hour - 1; # one too many |
113 |
> |
if ($hour == 0) { # everything's an hour ahead, so roll back |
114 |
> |
$hour = 23; |
115 |
> |
$day = $day - 1; |
116 |
> |
} else { |
117 |
> |
$hour = $hour - 1; |
118 |
> |
} |
119 |
|
$minute = date('i', $until); |
120 |
|
$return = ""; |
121 |
|
if ($day) { |
122 |
< |
$return = "$return$day Days "; |
122 |
> |
$return = "$return$day"; |
123 |
> |
if ($day == 1) { |
124 |
> |
$return = "$return Day "; |
125 |
> |
} else { |
126 |
> |
$return = "$return Days "; |
127 |
> |
} |
128 |
|
} |
129 |
|
if ($hour) { |
130 |
< |
$return = "$return$hour Hours "; |
130 |
> |
$return = "$return$hour"; |
131 |
> |
if ($hour == 1) { |
132 |
> |
$return = "$return Hour "; |
133 |
> |
} else { |
134 |
> |
$return = "$return Hours "; |
135 |
> |
} |
136 |
|
} |
137 |
< |
return "$return$minute Mins"; |
137 |
> |
$return = "$return$minute"; |
138 |
> |
if ($minute == 1) { |
139 |
> |
$return = "$return Min"; |
140 |
> |
} else { |
141 |
> |
$return = "$return Mins"; |
142 |
> |
} |
143 |
> |
return $return; |
144 |
|
} |
145 |
|
|
146 |
|
|
238 |
|
# Return a preg_match result. |
239 |
|
function getPregMatch($value, $input) { |
240 |
|
preg_match("/$value=([^\,\}]*)[\,\}]/", $input, $matches); |
241 |
+ |
if(!isset($matches[1])) { |
242 |
+ |
return; |
243 |
+ |
} |
244 |
|
return $matches[1]; |
245 |
|
} |
246 |
|
|