private function validate_step2() { $next = UIBase::GrabInput('ANY', 'next'); if ($next == 0) { $this->next_step = 1; return TRUE; } $php_version = UIBase::GrabGoodInput('ANY', 'buildver'); // only if illegal action, will have err if (!$this->validate_php_version($php_version)) { $this->next_step = 0; return FALSE; } $this->pass_val['php_version'] = $php_version; $options = new BuildOptions($php_version); $options->SetValue('ExtraPathEnv', UIBase::GrabGoodInput('ANY', 'path_env')); $options->SetValue('InstallPath', UIBase::GrabGoodInput('ANY', 'installPath')); $compilerFlags = UIBase::GrabGoodInput('ANY', 'compilerFlags'); $configParams = UIBase::GrabGoodInput('ANY', 'configureParams'); //set the input even it has error, so user can modify $options->SetValue('ConfigParam', $configParams); $options->SetValue('CompilerFlags', $compilerFlags); $options->SetValue('AddOnSuhosin', NULL != UIBase::GrabGoodInput('ANY', 'addonSuhosin')); $options->SetValue('AddOnMailHeader', NULL != UIBase::GrabGoodInput('ANY', 'addonMailHeader')); $options->SetValue('AddOnAPC', NULL != UIBase::GrabGoodInput('ANY', 'addonAPC')); $options->SetValue('AddOnXCache', NULL != UIBase::GrabGoodInput('ANY', 'addonXCache')); $options->SetValue('AddOnMemCache', NULL != UIBase::GrabGoodInput('ANY', 'addonMemCache')); $options->SetValue('AddOnMemCached', NULL != UIBase::GrabGoodInput('ANY', 'addonMemCached')); $options->SetValue('AddOnOPcache', NULL != UIBase::GrabGoodInput('ANY', 'addonOPcache')); // can be real input err $v1 = $this->validate_extra_path_env($options->GetValue('ExtraPathEnv')); $v2 = $this->validate_install_path($options->GetValue('InstallPath')); $v3 = $this->validate_complier_flags($compilerFlags); $v4 = $this->validate_config_params($configParams); if (!$v1 || !$v2 || !$v3 || !$v4) { $options->SetType('INPUT'); $options->SetValidated(FALSE); $this->pass_val['input_options'] = $options; $this->next_step = 2; return FALSE; } if (strpos($configParams, '--with-litespeed') === FALSE) { $configParams .= " '--with-litespeed'"; } $configParams = "'--prefix=" . $options->GetValue('InstallPath') . "' " . $configParams; $options->SetValue('ConfigParam', escapeshellcmd($configParams)); $options->SetValue('CompilerFlags', escapeshellcmd($compilerFlags)); $options->SetType('BUILD'); $options->SetValidated(TRUE); $this->pass_val['build_options'] = $options; $this->next_step = 3; return TRUE; }
function print_step_2() { $options = NULL; $saved_options = NULL; $default_options = NULL; $cur_step = $this->check->GetCurrentStep(); $pass_val = $this->check->pass_val; if ($cur_step == 1) { $php_version = $pass_val['php_version']; $options = new BuildOptions($php_version); $options->setDefaultOptions(); $default_options = $options; $supported = $this->check->GetModuleSupport($php_version); } elseif ($cur_step == 2) { $options = $pass_val['input_options']; $php_version = $options->GetValue('PHPVersion'); $default_options = new BuildOptions($php_version); $default_options->setDefaultOptions(); } elseif ($cur_step == 3) { $php_version = $pass_val['php_version']; $options = new BuildOptions($php_version); $default_options = new BuildOptions($php_version); $default_options->setDefaultOptions(); } if ($options == NULL) { return "NULL options\n"; } $saved_options = $options->getSavedOptions(); if ($saved_options != NULL && $cur_step == 3) { $options = $saved_options; } $buf = $this->form_start(); if (isset($pass_val['err'])) { $buf .= UIBase::error_divmesg(DMsg::ALbl('note_inputerr')); } $input = '<input type="button" class="btn btn-default btn-sm" value="' . DMsg::ALbl('buildphp_useprevconf') . '" ' . ($saved_options ? $saved_options->gen_loadconf_onclick('IMPORT') : 'disabled') . '> <input type="button" class="btn btn-default btn-sm" value="' . DMsg::ALbl('buildphp_restoredefault') . '" ' . $default_options->gen_loadconf_onclick('DEFAULT') . '>'; $buf .= $this->form_group(DMsg::ALbl('buildphp_loadconf'), false, $input); $input = $this->input_text('path_env', $options->GetValue('ExtraPathEnv')); $err = isset($pass_val['err']['path_env']) ? $pass_val['err']['path_env'] : ''; $tip = DMsg::GetAttrTip('extrapathenv')->Render(); $buf .= $this->form_group(DMsg::ALbl('buildphp_extrapathenv'), false, $input, $tip, '', $err); $input = $this->input_text('installPath', $options->GetValue('InstallPath')); $err = isset($pass_val['err']['installPath']) ? $pass_val['err']['installPath'] : ''; $tip = DMsg::GetAttrTip('installpathprefix')->Render(); $buf .= $this->form_group(DMsg::ALbl('buildphp_installpathprefix'), true, $input, $tip, '', $err); $input = $this->input_text('compilerFlags', $options->GetValue('CompilerFlags')); $err = isset($pass_val['err']['compilerFlags']) ? $pass_val['err']['compilerFlags'] : ''; $tip = DMsg::GetAttrTip('compilerflags')->Render(); $buf .= $this->form_group(DMsg::ALbl('buildphp_compilerflags'), false, $input, $tip, '', $err); $input = $this->input_textarea('configureParams', $options->GetValue('ConfigParam'), 6, 'soft'); $err = isset($pass_val['err']['configureParams']) ? $pass_val['err']['configureParams'] : ''; $tip = DMsg::GetAttrTip('configureparams')->Render(); $buf .= $this->form_group(DMsg::ALbl('buildphp_confparam'), true, $input, $tip, '', $err); $input = ''; if ($supported['mailheader']) { $input = $this->input_checkbox('addonMailHeader', $options->GetValue('AddOnMailHeader'), '<a href="http://choon.net/php-mail-header.php" target="_blank">' . DMsg::ALbl('buildphp_mailheader1') . '</a> (' . DMsg::ALbl('buildphp_mailheader2') . ')'); } if ($supported['suhosin']) { $input .= $this->input_checkbox('addonSuhosin', $options->GetValue('AddOnSuhosin'), '<a href="http://suhosin.org" target="_blank">Suhosin</a> ' . DMsg::ALbl('buildphp_suhosin')); } $label_opcode = DMsg::ALbl('buildphp_opcodecache'); if ($supported['apc']) { $input .= $this->input_checkbox('addonAPC', $options->GetValue('AddOnAPC'), '<a href="http://pecl.php.net/package/APC" target="_blank">APC</a> (' . $label_opcode . ') V' . BuildConfig::GetVersion(BuildConfig::APC_VERSION)); } $input .= $this->input_checkbox('addonXCache', $options->GetValue('AddOnXCache'), '<a href="http://xcache.lighttpd.net/" target="_blank">XCache</a> (' . $label_opcode . ') V' . BuildConfig::GetVersion(BuildConfig::XCACHE_VERSION)); $input .= $this->input_checkbox('addonMemCache', $options->GetValue('AddOnMemCache'), '<a href="http://pecl.php.net/package/memcache" target="_blank">memcache</a> (memcached extension) V' . BuildConfig::GetVersion(BuildConfig::MEMCACHE_VERSION)); if ($supported['opcache']) { $input .= $this->input_checkbox('addonOPcache', $options->GetValue('AddOnOPcache'), '<a href="http://pecl.php.net/package/ZendOpcache" target="_blank">Zend OPcache</a> (' . $label_opcode . ') V' . BuildConfig::GetVersion(BuildConfig::OPCACHE_VERSION)); } $note = DMsg::ALbl('buildphp_updatever') . ' /usr/local/lsws/admin/html/lib/util/build_php/BuildConfig.php'; $buf .= $this->form_group(DMsg::ALbl('buildphp_addonmodules'), false, $input, '', $note); $buf .= $this->form_end(); echo $buf; }