<?php chdir(dirname(__FILE__)); include_once '../lib/datapipe.php'; # NOTE: FTP login credentials taken from the Wizard of Math plugin $commands = <<<'END' - $ftp_svr: ftp.ercontent.com - ftp_init: svr: $ftp_svr usr: EROPTIONA pwd: @eR2oPtA251 END; process_commands($commands);
function process_commands_list($commands_list, $plugin_name = '') { # check inputs if (!is_string($plugin_name)) { return error(null, "plugin name is not a string"); } if (!is_array($commands_list)) { return error(null, "commands to process are not an array"); } if (empty($commands_list)) { return notice(null, "no commands to process"); } # loop through all the commands foreach ($commands_list as $commands) { $r = process_commands($commands); if (@$GLOBALS['error'] === false) { $r = true; } if ($r === true) { $syslog = get_config_value('syslog_on_success', false); if ($syslog) { $syslog_error_msg = "[SureDone {$plugin_name} plugin] [Success]"; $syslog_priority = get_config_value('syslog_success_priority', LOG_INFO); } $msg = "[Success] Script execution successful"; } else { $syslog = get_config_value('syslog_on_failure', true); if ($syslog) { $error_msg = $GLOBALS['error_msg']; $syslog_msg = "[SureDone {$plugin_name} plugin] [Error] {$error_msg}"; $syslog_priority = get_config_value('syslog_failure_priority', LOG_ERR); } $msg = "[Failure] Script exited with errors"; break; } } # perform a syslog if required if ($syslog) { syslog($syslog_priority, $syslog_msg); $msg = "{$msg} (logged to syslog)"; $exit_status = 1; } else { $msg = "{$msg} (not logged to syslog)"; $exit_status = 0; } # echo the success/failure of the script and exit echo "{$msg}\n"; if ($exit_status != 0) { exit($exit_status); } }
<?php //------------This file inserts your field data into the MySQL database include_once "../../globals.php"; include_once "../../../library/api.inc"; include_once "../../../library/forms.inc"; include_once "../../../library/sql.inc"; include_once "content_parser.php"; include_once "../../../library/formdata.inc.php"; $field_names = array('category' => formData("category"), 'subcategory' => formData("subcategory"), 'item' => formData("item"), 'content' => strip_escape_custom($_POST['content'])); $camos_array = array(); process_commands($field_names['content'], $camos_array); $CAMOS_form_name = "CAMOS-" . $field_names['category'] . '-' . $field_names['subcategory'] . '-' . $field_names['item']; if ($encounter == "") { $encounter = date("Ymd"); } if (preg_match("/^[\\s\\r\\n\\\\r\\\\n]*\$/", $field_names['content']) == 0) { //make sure blanks do not get submitted // Replace the placeholders before saving the form. This was changed in version 4.0. Previous to this, placeholders // were submitted into the database and converted when viewing. All new notes will now have placeholders converted // before being submitted to the database. Will also continue to support placeholder conversion on report // views to support notes within database that still contain placeholders (ie. notes that were created previous to // version 4.0). $field_names['content'] = add_escape_custom(replace($pid, $encounter, $field_names['content'])); reset($field_names); $newid = formSubmit("form_CAMOS", $field_names, $_GET["id"], $userauthorized); addForm($encounter, $CAMOS_form_name, $newid, "CAMOS", $pid, $userauthorized); } //deal with embedded camos submissions here foreach ($camos_array as $val) { if (preg_match("/^[\\s\\r\\n\\\\r\\\\n]*\$/", $val['content']) == 0) {