PageRenderTime 80ms CodeModel.GetById 73ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/source/gl/user/i.phpbak

http://prosporous.googlecode.com/
Unknown | 701 lines | 688 code | 13 blank | 0 comment | 0 complexity | 6d4e6acd180072b336d3025204de9eca MD5 | raw file
  1<?php
  2/**??????UTF-8???.
  3 * Created on 2010-6-29
  4 *
  5 * @author EXT <isrn@qq.com>
  6 *
  7 */
  8include ('../../includes/global.php');
  9include ('../global.php');
 10include ("../power.php");
 11$dbcfg=Sys::Gp(array('dbcfg','sevenel'));
 12$donotrender = array('htmleditor','fckeditor','password','hidden');
 13function grv($type,$blm,$dvalue=false){
 14	//print_r($type);
 15	if($dvalue){
 16		return $dvalue;
 17		}else{
 18		switch($type){
 19				case 'function':{
 20					$a=explode('#',$blm);
 21					return $a[0]($a[1]);
 22					break;
 23					}
 24				case '$_GET':{
 25					return	$_GET[$blm];
 26					break;
 27					}
 28				case '$_SESSION':{
 29					return	$_SESSION[$blm];
 30					break;
 31					}
 32				case '$_POST':{
 33					return	$_POST[$blm];
 34					break;
 35					}
 36				case '$_COOKIE':{
 37					return	$_COOKIE[$blm];
 38					break;
 39					}
 40				case '$_SERVER':{
 41					return	$_SERVER[$blm];
 42					break;
 43					}
 44				case '$_ENV':{
 45					return	$_ENV[$blm];
 46					break;
 47					}
 48				case '$_FILES':{
 49					return	$_FILES[$blm];
 50					break;
 51					}
 52				case '0':{
 53					return $blm;
 54					break;
 55					}
 56				case '1':{
 57					break;
 58					}
 59				default:{
 60					return $blm;
 61					break;
 62					}
 63			
 64				}
 65			}
 66	}
 67 switch($_REQUEST['op']){
 68	case 'add':{
 69		$tree_id = $_GET['tid'];
 70		Tr($_GET['tid'],'tid');
 71		Tr($_GET['bdtid'],'bdtid');
 72		Tr($_GET['bdid'],'bdid');
 73		$field=Dgd(array(
 74		  'db'=>'d_sevenel',
 75		  'cd'=>"tid = $tree_id order by px asc",
 76		  'tn'=>"fld"
 77		));
 78			$tree=Dgd(array(
 79			  'db'=>'d_sevenel',
 80			  'cd'=>"id = $tree_id",
 81			  'tn'=>"tree",
 82			  'limit'=>1
 83			));
 84			$tname=gettabname($tree['table'],$dbcfg['prefix'],true);
 85			Tr($tname,'tname');
 86		if($_GET['id']){
 87			Tr($_GET['id'],'id');
 88				$fdada=Dgd(array(
 89					  'db'=>'d_sevenel',
 90					  'cd'=>" id = '".$_GET['id']."' and del != '1' ",
 91					  'tn'=>"$tname",
 92					  'limit'=>1
 93					));
 94				Tr($fdada['gid'],'gid');
 95				Tr(preg_replace("/[\s]{2,}/","",$fdada['lg']),'lg');
 96				}
 97		foreach($field as $arrow=>$value){
 98			$back = is_odd($arrow+1)?"itemCls:'hang',":"";
 99			if($value['cfg']!=''){
100				$config =json_decode($value['cfg'],true);
101			}else{$config =''; }
102/*			if($config!=''){foreach($config  as $key=>$v){
103				 $config[$key]=adxx($v);
104				}}
105*/			$config['STR']=str_replace("\r","",$config['STR']);
106			$config['STR']=str_replace("\n","",$config['STR']);
107			$config['STR']=str_replace("\t","",$config['STR']);
108			switch($value['type']){
109				case 'hidden':{
110						$js[] ="{
111							xtype: 'hidden',
112								value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
113								".(($config['STR'])?("".$config['STR'].""):(""))."
114							name: '".$value['fname']."'
115							}";
116				break;}
117				case 'textfield':{
118						$js[] ="{
119							xtype: 'textfield',
120							value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
121							fieldLabel:'".$value['name']."',
122							".(($value['id'])?("id:'".$value['id']."',"):(""))."
123							".(($value['width'])?("width:'".$value['width']."px',"):("grow:true,growMin:68,growMax:300,"))."
124							".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
125							".(($config['readonly'])?("readOnly:'true',"):(""))."
126							".(($config['STR'])?("".$config['STR'].""):(""))."
127							".$back."
128							name: '".$value['fname']."'
129							}";
130				break;}
131				case 'password':{
132					if($_GET['id']==''){
133						$js[] ="{
134							xtype: 'textfield',
135							value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
136							fieldLabel:'".$value['name']."',
137							inputType: 'password',
138							id: '".$value['fname']."',
139							width:'150',
140							".(($config['STR'])?("".$config['STR'].""):(""))."
141							".$back."name: '".$value['fname']."'
142							}";
143							if($value['yxwk']){
144						$js[] ="{
145							xtype: 'textfield',
146							value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
147							fieldLabel:'??".$value['name']."',
148							inputType: 'password',
149							vtype: 'password',
150							width:'150',
151							".(($config['STR'])?("".$config['STR'].""):(""))."
152							initialPassField: '".$value['fname']."',
153							".$back."name: '".$value['fname']."-cfrm'
154							}";
155		        		$plugurl[] = '/Plug-in/ext/adv-vtypes.js';
156								}}else{
157						$js[] ="{
158							xtype: 'button',
159							fieldLabel:'????'
160							}";
161									}
162							break;}
163				case 'fileup':{
164					if($fdada[$value['fname']]==''){
165						$fdada[$value['fname']]='zwtp.jpg';
166						}
167										$dvalue=array( 0=>array('rar','zip','tar','.tz'),
168													   1=>array('jpg','gif','png','bmp'),
169													   2=>array('mp3','mp4','avi','wmv','mid','.rm','mvb','mov','wma','wav'),
170													   3=>array('doc','xls','txt','ocx','lsx','ppt','pdf','chm'),
171													   4=>array('doc','xls','txt','ocx','lsx','ppt','pdf','chm','mp3','mp4','avi','wmv','mid','.rm','mvb','mov','wma','wav','jpg','gif','png','bmp','rar','zip','tar','.tz')		   
172															   );
173										$otype=substr(strtolower($fdada[$value['fname']]),-3);
174												if(in_array($otype,$dvalue[0])){
175												$zs="<a href=\"/uplods/pic/".$fdada[$value['fname']]."\" target=\'_blank\'><img src=\"../img/archive.png\">??[Download]</a>";
176													}
177												if(in_array($otype,$dvalue[1])){
178													if($config['sypic']==1||$config['sytxt']==1){
179													$zs="<img src=\"/uplods/sytp/".$fdada[$value['fname']]."\" >";	
180															}else{
181													$zs="<img src=\"/uplods/pic/".$fdada[$value['fname']]."\" >";	
182																}
183													}
184												if(in_array($otype,$dvalue[2])){
185												$zs="<a href=\"/uplods/pic/".$fdada[$value['fname']]."\" target=\'_blank\'><img src=\"../img/film_link.png\">??[Download]</a>";
186													}
187												if(in_array($otype,$dvalue[3])){
188												$zs="<a href=\"/uplods/pic/".$fdada[$value['fname']]."\" target=\'_blank\'><img src=\"../img/report_word.png\">??[Download]</a>";
189													}
190					$qk=" <a href=\"#\"  onclick=qkzd(\"".$fdada['id']."\",\"".$value['fname']."\") ><img src=\"../img/001_02.gif\">?????</a>";	
191						$js[] ="{
192							xtype: 'textfield',
193							fieldLabel:'".$value['name']."',
194							inputType: 'file',
195							".(($value['id'])?("id:'".$value['id']."',"):(""))."
196							width:'150',
197							".(($config['STR'])?("".$config['STR'].""):(""))."
198							".$back."name: '".$value['fname']."'
199							},{".$back."html:'<div style=\"float:left;width:300px;\" align=center>".$zs."".$qk."</div>'}";
200				break;}
201				case 'textarea':{
202						$js[] =preg_replace("/[\s]{2,}/","","{
203							xtype: 'textarea',
204							value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
205							fieldLabel:'".$value['name']."',
206							grow:true,
207							".(($value['id'])?("id:'".$value['id']."',"):(""))."
208							".(($value['width'])?("width:'".$value['width']."px',"):("width:'400px',"))."
209							".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
210							".(($config['readonly'])?("readOnly:'true',"):(""))."
211							".(($config['STR'])?("".$config['STR'].""):(""))."
212							".$back."
213							name: '".$value['fname']."'
214							}");
215				break;}
216				case 'htmleditor':{
217						$js[] =preg_replace("/[\s]{2,}/","","{
218							xtype: 'htmleditor',
219							value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
220							fieldLabel:'".$value['name']."',
221							".(($value['id'])?("id:'".$value['id']."',"):(""))."
222							".(($value['width'])?("width:".$value['width'].","):("anchor:'98%',"))."
223							".(($config['height'])?("height:".$config['height'].","):(""))."
224							".(($config['STR'])?("".$config['STR'].""):(""))."
225							".$back."
226							name: '".$value['fname']."'
227							}");
228				break;}
229				case 'fckeditor':{
230					$js[] =preg_replace("/[\s]{2,}/","","{
231						xtype:\"textarea\",
232						".(($value['id'])?("id:'".$value['id']."',"):(""))."
233						value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
234						".(($value['width'])?("width:".$value['width'].","):("anchor:'98%',"))."
235						".(($config['height'])?("height:".$config['height'].","):("height:300,"))."
236						fieldLabel:'".$value['name']."',
237						".$back."
238						listeners:{
239						     focus:function(f){
240								 				var myMask = new Ext.LoadMask(Ext.getBody(), {msg:'???'});
241												myMask.show();
242												var w=f.getSize();
243												   fckEditor = new FCKeditor('".$value['fname']."') ;
244												   fckEditor.Height=".(($config['height'])?($config['height']):(300)).";
245												   fckEditor.Width=".(($value['width'])?($value['width']):(800)).";
246												fckEditor.SkinPath = '/Plug-in/fck/editor/skins/silver/' ;
247												fckEditor.BasePath = '/Plug-in/fck/' ;
248												fckEditor.Config['ToolbarStartExpanded'] = ".(($config['zhed'])?("false"):('true')).";
249												".(($config['STR'])?($config['STR']):(""))."
250												fckEditor.ReplaceTextarea() ;
251												myMask.hide();
252						                     }
253						                   },
254						name: '".$value['fname']."'
255						}");
256					$fckplugin.="try{var fckobj_temp = FCKeditorAPI.GetInstance('".$value['fname']."');
257										 fckobj_temp.UpdateLinkedField();}catch(err){
258														};";
259					$plugurl[] = '/Plug-in/fck/fckeditor.js';	  // fckEditor.ReplaceTextarea() ;
260				break;}
261				case 'kindeditor':{
262					$yuan = array("</script>", "vegetables", "fiber");
263					$tyuan   = array("<\/script>", "beer", "ice cream");
264
265					$js[] =preg_replace("/[\s]{2,}/","","{
266						xtype:\"textarea\",
267						id:'".$value['fname']."',
268						".$back."
269						value:\"".(grv($value['qzfs'],$value['blm'],str_replace($yuan, $tyuan,adxx(preg_replace("'([\r\n])[\s]+'", "", $fdada[$value['fname']])))))."\",
270						".(($value['width'])?("width:".$value['width'].","):("anchor:'98%',"))."
271						".(($config['height'])?("height:".$config['height'].","):("height:300,"))."
272						fieldLabel:'".$value['name']."',
273						listeners:{
274							   render:function(f){
275												try{KE.show({id : '".$value['fname']."',
276												width :".(($value['width'])?("'".$value['width']."px'"):('70%')).",
277												height : ".(($config['height'])?("'".$config['height']."px'"):('300px')).", 
278												".(($config['STR'])?($config['STR']):(""))."
279												".(($config['jd'])?("resizeMode : 1,
280													allowPreviewEmoticons : false,
281													allowUpload : false,
282													items : [
283													'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
284													'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
285													'insertunorderedlist', '|', 'emoticons', 'image', 'link'],"):(""))."
286												filterMode : false});}catch(err){
287														};
288								   				}
289						                   },
290						
291						name: '".$value['fname']."'
292						}");
293					$fckplugin.="KE.util.setData('".$value['fname']."');";
294					$plugurl[] = '/Plug-in/kind/kindeditor.js';	  // fckEditor.ReplaceTextarea() ;
295				break;}
296				case 'datefield':{
297					if(is_numeric($fdada[$value['fname']])){
298							$fdada[$value['fname']]=date($config['zqgs'],$fdada[$value['fname']]);				 
299											 }
300						$js[] ="{
301							xtype: 'datefield',
302							".$back."
303							value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
304							fieldLabel:'".$value['name']."',
305							".(($value['id'])?("id:'".$value['id']."',"):(""))."
306							".(($value['width'])?("width:".$value['width'].","):(""))."
307							disabledDays :[".@implode(',',$config['pbxq'])."],
308							".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
309							".(($config['zwxs'])?("readOnly:'true',"):(""))."
310							".(($config['STR'])?("".$config['STR'].""):(""))."
311							".(($config['zqgs'])?("format:'".$config['zqgs']."',"):(""))."
312							name: '".$value['fname']."'
313							}";
314		        if($config['zwxs']==1){$plugjs[] ='Date.dayNames = ["?", "?", "?", "?", "?", "?", "?"];
315						    if (Ext.DatePicker) {
316						        Ext.apply(Ext.DatePicker.prototype, {
317						            todayText: "??",
318						            minText: "?????????",
319						            maxText: "?????????",
320						            disabledDaysText: "",
321						            disabledDatesText: "",
322						            monthNames: Date.monthNames,
323						            dayNames: Date.dayNames,
324						            nextText: "?? (Control+Right)",
325						            prevText: "?? (Control+Left)",
326						            monthYearText: "????? (Control+Up/Down ????)",
327						            todayTip: "{0} (Spacebar)",
328						            okText: "??",
329						            cancelText: "??",
330						            format: "y?m?d?"
331						        });
332   					}';}
333				break;}
334				case 'swfupload':{
335					$js[] ="{
336							xtype: '{$value['type']}',
337							".$back."
338			                name: '{$value['fname']}',
339			                id: '{$value['fname']}',
340			                fieldLabel: '{$value['name']}',
341			                anchor:'99%',
342			                height: {$config['height']}
343						}";
344				break;}
345				case 'combo':{
346								$tempxx = json_decode($value['zyz'],true);
347								$config_num = count($tempxx);
348								$items='';
349								if($config_num != 0){
350									foreach($tempxx as $key => $data){
351										if($data['ck']=='1'){
352											$fdada[$value['fname']]?$fdada[$value['fname']]:$fdada[$value['fname']]=$data['xv'];}
353											$items.= "['".$data['xv']."','".$data['yv']."']";
354										if($key < $config_num-1){
355											$items.= ",";
356										}
357									}
358								}
359						$js[] ="{
360							".$back."
361							value:\"".(grv($value['qzfs'],$value['blm'],adxx($fdada[$value['fname']])))."\",
362							fieldLabel:'".$value['name']."',
363							".(($value['id'])?("id:'".$value['id']."',"):(""))."
364							".(($value['width'])?("width:".$value['width'].","):(""))."
365							".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
366							".(($config['readonly'])?("readOnly:'true',"):(""))."
367							typeAhead: true,
368							name: '".$value['fname']."_',
369							hiddenName : '".$value['fname']."',
370							editable: false,xtype: 'combo',
371							store:new Ext.data.SimpleStore({
372											fields:['name','value'],
373											data:[".$items."]}),
374							mode:'local',
375					        displayField:'name',
376					        selectOnFocus:true,
377					        valueField :'value',
378							".(($config['STR'])?("".$config['STR'].""):(""))."
379					        triggerAction:'all'
380
381							}";
382				break;}
383				case 'combo1':{
384								
385						$js[] ="{
386							".$back."
387							value:\"".(adxx($fdada[$value['fname']])?adxx($fdada[$value['fname']]):$config['dy'])."\",
388							fieldLabel:'".$value['name']."',
389							".(($value['id'])?("id:'".$value['id']."',"):(""))."
390							".(($value['width'])?("width:".$value['width'].","):(""))."
391							".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
392							".(($config['readonly'])?("readOnly:'true',"):(""))."
393							typeAhead: true,
394							emptyText:'".$config['dx']."',
395							name: '".$value['fname']."_',
396							id: '".$value['fname']."_',
397							hiddenName : '".$value['fname']."',
398							editable: false,xtype: 'combo',
399							store:new Ext.data.Store({   
400								proxy: new Ext.data.HttpProxy({   
401									url: '../cascade/getcascade.php?id=".$value['id']."'
402								}),
403								listeners : { 
404								load : function(){ 
405										
406										if(typeof(chuzai)=='undefined'){
407											Ext.getCmp('".$value['fname']."_"."').setValue('".(adxx($fdada[$value['fname']])?adxx($fdada[$value['fname']]):$config['dy'])."'); 
408											chuzai=1;
409											}
410										} 
411										} ,
412								autoLoad:true,
413								reader: new Ext.data.ArrayReader({   
414							}, [   
415								{name: '".$config['y']."', mapping: '".$config['y']."'},   
416								{name: '".$config['x']."', mapping: '".$config['x']."'}   
417							])   
418}),
419							mode:'local',
420					        displayField:'".$config['x']."',
421					        selectOnFocus:true,
422					        valueField :'".$config['y']."',
423							".(($config['STR'])?("".$config['STR'].""):(""))."
424					        triggerAction:'all'
425								
426							}";
427				break;}
428				case 'radiogroup':{
429								$tempxx = json_decode($value['zyz'],true);
430								$config_num = count($tempxx);
431								if($config_num != 0){
432									$items='';
433									if($_GET['id']!=''){
434									foreach($tempxx as $key => $data){
435										if($data['yv']==$fdada[$value['fname']]){
436											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."',checked: true}";}else{
437											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."'}";}
438										if($key < $config_num-1){
439											$items.= ",";
440										}
441									}
442									}else{
443									foreach($tempxx as $key => $data){
444										if($data['ck']=='1'){
445											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."',checked: true}";}else{
446											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."',inputValue:'".$data['yv']."'}";}
447										if($key < $config_num-1){
448											$items.= ",";
449										}
450									}
451										}
452								}
453						$js[] ="{
454							xtype: 'radiogroup',
455							".$back."
456							".(($value['width']&&$value['width']<=$config_num)?("columns:".$value['width'].","):(""))."
457							".(($config['vertical'])?("vertical: true,"):(""))."
458							".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
459							anchor: '95%',
460							 items: [".$items."],
461							".(($config['STR'])?("".$config['STR'].""):(""))."
462							fieldLabel:'".$value['name']."'
463							}";
464				break;}
465				case 'recommend':{
466							$items='';
467							if(1==$fdada[$value['fname']]){
468								$items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'1',checked: true},";
469								$items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'0'}";
470								}else{
471								$items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'1'},";
472								$items.= "{boxLabel:'???',name:'".$value['fname']."',inputValue:'0',checked: true}";
473									}
474								
475						$js[] ="{
476							xtype: 'radiogroup',
477							".$back."
478							".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
479							anchor: '95%',
480							 items: [".$items."],
481							".(($config['STR'])?("".$config['STR'].""):(""))."
482							fieldLabel:'".$value['name']."'
483							}";
484				break;}
485				case 'checkboxgroup':{
486								$tempxx = json_decode($value['zyz'],true);
487								$config_num = count($tempxx);
488								if($config_num != 0){
489									$items='';
490									if($_GET['id']!=''){
491										$xsarray=explode("#_#",$fdada[$value['fname']]);
492									foreach($tempxx as $key => $data){
493										if(in_array($data['yv'],$xsarray)){
494											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."',checked: true}";}else{
495											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."'}";}
496										if($key < $config_num-1){
497											$items.= ",";
498										}
499									}
500									}else{
501									foreach($tempxx as $key => $data){
502										if($data['ck']=='1'){
503											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."',checked: true}";}else{
504											$items.= "{boxLabel:'".$data['xv']."',name:'".$value['fname']."[".$key."]',inputValue:'".$data['yv']."'}";}
505										if($key < $config_num-1){
506											$items.= ",";
507										}
508									}
509										}
510								}
511						$js[] ="{
512							xtype:'checkboxgroup',
513							".$back."
514							".(($value['width']&&$value['width']<=$config_num)?("columns:".$value['width'].","):(""))."
515							".(($config['vertical'])?("vertical: true,"):(""))."
516							".((!$value['yxwk'])?("allowBlank:false,blankText:'".adxx($value['ts'])."',"):(""))."
517							anchor: '95%',
518							 items: [".$items."],
519							".(($config['STR'])?("".$config['STR'].""):(""))."
520							fieldLabel:'".$value['name']."'
521							}";
522				break;}
523				default:{
524						$js[] ="{
525							xtype: 'textfield',
526							fieldLabel: '{$value['name']}',
527							name: '{$value['fname']}',
528							".$back."
529							anchor:'60%'
530						}";
531						}
532		  }
533		}
534		Tr($plugurl,'plugurl');
535		Tr($plugjs,'plugjs');
536		Tr($fckplugin,'fckplugin');
537		Tr($js,'js');
538		if($_GET['id']==0){
539			Tr('??','action');
540		}else{
541			Tr('??','action');
542		}
543		Ts('show1/add.html');
544		break;
545		}
546	case 'save':{
547			
548		$id = $_POST['id'];
549		$tree_id = $_POST['tid'];
550 		$tree=Dgd(array(
551						  'db'=>'d_sevenel',
552						  'cd'=>"id = $tree_id",
553						  'tn'=>"tree",
554						  'limit'=>'1'
555						));
556		$tabname = gettabname($tree['table'],'',true);
557		$fld=Dgd(array(
558					'db'=>'d_sevenel',
559					'cd'=>"tid = $tree_id",
560					'tn'=>"fld"
561				));
562		if(!$id){
563		$wyyz='user';
564 		$wztemp=Dgd(array(
565						  'db'=>'d_sevenel',
566						  'cd'=>"$wyyz like '".$_POST[$wyyz]."'",
567						  'tn'=>$tabname,
568						  'limit'=>'1'
569						));
570		if($wztemp!=''){
571				ext_request_failure('??????');
572				exit();
573			}
574		}
575		foreach($fld as $key => $value){
576			switch($value['type']){
577				case 'datefield':{
578					if($value['zy']!=1){
579						if(strtotime($_POST[$value['fname']])){
580							$save[$value['fname']] = strtotime($_POST[$value['fname']]);
581							}else{
582							$save[$value['fname']]=$_POST[$value['fname']];
583								}
584						}else{
585					$save[$value['fname']]=$_POST[$value['fname']];
586							}
587				break;}
588				case 'checkboxgroup':{
589					$save[$value['fname']]=implode("#_#",$_POST[$value['fname']]);
590				break;}
591				case 'password';{
592					if($value['yxwk']=='1'){
593						if($_POST[$value['fname']]==$_POST[$value['fname'].'-cfrm']){
594							$save [$value['fname']] = md5($_POST[$value['fname']]);
595						}else{
596							ext_request_failure('???????');
597							exit();
598						}
599					}else{
600						$save [$value['fname']] = md5($_POST[$value['fname']]);
601					}
602				break;}
603			case 'fileup':{
604					//print_r($_FILES);exit;
605							if($_FILES[$value['fname']]['name']!=''){
606							$cp=1;
607								//????
608							$config=json_decode($value['cfg'],true);
609							
610							
611							$dvalue=array( 0=>array('rar','zip','tar','.tz'),
612										   1=>array('jpg','gif','png','bmp'),
613										   2=>array('mp3','mp4','avi','wmv','mid','.rm','mvb','mov','wma','wav'),
614										   3=>array('doc','xls','txt','ocx','lsx','ppt','pdf','chm'),
615										   4=>array('doc','xls','txt','ocx','lsx','ppt','pdf','chm','mp3','mp4','avi','wmv','mid','.rm','mvb','mov','wma','wav','jpg','gif','png','bmp','rar','zip','tar','.tz')		   
616												   );
617								if(!$_FILES[$value['fname']]['name']){
618									$cp=0;
619								}
620							$otype=substr(strtolower($_FILES[$value['fname']]['name']),-3);
621							if(!in_array($otype,$dvalue[$config['type']])){
622									$cp=0;
623											header("Content-type: text/html; charset: UTF-8");
624											echo "{success:true,msg:'%u4E0A%u4F20%u683C%u5F0F%u4E0D%u5141%u8BB8%21%u8BF7%u8054%u7CFB%u7BA1%u5458%21<BR> Upload format is not allowed! Please contact the administrator!'}";
625											exit;
626							}
627							if($_FILES[$value['fname']]['size']/1000>$config['size']){
628							$cp=0;
629											header("Content-type: text/html; charset: UTF-8");
630							echo "{success:true,msg:'%u6587%u4EF6%u5927%u5C0F%u8D85%u8FC7%u9650%u5236%21<br> The file size limit expired!'}";
631							exit;
632								}
633						if($cp){
634						$bsname=time();
635						$bcname=$bsname.".".$otype;
636						$filename="../../uplods/pic/".$bcname;
637						$copymes=copy($_FILES[$value['fname']]['tmp_name'],$filename);
638						$save[$value['fname']]=$bcname;
639						}
640						if(in_array($otype,$dvalue[1])){
641							if($config['sl1']==1){
642						@createthumb($_FILES[$value['fname']]['tmp_name'],".".$otype,$bsname,$config['sl1x'],$config['sl1y'],'1');
643								}
644								if($config['sl2']==1){
645						@createthumb($_FILES[$value['fname']]['tmp_name'],".".$otype,$bsname,$config['sl2x'],$config['sl2y'],'2');
646								}
647								if($config['sypic']==1){
648							$sypicname="../../uplods/sypic/".$bcname;
649							$sypicwz="../../uplods/".$config['sytp']."";
650							//echo $sypicwz ,$config['sytp'],$config['sywz'];
651							@imageWaterMark($filename,$sypicname,$config['sypicwz'],$sypicwz,"",20,'wqy-microhei-lite.ttc',"#00FF00");
652								}
653								if($config['sytxt']==1){
654							$sypicname="../../uplods/sytxt/".$bcname;
655							$sypicwz="";
656							@imageWaterMark($filename,$sypicname,$config['sytxtwz'],"",$config['sywz'],$config['sywzdx'],$config['syzt'],"#".$config['syys']);
657								}
658								if($config['sytxt']==1&&$config['sypic']==1){
659							$filename="../../uplods/sypic/".$bcname;
660							$sypicname="../../uplods/sytp/".$bcname;
661							$sypicwz="";
662							@imageWaterMark($filename,$sypicname,$config['sytxtwz'],"",$config['sywz'],$config['sywzdx'],$config['syzt'],"#".$config['syys']);
663								}
664								
665								}
666					}
667				break;}
668				default:{
669				$save[$value['fname']]=$_POST[$value['fname']];
670				}
671			}
672		}
673			$save['tid'] = $tree_id;
674			!$_POST['lg']&&$save['lg']='zh';
675			$_POST['bdid']&&$save['bdid']=$_POST['bdid'];
676			$_POST['bdtid']&&$save['bdtid']=$_POST['bdtid'];
677			!$_POST['gid']&&$save['gid']=Mct();
678			$save['at']=time();
679		//???
680		if($id!=0){
681			unset($save['psw']);
682		if(Du('sevenel',$tabname,$save,'id',$id,1))
683			
684			ext_request('ok');
685		}else{
686			if(Di('sevenel',$tabname,$save));
687			ext_request('ok');
688		}
689	break;}
690	case 'qkzd':{
691		$save[$_POST['zd']]='';
692		if(Du('sevenel',$_POST['tname'],$save,'id',$_POST['id'],1))
693			ext_request('ok');	break;
694			}
695	case 'gxzd':{
696		$save[$_POST['zd']]=$_POST['xz'];
697		if(Du('sevenel',$_POST['tname'],$save,'id',$_POST['id'],1))
698			ext_request('ok');	break;
699			}
700 }
701?>