function tpl_function_html_select_date($params, &$template_object) { require_once "shared.make_timestamp.php"; require_once "function.html_options.php"; /* Default values. */ $prefix = "Date_"; $start_year = strftime("%Y"); $end_year = $start_year; $display_days = true; $display_months = true; $display_years = true; $month_format = "%B"; /* Write months as numbers by default GL */ $month_value_format = "%m"; $day_format = "%02d"; /* Write day values using this format MB */ $day_value_format = "%d"; $year_as_text = false; /* Display years in reverse order? Ie. 2000,1999,.... */ $reverse_years = false; /* Should the select boxes be part of an array when returned from PHP? e.g. setting it to "birthday", would create "birthday[Day]", "birthday[Month]" & "birthday[Year]". Can be combined with prefix */ $field_array = null; /* <select size>'s of the different <select> tags. If not set, uses default dropdown. */ $day_size = null; $month_size = null; $year_size = null; /* Unparsed attributes common to *ALL* the <select>/<input> tags. An example might be in the template: all_extra ='class ="foo"'. */ $all_extra = null; /* Separate attributes for the tags. */ $day_extra = null; $month_extra = null; $year_extra = null; /* Order in which to display the fields. "D" -> day, "M" -> month, "Y" -> year. */ $field_order = 'MDY'; /* String printed between the different fields. */ $field_separator = "\n"; $time = time(); extract($params); // If $time is not in format yyyy-mm-dd if (!preg_match('/^\\d{4}-\\d{2}-\\d{2}$/', $time)) { // then $time is empty or unix timestamp or mysql timestamp // using smarty_make_timestamp to get an unix timestamp and // strftime to make yyyy-mm-dd $time = strftime('%Y-%m-%d', tpl_make_timestamp($time)); } // Now split this in pieces, which later can be used to set the select $time = explode("-", $time); // make syntax "+N" or "-N" work with start_year and end_year if (preg_match('!^(\\+|\\-)\\s*(\\d+)$!', $end_year, $match)) { if ($match[1] == '+') { $end_year = strftime('%Y') + $match[2]; } else { $end_year = strftime('%Y') - $match[2]; } } if (preg_match('!^(\\+|\\-)\\s*(\\d+)$!', $start_year, $match)) { if ($match[1] == '+') { $start_year = strftime('%Y') + $match[2]; } else { $start_year = strftime('%Y') - $match[2]; } } $field_order = strtoupper($field_order); $html_result = $month_result = $day_result = $year_result = ""; if ($display_months) { $month_names = array(); $month_values = array(); for ($i = 1; $i <= 12; $i++) { $month_names[] = strftime($month_format, time(0, 0, 0, $i, 1, 2000)); $month_values[] = strftime($month_value_format, time(0, 0, 0, $i, 1, 2000)); } $month_result .= '<select name='; if (null !== $field_array) { $month_result .= '"' . $field_array . '[' . $prefix . 'Month]"'; } else { $month_result .= '"' . $prefix . 'Month"'; } if (null !== $month_size) { $month_result .= ' size="' . $month_size . '"'; } if (null !== $month_extra) { $month_result .= ' ' . $month_extra; } if (null !== $all_extra) { $month_result .= ' ' . $all_extra; } $month_result .= '>' . "\n"; $month_result .= tpl_function_html_options(array('output' => $month_names, 'values' => $month_values, 'selected' => $month_values[$time[1] - 1], 'print_result' => false), $template_object); $month_result .= '</select>'; } if ($display_days) { $days = array(); for ($i = 1; $i <= 31; $i++) { $days[] = sprintf($day_format, $i); $day_values[] = sprintf($day_value_format, $i); } $day_result .= '<select name='; if (null !== $field_array) { $day_result .= '"' . $field_array . '[' . $prefix . 'Day]"'; } else { $day_result .= '"' . $prefix . 'Day"'; } if (null !== $day_size) { $day_result .= ' size="' . $day_size . '"'; } if (null !== $all_extra) { $day_result .= ' ' . $all_extra; } if (null !== $day_extra) { $day_result .= ' ' . $day_extra; } $day_result .= '>' . "\n"; $day_result .= tpl_function_html_options(array('output' => $days, 'values' => $day_values, 'selected' => $time[2], 'print_result' => false), $template_object); $day_result .= '</select>'; } if ($display_years) { if (null !== $field_array) { $year_name = $field_array . '[' . $prefix . 'Year]'; } else { $year_name = $prefix . 'Year'; } if ($year_as_text) { $year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"'; if (null !== $all_extra) { $year_result .= ' ' . $all_extra; } if (null !== $year_extra) { $year_result .= ' ' . $year_extra; } $year_result .= '>'; } else { $years = range((int) $start_year, (int) $end_year); if ($reverse_years) { rsort($years, SORT_NUMERIC); } $year_result .= '<select name="' . $year_name . '"'; if (null !== $year_size) { $year_result .= ' size="' . $year_size . '"'; } if (null !== $all_extra) { $year_result .= ' ' . $all_extra; } if (null !== $year_extra) { $year_result .= ' ' . $year_extra; } $year_result .= '>' . "\n"; $year_result .= tpl_function_html_options(array('output' => $years, 'values' => $years, 'selected' => $time[0], 'print_result' => false), $template_object); $year_result .= '</select>'; } } // Loop thru the field_order field for ($i = 0; $i <= 2; $i++) { $c = substr($field_order, $i, 1); switch ($c) { case 'D': $html_result .= $day_result; break; case 'M': $html_result .= $month_result; break; case 'Y': $html_result .= $year_result; break; } // Add the field seperator if ($i != 2) { $html_result .= $field_separator; } } return $html_result; }
<?php if (!function_exists('tpl_function_html_options')) { require CORE_DIR . '/include_v5/smartyplugins/function.html_options.php'; } ?> <h3>数据库的相关信息配置</h3> <form method="post" action="index.php?step=ready" id="db_setting" onsubmit ='return checkdbname()'> <table width="100%" border="0"> <tr> <th width="22%" align="right"><label for="db_host">数据库主机:</label></th> <td width="30%"><input class="txt" id="db_host" name="dbhost" size="25" value="<?php echo isset($this->_vars['host']) && '' !== $this->_vars['host'] ? $this->_vars['host'] : 'localhost'; ?> " type="text" onchange='checkdbInfo()'></td> <td width="48%">如果数据库服务器与WEBSERVER不在同一台主机上,请设置为数据库服务器的地址。</td> </tr> <tr> <th align="right" scope="row"><label for="db_uname">数据库用户名:</label></th> <td><input id="db_uname" class="txt" name="uname" size="25" value="" type="text" onchange='checkdbInfo()'></td> <td rowspan="2" id="db_check_result" style="display:none"> <img src="images/db_succ.gif" /> </td> </tr> <tr> <th align="right" scope="row"><label for="db_passwd">数据库密码:</label></th> <td><input id="db_passwd" class="txt" type="password" name="pwd" size="25" value="" type="text" onchange='checkdbInfo()'></td> </tr> <tr> <th align="right" scope="row"><label for="db_name">数据库名:</label></th> <td id="db_selector"><input class="txt" style="width:120px" id="db_name" name="dbname" size="25" value="" type="text"> <span id="btn_check_db" onclick="checkdbInfo()"><span style="text-decoration: underline; cursor: pointer;color:#00f;">测试连接»</span></span> </td> <td></td> </tr> <tr> <th align="right" scope="row"><label for="db_prefix">安装数据表前缀:</label></th> <td><input class="txt" id="db_prefix" name="prefix" id="prefix" value="sdb_" size="25" type="text"></td> <td>一般您不需要修改数据表前缀。</td> </tr> <tr> <th align="right" scope="row"><label for="db_PREFIX">选择您的服务器时区</label></th> <td colspan="2"> <select name="stimezone" style="width:300px"> <?php echo tpl_function_html_options(array('options' => $this->_vars['timezone'], 'selected' => $this->_vars['default_timezone']), $this); ?> </select> </td> </tr> <tr><td colspan='3' align='center'><input style="margin:10px;cursor:pointer;" value="保存并进入下一步 »" type="submit" /></td></tr> </table> </form> <script> var checkdbname = function(){ var dbname = document.getElementById('db_name'); if(!!!dbname.value){ alert('请指定正确的数据库名称!'); return false; } return true; }; void function(){ var dbNameInput=_$('db_selector').innerHTML; checkdbInfo=function(){ var bakvalue =_$('db_name').value; var dbHost=_$('db_host').value; var dbUname=_$('db_uname').value; var dbPass=_$('db_passwd').value; if(!XHR)return;
function tpl_function_html_select_time($params, &$template_object) { require_once "shared.make_timestamp.php"; require_once "function.html_options.php"; /* Default values. */ $prefix = "Time_"; $time = time(); $display_hours = true; $display_minutes = true; $display_seconds = true; $display_meridian = true; $use_24_hours = true; $minute_interval = 1; $second_interval = 1; /* Should the select boxes be part of an array when returned from PHP? e.g. setting it to "birthday", would create "birthday[Hour]", "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]". Can be combined with prefix. */ $field_array = null; $all_extra = null; $hour_extra = null; $minute_extra = null; $second_extra = null; $meridian_extra = null; extract($params); $time = tpl_make_timestamp($time); $html_result = ''; if ($display_hours) { $hours = $use_24_hours ? range(0, 23) : range(1, 12); $hour_fmt = $use_24_hours ? '%H' : '%I'; for ($i = 0, $for_max = count($hours); $i < $for_max; $i++) { $hours[$i] = sprintf('%02d', $hours[$i]); } $html_result .= '<select name='; if (null !== $field_array) { $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"'; } else { $html_result .= '"' . $prefix . 'Hour"'; } if (null !== $hour_extra) { $html_result .= ' ' . $hour_extra; } if (null !== $all_extra) { $html_result .= ' ' . $all_extra; } $html_result .= '>' . "\n"; $html_result .= tpl_function_html_options(array('output' => $hours, 'values' => $hours, 'selected' => strftime($hour_fmt, $time), 'print_result' => false), $template_object); $html_result .= "</select>\n"; } if ($display_minutes) { $all_minutes = range(0, 59); for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i += $minute_interval) { $minutes[] = sprintf('%02d', $all_minutes[$i]); } $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval); $html_result .= '<select name='; if (null !== $field_array) { $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"'; } else { $html_result .= '"' . $prefix . 'Minute"'; } if (null !== $minute_extra) { $html_result .= ' ' . $minute_extra; } if (null !== $all_extra) { $html_result .= ' ' . $all_extra; } $html_result .= '>' . "\n"; $html_result .= tpl_function_html_options(array('output' => $minutes, 'values' => $minutes, 'selected' => $selected, 'print_result' => false), $template_object); $html_result .= "</select>\n"; } if ($display_seconds) { $all_seconds = range(0, 59); for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i += $second_interval) { $seconds[] = sprintf('%02d', $all_seconds[$i]); } $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval); $html_result .= '<select name='; if (null !== $field_array) { $html_result .= '"' . $field_array . '[' . $prefix . 'Second]"'; } else { $html_result .= '"' . $prefix . 'Second"'; } if (null !== $second_extra) { $html_result .= ' ' . $second_extra; } if (null !== $all_extra) { $html_result .= ' ' . $all_extra; } $html_result .= '>' . "\n"; $html_result .= tpl_function_html_options(array('output' => $seconds, 'values' => $seconds, 'selected' => $selected, 'print_result' => false), $template_object); $html_result .= "</select>\n"; } if ($display_meridian && !$use_24_hours) { $html_result .= '<select name='; if (null !== $field_array) { $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"'; } else { $html_result .= '"' . $prefix . 'Meridian"'; } if (null !== $meridian_extra) { $html_result .= ' ' . $meridian_extra; } if (null !== $all_extra) { $html_result .= ' ' . $all_extra; } $html_result .= '>' . "\n"; $html_result .= tpl_function_html_options(array('output' => array('AM', 'PM'), 'values' => array('am', 'pm'), 'selected' => strtolower(strftime('%p', $time)), 'print_result' => false), $template_object); $html_result .= "</select>\n"; } return $html_result; }
?> </td><td><?php echo $this->_vars['value']['value']; ?> </td> </tr> <?php } unset($this->_env_vars['foreach'][basic]); ?> </table> <?php } else { ?> <h4>建立商店管理员帐户:</h4> <form id="show" method="post" action="index.php?step=complete"> <table> <tr> <th width="120px" align="right" scope="row"><label for="ipt_uname">管理员用户名:</label></th> <td width="150px"><input type="text" name="uname" id="ipt_uname" value="admin" tabindex="1"></td> <th align="right">服务器时区:</th> <td> <?php echo $this->_vars['stimezone']; ?> </td> </tr> <tr> <th align="right" scope="row"><label for="ipt_passwd">管理员密码:</label></th> <td><input type="password" name="password" id="ipt_passwd" tabindex="2"></td> <th align="right">您当前时间:</th> <td> <select style="width:200px" name="localtime" tabindex="6" id="localtime"> <?php echo tpl_function_html_options(array('options' => $this->_vars['timelist'], 'selected' => $this->_vars['defaultHour']), $this); ?> </select> </td> </tr> <tr> <th align="right" scope="row"><label for="ipt_re_passwd">再输入一次密码:</label></th> <td colspan="3"><input type="password" name="re_passwd" id="ipt_re_passwd" tabindex="3"></td> </tr> <tr> <td align="right" valign="top"> <input type="checkbox" id="use_demo" checked="checked" name="use_demo" value="yes" tabindex="4"> </td> <td colspan="3"> <label for="use_demo">安装体验数据</label><br /> <span style="color:#666">装载体验数据后,您不必进行任何系统设置,可以用模拟数据体验ShopEx网店系统的各项功能</span> </td> </tr> </table> </form> <div class="button"><input type="image" src="images/btn-install.gif" tabindex="5" onclick="startInstall()"/></div> <?php } ?> </div> <div id="install_progress" style='display:none'> <div id="now_installing" style="padding-left:50px">正在安装数据库...</div> <div id="install_info" style="padding-left:50px"></div> </div> <form action="http://service.shopex.cn/plugins/install_errorlog/b2c_install_erlog.php" style="display:none" method="post" id="server_form" target="shopex_iframe"> <input name="webserver" id="webserver" value="" type="text"/> <input name="os" id="os" value="" type="text"/> <input name="phpver" id="phpver" value="" type="text"/> <input name="mysql" id="mysql" value="" type="text"/> <input name="domain" id="domain" value="" type="text"/> <textarea name="error_msg" id="error_msg"></textarea> <input name="contact" id="contact" value="" type="text"/> </form> <iframe frameborder="0" src="about:blank" width='0' height='0' id="shopex_iframe" name="shopex_iframe"></iframe> <script> function check_installFrom(str){ if(!$('ipt_uname').value){ alert('管理员用户名不能为空。'); return false; } if($('ipt_passwd').value !== $('ipt_re_passwd').value){ alert('两次输入密码不一致。'); return false; } if(!$('ipt_passwd').value){