function write_setting() { extract($_POST); if (!isset($neg_setting)) { $neg_setting = "yes"; } db_connect(); #check if settings exists ... $get_check = "SELECT value FROM settings WHERE constant = 'SORDER_NEG_STOCK' LIMIT 1"; $run_check = db_exec($get_check) or errDie("Unable to check setting information."); if (pg_numrows($run_check) < 1) { #nothing found! $ins_sql = "\n\t\t\tINSERT INTO settings (\n\t\t\t\tconstant, label, value, type, datatype, minlen, maxlen, div, readonly\n\t\t\t) VALUES (\n\t\t\t\t'SORDER_NEG_STOCK', 'Show Negative Stock On Sales Order', '{$neg_setting}', 'static', 'allstring', '1', '250', '0', 'f'\n\t\t\t)"; $run_ins = db_exec($ins_sql) or errDie("Unable to update setting information. (1)"); } else { #found! update! $upd_sql = "UPDATE settings SET value = '{$neg_setting}' WHERE constant = 'SORDER_NEG_STOCK'"; $run_upd = db_exec($upd_sql) or errDie("Unable to update setting information. (2)"); } return show_setting("<li class='err'>Setting has been updated.</li><br>"); }
function show_form(&$form_items, $error_msg) { global $step, $uchidden; /*vot*/ global $language; if (empty($form_items) || !is_array($form_items)) { return; } show_header(); show_setting('start'); show_setting('hidden', 'step', $step); /*vot*/ show_setting('hidden', 'language', $language); show_setting('hidden', 'install_ucenter', getgpc('install_ucenter')); if ($step == 2) { show_tips('install_dzfull'); show_tips('install_dzonly'); } $is_first = 1; if (!empty($uchidden)) { $uc_info_transfer = unserialize(urldecode($uchidden)); } echo '<div id="form_items_' . $step . '" ' . ($step == 2 && !getgpc('install_ucenter') ? 'style="display:none"' : '') . '><br />'; foreach ($form_items as $key => $items) { global ${'error_' . $key}; if ($is_first == 0) { echo '</table>'; } if (!${'error_' . $key}) { show_tips('tips_' . $key); } else { show_error('tips_admin_config', ${'error_' . $key}); } echo '<table class="tb2">'; foreach ($items as $k => $v) { $value = ''; if (!empty($error_msg)) { $value = isset($_POST[$key][$k]) ? $_POST[$key][$k] : ''; } if (empty($value)) { if (isset($v['value']) && is_array($v['value'])) { if ($v['value']['type'] == 'constant') { $value = defined($v['value']['var']) ? constant($v['value']['var']) : $v['value']['var']; } else { $value = $GLOBALS[$v['value']['var']]; } } else { $value = ''; } } if ($k == 'ucurl' && isset($uc_info_transfer['ucapi'])) { $value = $uc_info_transfer['ucapi']; } elseif ($k == 'ucpw' && isset($uc_info_transfer['ucfounderpw'])) { $value = $uc_info_transfer['ucfounderpw']; } elseif ($k == 'ucip') { $value = ''; } show_setting($k, $key . '[' . $k . ']', $value, $v['type'], isset($error_msg[$key][$k]) ? $key . '_' . $k . '_invalid' : ''); } if ($is_first) { $is_first = 0; } } echo '</table>'; echo '</div>'; echo '<table class="tb2">'; show_setting('', 'submitname', 'new_step', $step == 2 ? 'submit|oldbtn' : 'submit'); show_setting('end'); show_footer(); }
function show_form(&$form_items, $error_msg) { global $step; if (empty($form_items) || !is_array($form_items)) { return; } show_header(); show_setting('start'); show_setting('hidden', 'step', $step); $is_first = 1; foreach ($form_items as $key => $items) { global ${'error_' . $key}; if ($is_first == 0) { echo '</table>'; } if (!${'error_' . $key}) { show_tips('tips_' . $key); } else { show_error('tips_admin_config', ${'error_' . $key}); } if ($is_first == 0) { echo '<table class="tb2">'; } foreach ($items as $k => $v) { global ${$k}; if (!empty($error_msg)) { $value = isset($_POST[$key][$k]) ? $_POST[$key][$k] : ''; } else { if (isset($v['value']) && is_array($v['value'])) { if ($v['value']['type'] == 'constant') { $value = defined($v['value']['var']) ? constant($v['value']['var']) : ''; } elseif ($v['value']['type'] == 'var') { $value = $GLOBALS[$v['value']['var']]; } elseif ($v['value']['type'] == 'string') { $value = $v['value']['var']; } } else { $value = ''; } } if ($v['type'] == 'checkbox') { $value = '1'; } show_setting($k, $key . '[' . $k . ']', $value, $v['type'], isset($error_msg[$key][$k]) ? $key . '_' . $k . '_invalid' : ''); } if ($is_first) { $is_first = 0; } } show_setting('', 'submitname', 'new_step', 'submit'); show_setting('end'); show_footer(); }
function show_form(&$form_items, $error_msg) { global $step; if (empty($form_items) || !is_array($form_items)) { return; } show_header(); show_setting('start'); show_setting('hidden', 'step', $step); $is_first = 1; foreach ($form_items as $key => $items) { global ${'error_' . $key}; if ($is_first == 0) { echo '</table>'; } if (!${'error_' . $key}) { show_tips('tips_' . $key); } else { show_error('tips_admin_config', ${'error_' . $key}); } echo '<table class="tb2">'; foreach ($items as $k => $v) { global ${$k}; if (!empty($error_msg)) { $value = isset($_POST[$key][$k]) ? $_POST[$key][$k] : ''; } else { if (isset($v['value']) && is_array($v['value'])) { if ($v['value']['type'] == 'constant') { $value = defined($v['value']['var']) ? constant($v['value']['var']) : ''; } else { $value = $GLOBALS[$v['value']['var']]; } } else { $value = ''; } } if ($v['type'] == 'checkbox') { $value = '1'; } show_setting($k, $key . '[' . $k . ']', $value, $v['type'], isset($error_msg[$key][$k]) ? $key . '_' . $k . '_invalid' : ''); } //当为环境配置的步骤时,单独输出是否增加演示数据 if ($step == 2 && $key == 'dbinfo') { if ($_POST['demo_date'] == '1') { $demo_check = "checked='checked'"; } echo " </td>\n<td> "; if ($error) { $comment = '<span class="red">' . (is_string($error) ? lang($error) : lang($setname . '_error')) . '</span>'; } else { $comment = lang($setname . '_comment', false); } echo "{$comment}</td>\n</tr>\n"; } if ($is_first) { $is_first = 0; } } show_setting('', 'submitname', 'new_step', 'submit'); show_setting('end'); show_footer(); }
function show_form(&$form_items, $error_msg) { global $step; if (empty($form_items) || !is_array($form_items)) { return; } show_header(); show_setting('start'); show_setting('hidden', 'step', $step); show_select_db(); $is_first = 1; echo '<div id="form_items_' . $step . '" ' . ($step == 5 ? 'style="display:none"' : '') . '><br />'; foreach ($form_items as $key => $items) { global ${'error_' . $key}; if ($is_first == 0) { echo '</table>'; echo '</div>'; } echo '<div id="' . $key . '_feilds">'; if (!${'error_' . $key}) { show_tips('tips_' . $key); } else { show_error('tips_admin_config', ${'error_' . $key}); } echo '<table class="tb2">'; foreach ($items as $k => $v) { $value = ''; if (!empty($error_msg)) { $value = isset($_POST[$key][$k]) ? $_POST[$key][$k] : ''; } if (empty($value)) { if (isset($v['value']) && is_array($v['value'])) { if ($v['value']['type'] == 'constant') { $value = defined($v['value']['var']) ? constant($v['value']['var']) : $v['value']['var']; } else { $value = isset($GLOBALS[$v['value']['var']]) ? $GLOBALS[$v['value']['var']] : ''; } } else { $value = ''; } } show_setting($k, $key . '[' . $k . ']', $value, $v['type'], isset($error_msg[$key][$k]) ? $key . '_' . $k . '_invalid' : ''); } if ($is_first) { $is_first = 0; } } echo '</table>'; echo '</div>'; echo '<table class="tb2">'; show_setting('', 'submitname', 'new_step', 'submit'); show_setting('end'); show_footer(); }
function show_form(&$form_items, $error_msg) { global $_G, $step, $uchidden; if (empty($form_items) || !is_array($form_items)) { return; } show_header(); show_setting('start'); show_setting('hidden', 'step', $step); $is_first = 1; if (!empty($uchidden)) { $uc_info_transfer = unserialize(urldecode($uchidden)); } foreach ($form_items as $key => $items) { global $_G, ${'error_' . $key}; if ($is_first == 0) { echo '</table>'; } if (!${'error_' . $key}) { show_tips('tips_' . $key); } else { show_error('tips_admin_config', ${'error_' . $key}); } echo '<table class="tb2">'; foreach ($items as $k => $v) { $value = ''; if (!empty($error_msg)) { $value = isset($_POST[$key][$k]) ? $_POST[$key][$k] : ''; } if (empty($value)) { if (isset($v['value']) && is_array($v['value'])) { if ($v['value']['type'] == 'constant') { $value = defined($v['value']['var']) ? constant($v['value']['var']) : $v['value']['var']; } else { $value = $GLOBALS[$v['value']['var']]; } } else { $value = ''; } } if ($k == 'ucurl' && isset($uc_info_transfer['ucapi'])) { $value = $uc_info_transfer['ucapi']; } elseif ($k == 'ucpw' && isset($uc_info_transfer['ucfounderpw'])) { $value = $uc_info_transfer['ucfounderpw']; } show_setting($k, $key . '[' . $k . ']', $value, $v['type'], isset($error_msg[$key][$k]) ? $key . '_' . $k . '_invalid' : ''); } if ($is_first) { $is_first = 0; } } show_setting('', 'submitname', 'new_step', 'submit'); show_setting('end'); show_footer(); }
show_setting('forceinstall', '', '<input type="checkbox" name="forceinstall" value="1" ' . $showforceinstallcheck . '> ' . lang('agree_forceinstall'), 'custum', true); } echo '</table>'; if (!$error_admin) { show_tips('tips_admin_config'); } else { show_error('tips_admin_config', $error_admin); } echo '<table class="tb2">'; show_setting('username', 'username', $username, 'text', @$error_admin['username']); show_setting('email', 'email', $email, 'text', @$error_admin['email']); show_setting('password', 'password1', $password1, 'password', @$error_admin['password1']); show_setting('repeat_password', 'password2', $password2, 'password', @$error_admin['password2']); show_setting('hidden', 'step', $step); show_setting('', 'boardsubmit', $lang['new_step'], 'submit'); show_setting('end'); show_footer(); } elseif ($step == 3) { $uid = getgpc('uid'); $username = getgpc('username'); $password = md5(random(10)); $email = getgpc('email'); if (empty($uid) || empty($username) || empty($password) || empty($email)) { $step--; redirect("{$self}?step={$step}"); } $db = new dbstuff(); $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset); show_tips('tips_install_process'); echo '<div class="btnbox"><textarea name="notice" style="width: 80%;" readonly id="notice"></textarea></div>'; echo '<div class="btnbox marginbot"><input type="button" name="submit" value="' . lang('install_in_processed') . '" onclick="return false" id="laststep"></div>';