function CopyIn(&$a_vars, $b_overwrite_empty) { //$s_db = "Session CopyIn:\n"; $n_copied = 0; foreach ($this->_aAccessList as $s_var_name) { if (IsSetSession($s_var_name)) { if (!isset($a_vars[$s_var_name]) || $b_overwrite_empty && IsFieldEmpty($a_vars[$s_var_name])) { $a_vars[$s_var_name] = GetSession($s_var_name); //$s_db .= "$s_var_name='".$a_vars[$s_var_name]."'\n"; $n_copied++; } } } //SendAlert($s_db); return $n_copied; }
function ProcessField($s_name, $raw_value, &$a_order, &$a_fields, &$a_raw_fields) { global $FORMATTED_INPUT; // // fields go into an array of special values or an array of other values // $b_special = false; if (IsSpecialField($s_name)) { SetSpecialField($s_name, $raw_value); $b_special = true; } // // check for multiple valued special fields // if (($a_multi_fld = IsSpecialMultiField($s_name)) !== false) { SetSpecialMultiField($a_multi_fld[0], $a_multi_fld[1], $raw_value); $b_special = true; } if (!$b_special) { // // return the raw value unchanged in the $a_raw_fields array // $a_raw_fields[$s_name] = $raw_value; // // handle checkboxes and multiple-selection lists // Thanks go to Theodore Boardman for the suggestion // and initial working code. // if (is_array($raw_value)) { // // the array must be an array of scalars (not an array // of arrays, for example) // if (is_scalar($raw_value[0])) { $a_cleaned_values = CleanValue($raw_value); // // the output is a comma separated list of values for the // checkbox. For example, // events: Diving,Cycling,Running // // Set the clean value to the list of cleaned checkbox // values. // First, remove any commas in the values themselves. // $a_cleaned_values = str_replace(",", "", $a_cleaned_values); $s_cleaned_value = implode(",", $a_cleaned_values); } else { $s_cleaned_value = "<invalid list>"; } } else { // // NOTE: there is a minor bug here now that we support // $FORM_INI_FILE. The INI file is processed at the end // so if you set the mail_options below in the INI file they // won't get processed here. This means you must set // the following mail_options in the HTML form for now. // (To be fixed at a later date. RJR 17-Feb-06). // // // if the form specifies the "KeepLines" option, // don't strip new lines // if (IsMailOptionSet("KeepLines") && strpos($raw_value, "\n") !== false) { // // truncate first // $s_truncated = substr("{$raw_value}", 0, MAXSTRING); // // split into lines, clean each individual line, // then put it back together again // $a_lines = explode("\n", $s_truncated); $a_lines = CleanValue($a_lines); $s_cleaned_value = implode(BODY_LF, $a_lines); // // and, for this special case, prepend a new line // so that the value is shown on a fresh line // $s_cleaned_value = BODY_LF . $s_cleaned_value; } else { $s_cleaned_value = CleanValue($raw_value); } } // // if the form specifies the "NoEmpty" option, skip // empty values. // if (!IsMailOptionSet("NoEmpty") || !IsFieldEmpty($s_cleaned_value)) { if (!IsMailExcluded($s_name)) { // // by default, we maintain the order as passed in // the HTTP request // $a_order[] = $s_name; $a_fields[$s_name] = $s_cleaned_value; } } // // add to the $FORMATTED_INPUT array for debugging and // error reporting // array_push($FORMATTED_INPUT, "{$s_name}: '{$s_cleaned_value}'"); } }