include_once dirname(dirname(__DIR__)) . "/Setup_Files/ScriptSettings.php"; new ScriptSettings(); //Read in CLI Vars //Add new parameters to print out in the help screen that are exclusive to this custom Script. Can use the simpler format here or the format api classes use. // $cli_params = ["example" => "What example should be used to do"]; // $api_object->createCliParameters($cli_params); $template_get->setDescription("Return a how compatible a given template is, or an Account's templates are, with regards to Pinning."); $input_vars = $script->readCliArguments($argv, $template_get); $template_get->ingestInput($input_vars["config_vars"] + $input_vars["wildcard_vars"], CliScriptAbstract::$flags["isOverride"]); //Validates and Assigns Vars //////////////////// START MAIN PROGRAM ////Create Client if (CliScriptAbstract::$flags["isDefaults"]) { $account_credentials->setAccount("defaults"); } $client = new Sailthru_Implementation_Client($account_credentials->getKey(), $account_credentials->getSecret(), $account_credentials->getEnvironment); ////Designate Call Parameters $call_data = $template_get->getCallData(); $bad_includes = []; $horizon_includes = []; ////Status Output CliScriptAbstract::$flags["isSilent"] ?: (print "Starting\n"); if ((CliScriptAbstract::$flags["isVerbose"] || CliScriptAbstract::$flags["isInteractive"]) && (!CliScriptAbstract::$flags["isQuiet"] && !CliScriptAbstract::$flags["isSilent"])) { if ($account_credentials->getNumber() && $account_credentials->getKey() == $account_credentials->getKey($account_credentials->getNumber())) { print "Account " . $account_credentials->getNumber() . ": " . $account_credentials->getName() . "\n"; } print "Key: " . $account_credentials->getKey() . "\n"; print "Secret: " . $account_credentials->getSecret() . "\nValues:"; print json_encode($call_data, JSON_PRETTY_PRINT) . "\n"; if (CliScriptAbstract::$flags["isInteractive"]) { //Confirm + screen output if user decides to kills the script.
$retry += 1; } while ($id == "" && $retry < $user_retries_entry); $retry = 0; do { print "Enter " . $account_ref . " Account's Name:\n"; if (isset($name)) { print "Hit enter to reuse " . $name . "\n"; $old_name = $name; } $name = trim(readline()); if ($name == "" && isset($old_name)) { $name = $old_name; } $retry += 1; } while ($name == "" && $retry < $user_retries_entry); $client = new Sailthru_Implementation_Client($key, $secret, $environment); try { print "Confirming Acct #\n"; $return_id = $client->getAccountId(); } catch (Exception $e) { } if (is_numeric($return_id)) { if ($return_id != $id) { print "\nThe Id doesn't match up: Supplied {$id} vs Retrieved {$return_id}.\n"; print "Would you like to enter the information again, proceed anyway or abort?\n (retry/proceed/abort)\n"; $answer = readline(); if ($answer == "proceed") { $is_repeat = false; } else { if ($answer == "abort") { exit(3);