// Store the directory where the script was called and the bundle is going to be generated $cwd = getcwd(); // Ask for bundle details while (!($bundle_file = read_input("Bundle filename e.g. myapp"))) { } while (!($bundle_identifier = read_input("Bundle identifer e.g. com.mycompany.myapp"))) { } while (!($application_name = read_input("Application name e.g. My Application"))) { } while (!($application_information = read_input("Application information e.g. My Application version 1.0, (c) 2014 Provider"))) { } while (!($short_version = read_input("Short version e.g. 1.0"))) { } while (!($long_version = read_input("Long version e.g. 1.0 beta 2014/08/23"))) { } while (!($copyright = read_input("Copyright e.g. Copyright 2014 Provider"))) { } // Start generating the bundle skeleton if (!file_exists("{$bundle_file}.app")) { mkdir("{$bundle_file}.app"); } if (!file_exists("{$bundle_file}.app/Contents")) { mkdir("{$bundle_file}.app/Contents"); } if (!file_exists("{$bundle_file}.app/Contents/MacOS")) { mkdir("{$bundle_file}.app/Contents/MacOS"); } if (!file_exists("{$bundle_file}.app/Contents/Resources")) { mkdir("{$bundle_file}.app/Contents/Resources"); } $info_plist = <<<VALUE
function write_row($handle, $row) { foreach ($row as $key => $value) { $row[$key] = preg_replace("/\"/", "\"\"", $value); } fprintf($handle, "\"%s\"\n", implode("\",\"", $row)); } /*********************************************************************/ $filter = $argv[1]; $in = $argv[2]; $out = $argv[3]; // Process the input file if (!file_exists($in)) { print_usage_and_exit("File {$in} not found"); } $csv = read_input($in, isset($argv[5]) ? $argv[5] : ','); // Filter the CSV data for conversion if (!@(include $filter)) { print_usage_and_exit("Could not include filter script {$in}"); } $conf = formatter_filter($csv); $conf["start_at"] = isset($conf["start_at"]) ? $conf["start_at"] : 1; $conf["id"] = isset($conf["id"]) ? $conf["id"] : 0; $conf["rows"] = isset($conf["rows"]) ? $conf['rows'] : array(); $csv = formatter($csv, $conf); // Write the output $handle = fopen($out, 'w'); if (!$handle) { // print_error_and_exit('Could not create output file'); } write_output($handle, $csv);
echo " **********************************************\n"; echo " \n\n\n\n\n\n\n"; $msg = "Should all modules be enabled ? (yes - Recommended/no): \n"; $vars["default_module_status"] = strtolower(read_input($msg)); } while ($vars["default_module_status"] != "yes" && $vars["default_module_status"] != "no"); if ($vars["default_module_status"] == "yes") { $vars["default_module_status"] = 1; } if ($vars["default_module_status"] == "no") { $vars["default_module_status"] = 0; } echo " \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; echo " **********************************************\n"; echo " If you have entered everything correctly \n"; echo " the bot should start.\n"; echo " ----------------------------------------------\n"; echo " We would appreciate any feedback you have.\n"; echo " Comments and suggestions are more than welcome!\n"; echo " www.budabot.com\n"; echo " ----------------------------------------------\n"; echo " Have a good day on Rubi-Ka.\n"; echo " To rerun this setup simply delete your\n"; echo " config file: {$configFile->getFilePath()}\n"; echo " **********************************************\n"; echo " \n\n\n\n\n"; $msg = "Press [Enter] to start the bot.\n"; read_input($msg); //Save the entered info to $configFile $configFile->insertVars($vars); $configFile->save(); die("Restarting bot");
#!/usr/bin/php <?php /* symlinks_update.php - script to update user's symlinks */ if (strcmp(PHP_SAPI, 'cli') != 0) { die("this script can only be called from the command line - exiting\n"); } require_once '../core/init.php'; if (posix_geteuid() == 0) { update_all_users(); exit; } $user = read_input(); if (!mcm_action('validate_login', $user)) { die("invalid username/password\n"); } update_user($user); return; function update_user($user) { global $mcm; /* if we ran validate_login(),then the $user_id hasn't been set... */ if (!isset($user['user_id'])) { $user['user_id'] = $mcm['user_id']; } $prefs = mcm_action('lookup_prefs', $user['user_id']); if (isset($user['forced_target'])) { $prefs['pref_target'] = $user['forced_target']; } echo "updating symlinks for user '{$user['user_name']}' on directory '{$prefs['pref_target']}'\n"; if (!($prefs = validate_prefs($prefs))) { return;