BVB Source Codes

Shandong kernel enterprise stand the source code Show mychannel_field_edit.php Source code

Return Download Shandong kernel enterprise stand the source code: download mychannel_field_edit.php Source code - Download Shandong kernel enterprise stand the source code Source code - Type:.php
  1. <?php
  2. require_once(dirname(__FILE__)."/config.php");
  3. CheckPurview('c_New');
  4. require_once(DEDEINC."/dedetag.class.php");
  5. require_once(dirname(__FILE__)."/inc/inc_admin_channel.php");
  6.  
  7. if(empty($action)) {
  8.         $action = '';
  9. }
  10.  
  11. $id = isset($id) && is_numeric($id) ? $id : 0;
  12.  
  13. $mysql_version = $dsql->GetVersion();
  14.  
  15. //获取模型信息
  16. $row = $dsql->GetOne("Select fieldset,'' as maintable,addtable,issystem From `#@__channeltype` where id='$id'");
  17. $fieldset = $row['fieldset'];
  18. $trueTable = $row['addtable'];
  19.  
  20. $dtp = new DedeTagParse();
  21. $dtp->SetNameSpace("field","<",">");
  22. $dtp->LoadSource($fieldset);
  23. foreach($dtp->CTags as $ctag)
  24. {
  25.         if(strtolower($ctag->GetName())==strtolower($fname))
  26.         {
  27.                 break;
  28.         }
  29. }
  30.  
  31. //字段类型信息
  32. $ds = file(dirname(__FILE__)."/inc/fieldtype.txt");
  33. foreach($ds as $d)
  34. {
  35.         $dds = explode(',',trim($d));
  36.         $fieldtypes[$dds[0]] = $dds[1];
  37. }
  38.  
  39. //保存更改
  40. /*--------------------
  41. function _SAVE()
  42. ----------------------*/
  43. if($action=='save')
  44. {
  45.         if(!isset($fieldtypes[$dtype]))
  46.         {
  47.                 ShowMsg("你修改的是系统专用类型的数据,禁止操作!","-1");
  48.                 exit();
  49.         }
  50.        
  51.         $dfvalue = $vdefault;
  52.        
  53.         if(ereg('^(select|radio|checkbox)',$dtype))
  54.         {
  55.                 if(!ereg(',',$dfvalue))
  56.                 {
  57.                         ShowMsg("你设定了字段为 {$dtype} 类型,必须在默认值中指定元素列表,如:'a,b,c' ","-1");
  58.                         exit();
  59.                 }
  60.         }
  61.        
  62.         if($dtype=='stepselect')
  63.         {
  64.                 $arr = $dsql->GetOne("Select * From `#@__stepselect` where egroup='$fieldname' ");
  65.                 if(!is_array($arr))
  66.                 {
  67.                         ShowMsg("你设定了字段为联动类型,但系统中没找到与你定义的字段名相同的联动组名!","-1");
  68.                         exit();
  69.                 }
  70.         }
  71.  
  72.         //检测数据库是否存在附加表,不存在则新建一个
  73.         $tabsql = "CREATE TABLE IF NOT EXISTS  `{$row['addtable']}`( `aid` int(11) NOT NULL default '0',\r\n `typeid` int(11) NOT NULL default '0',\r\n ";
  74.         if($mysql_version < 4.1)
  75.         {
  76.                 $tabsql .= " PRIMARY KEY  (`aid`), KEY `".$trueTable."_index` (`typeid`)\r\n) TYPE=MyISAM; ";
  77.         }
  78.         else
  79.         {
  80.                 $tabsql .= " PRIMARY KEY  (`aid`), KEY `".$trueTable."_index` (`typeid`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; ";
  81.         }
  82.         $dsql->ExecuteNoneQuery($tabsql);
  83.  
  84.         //检测附加表里含有的字段
  85.         $fields = array();
  86.         $rs = $dsql->SetQuery("show fields from `{$row['addtable']}`");
  87.         $dsql->Execute('a');
  88.         while($nrow = $dsql->GetArray('a',MYSQL_ASSOC))
  89.         {
  90.                 $fields[ strtolower($nrow['Field']) ] = $nrow['Type'];
  91.         }
  92.  
  93.         //修改字段配置信息
  94.         $isnull = ($isnull==1 ? "true" : "false");
  95.         $mxlen = $maxlength;
  96.         $fieldname = strtolower($fname);
  97.  
  98.         //检测被修改的字段类型,并更新数据表
  99.         $fieldinfos = GetFieldMake($dtype,$fieldname,$dfvalue,$mxlen);
  100.         $ntabsql = $fieldinfos[0];
  101.         $buideType = $fieldinfos[1];
  102.         $tabsql  = '';
  103.  
  104.         //检测旧数据类型,并替换为新配置
  105.         foreach($dtp->CTags as $tagid=>$ctag)
  106.         {
  107.                 if($fieldname==strtolower($ctag->GetName()))
  108.                 {
  109.                         if(isset($fields[$fieldname]) && $fields[$fieldname]!=$buideType)
  110.                         {
  111.                                 $tabsql = "ALTER TABLE `$trueTable` CHANGE `$fieldname` ".$ntabsql;
  112.                                 $dsql->ExecuteNoneQuery($tabsql);
  113.                         }else if(!isset($fields[$fieldname]))
  114.                         {
  115.                                 $tabsql = "ALTER TABLE `$trueTable` ADD ".$ntabsql;
  116.                                 $dsql->ExecuteNoneQuery($tabsql);
  117.                         }else
  118.                         {
  119.                                 $tabsql = '';
  120.                         }
  121.                         $dtp->Assign($tagid,stripslashes($fieldstring),false);
  122.                         break;
  123.                 }
  124.         }
  125.         $oksetting = $dtp->GetResultNP();
  126.        
  127.         $addlist = GetAddFieldList($dtp,$oksetting);
  128.         $oksetting = addslashes($oksetting);
  129.         $dsql->ExecuteNoneQuery("Update `#@__channeltype` set fieldset='$oksetting',listfields='$addlist' where id='$id' ");
  130.        
  131.         ShowMsg("成功更改一个字段的配置!","mychannel_edit.php?id={$id}&dopost=edit&openfield=1");
  132.        
  133.         exit();
  134. }
  135. /*------------------
  136. 删除字段
  137. function _DELETE()
  138. -------------------*/
  139. else if($action=="delete")
  140. {
  141.         if($row['issystem']==1)
  142.         {
  143.                 ShowMsg("对不起,系统模型的字段不允许删除!","-1");
  144.                 exit();
  145.         }
  146.  
  147.         //检测旧数据类型,并替换为新配置
  148.         foreach($dtp->CTags as $tagid=>$ctag)
  149.         {
  150.                 if(strtolower($ctag->GetName())==strtolower($fname))
  151.                 {
  152.                         $dtp->Assign($tagid,"#@Delete@#");
  153.                 }
  154.         }
  155.         $oksetting = addslashes($dtp->GetResultNP());
  156.        
  157.         $dsql->ExecuteNoneQuery("Update `#@__channeltype` set fieldset='$oksetting' where id='$id' ");
  158.        
  159.         $dsql->ExecuteNoneQuery("ALTER TABLE `$trueTable` DROP `$fname` ");
  160.        
  161.         ShowMsg("成功删除一个字段!","mychannel_edit.php?id={$id}&dopost=edit&openfield=1");
  162.         exit();
  163. }
  164.  
  165. require_once(DEDEADMIN."/templets/mychannel_field_edit.htm");
  166.  
  167. ?>
