"") { require_once($pkg['include_file']); } if (!isset($pkg['adddeleteeditpagefields'])) $only_edit = true; else $only_edit = false; $package_name = $pkg['menu'][0]['name']; $section = $pkg['menu'][0]['section']; $config_path = $pkg['configpath']; $name = $pkg['name']; $title = $pkg['title']; $pgtitle = $title; $id = $_GET['id']; if (isset($_POST['id'])) $id = htmlspecialchars($_POST['id']); // Not posting? Then user is editing a record. There must be a valid id // when editing a record. if(!$id && !$_POST) $id = "0"; if($pkg['custom_php_global_functions'] <> "") eval($pkg['custom_php_global_functions']); // grab the installedpackages->package_name section. if(!is_array($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'])) $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'] = array(); $a_pkg = &$config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']; if($_GET['savemsg'] <> "") $savemsg = htmlspecialchars($_GET['savemsg']); if($pkg['custom_php_command_before_form'] <> "") eval($pkg['custom_php_command_before_form']); if ($_POST) { if($_POST['act'] == "del") { if($pkg['custom_delete_php_command']) { if($pkg['custom_php_command_before_form'] <> "") eval($pkg['custom_php_command_before_form']); eval($pkg['custom_delete_php_command']); } write_config($pkg['delete_string']); // resync the configuration file code if defined. if($pkg['custom_php_resync_config_command'] <> "") { if($pkg['custom_php_command_before_form'] <> "") eval($pkg['custom_php_command_before_form']); eval($pkg['custom_php_resync_config_command']); } } else { if($pkg['custom_add_php_command']) { if($pkg['donotsave'] <> "" or $pkg['preoutput'] <> "") { ?>
"; eval($pkg['custom_add_php_command']); if($pkg['preoutput']) echo ""; } } // donotsave is enabled. lets simply exit. if($pkg['donotsave'] <> "") exit; $firstfield = ""; $rows = 0; $input_errors = array(); $reqfields = array(); $reqfieldsn = array(); foreach ($pkg['fields']['field'] as $field) { if (($field['type'] == 'input') && isset($field['required'])) { if($field['fieldname']) $reqfields[] = $field['fieldname']; if($field['fielddescr']) $reqfieldsn[] = $field['fielddescr']; } } do_input_validation($_POST, $reqfields, $reqfieldsn, &$input_errors); if ($pkg['custom_php_validation_command']) eval($pkg['custom_php_validation_command']); // store values in xml configration file. if (!$input_errors) { $pkgarr = array(); foreach ($pkg['fields']['field'] as $fields) { if($fields['type'] == "listtopic") continue; if($fields['type'] == "rowhelper") { // save rowhelper items. for($x=0; $x<99; $x++) { // XXX: this really should be passed from the form. // XXX: this really is not helping embedded platforms. foreach($fields['rowhelper']['rowhelperfield'] as $rowhelperfield) { if($firstfield == "") { $firstfield = $rowhelperfield['fieldname']; } else { if($firstfield == $rowhelperfield['fieldname']) $rows++; } $fieldname = str_replace("\\", "", $rowhelperfield['fieldname']); $comd = "\$value = \$_POST['" . $fieldname . $x . "'];"; eval($comd); if($value <> "") { $comd = "\$pkgarr['row'][" . $x . "]['" . $fieldname . "'] = \"" . $value . "\";"; //echo($comd . "