function build($argv) { global $_plugin; global $success; global $error; global $errors; plugin_is_installed($_plugin['name']) or $error = $error['not_installed']; isset($argv[3]) or $error = $errors['usage']; prompt('WARNING: Building a table from a definition will clear all data from your table; are you sure you want to do this?') or $error = $errors['aborted']; if (!$error) { # Let's get connected! db_connect(); use_db(); # Get definition config. $_definition = get_plugin_config('definitions'); # At this point, $_definition is overwritten with the defined $_definition in the require. require $_definition['dir']['definitions'] . $argv[3] . '.php'; # Drop the current table. Should really be its own script, no? # Check for table existence. if (mysql_query('SELECT * FROM ' . $_definition['name'])) { mysql_query('DROP TABLE ' . $_definition['name']); } # Let's build this noise! $query = 'CREATE TABLE ' . $_definition['name'] . '(' . "\n"; # We'll foreach through the table def and build the SQL string as needed. foreach ($_definition['fields'] as $field => $data) { $query .= $field . ' ' . strtoupper($data['type']); if ($data['length']) { $query .= '(' . $data['length'] . ')'; } if (!$data['null']) { $query .= ' NOT NULL'; } if ($data['auto_inc']) { $query .= ' AUTO_INCREMENT'; } # Add a comma and line break. $query .= ",\n"; # Output relational data. if (isset($data['relation'])) { $query .= 'INDEX ' . $data['relation']['name'] . '_rel(' . $data['relation']['name'] . '_id)'; $query .= ',' . "\n" . 'FOREIGN KEY(' . $data['relation']['name'] . '_id) REFERENCES ' . $data['relation']['name'] . '(id) ON DELETE CASCADE'; $query .= ",\n"; } } if ($_definition['primary']) { $query .= 'PRIMARY KEY(' . $_definition['primary'] . ')'; } # End query here. $query .= "\n" . ')'; //add option to display this! echo 'Executing the following query:' . "\n" . $query . "\n\n"; if (mysql_query($query)) { //$success = 'Created ' . $_definition['name'] . ' with the following query: ' . "\n" . $query; $success = 'Created "' . $_definition['name'] . '"'; } else { $error = mysql_error(); } } }
function build($argv) { global $_plugin; global $success; global $error; global $errors; prompt('WARNING: Building fixtures clear all data from your table; are you sure you want to do this?') or $error = $errors['aborted']; if (!$error) { require_once $_plugin['dir']['fixtures'] . $argv[3] . '.php'; # Let's get connected! db_connect(); use_db(); # Truncate table. echo 'Truncating ' . $argv[3] . ' table...' . "\n\n"; $query = mysql_query('TRUNCATE ' . $argv[3]); foreach ($_fixtures as $_fixture) { $query = ' INSERT INTO ' . $argv[3] . ' (' . implode(',', array_keys($_fixture)) . ') VALUES (' . implode(',', array_values(enquote($_fixture))) . ') '; //add option to display this? echo 'Running the following query:'; echo "\n" . $query . "\n\n"; if (mysql_query($query)) { $success = 'fixtures for the table: ' . $argv[3] . ' have been succesfully built!'; } else { $error = mysql_error(); } } } }
/** * @param InputInterface $input * @param OutputInterface $output * * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { $name = prompt("Name"); $this->descr["description"] = prompt("Description"); if (!$name) { $output->writeln("Error, name is not supplied."); exit; } if ($input->getOption("controller")) { $this->controller($name, $output); } if ($input->getOption("model")) { $this->model($name, $output); } if ($input->getOption("libs")) { $this->libs($name, $output); } if ($input->getOption("task")) { $this->task($name, $output); } if ($input->getOption("cronjob")) { $this->cronjob($name, $output); } if ($input->getOption("resque")) { $this->resque($name, $output); } $output->writeln("Please run update to update MiraApp and Composer"); }
function customerFields($data, $badFields) { global $states; global $COUNTRIES; if (userLoggedIn() && array_key_exists("CID", $data) && $data["CID"] != "") { tableRow(array(tableData(prompt("<b>CID:</b>"), "right", "top"), tableData(prompt($data["CID"]), "left", "top"))); prepDatePicker(); tableRow(array(tableData(prompt("<b>Met Date:</b>"), "right", "top"), tableData(text($data, "metDate", "", "", "datepicker"), "left", "middle"))); } tableRow(array(tableData(prompt("<b>First name*:</b>", in_array("fname", $badFields)), "right"), tableData(text($data, "fname"), "left", "middle"), tableData(prompt("<b>Last name*:</b>", in_array("lname", $badFields)), "right"), tableData(text($data, "lname"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Email*:</b>", in_array("email", $badFields)), "right"), tableData(text($data, "email"), "left", "middle"), tableData(prompt("<b>Phone Number:</b>", in_array("phoneNum", $badFields)), "right"), tableData(text($data, "phoneNum"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Title:</b>", in_array("title", $badFields)), "right"), tableData(radioButton($data, "title", "Mr.", false, "Mr."), "center", "middle"), tableData(radioButton($data, "title", "Ms.", false, "Ms."), "center", "middle"), tableData(radioButton($data, "title", "Mrs.", false, "Mrs."), "center", "middle"), tableData(radioButton($data, "title", "Dr.", false, "Dr."), "center", "middle"))); if (!userLoggedIn()) { if ($data["charity"] == true) { tableRow(array(tableData(prompt("Tell us about your situtation, your team and why you need a ChapR. The more information the better!"), "middle", "top", 6))); } else { tableRow(array(tableData(prompt("Write anything else you would like us to know about you below: <br> team info (type, name, number), how you heard about us (where, from who?) etc."), "middle", "top", 6))); } } tableRow(array(tableData(prompt("<b>Comments:</b>", in_array("customerCNotes", $badFields), ""), "right", "top"), tableData(textArea($data, "customerCNotes", 3), "center", "", 5))); tableRow(array(tableData(prompt("<b>Street1*:</b>", in_array("street1", $badFields)), "right"), tableData(text($data, "street1"), "left", "middle", 3))); tableRow(array(tableData(prompt("<b>Street2:</b>", in_array("street2", $badFields)), "right"), tableData(text($data, "street2"), "left", "middle", 3))); $stateDirections = 'only applicable for domestic teams'; tableRow(array(tableData(prompt("<b>City*:</b>", in_array("city", $badFields)), "right"), tableData(text($data, "city"), "left", "middle"), tableData(prompt("<b>State*:</b>", in_array("state", $badFields), "", $stateDirections), "right"), tableData(dropDown($data, "state", $states, "--------Choose Your State-------"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Zip*:</b>", in_array("zip", $badFields)), "right"), tableData(text($data, "zip"), "left", "middle"), tableData(prompt("<b>Country:</b>", in_array("country", $badFields)), "right"), tableData(dropDown($data, "country", $COUNTRIES), "left", "middle"))); if (userLoggedIn()) { tableRow(array(tableData(prompt("<b>Admin Comments:</b>", in_array("adminCNotes", $badFields), "", $commentDirections), "right", "top"), tableData(textArea($data, "adminCNotes", 3), "center", "", 5))); } tableRow(array(tableData(hiddenField("CID", $data["CID"])), tableData(hiddenField("OID", $data["OID"])))); }
function promptDivide() { $a = prompt("Enter a number (a) that you'd like to divide:"); $b = prompt("Enter a number (b) that you'd like to divide by:"); $c = prompt("Enter a number (c) that you'd like to multiply by:"); return Attempt::call('divide', array($a, $b))->map(function ($elem) use($c) { return multiply($elem, $c); }); }
function shippingFields($data, $badFields) { tableRow(array(tableData(prompt("<b>OID*: </b>"), "right"), tableData(prompt($data["OID"]), "left"))); $carriers = array("UPS" => "1 - UPS", "FedEx" => "2 - FedEx", "US Postal" => "3 - US Postal", "Other" => "4 - Other"); tableRow(array(tableData(prompt("<b>Carrier*:</b>", in_array("carrier", $badFields)), "right"), tableData(dropDown($data, "carrier", $carriers, "--------Choose The Carrier-------"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Shipping Info (Tracking Num)*:</b>", in_array("trackingNum", $badFields)), "right"), tableData(text($data, "trackingNum"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Shipped Date*:</b>", in_array("shippedDate", $badFields)), "right"), tableData(text($data, "shippedDate", date("m/d/Y"), "", "datepicker"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Admin Order Notes:</b>", in_array("adminONotes", $badFields)), "right"), tableData(textArea($data, "adminONotes", 5), "left", "", 5))); hiddenField("OID", $data["OID"]); }
function openMapFile($prompt = "") { $mapFile = prompt($prompt); try { $map = @fopen($mapFile, "r"); return $map; } catch (Exception $ex) { print "\nMap file does not exist!\n"; return false; } }
function showForm($err_msgs = null) { // generate error messages if ($err_msgs != null) { foreach ($err_msgs as $emsg) { echo '<i>'; echo "{$emsg}"; echo ' </h4>'; } } echo '<form action="file2.php" method="get"> <table class="table2" frame="border">'; tableRow(array(tableData("right", prompt("<h1>Title!</h1>")))); tableRow(array(tableData("right", prompt("First name:")), tableData("right", text("fname")), tableData("right", prompt("Last name:")), tableData("right", text("lname")))); tableRow(array(tableData("right", prompt("City:")), tableData("right", text("city")), tableData("right", prompt("State:")), tableData("right", text("state")))); tableRow(array(tableData("right", prompt("<b>Gender:</b>")), tableData("center", radioButton("gender", "male", false, "Male")), tableData("center", radioButton("gender", "female", false, "Female")), tableData("center", radioButton("gender", "other", true, "Other")))); tableRow(array(tableData("right", prompt("<b>Grade:</b>")), tableData("center", radioButton("grade", "freshman", false, "9<sup>th</sup>")), tableData("center", radioButton("grade", "sohpomore", false, "10<sup>th</sup>")), tableData("center", radioButton("grade", "junior", false, "11<sup>th</sup>")), tableData("center", radioButton("grade", "senior", false, "12<sup>th</sup>")))); tableRow(array(tableData("right", prompt("<b>Product:</b>")), tableData("center", checkBox("product", "ChapR", false, "ChapR")), tableData("center", checkBox("product", "Kit", false, "Kit")), tableData("center", checkBox("product", "USB", false, "USB")), tableData("center", checkBox("product", "Programmer", false, "Programmer")))); echo '</table> <input type="hidden" name="filled" value="true"> </form>'; /* echo ' <tr> <td align="right"><b>Product:</b></td> p <td colspan="3"> <table style="width:100%"> <tr> <td align="center"><input type="checkbox" name="product" value="ChapR">ChapR</td> <td align="center"><input type="checkbox" name="product" value="Programmer">Programmer</td> <td align="center"><input type="checkbox" name="product" value="Kit">Kit</td> <td align="center"><input type="checkbox" name="product" value="USB">USB</td> </tr> </table> </td> </tr> <tr> <td valign="top" align="right"><b>Comments:</b></td> <td colspan="3"><textarea rows="4" style="width:100%" name="comments">'; echo $_GET["comments"]; echo '</textarea></td> </tr> <tr> <td></td> <td></td> <td></td> <td align="right"><input type="submit" value="Submit!"></td> </tr> </table> <input type="hidden" name="filled" value="true"> </form>';*/ }
function prompt() { echo 'How many meows would you like? '; $input = fgets(STDIN); if (trim($input) == 'exit') { exit(0); } if ($num = filter_var($input, FILTER_VALIDATE_INT)) { if ($facts = getCatMeowArray($num)) { meow($facts); } else { echo "I don't want your love right meow. \n"; } } else { echo "Don't be silly hooman, kittehs only know integers. \n"; } prompt(); }
function packageFields($data, $badFields) { print_r("data"); print_r($data); tableRow(array(tableData(prompt("<b>Package Name:</b>", in_array("packname", $badFields)), "right"), tableData(text($data, "packname", "", "30"), "left", "middle"), tableData(prompt("<b>Package Price:</b>", in_array("packprice", $badFields)), "right"), tableData(text($data, "packprice", "", "10"), "left", "middle"), tableData(prompt("<b>Active?</b>", in_array("active", $badFields)), "right"), tableData(checkBox($data, "active", "false", "YES"), "left", "middle", 3))); $pieces = $data["pieces"]; // the list of all the pieces included in the package (as pulled from the pvp table) $i = 1; foreach ($pieces as $piece) { $pieceInfo = dbGetPiece($piece["PID"]); // get the info for the piece with that PID $pieceInfo["PID{$i}"] = $pieceInfo["PID"]; $piecesOptions = dbGetPiecesNames(); print_r("piecesOptions"); print_r($piecesOptions); tableRow(array(tableData(prompt("<b>Piece{$i}:</b>", in_array("piece{$i}", $badFields)), "right"), tableData(dropDown($pieceInfo, "PID{$i}", $piecesOptions)))); $i++; } hiddenField("PKID", $data["PKID"]); print "\n\n"; }
<?php answer(); $result = prompt("Hello. Please enter any number", array("choices" => "[DIGITS]")); if ($result->name == 'choice') { say("Great, you said " . $result->value); } hangup(); ?>
function orderFields($data, $badFields) { global $SETTINGS; // display data not supposed to be visible for customers if (userLoggedIn()) { if (array_key_exists("OID", $data) && $data["OID"] != "") { tableRow(array(tableData(prompt("<b>OID: </b>"), "right", "top"), tableData(prompt($data["OID"]), "left", "top"))); } tableRow(array(tableData(prompt("<b>Expedite:</b>"), "right", "top"), tableData(checkBox($data, "isExpedited", "true", "YES"), "left", "middle", 3))); prepDatePicker(); tableRow(array(tableData(prompt("<b>Ordered Date:</b>"), "right", "top"), tableData(text($data, "orderedDate", "", "", "datepicker"), "left", "middle"))); } // show the order amount change fields if the user has permission (and in WordPress) if (inWordPress() && current_user_can("can_change_amounts")) { tableRow(array(tableData(prompt("<b>Shipping Fee:</b>", in_array("shippingFee", $badFields)), "right"), tableData(text($data, "shippingFee", null, "10"), "left"), tableData(prompt("<b>Expedite Fee:</b>", in_array("expediteFee", $badFields)), "right"), tableData(text($data, "expediteFee", null, "10"), "left"), tableData(prompt("<b>Discount:</b>", in_array("discount", $badFields)), "right"), tableData(text($data, "discount", null, "10"), "left"))); } // figure out how many rows to display initially ($i is set to that value) for ($i = $SETTINGS["MaxItems"]; $i > 1; $i--) { if (array_key_exists("packages{$i}", $data) && $data["packages{$i}"] != "" && $data["packages{$i}"] != 0 || array_key_exists("personality{$i}", $data) && $data["personality{$i}"] != "" && $data["personality{$i}"] != 0 || array_key_exists("quantity{$i}", $data) && $data["quantity{$i}"] != "" && $data["quantity{$i}"] != 0) { break; } } $initialRows = $i; // get currently available packages (from database) for display $rows = dbGetPackages(); $displayPackages = array(); foreach ($rows as $row) { if ($row["Active"]) { $displayPackages[$row["PackageName"]] = $row["PKID"]; } } // get currently available personalities (from database) for display $rows = dbGetPersonalities(); $displayPersonalities = array(); foreach ($rows as $row) { if ($row["Active"]) { $displayPersonalities[$row["PieceName"]] = $row["PID"]; } } if (!userLoggedIn()) { tableRow(array(tableData(prompt("Note: \"personality\" refers to the type of software or platform the firmware is compatible with.\n<br> It can be changed later using a USB stick, but we might as well set it for you."), "middle", "top", 6))); } for ($i = 1; $i <= $SETTINGS["MaxItems"]; $i++) { // note that the "table-row" setting for display is controversial and may // not work well in Microsoft IE // note, too, that the reason while rows 2 through 5 don't initially display // is that they are set as display = 'none' in the style sheet - if that // is turned off, then they will display right away $magicClick = ""; if ($i != $SETTINGS["MaxItems"]) { $magicClick = "<button id=\"prodrowclick-"; $magicClick .= $i; $magicClick .= "\""; if ($i != $initialRows) { $magicClick .= " style=\"visibility:hidden;\""; } $magicClick .= " type=\"button\" onclick=\""; $magicClick .= "document.getElementById('prodrow-"; $magicClick .= $i + 1; // sets the next row to visible $magicClick .= "').style.display = 'table-row';"; if ($i < $SETTINGS["MaxItems"] - 1) { $magicClick .= "document.getElementById('prodrowclick-"; $magicClick .= $i + 1; // sets the next button to visible $magicClick .= "').style.visibility = 'visible';"; } $magicClick .= "document.getElementById('prodrowclick-"; $magicClick .= $i; // sets its own button to hidden $magicClick .= "').style.visibility = 'hidden';"; $magicClick .= "\">+</button>"; } if (userLoggedIn() && array_key_exists("iid{$i}", $data) && $data["IID"] != "") { tableRow(array(tableData(prompt("<b>IID{$i}:</b>"), "right", "top"), tableData(prompt($data["iid{$i}"]), "left", "top"))); } tableRow(array(tableData(prompt("<b>Product*:</b>", in_array("product{$i}", $badFields)), "right"), tableData(dropDown($data, "packages{$i}", $displayPackages, "----------Select Product----------")), tableData(prompt("<b>Personality:</b>", in_array("personality{$i}", $badFields)), "right"), tableData(dropDown($data, "personality{$i}", $displayPersonalities, " ")), tableData(prompt("<b>Quantity*:</b>", in_array("quantity{$i}", $badFields)), "right"), tableData(text($data, "quantity{$i}", "", "2"), "left"), tableData($magicClick)), "prodrow-" . $i, $i <= $initialRows); hiddenField("iid{$i}", $data["iid{$i}"]); } if (!userLoggedIn()) { tableRow(array(tableData(prompt("Write anything you would like us to know about the order: <br> a deadline you need to meet, some option you want that isn't offered etc."), "middle", "top", 6))); } tableRow(array(tableData(prompt("<b>Order Notes:</b>"), "right", "top"), tableData(textArea($data, "customerONotes", 5), "left", "", 5))); if (userLoggedIn()) { tableRow(array(tableData(prompt("<b>Admin Order Notes:</b>"), "right", "top"), tableData(textArea($data, "adminONotes", 5), "left", "", 5))); } hiddenField("charity", $data["charity"]); hiddenField("OID", $data["OID"]); }
/** * @param InputInterface $input * @param OutputInterface $output * * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { $table = prompt("Table to create model for"); $this->description["description"] = prompt("Description"); if (!$table) { $output->writeln("Error, table name is not supplied."); exit; } // Setup the path and make sure it doesn't already exist $path = __DIR__ . "/../Model/Database/{$table}.php"; if (file_exists($path)) { return $output->writeln("Error, file already exists"); } // Load app $app = \ProjectRena\RenaApp::getInstance(); // Load the table, if it exists in the first place $tableColums = $app->Db->query("SHOW COLUMNS FROM {$table}"); // Generate the start of the model code $class = new PhpClass(); $class->setQualifiedName("ProjectRena\\Model\\Database\\{$table}")->setProperty(PhpProperty::create("app")->setVisibility("private")->setDescription("The Slim Application"))->setProperty(PhpProperty::create("db")->setVisibility("private")->setDescription("The database connection"))->setMethod(PhpMethod::create("__construct")->addParameter(PhpParameter::create("app")->setType("RenaApp"))->setBody("\$this->app = \$app;\n\r\n \$this->db = \$app->Db;\n"))->setDescription($this->description)->declareUse("ProjectRena\\RenaApp"); $nameFields = array(); $idFields = array(); foreach ($tableColums as $get) { // This is for the getByName selector(s) if (stristr($get["Field"], "name")) { $nameFields[] = $get["Field"]; } // This is for the getByID selector(s) if (strstr($get["Field"], "ID")) { $idFields[] = $get["Field"]; } } // Get generator foreach ($nameFields as $name) { // get * by Name $class->setMethod(PhpMethod::create("getAllBy" . ucfirst($name))->addParameter(PhpParameter::create($name))->setVisibility("public")->setBody("return \$this->db->query(\"SELECT * FROM {$table} WHERE {$name} = :{$name}\", array(\":{$name}\" => \${$name}));")); } foreach ($idFields as $id) { // get * by ID, $class->setMethod(PhpMethod::create("getAllBy" . ucfirst($id))->addParameter(PhpParameter::create($id)->setType("int"))->setVisibility("public")->setBody("return \$this->db->query(\"SELECT * FROM {$table} WHERE {$id} = :{$id}\", array(\":{$id}\" => \${$id}));")); } foreach ($nameFields as $name) { foreach ($tableColums as $get) { // If the fields match, skip it.. no reason to get/set allianceID where allianceID = allianceID if ($get["Field"] == $name) { continue; } // Skip the id field if ($get["Field"] == "id") { continue; } $class->setMethod(PhpMethod::create("get" . ucfirst($get["Field"]) . "By" . ucfirst($name))->addParameter(PhpParameter::create($name))->setVisibility("public")->setBody("return \$this->db->queryField(\"SELECT {$get["Field"]} FROM {$table} WHERE {$name} = :{$name}\", \"{$get["Field"]}\", array(\":{$name}\" => \${$name}));")); } } foreach ($idFields as $id) { foreach ($tableColums as $get) { // If the fields match, skip it.. no reason to get/set allianceID where allianceID = allianceID if ($get["Field"] == $id) { continue; } // Skip the id field if ($get["Field"] == "id") { continue; } $class->setMethod(PhpMethod::create("get" . ucfirst($get["Field"]) . "By" . ucfirst($id))->addParameter(PhpParameter::create($id))->setVisibility("public")->setBody("return \$this->db->queryField(\"SELECT {$get["Field"]} FROM {$table} WHERE {$id} = :{$id}\", \"{$get["Field"]}\", array(\":{$id}\" => \${$id}));")); } } // Update generator foreach ($nameFields as $name) { foreach ($tableColums as $get) { // If the fields match, skip it.. no reason to get/set allianceID where allianceID = allianceID if ($get["Field"] == $name) { continue; } // Skip the id field if ($get["Field"] == "id") { continue; } $class->setMethod(PhpMethod::create("update" . ucfirst($get["Field"]) . "By" . ucfirst($name))->addParameter(PhpParameter::create($get["Field"]))->addParameter(PhpParameter::create($name))->setVisibility("public")->setBody("\$exists = \$this->db->queryField(\"SELECT {$get["Field"]} FROM {$table} WHERE {$name} = :{$name}\", \"{$get["Field"]}\", array(\":{$name}\" => \${$name}));\r\n if(!empty(\$exists)){\r\n \$this->db->execute(\"UPDATE {$table} SET {$get["Field"]} = :{$get["Field"]} WHERE {$name} = :{$name}\", array(\":{$name}\" => \${$name}, \":{$get["Field"]}\" => \${$get["Field"]}));}\r\n ")); } } foreach ($idFields as $id) { foreach ($tableColums as $get) { // If the fields match, skip it.. no reason to get/set allianceID where allianceID = allianceID if ($get["Field"] == $id) { continue; } // Skip the id field if ($get["Field"] == "id") { continue; } $class->setMethod(PhpMethod::create("update" . ucfirst($get["Field"]) . "By" . ucfirst($id))->addParameter(PhpParameter::create($get["Field"]))->addParameter(PhpParameter::create($id))->setVisibility("public")->setBody("\$exists = \$this->db->queryField(\"SELECT {$get["Field"]} FROM {$table} WHERE {$id} = :{$id}\", \"{$get["Field"]}\", array(\":{$id}\" => \${$id}));\r\n if(!empty(\$exists))\r\n {\r\n \$this->db->execute(\"UPDATE {$table} SET {$get["Field"]} = :{$get["Field"]} WHERE {$id} = :{$id}\", array(\":{$id}\" => \${$id}, \":{$get["Field"]}\" => \${$get["Field"]}));}\r\n ")); } } // Global insert generator (Yes it's ugly as shit..) $inserter = "public function insertInto" . ucfirst($table) . "("; foreach ($tableColums as $field) { // Skip the ID field if ($field["Field"] == "id") { continue; } $inserter .= "\${$field["Field"]}, "; } $inserter = rtrim(trim($inserter), ",") . ")"; $inserter .= "{"; $inserter .= "\$this->db->execute(\"INSERT INTO {$table} ("; foreach ($tableColums as $field) { if ($field["Field"] == "id") { continue; } $inserter .= $field["Field"] . ", "; } $inserter = rtrim(trim($inserter), ",") . ") "; $inserter .= "VALUES ("; foreach ($tableColums as $field) { if ($field["Field"] == "id") { continue; } $inserter .= ":" . $field["Field"] . ", "; } $inserter = rtrim(trim($inserter), ",") . ")\", "; $inserter .= "array("; foreach ($tableColums as $field) { if ($field["Field"] == "id") { continue; } $inserter .= "\":" . $field["Field"] . "\" => \${$field["Field"]}, "; } $inserter = rtrim(trim($inserter), ",") . "));"; $inserter .= "}}"; $generator = new CodeFileGenerator(); $code = $generator->generate($class); $code = rtrim(trim($code), "}"); $code .= $inserter; $formatter = new Formatter(); $code = $formatter->format($code); file_put_contents($path, $code); chmod($path, 0777); $output->writeln("Model created: {$path}"); }
} } $new_translations = array(); foreach ($old_translations as $key => $vals) { if ($key == $old_src) { $new_translations[$key] = $new_src; } else { $new_translations[$key] = $key; } } $change_template = null; if (array_key_exists($module, $templates)) { foreach ($templates[$module] as $basePath => $template_files) { //basePath ends in en_US; foreach ($template_files as $template_file) { if (!prompt("Change template file {$template_file}?", $change_template)) { continue; } $translations = $new_translations; $new_template = translateTemplate($template_file); if (false === $new_template) { I2CE::raiseError("WARNING: Could not translate {$template_file}"); } if (!trim($new_template)) { //empty contents continue; } file_put_contents($template_file, $new_template); } } }
if (!($res = $template->query('/I2CEConfiguration/metadata/version')) instanceof DOMNodeList || $res->length == 0) { echo "\tVersion not found\n"; continue; } $versNode = $res->item(0); $vers = trim($versNode->textContent); $vers_comps = explode('.', $vers); //first we check to see if the major/minor/fanastic versions match. if not,we don't update. $exis_vers = implode('.', array_slice(array_pad($vers_comps, $bump_type + 1, 0), 0, $bump_type + 1)); if ($exis_vers != $check_vers) { //if the base versions and e if ($check_short_vers && I2CE_Validate::checkVersion($vers, 'greaterThan', $check_short_vers) && I2CE_Validate::checkVersion($vers, 'lessThan', $base_vers)) { if (!array_key_exists($module, $always_update)) { $always_update[$module] = null; } if (!prompt("Would you like to update {$module} from {$vers} to {$new_vers}?", $always_update[$module])) { continue; } } else { continue; } } if ($file == $mod_file) { echo "{$red}BUMPING{$black}: {$module} from " . trim($versNode->textContent) . " to {$new_vers}\n"; } else { $locale = basename(dirname($file)); echo "{$red}BUMPING{$black}: {$module} localized to {$blue}{$locale}{$black} from " . trim($versNode->textContent) . " to {$new_vers}\n"; } while ($versNode->hasChildNodes()) { $versNode->removeChild($versNode->firstChild); }
} unset($each); $i_file = $d_dir . '/install'; file_put_contents($i_file, implode("\n", $install) . "\n"); $c_file = $d_dir . '/control'; $control = "Source: " . $pkg_name . "\n" . "Maintainer: Carl Leitner <*****@*****.**>\n" . "Section: web\n" . "Priority: optional\n" . "Standards-Version: 3.9.1\n" . "Build-Depends: debhelper (>= 7)\n" . "Homepage: http://www.capacityproject.org/hris/suite/\n" . "\nPackage: " . $pkg_name . "\n" . "Architecture: all\n" . "Depends: " . implode(",", $depends) . "\n" . $recommends . $conflicts . $breaks . "Description: {$desc}\n"; file_put_contents($c_file, $control); $out = array(); I2CE::raiseError("Buildiing signed source for {$module} on {$ubuntu}"); $ret = 0; exec("cd {$deb_src_dir}/{$ubuntu}/{$pkg_dir} && dpkg-buildpackage {$keyid} -S -sa > /dev/null", $out, $ret); if ($ret != 0) { I2CE::raiseError("{$module} failed dpkg-build[{$ret}]:\n\t" . implode("\n\t", $out)); continue; } if (!prompt("Would you like to upload {$pkg_name} for {$ubuntu} to ppa:{$launchpad_login}/{$ppa}", $do_upload)) { continue; } I2CE::raiseError("Uploading {$package} to PPA {$ppa} for {$ubuntu}"); $out = array(); $short_pkg = $pkg_name . '_' . substr($pkg_dir, strlen($pkg_name) + 1); //change it from packge-version to package_version $cmd = " dput --force ppa:{$launchpad_login}/{$ppa} {$deb_src_dir}/{$ubuntu}/{$short_pkg}_source.changes"; exec($cmd, $out, $ret); if ($ret != 0) { I2CE::raiseError(basename($dir) . " failed dput [{$ret}]:\n\t" . implode("\n\t", $out)); } } } } function vers_compare($vers1, $vers2)
<?php (!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!'); get_key("office_goods_stock"); global $db; $key1 = $db->result("SELECT * FROM " . DB_TABLEPRE . "office_goods_key where warehousing like '%" . get_realname($_USER->id) . "%' "); if ($key1["warehousing"] == '') { prompt('对不起,你没有权限执行本操作!'); } empty($do) && ($do = 'list'); if ($do == 'list') { //列表信息 $wheresql = ''; $page = max(1, getGP('page', 'G', 'int')); $pagesize = $_CONFIG->config_data('pagenum'); $offset = ($page - 1) * $pagesize; $url = 'admin.php?ac=' . $ac . '&fileurl=' . $fileurl . ''; $num = $db->result("SELECT COUNT(*) AS num FROM " . DB_TABLEPRE . "goods_purchase WHERE key1='2' ORDER BY id desc"); $sql = "SELECT * FROM " . DB_TABLEPRE . "goods_purchase WHERE key1='2' ORDER BY id desc LIMIT {$offset}, {$pagesize}"; $result = $db->fetch_all($sql); include_once 'template/goods_purchase_stock.php'; } elseif ($do == 'keys') { $id = getGP('id', 'G', 'int'); global $db; $query = $db->query("SELECT * FROM " . DB_TABLEPRE . "goods_purchase_view where goods_purchase='" . $id . "' ORDER BY id Asc"); while ($row = $db->fetch_array($query)) { $rsrow = $db->fetch_one_array("SELECT * FROM " . DB_TABLEPRE . "office_goods where id=" . $row[officegoods] . " ORDER BY id desc limit 0,1"); $office_goods_stock = array('officegoods' => $row['officegoods'], 'goods_type' => $rsrow['goods_type'], 'title' => $row['title'], 'specification' => $row['specification'], 'unit' => $row['unit'], 'price' => $row['price'], 'number' => $rsrow['number'], 'content' => '采购入库', 'purchase' => $row['goodsnumber'], 'type' => 2, 'date' => get_date('y-m-d H:i:s', PHP_TIME), 'uid' => $_USER->id); insert_db('office_goods_stock', $office_goods_stock); } //更新采购表
} if (!$db2->database && !$db2->schema) { error("destination database or schema file must be specified with --schema-file2, --database2 or --database"); } if ($db2->schema) { if (!file_exists($db1->schema)) { error("schema file 2 does not exist"); } $db2->database = "tmp_schema_" . uniqid(); } if ($db1->host == $db2->host && $db1->database == $db2->database && !$db1->schema && !$db2->schema) { error("databases names must be different if they reside on the same host"); } if ($options->output_file) { if (file_exists($options->output_file) && !$options->overwrite) { if (prompt("Output file {$options->output_file} exists. Overwrite it (y/n)? ") != 'y') { exit(0); } } $options->ofh = @fopen($options->output_file, 'w') or error("error creating output file {$options->output_file}"); } $db1->link = @mysql_connect($db1->host, $db1->user, $db1->pwd, TRUE) or error(mysql_error()); create_schema_db($db1); mysql_selectdb($db1->database, $db1->link) or error(mysql_error($db1->link)); $db2->link = @mysql_connect($db2->host, $db2->user, $db2->pwd, TRUE) or error(mysql_error()); create_schema_db($db2); mysql_selectdb($db2->database, $db2->link) or error(mysql_error($db2->link)); load_schema_db($db1); load_schema_db($db2); populate_schemata_info($db1); populate_schemata_info($db2);
$meta = false; } } else { I2CE::raiseError("Warning: No meta data found in {$pot_file}"); //no meta data was found in the string. $meta = false; } } if (count($existing_template) == 0 && count($mod_strings) == 0) { I2CE::raiseError("No strings for the module {$module}. -- Skipping"); continue; } $removed_strings = array_diff_key($existing_template, $mod_strings); $removed = array(); foreach ($removed_strings as $string => $data) { if (prompt('The string "' . $string . '" was in the existing .pot file for the module ' . $module . ' but not is not currently found in the module. Remove?', $booleans['remove-strings'])) { unset($existing_template[$string]); $removed[] = $string; } } $new_strings = array(); unset($data); $changed_comments = false; foreach ($mod_strings as $string => &$data) { if (array_key_exists($string, $existing_template)) { $existing_comments = array(); if (array_key_exists('comments', $existing_template[$string])) { $existing_comments = $existing_template[$string]['comments']; } if (array_key_exists('msgid_plural', $existing_template[$string])) { $plural = $existing_template[$string]['msgid_plural'];
function workspaceRestore($backupFilename, $targetWorkspace, $overwrite) { $tempDirectory = tempnam(__FILE__, ''); if (file_exists($tempDirectory)) { unlink($tempDirectory); } if (file_exists($tempDirectory)) { G::rm_dir($tempDirectory); } G::mk_dir($tempDirectory); G::LoadThirdParty('pear/Archive', 'Tar'); $tar = new Archive_Tar($backupFilename); $res = $tar->extract($tempDirectory); $metadataFilename = $tempDirectory . PATH_SEP . 'metadata.txt'; if (!file_exists($metadataFilename)) { /* Look for legacy backups, where metadata was stored as a file with the * workspace name, such as workflow.txt * This means the backup filename must be the same as the metadata file. */ $info = pathinfo($backupFilename); /* Check if it's a compressed backup, in which case we need to remove * both the gz and the tar extensions. */ if ($info['extension'] == "gz") { $info = pathinfo(basename($backupFilename, '.' . $info['extension'])); } $wsNameFromTar = basename($backupFilename, '.' . $info['extension']); $metadataFilename = $tempDirectory . PATH_SEP . $wsNameFromTar . '.txt'; if (!file_exists($metadataFilename)) { throw new Exception("Metadata file was not found in backup"); } } $metadata = unserialize(file_get_contents($metadataFilename)); $backupWorkspace = $metadata['WORKSPACE_NAME']; $changeWorkspace = isset($targetWorkspace); if (!$changeWorkspace) { $targetWorkspace = $backupWorkspace; } else { echo "Restoring from workspace: " . pakeColor::colorize($backupWorkspace, 'INFO') . "\n"; } echo "Restoring to workspace: " . pakeColor::colorize($targetWorkspace, 'INFO') . "\n"; //moving the site files $backupWorkspaceDir = $tempDirectory . PATH_SEP . $backupWorkspace; $targetWorkspaceDir = PATH_DATA . 'sites' . PATH_SEP . $targetWorkspace; if (!$overwrite && file_exists($targetWorkspaceDir)) { $overwrite = strtolower(prompt('Workspace already exists, do you want to overwrite? [Y/n]')); if (array_search(trim($overwrite), array("y", "")) === false) { die; } $overwrite = true; } printf("Moving files to %s \n", pakeColor::colorize($targetWorkspaceDir, 'INFO')); /* We already know we will be overwriting the new workspace if we reach this * point, so remove the workspace directory if it exists. */ if (file_exists($targetWorkspaceDir)) { G::rm_dir($targetWorkspaceDir); } if (!rename($backupWorkspaceDir, $targetWorkspaceDir)) { throw new Exception("There was an error moving from {$backupWorkspaceDir} to {$targetWorkspaceDir}"); } $dbOpt = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH)); $dbHostname = $dbOpt[0]; /* TODO: Check if database exists after updateDBfile */ $config = updateDBfile($targetWorkspaceDir, $targetWorkspace, $dbHostname, $changeWorkspace); G::LoadSystem('dbMaintenance'); $oDbMaintainer = new DataBaseMaintenance($dbOpt[0], $dbOpt[1], $dbOpt[2]); $dbName = $config['DB_NAME']; $dbUser = $config['DB_USER']; $dbPass = $config['DB_PASS']; restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite); $dbName = $config['DB_RBAC_NAME']; $dbUser = $config['DB_RBAC_USER']; $dbPass = $config['DB_RBAC_PASS']; restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_RBAC_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite); $dbName = $config['DB_REPORT_NAME']; $dbUser = $config['DB_REPORT_USER']; $dbPass = $config['DB_REPORT_PASS']; restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_REPORT_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite); echo "\n"; $wsInfo = getSysInfo(); $wsInfo['WORKSPACE_NAME'] = $targetWorkspace; $wsInfo = array_merge($wsInfo, $config); printInfoSites($metadata, $wsInfo); return true; }
function prompt($prompt, $required, $default = "") { echo $prompt . (empty($default) ? empty($required) ? "" : " (required)" : " [" . $default . "]") . ": "; $value = trim(fgets(STDIN)); if ($value == "") { $value = $default; } if ($value == "" && ($required == "required" || $required == true)) { prompt($prompt, $required, $default); } return $value; }
function print_results_voice($results) { global $callerid; $i = 1; foreach ($results as $location) { $title = str_replace(' & ', ' and ', $location['Title']); $choices .= 'press ' . $i . ' for ' . $title . ', '; $number[$i] = $location['Phone']; $name[$i] = $title; $address[$i] = $location['Address']; $i++; } $event = prompt($choices, array("choices" => '1,2,3,4,5')); if ($event->name == 'choice') { $message = 'Thanks for using Tropo.com Local Search. - <br/>' . "\n" . $name[$event->value] . ' - ' . $address[$event->value] . ' - ' . $number[$event->value]; $outbound = message($message, array('to' => '1' . $callerid, 'network' => 'SMS', 'voice' => 'allison')); say('Connecting you to ' . $name[$event->value] . ' at ' . $number[$event->value] . '. Please hold.', array('voice' => 'allison')); $dial = str_replace('(', '', $number[$event->value]); $dial = str_replace(')', '', $dial); $dial = str_replace(' ', '', $dial); $dial = str_replace('-', '', $dial); $dial = str_replace('+', '', $dial); transfer('tel:+1' . preg_replace('[^0-9]', '', $dial)); } }
<?php function prompt($message) { print $message; $handle = fopen("php://stdin", "r"); $line = fgets($handle); if ("ja" !== trim($line)) { print "Dann nicht.\n"; exit; } } prompt("Sind Sie Sich über die Folgen Ihrer Handlung im Klaren?\n"); prompt("Wirklich?\n"); // print "Nee, mache ich nicht.\n"; // exit(1); require_once "mygassi-config.php"; require_once mageroot; Mage::app('admin')->setUseSessionInUrl(false); $sales = Mage::getModel("sales/order")->getCollection()->addAttributeToFilter("status", "holded"); // $sales = Mage::getModel("sales/order")->getCollection(); foreach ($sales as $sale) { try { print "sale: " . $sale->getIncrementId() . " is removed" . PHP_EOL; Mage::getModel('sales/order')->loadByIncrementId($sale->getIncrementId())->delete(); } catch (Exception $e) { print "sale " . $sale->getId() . " could not be remvoved: " . $e->getMessage() . PHP_EOL; } } exit(1);
get_logadd($id, $content, $title, 2, $_USER->id); } show_msg('权限组信息操作成功!', 'admin.php?ac=' . $ac . '&fileurl=' . $fileurl . ''); } elseif ($savetype == 'edit') { update_db('usergroup', $usergroup, array('id' => $id)); usergroup_recache(); if ($id != '') { $content = serialize($usergroup); $title = '修改用户组'; get_logadd($id, $content, $title, 2, $_USER->id); } show_msg('权限组信息操作成功!', 'admin.php?ac=' . $ac . '&fileurl=' . $fileurl . ''); } } elseif ($do == 'update') { get_key("config_usergroup_delete"); $idarr = getGP('id', 'P', 'array'); if (count($idarr)) { foreach ($idarr as $id) { $db->query("DELETE FROM " . DB_TABLEPRE . "usergroup WHERE `type` = 'user' AND id = '{$id}' "); } } else { prompt($message[4]); } usergroup_recache(); if ($id != '') { $content = serialize($idarr); $title = '删除用户组'; get_logadd($id, $content, $title, 2, $_USER->id); } show_msg('权限组信息删除成功!', 'admin.php?ac=' . $ac . '&fileurl=' . $fileurl . ''); }
continue; } if ($contents == $existing) { continue; } else { $msg = "There is an existing translation to {$locale} for {$file} in the module {$module}. Overwrite? "; if (function_exists('xdiff_string_diff')) { $diff = xdiff_string_diff($existing, $contents, 1); } else { if ($first_time) { $msg .= "\nFor more information, run (on ubunutu):\n\tsudo apt-get install re2c php5-dev build-essential wget\n\tmkdir -p /tmp/src\n\tcd /tmp/src\n\twget http://www.xmailserver.org/libxdiff-0.22.tar.gz\n\ttar -xzf libxdiff-0.22.tar.gz \n\tcd libxdiff-0.22\n\t./configure\n\tmake\n\tsudo make install\n\tsudo pecl install xdiff\n\techo \"extension=xdiff.so\" | sudo tee /etc/php5/conf.d/xdiff.ini \n"; } $first_time = false; $diff = false; } if (prompt($msg, $booleans['overwrite-all'], $diff)) { unlink($target_file); } else { continue; } } } if (false === file_put_contents($target_file, $contents)) { I2CE::raiseError("WARNING: Could not create file {$target_file}", E_USER_ERROR); } else { I2CE::raiseError("Translate {$target_file}"); } } } } }
function getFormObjByFields($form, $fields, $create = false, $parent = false, $id = '0') { global $always_create; if (!is_array($fields) || count($fields) == 0) { I2CE::raiseError("No fields to lookup form {$form} on"); return false; } $where = array('operator' => 'AND', 'operand' => array()); foreach ($fields as $field => $val) { if ($field == 'name') { $where['operand'][] = array('operator' => 'FIELD_LIMIT', 'field' => $field, 'style' => 'lowerlike', 'data' => array('value' => $val)); } else { $where['operand'][] = array('operator' => 'FIELD_LIMIT', 'field' => $field, 'style' => 'equals', 'data' => array('value' => $val)); } } $formObj = getFormObjByWhere($form, $where); if ($formObj instanceof I2CE_Form) { return $formObj; } if (is_string($create)) { $str = "Create the form `{$form}` with the fields:\n"; foreach ($fields as $f => $v) { $str .= "\t{$f} => '{$v}'\n"; } if ($create == 'simple_prompt') { $create = simple_prompt($str); } else { if ($create == 'prompt') { if (!array_key_exists($form, $always_create)) { $always_create[$form] = null; } $create = prompt($str, $always_create[$form]); } else { I2CE::raiseError("Unrecognized creation", E_USER_ERROR); return false; } } } if (!$create) { return null; } $formObj = createFormWithFields($form, $fields, $parent, $id); if (!$formObj instanceof I2CE_Form) { return null; } //try to create the object return $formObj; }
I2CE::raiseError("Creating {$tar_ball}"); exec($cmd); } $tar_ball = "{$tmp_dir_base}/ihris-suite-{$release}.tar.bz2"; $created_tarballs['I2CE'][] = $tar_ball; I2CE::raiseError("Creating {$tar_ball}"); $cmd = "cd {$tmp_dir} && tar -cj {$excludes} -f {$tar_ball} " . implode(" ", array_keys($top_mod_dirs)); exec($cmd); } if ($ask_upload && simple_prompt("Upload tarballs to launchpad?")) { $do_upload = null; foreach ($created_tarballs as $top_mod => $tar_balls) { $project = strtolower($top_mod); if ($do_versioning) { $version = $last_release[$mod]['next_release']; } else { $version = $last_release[$top_mod]['release']; } $series = implode(".", array_slice(explode(".", $version), 0, 2)); if (!createRelease($project, $series, $version)) { continue; } foreach ($tar_balls as $base => $tar_ball) { if (!prompt("Upload tarball to launchpad ({$tar_ball})?", $do_upload)) { continue; } $desc = str_replace('Ihris', 'iHRIS', ucwords(str_replace('textlayout', 'Text Layout Tools', str_replace('-', ' ', $base)))) . ' ' . $version; uploadReleaseTarBall($tar_ball, $project, $series, $version, $desc); } } }
$input = substr($input, 0, -1); // Strips newline character fclose($handle); return $input; } echo "MySQL configuration:\n"; $mysql_hostname = prompt(" Address"); $mysql_username = prompt(" Username"); $mysql_password = prompt(" Password"); $mysql_database = prompt(" Database"); echo "\n"; while (true) { echo "Available environment configurations:\n"; echo " 0: Development\n"; echo " 1: Production\n"; switch (prompt("Select environment [0]")) { case "": case "0": $environment = "development"; break 2; case "1": $environment = "production"; break 2; } } $app_path = realpath(dirname(__FILE__)) . "/application"; $std_cfg = (include "{$app_path}/configs/application.template.php"); $cfg = $std_cfg[$environment]; $cfg["resources"]["db"]["params"]["host"] = $mysql_hostname; $cfg["resources"]["db"]["params"]["username"] = $mysql_username; $cfg["resources"]["db"]["params"]["password"] = $mysql_password;
$result = prompt("Hello. Please enter your 5 digit ZIP code", array("choices" => "[5 DIGITS]")); if ($result->name == 'choice') { say("Great, you said " . $result->value); } // Digits work with speech or touch-tone input... $result = prompt("Hello. Please say or enter your 5 digit ZIP code", array("choices" => "[5 DIGITS]")); if ($result->name == 'choice') { say("Great, you said " . $result->value); } // ask for 1 to 6 digit long an account ID $result = prompt("Please enter your account ID followed by the pound key.", array("choices" => "[1-6 DIGITS]")); if ($result->name == 'choice') { say("Great, you said " . $result->value); } // ask for a US phone number (7 digits without area code, 10 digits with) $result = prompt("Please enter your 7 to 10 digit U.S. phone number", array("choices" => "[7-10 DIGITS]")); if ($result->name == 'choice') { say("Great, you said " . $result->value); } // digit collection also supports all other prompt properties and event handlers _log("\$***********************result name " . $result->name); while ($result->name != 'hangup') { // collect 3 digits. Reprompt up to 3 times. Use a 7 second timeout... $result = prompt("Now please enter a number between 1 and 999", array("choices" => "[1-3 DIGITS]", "repeat" => 3, "timeout" => 7, "onBadChoice" => create_function('$event', 'say("I am sorry, I did not understand what you said.");'), "onTimeout" => create_function('$event', 'say("I am sorry. I didn\'t hear anything.");'))); _log("{$result} name " . $result->name); _log("number is " . $result->value); if ($result->name == 'choice') { say("Great, you said " . $result->value); } } hangup();
} // Pheal cache out("|g|It is highly recommended you find a good location other than the default for these files.|n|"); $settings["phealcachelocation"] = prompt("Where do you want to store Pheal's cache files?", "/tmp/"); // Server addr out("What is the address of your server? |g|e.g. zkillboard.com|n|"); $settings["baseaddr"] = prompt("Domain name?", "zkillboard.com"); // Log $settings["logfile"] = prompt("Log file location?", "/var/log/zkb.log"); // Image server out("Image and API server."); $settings["apiserver"] = prompt("API Server?", "https://api.eveonline.com/"); $settings["imageserver"] = prompt("Image Server?", "https://image.eveonline.com/"); // Secret key for cookies out("A secret key is needed for your cookies to be encrypted."); $cookiesecret = prompt("Secret key for cookies?", uniqid(time())); $settings["cookiesecret"] = sha1($cookiesecret); // Get default config $configFile = file_get_contents("{$base}/config.new.php"); // Create the new config foreach ($settings as $key => $value) { $configFile = str_replace("%{$key}%", $value, $configFile); } // Save the file and then attempt to load and initialize from that file $configLocation = "{$base}/../config.php"; if (file_put_contents($configLocation, $configFile) === false) { out("|r|Unable to write configuration file at {$configLocation}", true); } try { out("|g|Config file written, now attempting to initialize settings"); require_once "{$base}/../config.php";