This commit is contained in:
2019-05-22 04:02:22 -07:00
parent c062910a22
commit e84c693464
11 changed files with 313 additions and 26 deletions

View File

@@ -0,0 +1,53 @@
<?php
// YubaPrefs 0.1.0
//
// Includes
require (__DIR__."/functions.php");
require (__DIR__."/functions.pashua.php");
// Read Prefs
$p = unserialize(file_get_contents(__DIR__."/prefs.php"));
if(!$p['bdest']) {
$p['bdest'] = "/Users/".get_current_user()."/Documents/Yuba/";
if (!is_dir($p['bdest'])) { if (!mkdir($p['bdest'])) { echo "Error creating destination directory"; } }
}
// Load strings
$strings[] = array("Do nothing","Reveal result in Finder","Upload result with rsync");
$strings[] = array("Bypass","Generate","Rebuild (tk)");
$result = Pashua::showDialog(makeWindowString($p, $strings));
// User cancelled
if (@$result['cb']) {
echo "0";
die;
}
// Fix strings
$result['postflight'] = array_search($result['postflight'],$strings[0]);
$result['thumbs'] = array_search($result['thumbs'],$strings[1]);
// If the user didn't specify a destpath, set to default
if(!$p['bdest']) {
$p['bdest'] = "/Users/".get_current_user()."/Documents/Yuba/";
}
// Fix a Pashua bug
$result['destpath'] = str_replace("Desktop/Desktop","Desktop",$result['destpath']);
// Write Prefs
file_put_contents("prefs.php",serialize($result));
echo "1";
?>