/source/gl/module/i.php

http://prosporous.googlecode.com/ · PHP · 699 lines · 671 code · 14 blank · 14 comment · 56 complexity · 4e1de631e1d0e14feb2611729aabb0ed MD5 · raw file

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