// The default size of the listfield field's fh_conf('FH_DEFAULT_LISTFIELD_SIZE', 4); // The default glue which should be used to merge multiple // checkboxes or radiobuttons fh_conf('FH_DEFAULT_GLUE_MASK', "%field%<br />\n"); // The chmod which is used when a dir is created fh_conf('FH_DEFAULT_CHMOD', 0777); // Display errors of FormHandler (PHP errors, NOT field validation errors!) fh_conf('FH_DISPLAY_ERRORS', true); // If this variabele is set to true, FH will // expose itsself by adding a extra line on the bottom of the form fh_conf('FH_EXPOSE', false); // Disable the submit button after submitting the form ? fh_conf('FH_DEFAULT_DISABLE_SUBMIT_BTN', true); // use / for valid XHTML, '' for valid HTML fh_conf('FH_XHTML_CLOSE', '/'); /***********************************/ /*** Don't change anything below ***/ /***********************************/ /** * Document::fh_conf() * * Set the configuration defines if they are * not defined by the user yet. * */ function fh_conf() { static $define = array(); // is a value set? if (func_num_args() == 2) {
/** * FormHandler::FormHandler() * * constructor: initialisation of some vars * * @param string $name: the name for the form (used in the <form> tag * @param string $action: the action for the form (used in <form action="xxx">) * @param string $extra: extra css or js which is included in the <form> tag * @author Teye Heimans * @return FormHandler */ function FormHandler($name = null, $action = null, $extra = null) { // initialisation $this->_viewMode = false; $this->_ajaxValidator = false; $this->_ajaxValidatorScript = true; $this->_fields = array(); $this->_date = array(); $this->_upload = array(); $this->_add = array(); $this->_js = array(); $this->_buffer = array(); $this->_convert = array(); $this->_mail = array(); $this->_tabindexes = array(); $this->_customMsg = array(); $this->_help = array(); $this->_cache = array(); $this->_tableSettings = array(); $this->_displayErrors = true; $this->_setTable = true; $this->_focus = null; $this->_pageCounter = 1; // make vars global if needed if (!_global) { global $_SERVER, $_POST, $_GET; } // try to disable caching from the browser if possible if (!headers_sent()) { header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); header("Cache-control: private"); } // set all config values fh_conf(); // get config setting for _setTable, since 08-10-2009 JW $this->_setTable = FH_USE_TABLE; // get config setting for _focus, since 14-01-2010 JW $this->_focus = FH_SET_FOCUS; // set the name of the form (the user has submitted one) if (!empty($name)) { $this->_name = $name; } else { // get a unique form name! $i = null; while (defined('FH_' . FH_DEFAULT_FORM_NAME . $i)) { $i = is_null($i) ? 1 : $i + 1; } define('FH_' . FH_DEFAULT_FORM_NAME . $i, 1); $this->_name = FH_DEFAULT_FORM_NAME . $i; $i = null; } // set the action of the form if none is given if (!empty($action)) { $this->_action = $action; } else { $this->_action = $_SERVER['PHP_SELF']; if (!empty($_SERVER['QUERY_STRING'])) { $this->_action .= '?' . $_SERVER['QUERY_STRING']; } } // get the $extra (JS, css, etc..) to put into the <form> tag if (!empty($extra)) { $this->_extra = $extra; } // set the default mask $this->setMask(FH_DEFAULT_ROW_MASK); // set the default help icon $this->setHelpIcon(FH_FHTML_DIR . 'images/helpicon.gif'); // check if the form is posted $this->_posted = $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST[$this->_name . '_submit']); // make a hidden field so we can identify the form $this->hiddenField($this->_name . '_submit', '1'); // get the current page $this->_curPage = isset($_POST[$this->_name . '_page']) ? $_POST[$this->_name . '_page'] : 1; // set our own error handler if (FH_DISPLAY_ERRORS) { error_reporting(E_ALL); set_error_handler('catchErrors'); } // set the language... $this->setLanguage(); // set the default table settings $this->setTableSettings(); }
// The default glue which should be used to merge multiple // checkboxes or radiobuttons fh_conf('FH_DEFAULT_GLUE_MASK', "%field%<br />\n"); // The chmod which is used when a dir is created fh_conf('FH_DEFAULT_CHMOD', 0777); // Display errors of FormHandler (PHP errors, NOT field validation errors!) fh_conf('FH_DISPLAY_ERRORS', true); // If this variabele is set to true, FH will // expose itsself by adding a extra line on the bottom of the form fh_conf('FH_EXPOSE', true); // Disable the submit button after submitting the form ? fh_conf('FH_DEFAULT_DISABLE_SUBMIT_BTN', true); // use / for valid XHTML, '' for valid HTML fh_conf('FH_XHTML_CLOSE', '/'); // encoding for htmlentities & htmlspecialchars fh_conf('FH_HTML_ENCODING', 'UTF-8'); /***********************************/ /*** Don't change anything below ***/ /***********************************/ /** * Document::fh_conf() * * Set the configuration defines if they are * not defined by the user yet. * */ function fh_conf() { static $define = array(); // is a value set? if (func_num_args() == 2) {