/** * Class constructor * @param string $formName Form's name. * @param string $method (optional)Form's method defaults to 'POST' * @param string $action (optional)Form's action * @param string $target (optional)Form's target defaults to '_self' * @param mixed $attributes (optional)Extra attributes for <form> tag * @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field * @access public */ function HTML_QuickForm($formName = '', $method = 'post', $action = '', $target = '', $attributes = null, $trackSubmit = false) { HTML_Common::HTML_Common($attributes); $method = strtoupper($method) == 'GET' ? 'get' : 'post'; $action = CRM_Utils_System::postURL($action); // $action = ($action == '') ? $_SERVER['PHP_SELF'] : $action; $target = empty($target) ? array() : array('target' => $target); $attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $formName) + $target; $this->updateAttributes($attributes); if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) { if (1 == get_magic_quotes_gpc()) { $this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method ? $_GET : $_POST); foreach ($_FILES as $keyFirst => $valFirst) { foreach ($valFirst as $keySecond => $valSecond) { if ('name' == $keySecond) { $this->_submitFiles[$keyFirst][$keySecond] = $this->_recursiveFilter('stripslashes', $valSecond); } else { $this->_submitFiles[$keyFirst][$keySecond] = $valSecond; } } } } else { $this->_submitValues = 'get' == $method ? $_GET : $_POST; $this->_submitFiles = $_FILES; } $this->_flagSubmitted = count($this->_submitValues) > 0 || count($this->_submitFiles) > 0; } if ($trackSubmit) { unset($this->_submitValues['_qf__' . $formName]); $this->addElement('hidden', '_qf__' . $formName, null); } if (preg_match('/^([0-9]+)([a-zA-Z]*)$/', ini_get('upload_max_filesize'), $matches)) { // see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes switch (strtoupper($matches['2'])) { case 'G': $this->_maxFileSize = $matches['1'] * 1073741824; break; case 'M': $this->_maxFileSize = $matches['1'] * 1048576; break; case 'K': $this->_maxFileSize = $matches['1'] * 1024; break; default: $this->_maxFileSize = $matches['1']; } } }
/** * Class constructor * @param string $formName Form's name. * @param string $method (optional)Form's method defaults to 'POST' * @param string $action (optional)Form's action * @param string $target (optional)Form's target defaults to '_self' * @param mixed $attributes (optional)Extra attributes for <form> tag * @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field * @access public */ function HTML_QuickForm($formName = '', $method = 'post', $action = '', $target = '_self', $attributes = null, $trackSubmit = false) { HTML_Common::HTML_Common($attributes); $method = strtoupper($method) == 'GET' ? 'get' : 'post'; $action = CRM_Utils_System::postURL($action); /** if ( array_key_exists( 'q', $_GET ) ) { $action = ($action == '') ? CRM_Utils_System::url( $_GET['q'] ) : $action; } else { $action = ($action == '') ? $_SERVER['PHP_SELF'] : $action; } **/ $target = empty($target) || $target == '_self' ? array() : array('target' => $target); $attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $formName) + $target; $this->updateAttributes($attributes); if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) { if (1 == get_magic_quotes_gpc()) { $this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method ? $_GET : $_POST); foreach ($_FILES as $keyFirst => $valFirst) { foreach ($valFirst as $keySecond => $valSecond) { if ('name' == $keySecond) { $this->_submitFiles[$keyFirst][$keySecond] = $this->_recursiveFilter('stripslashes', $valSecond); } else { $this->_submitFiles[$keyFirst][$keySecond] = $valSecond; } } } } else { $this->_submitValues = 'get' == $method ? $_GET : $_POST; $this->_submitFiles = $_FILES; } } if ($trackSubmit) { unset($this->_submitValues['_qf__' . $formName]); $this->addElement('hidden', '_qf__' . $formName, null); } }