PageRenderTime 45ms CodeModel.GetById 3ms app.highlight 35ms RepoModel.GetById 1ms app.codeStats 0ms

/source/gl/dy/index.php

http://prosporous.googlecode.com/
PHP | 762 lines | 674 code | 20 blank | 68 comment | 161 complexity | a8ff3fb0fd45447182ee7daeac5d4471 MD5 | raw file
  1<?php
  2/* * ??????UTF-8???.
  3 * Created on 2010-10-2
  4 *
  5 * @author EXT <isrn@qq.com>
  6 *
  7 */
  8include ('../../includes/global.php');
  9include ('../global.php');
 10include ("../power.php");
 11include ("../clas/ext.php");
 12$plugurl = array();
 13$plugjs = array();
 14$fckplugin = '';
 15function grv($type, $blm, $dvalue=false) {
 16    //print_r($type);
 17    if ($dvalue) {
 18        return $dvalue;
 19    } else {
 20        switch ($type) {
 21            case 'function': {
 22                    $a = explode('#', $blm);
 23                    return $a[0]($a[1]);
 24                    break;
 25                }
 26            case '$_GET': {
 27                    return $_GET[$blm];
 28                    break;
 29                }
 30            case '$_SESSION': {
 31                    return $_SESSION[$blm];
 32                    break;
 33                }
 34            case '$_POST': {
 35                    return $_POST[$blm];
 36                    break;
 37                }
 38            case '$_COOKIE': {
 39                    return $_COOKIE[$blm];
 40                    break;
 41                }
 42            case '$_SERVER': {
 43                    return $_SERVER[$blm];
 44                    break;
 45                }
 46            case '$_ENV': {
 47                    return $_ENV[$blm];
 48                    break;
 49                }
 50            case '$_FILES': {
 51                    return $_FILES[$blm];
 52                    break;
 53                }
 54            case '0': {
 55                    return $blm;
 56                    break;
 57                }
 58            case '1': {
 59                    break;
 60                }
 61            default: {
 62                    return $blm;
 63                    break;
 64                }
 65        }
 66    }
 67}
 68Tr('index.php', 'thisurl');
 69Tr('??', 'thistitle');
 70$tmpml = 'dy/';
 71Tr($_GET['tid'], 'tid');
 72Tr('5', 'pagenum');
 73$paixu = array('zd' => 'id', 'order' => 'DESC');
 74Tr($paixu, 'paixu');
 75Tr($_GET['tid'], 'rightid');
 76Tr($_REQUEST['lg'], 'lg');
 77Tr($_REQUEST['bdid'], 'bdid');
 78Tr($_REQUEST['bdtid'], 'bdtid');
 79
 80
 81//$_SESSION['rcg']!='A'&&$_SESSION['rcg']['zdgxkey'][$_GET['tid']]=1;$_GET['tid']='105';$_POST['tid']='105';
 82/* $showcf=array(
 83  0=>array('title'=>'????','zd'=>array('tt','ct','pic1','input1','input2','ubb1'))Tr('106','rightid');
 84  );
 85
 86  $listcf=array('show'=>array('tt','ct','pic1','input1','input2'),
 87  'xnlist'=>array(
 88  array('id'=>451,'fname'=>'num','type'=>'input','name'=>'??','wd'=>100,'url'=>""),
 89  array('id'=>450,'fname'=>'yuding','type'=>'button','name'=>'??','wd'=>100,'url'=>"")
 90  ),
 91  'gj'=>array('user','ct','usertype'),
 92  //'ss'=>'ct',//olny one
 93  //'pt'=>" and user like '".$_SESSION['userinfo']['user']."' ",//sql
 94  'editdisble'=>array('tt','ct','pic1','input1','input2','ubb1'),
 95  //'zdgx'=>array('ct'),
 96  //'zdgxkey'=>array('ct'),
 97  'save'=>array('user','ct'),
 98  'zd'=>array('user','ct')
 99  );
100 */
101switch ($_REQUEST['op']) {
102    case 'list': {
103            $_REQUEST['lg'] != '' && $condition = " and lg like '" . $_REQUEST['lg'] . "' ";
104            $fldata = Dgd(array(
105                'db' => 'd_sevenel',
106                'cd' => "del!=1 and tid = '" . $_GET['tid'] . "' " . $condition . " order by px asc ",
107                'tn' => "fld"
108                    ));
109            Tr($_GET['bdtid'], 'bdtid');
110            Tr($_GET['bdid'], 'bdid');
111            if (count($listcf['show']) > 0) {
112                foreach ($fldata as $key => $v) {
113                    if (in_array($v['fname'], $listcf['show'])) {
114                        $xr[] = $v;
115                    }
116                }
117            } else {
118                foreach ($fldata as $key => $v) {
119                    if ($v['xr'] == 0) {
120                        $xr[] = $v;
121                    }
122                }
123            }
124            if (count($listcf['xnlist']) > 0) {
125                foreach ($listcf['xnlist'] as $v) {
126                    $xr[] = $v;
127                }
128            }
129            Tr($xr, 'xr');
130            if (count($listcf['gj']) > 0) {
131                foreach ($fldata as $key => $v) {
132                    if (in_array($v['fname'], $listcf['gj'])) {
133                        $gj[] = $v;
134                    }
135                }
136            } else {
137                foreach ($fldata as $key => $v) {
138                    if ($v['gj'] == 1) {
139                        $gj[] = $v;
140                    }
141                }
142            }
143            if ($gj != '') {
144                foreach ($gj as $key => $value) { $js[] = EXT::GG($value['id']); }
145            }
146            Tr($ckbox, 'ckbox');
147            Tr($js, 'js');
148            $gj && Tr('1', 'gjright');
149            if ($listcf['ss']) { Tr($listcf['ss'], 'titlesearch'); } else { Tr('title', 'titlesearch'); }
150            $tree = Dgd(array(
151                'db' => 'd_sevenel',
152                'cd' => "del!=1 and id = '" . $_GET['tid'] . "' ",
153                'tn' => "tree",
154                'limit' => 1
155                    ));
156            Tr($tree, 'tree');
157            if ($tree['expand']) {
158                $fstree = Dgd(array(
159                    'db' => 'd_sevenel',
160                    'cd' => "del!=1 and id in (0," . $tree['expand'] . ") ",
161                    'tn' => "tree"
162                        )); }
163            $fsstr = '';
164            if ($fstree) {
165                foreach ($fstree as $fsvalue) {
166                    $ttree = Dgd(array(
167                        'db' => 'd_sevenel',
168                        'cd' => "del!=1 and id = " . $fsvalue['id'] . "",
169                        'tn' => "tree",
170                        'limit' => '1'
171                            ));
172                    if ($ttree['config'] != '' && $ttree['config'] != '{"lg":""}') { $fsstr.=",{xtype:\"button\",text:\"??" . $fsvalue['title'] . "\",iconCls:\"fsadd\",pressed:true,handler:function(){
173				var record = grid.getStore().getAt(rowIndex);
174				fsadd('" . $fsvalue['id'] . "','" . $fsvalue['title'] . "',\"./dy/index.php?op=loaddata&tid=" . $fsvalue['id'] . "&bdtid=" . $_GET['tid'] . "&bdid=\",record.data.id);		}}
175				,{xtype:\"button\",text:\"??" . $fsvalue['title'] . "\",iconCls:\"fslist\",pressed:true,handler:function(){
176				var record = grid.getStore().getAt(rowIndex);
177				fslist('" . $fsvalue['id'] . "','" . $fsvalue['title'] . "',\"./dy/index.php?tid=" . $fsvalue['id'] . "&bdtid=" . $_GET['tid'] . "&bdid=\",record.data.id);
178					}}";
179                    } else {
180                        $fsstr.=",{xtype:\"button\",text:\"??" . $fsvalue['title'] . "\",iconCls:\"fsadd\",pressed:true,handler:function(){
181				var record = grid.getStore().getAt(rowIndex);
182				fsadd('" . $fsvalue['id'] . "','" . $fsvalue['title'] . "',\"./show1/i.php?op=add&tid=" . $fsvalue['id'] . "&bdtid=" . $_GET['tid'] . "&bdid=\",record.data.id);		}}
183				,{xtype:\"button\",text:\"??" . $fsvalue['title'] . "\",iconCls:\"fslist\",pressed:true,handler:function(){
184				var record = grid.getStore().getAt(rowIndex);
185				fslist('" . $fsvalue['id'] . "','" . $fsvalue['title'] . "',\"./show1/l.php?op=list&tid=" . $fsvalue['id'] . "&bdtid=" . $_GET['tid'] . "&bdid=\",record.data.id);
186					}}";
187                    }
188                } }
189
190                /**
191                 * ???????
192                 */
193                $config_tmp = json_decode($tree['config'],true);
194                if (1 == $config_tmp['realtime_price'] || 1 == $config_tmp['realtime_room']){
195                    $realtime_title = '??';
196                    //????
197                    $realtime_url = "/gl/price/real_time.php?bdb={$fsvalue['id']}";
198                    $realtime_title_tmp = array();
199                    //??????:?????
200                    $realtime_type = '';
201                    if (1 == $config_tmp['realtime_price']){
202                        $realtime_title_tmp[] = '??';
203                        $realtime_type .= '&realtime_show_price=1';
204                    }
205                    if (1 == $config_tmp['realtime_room']){
206                        $realtime_title_tmp[] = '??';
207                        $realtime_type .= '&realtime_show_room=1';
208                    }
209                    $realtime_title .= implode('/', $realtime_title_tmp);
210                    $realtime_url .= $realtime_type;
211                    $fsstr .= <<<EQT
212                        ,{
213                        xtype:"button",
214                        text:"{$realtime_title}",
215                        iconCls:"real_time",
216                        pressed:true,
217                        handler:function(){
218                            var record = grid.getStore().getAt(rowIndex);
219                            //createTab('tab_'+record.data.id,record.data.title+'-{$realtime_title}','{$realtime_url}&bdid='+record.data.id);
220                            fsadd('tab_{$fsvalue['id']}',record.data.title+'-{$fsvalue['title']}','{$realtime_url}&&bdid=',record.data.id);
221                            //fslist('{$fsvalue['id']}','{$realtime_title}',"./dy/index.php?tid={$fsvalue['id']}&bdtid={$_GET['tid']}&bdid=",record.data.id);
222                        }
223                    }
224EQT;
225                }
226
227            Tr($fsstr, 'fstree');
228
229            $table = Dgd(array(
230                'db' => 'd_sevenel',
231                'cd' => "del!=1 and id = '" . $tree['table'] . "' ",
232                'tn' => "datamod",
233                'limit' => 1
234                    ));
235            Tr($table, 'table');
236
237            Ts('dy/list.html');
238            break;
239        }
240    case 'fy': {
241            if ($_SESSION['rcg'] != 'A' && !$_SESSION['rcg']['c'][$_POST['tid']]) {
242                $pt = $listcf['pt'];
243            }
244            $_REQUEST['lg'] != '' && $lgcondition = " and lg like '" . $_REQUEST['lg'] . "' ";
245            $fldata = Dgd(array(
246                'db' => 'd_sevenel',
247                'cd' => "del!=1 and tid = '" . $_POST['tid'] . "' " . $lgcondition . " order by px asc ",
248                'tn' => "fld"
249                    ));
250            $zhuanyi = array();
251            $btsc = array();
252            $gjsc = array();
253            foreach ($fldata as $key => $value) {
254                if ($value['zy'] == 1) {
255                    $zhuanyi[] = $value;
256                }
257                if ($value['bt'] == 1) {
258                    $btsc[$value['fname']] = $value['type'];
259                }
260                /*
261                 * ??????????????
262                 */
263                if (($value['type'] == 'textfield' || $value['type'] == 'fckeditor') && $_POST['title']!=''){
264                    $_search_array_tmp [] = " {$value['fname']} like '%{$_POST['title']}%'";
265                }
266            }
267            //?? ???????
268            if($_search_array_tmp!='') {
269                $_search_array_tmp = ' and ('.join(' or ',$_search_array_tmp).') ';
270            }
271
272            $condition = $_search_array_tmp;
273            //$_POST['user']&&$condition.="and user like '%".$_POST['user']."%' ";
274            $_POST['bdtid'] && $condition.="and bdtid = '" . $_POST['bdtid'] . "' ";
275            $_POST['bdid'] && $condition.="and bdid = '" . $_POST['bdid'] . "' ";
276            //$_POST['title'] && $condition.="and title = '%" . $_POST['title'] . "%' ";
277            if (count($listcf['gj']) > 0) {
278                foreach ($fldata as $key => $v) {
279                    if (in_array($v['fname'], $listcf['gj'])) {
280                        $gj[] = $v;
281                    }
282                }
283            } else {
284                foreach ($fldata as $key => $v) {
285                    if ($v['gj'] == 1) {
286                        $gj[] = $v;
287                    }
288                }
289            }
290            if ($gj != '') {
291                $xzt = array('combo', 'recommend', 'radiogroup', 'combo1');
292                foreach ($gj as $value) {
293                    if (in_array($value['type'], $xzt)) {
294                        $_POST[$value['fname']] != '' && $condition.="and " . $value['fname'] . " = '" . $_POST[$value['fname']] . "' ";
295                    } else {
296                        if ($value['type'] == 'checkboxgroup') {
297                            if ($_POST[$value['fname']]) {
298                                foreach ($_POST[$value['fname']] as $cv) {
299                                    $cv != '' && $condition.="and " . $value['fname'] . " like '%" . $cv . "%' ";
300                                }
301                            }
302                        } else {
303                            $_POST[$value['fname']] != '' && $condition.="and " . $value['fname'] . " like '%" . $_POST[$value['fname']] . "%' ";
304                        }
305                    }
306                }
307            }
308            $dbinfo = Dgd(array(
309                'db' => 'd_sevenel',
310                'tn' => $_POST['dbname'],
311                'start' => $_POST['start'],
312                'limit' => $_POST['limit'],
313                'total' => true,
314                // 'ce'=>1,
315                'cd' => "tid = '" . $_POST['tid'] . "' " . $condition . "  and del != '1' " . $pt . " " . $lgcondition . " order by " . $paixu['zd'] . "  " . $paixu['order'] . "  "
316                    ));
317            //??
318            //??
319            $tempb = 0;
320            foreach ($dbinfo['data'] as $key => $value) {
321//							$tempb+=$value['ct'];
322
323                foreach ($zhuanyi as $zyv) {
324                    switch ($zyv['type']) {
325                        case 'fileup': {
326                                //echo $dbinfo['data'][$key][$zyv['fname']];
327                                $config = json_decode($zyv['cfg'], true);
328                                $config['sclj'] || $config['sclj'] = 'pic';
329                                $dvalue = array(0 => array('rar', 'zip', 'tar', '.tz'),
330                                    1 => array('jpg', 'gif', 'png', 'bmp'),
331                                    2 => array('mp3', 'mp4', 'avi', 'wmv', 'mid', '.rm', 'mvb', 'mov', 'wma', 'wav'),
332                                    3 => array('doc', 'xls', 'txt', 'ocx', 'lsx', 'ppt', 'pdf', 'chm'),
333                                    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')
334                                );
335                                $otype = substr(strtolower($dbinfo['data'][$key][$zyv['fname']]), -3);
336                                if (in_array($otype, $dvalue[0])) {
337                                    $dbinfo['data'][$key][$zyv['fname']] = "<a href=\"/uplods/{$config['sclj']}/" . $dbinfo['data'][$key][$zyv['fname']] . "\" target='_blank'><img src=\"../img/archive.png\">??[Download]</a>";
338                                }
339                                if (in_array($otype, $dvalue[1])) {
340                                    if ($config['sl1'] == 1) {
341                                        $dbinfo['data'][$key][$zyv['fname']] = "<img src=\"/uplods/thumb1/" . $dbinfo['data'][$key][$zyv['fname']] . "\" >";
342                                    } elseif ($config['sl2'] == 1) {
343                                        $dbinfo['data'][$key][$zyv['fname']] = "<img src=\"/uplods/thumb2/" . $dbinfo['data'][$key][$zyv['fname']] . "\" >";
344                                    } elseif ($config['sypic'] == 1 || $config['sytxt'] == 1) {
345                                        $dbinfo['data'][$key][$zyv['fname']] = "<img src=\"/uplods/sytp/" . $dbinfo['data'][$key][$zyv['fname']] . "\"  width=\"100px\">";
346                                    } else {
347                                        $dbinfo['data'][$key][$zyv['fname']] = "<img src=\"/uplods/pic/" . $dbinfo['data'][$key][$zyv['fname']] . "\"  width=\"100px\">";
348                                    }
349                                }
350                                if (in_array($otype, $dvalue[2])) {
351                                    $dbinfo['data'][$key][$zyv['fname']] = "<a href=\"/uplods/pic/" . $dbinfo['data'][$key][$zyv['fname']] . "\" target='_blank'><img src=\"../img/film_link.png\">??[Download]</a>";
352                                }
353                                if (in_array($otype, $dvalue[3])) {
354                                    $dbinfo['data'][$key][$zyv['fname']] = "<a href=\"/uplods/pic/" . $dbinfo['data'][$key][$zyv['fname']] . "\" target='_blank'><img src=\"../img/report_word.png\">??[Download]</a>";
355                                }
356                                break;
357                            }
358                        case 'radiogroup': {
359                                $tempxx = json_decode($zyv['zyz'], true);
360                                foreach ($tempxx as $value) {
361                                    if ($value['yv'] == $dbinfo['data'][$key][$zyv['fname']]) {
362                                        $dbinfo['data'][$key][$zyv['fname']] = $value['xv'];
363                                    }
364                                }
365                                break;
366                            }
367                        case 'checkboxgroup': {
368                                $tempxx = json_decode($zyv['zyz'], true);
369                                $nowv = explode('#_#', $dbinfo['data'][$key][$zyv['fname']]);
370                                $dbinfo['data'][$key][$zyv['fname']] = '';
371                                foreach ($tempxx as $value) {
372                                    if (in_array($value['yv'], $nowv)) {
373                                        $dbinfo['data'][$key][$zyv['fname']].=$value['xv'] . "<BR>";
374                                    }
375                                }
376                                break;
377                            }
378                        case 'combo': {
379                                $tempxx = json_decode($zyv['zyz'], true);
380                                foreach ($tempxx as $value) {
381                                    if ($value['yv'] == $dbinfo['data'][$key][$zyv['fname']]) {
382                                        $dbinfo['data'][$key][$zyv['fname']] = $value['xv'];
383                                    }
384                                }
385                                break;
386                            }
387                        case 'combo1': {
388                                $config = json_decode($zyv['cfg'], true);
389                                $tq = Dgd(array(
390                                    'db' => 'd_sevenel',
391                                    'tn' => $config['table'],
392                                    'cd' => "del!=1 and " . $config['y'] . " = '" . $dbinfo['data'][$key][$zyv['fname']] . "' and  " . $config['conditon'],
393                                    'limit' => 1
394                                        ));
395                                $dbinfo['data'][$key][$zyv['fname']] = $tq[$config['x']];
396                                break;
397                            }
398                        case 'recommend': {
399                                $config = json_decode($zyv['cfg'], true);
400                                if ($dbinfo['data'][$key][$zyv['fname']] != 0) {
401                                    $dbinfo['data'][$key][$zyv['fname']] = "<a href=\"#\" onclick='gxzd(\"" . $dbinfo['data'][$key]['id'] . "\",\"" . $zyv['fname'] . "\",\"0\")' title=\"??????????\"  >  <img src=\"../img/" . $config['paixu'] . "\"></a> " . (($config['px']) ? ("<a href=\"#\"  title=\"??[order]\"  onclick='tjpx(\"" . $_POST['tid'] . "@" . $_POST['dbname'] . "\",\"" . $zyv['fname'] . "\")' >   <img src=\"../img/sucaiwcom8170000bzc.gif\" ait=\"??[order]\"></a>") : ("")) . " ";
402                                } else {
403                                    $dbinfo['data'][$key][$zyv['fname']] = "<a href=\"#\" onclick='gxzd(\"" . $dbinfo['data'][$key]['id'] . "\",\"" . $zyv['fname'] . "\",\"1\")'  title=\"????????\"  ><img src=\"../img/flag.png\"></a>  " . (($config['px']) ? ("<a href=\"#\"  title=\"??[order]\"  onclick='tjpx(\"" . $_POST['tid'] . "@" . $_POST['dbname'] . "\",\"" . $zyv['fname'] . "\")' >   <img src=\"../img/sucaiwcom8170000bzc.gif\" ait=\"??[order]\"></a>") : ("")) . "";
404                                }
405                                break;
406                            }
407                    }
408                }
409                /* 						$dbinfo['data'][$key]['yuding']="<input type='button' value='???' onclick='yuding(".$dbinfo['data'][$key]['id'].")'/>";
410                  $dbinfo['data'][$key]['num']="<input type='text' value='1' name='num".$dbinfo['data'][$key]['id']."' id='num".$dbinfo['data'][$key]['id']."' />";
411                 */ }
412            /*
413              $tempz=$d_sevenel->Dqsql("select sum(ct) as total from  `se_user` where tid = '".$_POST['tid']."'  and del != '1' ");
414              $dbinfo['dq']=$tempb;
415              $dbinfo['zong']=$tempz[0]['total'];
416             */ echo json_encode($dbinfo);
417            break;
418        }
419    case 'width_change': {
420            $id = $_POST['id'];
421            Du('sevenel', 'fld', array('wd' => $_POST['width']), 'id', $id, 1);
422            echo 'ok';
423            break;
424        }
425    case 'del': {
426            $_POST['del'] = 1;
427            $_POST['ids'] = json_decode(stripslashes($_POST['ids']));
428            if (is_array($_POST['ids'])) {
429                foreach ($_POST['ids'] as $id) {
430                    Du('sevenel', $_POST['dbname'], $_POST, 'id', $id, 0);
431                }
432            } else {
433                Du('sevenel', $_POST['dbname'], $_POST, 'id', $id, 0);
434            }
435            echo '{success:true,msg:\'ok\'}';
436            break;
437        }
438
439    case 'add': {
440            $tree_id = $_GET['tid'];
441            Tr($_GET['tid'], 'tid');
442            Tr($_GET['bdtid'], 'bdtid');
443            Tr($_GET['bdid'], 'bdid');
444            Tr($_GET['gid'], 'gid');
445
446            $tree = Dgd(array(
447                'db' => 'd_sevenel',
448                'cd' => "del!=1 and id = $tree_id",
449                'tn' => "tree",
450                'limit' => 1
451                    ));
452            $tname = gettabname($tree['table'], $dbcfg['prefix'], true);
453            Tr($tname, 'tname');
454            if ($_GET['id']) {
455                Tr($_GET['id'], 'id');
456                $fdada = Dgd(array(
457                    'db' => 'd_sevenel',
458                    'cd' => "id = '" . $_GET['id'] . "' and del != '1' ",
459                    'tn' => "$tname",
460                    'limit' => 1
461                        ));
462                Tr(preg_replace("/[\s]{2,}/", "", $fdada['lg']), 'lg');
463            }
464            if ($_GET['id'] == 0) {
465                Tr('??', 'action');
466            } else {
467                Tr('??', 'action');
468            }
469            $_REQUEST['lg'] != '' && $condition = " and lg like '" . $_REQUEST['lg'] . "' ";
470            $fldata = Dgd(array(
471                'db' => 'd_sevenel',
472                'cd' => "del!=1 and tid = '" . $_GET['tid'] . "' " . $condition . " order by px asc ",
473                'tn' => "fld"
474                    ));
475
476
477            $fcf = '';
478            $fcf.="{
479								xtype:'fieldset',
480								title: '????',
481								autoHeight: true,
482								items: [";
483            foreach ($fldata as $value) {
484                $fcf.=EXT::GB($value['fname']) . ",";
485            }
486            $fcf = substr($fcf, 0, -1);
487            $fcf.="]},";
488
489            $fcf = substr($fcf, 0, -1);
490            Tr($fcf, 'fcf');
491            Tr($plugurl, 'plugurl');
492            Tr($plugjs, 'plugjs');
493            Tr($fckplugin, 'fckplugin');
494
495            Ts($tmpml . 'add.html');
496            break; }
497    case 'save': {
498
499            $condition = " and lg like 'zh' ";
500            $id = $_POST['id'];
501            $tree_id = $_POST['tid'];
502            $tree = Dgd(array(
503                'db' => 'd_sevenel',
504                'cd' => "del!=1 and id = $tree_id ",
505                'tn' => "tree",
506                'limit' => '1'
507                    ));
508            $tabname = gettabname($tree['table'], '', true);
509            $fld = Dgd(array(
510                'db' => 'd_sevenel',
511                'cd' => "del!=1 and tid = $tree_id {$condition}",
512                'tn' => "fld"
513                    ));
514            /* 		if(!$id){
515              $wyyz='user';
516              $wztemp=Dgd(array(
517              'db'=>'d_sevenel',
518              'cd'=>"$wyyz like '".$_POST[$wyyz]."'",
519              'tn'=>$tabname,
520              'limit'=>'1'
521              ));
522              if($wztemp!=''){
523              ext_request_failure('??????');
524              exit();
525              }
526              }
527             */ foreach ($fld as $key => $value) {
528                switch ($value['type']) {
529
530                    case 'datefield':
531                    case 'my97': {
532                            if ($value['zy'] != 1) {
533                                if (strtotime($_POST[$value['fname']])) {
534                                    $save[$value['fname']] = strtotime($_POST[$value['fname']]);
535                                } else {
536                                    $save[$value['fname']] = $_POST[$value['fname']];
537                                }
538                            } else {
539                                $save[$value['fname']] = $_POST[$value['fname']];
540                            }
541                            break; }
542                    case 'checkboxgroup': {
543                            $save[$value['fname']] = implode("#_#", $_POST[$value['fname']]);
544                            break; }
545                    case 'password';
546                        {
547                            if ($value['yxwk'] == '1') {
548                                if ($_POST[$value['fname']] == $_POST[$value['fname'] . '-cfrm']) {
549                                    $save [$value['fname']] = md5($_POST[$value['fname']]);
550                                } else {
551                                    ext_request_failure('???????');
552                                    exit();
553                                }
554                            } else {
555                                $save [$value['fname']] = md5($_POST[$value['fname']]);
556                            }
557                            break; }
558                    case 'fileup': {
559                            //print_r($_FILES);exit;
560                            if ($_FILES[$value['fname']]['name'] != '') {
561                                $cp = 1;
562                                //????
563                                $config = json_decode($value['cfg'], true);
564
565
566                                $dvalue = array(0 => array('rar', 'zip', 'tar', '.tz'),
567                                    1 => array('jpg', 'gif', 'png', 'bmp'),
568                                    2 => array('mp3', 'mp4', 'avi', 'wmv', 'mid', '.rm', 'mvb', 'mov', 'wma', 'wav'),
569                                    3 => array('doc', 'xls', 'txt', 'ocx', 'lsx', 'ppt', 'pdf', 'chm'),
570                                    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')
571                                );
572                                if (!$_FILES[$value['fname']]['name']) {
573                                    $cp = 0;
574                                }
575                                $otype = substr(strtolower($_FILES[$value['fname']]['name']), -3);
576                                if (!in_array($otype, $dvalue[$config['type']])) {
577                                    $cp = 0;
578                                    header("Content-type: text/html; charset: UTF-8");
579                                    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!'}";
580                                    exit;
581                                }
582                                if ($_FILES[$value['fname']]['size'] / 1000 > $config['size']) {
583                                    $cp = 0;
584                                    header("Content-type: text/html; charset: UTF-8");
585                                    echo "{success:true,msg:'%u6587%u4EF6%u5927%u5C0F%u8D85%u8FC7%u9650%u5236%21<br> The file size limit expired!'}";
586                                    exit;
587                                }
588                                if ($cp) {
589                                    $bsname = floor(Bic());
590                                    $bcname = $bsname . "." . $otype;
591                                    $filename = "../../uplods/pic/" . $bcname;
592                                    $copymes = copy($_FILES[$value['fname']]['tmp_name'], $filename);
593                                    $save[$value['fname']] = $bcname;
594                                }
595                                if (in_array($otype, $dvalue[1])) {
596                                    if ($config['sl1'] == 1) {
597                                        @createthumb($_FILES[$value['fname']]['tmp_name'], "." . $otype, $bsname, $config['sl1x'], $config['sl1y'], '1');
598                                    }
599                                    if ($config['sl2'] == 1) {
600                                        @createthumb($_FILES[$value['fname']]['tmp_name'], "." . $otype, $bsname, $config['sl2x'], $config['sl2y'], '2');
601                                    }
602                                    if ($config['sypic'] == 1) {
603                                        $sypicname = "../../uplods/sypic/" . $bcname;
604                                        $sypicwz = "../../uplods/" . $config['sytp'] . "";
605                                        //echo $sypicwz ,$config['sytp'],$config['sywz'];
606                                        @imageWaterMark($filename, $sypicname, $config['sypicwz'], $sypicwz, "", 20, 'wqy-microhei-lite.ttc', "#00FF00");
607                                    }
608                                    if ($config['sytxt'] == 1) {
609                                        $sypicname = "../../uplods/sytxt/" . $bcname;
610                                        $sypicwz = "";
611                                        @imageWaterMark($filename, $sypicname, $config['sytxtwz'], "", $config['sywz'], $config['sywzdx'], $config['syzt'], "#" . $config['syys']);
612                                    }
613                                    if ($config['sytxt'] == 1 && $config['sypic'] == 1) {
614                                        $filename = "../../uplods/sypic/" . $bcname;
615                                        $sypicname = "../../uplods/sytp/" . $bcname;
616                                        $sypicwz = "";
617                                        @imageWaterMark($filename, $sypicname, $config['sytxtwz'], "", $config['sywz'], $config['sywzdx'], $config['syzt'], "#" . $config['syys']);
618                                    }
619                                }
620                            }
621                            break; }
622                    default: {
623                            $save[$value['fname']] = $_POST[$value['fname']];
624                        }
625                }
626            }
627            $save['tid'] = $tree_id;
628            $save['lg'] = $_POST['lg'];
629            !$save['lg'] && $save['lg'] = 'zh';
630            $_POST['bdid'] && $save['bdid'] = $_POST['bdid'];
631            $_POST['bdtid'] && $save['bdtid'] = $_POST['bdtid'];
632            $save['gid'] = $_POST['gid'];
633            !$save['gid'] && $save['gid'] = Mct();
634            $save['at'] = time();
635            //???
636            if ($id != 0) {
637                if ($listcf['editdisble'] != '') {
638                    foreach ($listcf['editdisble'] as $tv) {
639                        unset($save[$tv]);
640                    }
641                }
642                if (Du('sevenel', $tabname, $save, 'id', $id, 1)) ext_request('ok');
643            }else {
644                if (Di('sevenel', $tabname, $save)) ;
645                ext_request('ok');
646            }
647            break; }
648    case 'yuding': {
649            $id = $_POST['id'];
650            $prodinfo = Dgd(array(
651                'db' => 'd_sevenel',
652                'cd' => "del!=1 and id = $id",
653                'tn' => "info",
654                'limit' => '1'
655                    ));
656            if ($prodinfo) {
657                $insert['tid'] = '108';
658                $insert['tt'] = $prodinfo['tt'];
659                $insert['pic1'] = $prodinfo['pic1'];
660                $insert['ct'] = $prodinfo['ct'];
661                $insert['input2'] = $prodinfo['input2'];
662                $insert['input1'] = $prodinfo['input1'];
663                $insert['ubb1'] = $prodinfo['ubb1'];
664                $insert['input4'] = $_SESSION['userinfo']['user'];
665                $insert['input5'] = $_POST['num'];
666                $insert['input6'] = $_POST['num'] * $prodinfo['ct'];
667                $insert['tj1'] = 2;
668                $insert['lg'] = 'zh';
669                $insert['bdid'] = $prodinfo['id'];
670                $insert['bdtid'] = $prodinfo['tid'];
671                $insert['gid'] = Mct();
672                $insert['at'] = time();
673                Di('sevenel', 'info', $insert);
674                echo "????????????";
675                exit;
676            } else {
677                echo "????,??????";
678                exit;
679            }
680
681            break; }
682    case 'qkzd': {
683            $save[$_POST['zd']] = '';
684            if (Du('sevenel', $_POST['tname'], $save, 'id', $_POST['id'], 1)) ext_request('ok'); break;
685        }
686    case 'gxzd': {
687            $save[$_POST['zd']] = $_POST['xz'];
688            if (Du('sevenel', $_POST['tname'], $save, 'id', $_POST['id'], 1)) ext_request('ok'); break;
689        }
690    case 'loaddata': {
691
692            $tid = $_GET['tid'];
693            Tr($tid, 'tid');
694            $tree = Dgd(array(
695                'db' => 'd_sevenel',
696                'cd' => "del!=1 and id = $tid",
697                'tn' => "tree",
698                'limit' => '1'
699                    ));
700            Tr($_GET['tid'], 'tid');
701            Tr($_GET['bdtid'], 'bdtid');
702            Tr($_GET['bdid'], 'bdid');
703            $tname = gettabname($tree['table'], $dbcfg['prefix'], true);
704            Tr($tname, 'tname');
705            if ($_GET['id']) {
706                Tr($_GET['id'], 'id');
707                $fdada = Dgd(array(
708                    'db' => 'd_sevenel',
709                    'cd' => "del!=1 and id = '" . $_GET['id'] . "' and del != '1' ",
710                    'tn' => "$tname",
711                    'limit' => 1
712                        ));
713                Tr($fdada['gid'], 'gid');
714                $gid = $fdada['gid'];
715                $fdada = Dgd(array(
716                    'db' => 'd_sevenel',
717                    'cd' => " gid = '" . $fdada['gid'] . "' and del != '1' ",
718                    'tn' => "$tname"
719                        ));
720                foreach ($fdada as $value) {
721                    $templg[$value['lg']] = $value['id'];
722                }
723            }
724            !$gid && $gid = Mct();
725            if ($tree['config'] != '') {
726                $tconfig = json_decode($tree['config'], true);
727                $nowlg = explode('|', $tconfig['lg']);
728                foreach ($nowlg as $tv) {
729                    $standlang[$tv] && $xhlg[] = array('lg' => $tv, 'value' => $standlang[$tv], 'id' => $templg[$tv], 'gid' => $gid);
730                }
731                if ($xhlg) {
732                    Tr($xhlg, 'dy');
733                }
734                Tr($_GET['lg'], 'slg');
735                Ts($tmpml . 'info.html');
736            }
737            break;
738        }
739    default: {
740            $tid = $_GET['tid'];
741            Tr($tid, 'tid');
742            $tree = Dgd(array(
743                'db' => 'd_sevenel',
744                'cd' => "del!=1 and id = $tid",
745                'tn' => "tree",
746                'limit' => '1'
747                    ));
748            if ($tree['config'] != '') {
749                $tconfig = json_decode($tree['config'], true);
750                $nowlg = explode('|', $tconfig['lg']);
751                foreach ($nowlg as $tv) {
752                    $standlang[$tv] && $xhlg[] = array('lg' => $tv, 'value' => $standlang[$tv], 'bdid' => $_GET['bdid'], 'bdtid' => $_GET['bdtid']);
753                }
754                if ($xhlg) {
755                    Tr($xhlg, 'dy');
756                }
757                Ts($tmpml . 'index.html');
758            }
759            break;
760        }
761}
762?>