0) { $uptimeString .= $days; $uptimeString .= (($days == 1) ? " day" : " days"); } if ($hours > 0) { $uptimeString .= (($days > 0) ? ", " : "") . $hours; $uptimeString .= (($hours == 1) ? " hr" : " hrs"); } if ($mins > 0) { $uptimeString .= (($days > 0 || $hours > 0) ? ", " : "") . $mins; $uptimeString .= (($mins == 1) ? " min" : " mins"); } if ($secs > 0) { $uptimeString .= (($days > 0 || $hours > 0 || $mins > 0) ? ", " : "") . $secs; $uptimeString .= (($secs == 1) ? " s" : " s"); } return $uptimeString; } function startsWith($haystack, $needle) { return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; } function getMHZ($freq) { return substr($freq,0,3) . "." . substr($freq,3,6) . " MHz"; } function isProcessRunning($processname) { exec("pgrep " . $processname, $pids); if(empty($pids)) { // process not running! return false; } else { // process running! return true; } } function clean($string) { return preg_replace('/[^A-Za-z0-9:\-\/\ \.\_\>\&]/', '', $string); // Removes special chars. } function createConfigLines() { $out =""; foreach($_GET as $key=>$val) { if($key != "cmd") { //$val = clean($val); $out .= "define(\"$key\", \"$val\");"."\n"; } } return $out; } function getSize($filesize, $precision = 2) { $units = array('', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'); foreach ($units as $idUnit => $unit) { if ($filesize > 1024) $filesize /= 1024; else break; } return round($filesize, $precision).' '.$units[$idUnit].'B'; } function checkSetup() { $el = error_reporting(); error_reporting(E_ERROR | E_WARNING | E_PARSE); if (file_exists ("setup.php") && ! defined("DISABLESETUPWARNING")) { ?> setTimezone(new DateTimeZone(TIMEZONE)); return $date->format('Y-m-d H:i:s'); } catch (Exception $err) {} } function encode($hex) { $validchars = " abcdefghijklmnopqrstuvwxyzäöüßABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ0123456789"; $str = ''; $chrval = hexdec($hex); $str = chr($chrval); if (strpos($validchars, $str)>=0) return $str; else return ""; } function recursive_array_search($needle,$haystack) { foreach($haystack as $key=>$value) { $current_key = $key; if($needle===$value OR (is_array($value) && recursive_array_search($needle,$value) !== false)) { return $current_key; } } return false; } function rot1($text) { $ric = 0; $slot = 0; $out = ""; for ($i = 0; $i < strlen($text); $i++) { if ($i == 0) $ric = ord($text[$i])-31; if ($i == 1) $slot = ord($text[$i])-32; if ($i > 1) $out .= chr(ord($text[$i])-1); } return "Skyper-Rubric-No.: ".$ric.", Slot: ".$slot.", message: ".$out; } ?>