downloadmychannel_field_edit.php Source code - Download Shandong kernel enterprise stand the source code Source code
Related Source Codes/Software:
Dede V2.2 dance music program - This system is based on DEDE5.7 sp1 production dan... 2016-11-11
Search engine v1.0 eight grams of novels - This program consists of WEB side and collection p... 2016-11-11
A thief free Jacky novel CMS, support for multiple station collection, support pseudo original SEO - A thief free Jacky novel CMS, support for multiple... 2016-11-11
Kunlun lubricating oil companies stand the source code - Just testing, free, source code is very beautiful ... 2016-11-11
Imitation of Chinese stationmaster net source dreams to 5.7 sp1 source code - Exactly the same and the Director of China network... 2016-11-11
Newscoop CMS v4.0.4 multilingual version - Newscoop is a content management system is mainly ... 2016-11-11
Ku978 navigator free send you department (with acquisition module) - Is I purchase the commercial version of this progr... 2016-11-11
Think of concise message this v1.1 - Wisdom of concise message this V1.1 main functions... 2016-11-11
nvidia-docker - Build and run Docker containers leveraging NVIDIA ... 2017-04-08
quickstart - Angular 2 QuickStart - source from the documentati... 2017-04-08
jQuery-Autocomplete - Ajax Autocomplete for jQuery allows you to easily ... 2017-04-08
Android-Best-Practices - Android best practice examples 2017-04-08
Bootstrap-Admin-Template - Metis - Free Bootstrap Admin Dashboard Template ... 2017-04-08
CocoaSPDY - SPDY for iOS and OS X 2017-04-08
parse-dashboard - A dashboard for managing your Parse apps that aren... 2017-04-08
HoloEverywhere - NO LONGER MAINTAINED. DEVELOP FOR 4.X+ DUDE. 2017-04-08
side-comments - [UNMAINTAINED] An interface component to give your... 2017-04-08
SVG-Morpheus - JavaScript library enabling SVG icons to morph fro... 2017-04-08

 Back to top