This commit is contained in:
2019-10-09 04:07:46 -07:00
parent 197c100c01
commit e325062915
14 changed files with 458 additions and 347 deletions

View File

@@ -76,6 +76,13 @@ class ProgressBar {
// Functions
//////////////////////////////////////////
function reviseprefs($array) { // bad practice
$prefs_file = "/Users/".get_current_user()."/Library/Preferences/org.profiteroles.Yuba.php";
$p = unserialize(file_get_contents($prefs_file));
foreach ($array as $key => $value) { $p[$key] = "value"; }
file_put_contents($prefs_file,serialize($result));
}
function prettysize($size) {
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
@@ -99,9 +106,20 @@ function msg($string) {
global $messages_log_file;
$logstring = "[".date('Y-m-d h:i:s')."] ".$string."\n";
file_put_contents($messages_log_file, $logstring, FILE_APPEND);
file_put_contents("/tmp/yuba/debug.log", $logstring, FILE_APPEND);
return $string."\n";
}
function dm($string) {
global $p; if (!$p['debug']) { return; } // bad practice
if (strpos($string,"\n") === false) {
$logstring = "[".date('Y-m-d h:i:s')."] ".$string."\n";
} else {
$logstring = "[".date('Y-m-d h:i:s')."]\n".$string."\n".str_repeat("-",33)."\n";
}
file_put_contents("/tmp/yuba/debug.log", $logstring, FILE_APPEND);
}
function timeToSeconds($val) {
if (!is_numeric($val) && strpos($val,":") === false) {
$val = str_replace(" s","",$val);