Размер файла: 3.57Kb
- <?php
- class form {
- protected $form = '';
- protected $method;
- protected $act;
- protected $form_names;
- protected $legend;
- protected $formid;
- protected $hidden = array();
-
- public function __construct($act, $method = '', $form_names = '', $formid = '', $hidden = '', $legend = '')
- {
- $this->act = $act;
- $this->method = $method ? $method : 'post';
- $this->form_names = $form_names ? $form_names : '';
- $this->formid = $formid ? $formid : '';
- $this->hidden = $hidden ? $hidden : '';
- $this->legend = $legend ? $legend : '';
- $form = '<form name="form" action="' . $this->act . '" method="' . $this->method . '" ';
- $form .= $this->formid ? $this->formid : '';
- $form .= $this->form_names ? 'name="' . $this->form_names . '">' : '>';
-
- return $this -> form = $form . PHP_EOL;
- }
-
- public function input($text = '', $name, $type = 'text', $value = '', $br = false, $size = '', $max = '',$name_check = '',$accept = '')
- {
-
- $form = '';
- $form.= $text ? $text . '<br/>' : '';
- $form.= '<input '.$accept.' type="' . $type . '" name="' . $name . '" value="' . $value . '" size="' . $size . '" ';
- $form.= $max ? 'maxlength="' . $max . '" />'.($br ? '<br />' : null).'' : '/> '.$name_check.''.($br ? '<br />' : null).'';
-
- return $this->form .= PHP_EOL . $form . PHP_EOL;
- }
-
- public function textarea($text = false, $name, $value = '',$bb_code = false)
- {
- global $text_list;
- $form = '';
- $form.= $text ? $text . '<br/>' : '';
- if($bb_code == true) {
- $form.= $text_list->text_lister();}
- $form.= '<textarea id="text" name="' . $name . '">';
- $form.= $value ? $value : '';
- $form.= '</textarea><br/>';
-
- return $this->form .= PHP_EOL . $form . PHP_EOL;
- }
-
- public function select($text, $name, $form_value, $selected = 1)
- {
- $form = ($text ? $text . '<br/>' : null) . '<select name="' . $name . '">' . PHP_EOL;
- $for_number = 1;
- foreach ($form_value as $form_z => $form_num)
- {
- $form .= '<option value="' . $form_num . '" ' . ($for_number==$selected ? 'selected="selected"' : '') . '>' . $form_z . '</option>' . PHP_EOL;
- $for_number ++; }
- $form .= '</select><br/>';
-
- return $this->form .= $form . PHP_EOL;
- }
-
- public function submit ($submitname = '', $submitvalue = '', $br = false) {
- $form = '<input type="submit" name="' . $submitvalue . '" value="' . $submitname . '" />' .($br ? '<br />' : null);
-
- return $this->form .= $form . PHP_EOL;
-
- }
-
- public function form_link($link_http = '',$link_title = '')
- {
- $form = '<a href="http://'.$_SERVER['HTTP_HOST'].''.$link_http.'">'.$link_title.'</a>';
- return $this->form .= $form . PHP_EOL;
- }
- public function captcha($name_funct) {
- global $settings_shcms;
- if($settings_shcms[$name_funct] == 1)
- {
- $form = '<script type="text/javascript">
- src="/shcms/antibot.php?r=rand(1000,9999)";
- function reload(){
- document.captcha.src="/shcms/antibot.php?r=rand(1000,9999)";
- document.captcha.src=src+"?rand="+Math.random(); } </script>
- <img name="captcha" class="midside" alt="Код безопастности" src="'.DIR_SHCMS.'antibot.php?r='.rand(1000, 9999) .'"/><br />
- <a href="javascript:void(0)" onclick="reload()">обновить, если не виден код</a><br/>
- <input type="text" style="width:115px" size="5" maxlength="5" name="kod"/><br/>';
- }
- return $this->form .= $form . PHP_EOL;
- }
-
- public function finish() {
- echo $this->form . '</form>';
- }
- }
-
-