| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | 
							- <?php
 
- class content_form {
 
- 	var $modelid;
 
- 	var $fields;
 
- 	var $id;
 
- 	var $formValidator;
 
-     function __construct($modelid,$catid = 0,$categorys = array()) {
 
- 		$this->modelid = $modelid;
 
- 		$this->catid = $catid;
 
- 		$this->categorys = $categorys;
 
- 		$this->fields = getcache('model_field_'.$modelid,'model');
 
- 		$this->siteid = get_siteid();
 
-     }
 
- 	function get($data = array()) {
 
- 		$_groupid = param::get_cookie('_groupid');
 
- 		$this->data = $data;
 
- 		if(isset($data['id'])) $this->id = $data['id'];
 
- 		$info = array();
 
- 		$this->content_url = $data['url'];
 
- 		foreach($this->fields as $field=>$v) {
 
- 			if(defined('IN_ADMIN')) {
 
- 				if($v['iscore'] || check_in($_SESSION['roleid'], $v['unsetroleids'])) continue;
 
- 			} else {
 
- 				if($v['iscore'] || !$v['isadd'] || check_in($_groupid, $v['unsetgroupids'])) continue;
 
- 			}
 
- 			$func = $v['formtype'];
 
- 			$value = isset($data[$field]) ? new_html_special_chars($data[$field]) : '';
 
- 			if($func=='pages' && isset($data['maxcharperpage'])) {
 
- 				$value = $data['paginationtype'].'|'.$data['maxcharperpage'];
 
- 			}
 
- 			if(!method_exists($this, $func)) continue;
 
- 			$form = $this->$func($field, $value, $v);
 
- 			if($form !== false) {
 
- 				if(defined('IN_ADMIN')) {
 
- 					if($v['isbase']) {
 
- 						$star = $v['minlength'] || $v['pattern'] ? 1 : 0;
 
- 						$info['base'][$field] = array('name'=>$v['name'], 'tips'=>$v['tips'], 'form'=>$form, 'star'=>$star,'isomnipotent'=>$v['isomnipotent'],'formtype'=>$v['formtype']);
 
- 					} else {
 
- 						$star = $v['minlength'] || $v['pattern'] ? 1 : 0;
 
- 						$info['senior'][$field] = array('name'=>$v['name'], 'tips'=>$v['tips'], 'form'=>$form, 'star'=>$star,'isomnipotent'=>$v['isomnipotent'],'formtype'=>$v['formtype']);
 
- 					}
 
- 				} else {
 
- 					$star = $v['minlength'] || $v['pattern'] ? 1 : 0;
 
- 					$info[$field] = array('name'=>$v['name'], 'tips'=>$v['tips'], 'form'=>$form, 'star'=>$star,'isomnipotent'=>$v['isomnipotent'],'formtype'=>$v['formtype']);
 
- 				}
 
- 			}
 
- 		}
 
- 		return $info;
 
- 	}
 
- }?>
 
 
  |