BVB Source Codes

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

Return Download Shandong kernel enterprise stand the source code: download diy_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.  
  4. //增加权限检查
  5.  
  6. require_once(DEDEINC."/dedetag.class.php");
  7. require_once(DEDEADMIN."/inc/inc_admin_channel.php");
  8. if(empty($action))
  9. {
  10.         $action = '';
  11. }
  12.  
  13. //获取模型信息
  14. $mysql_version = $dsql->GetVersion();
  15. $mysql_versions = explode(".",trim($mysql_version));
  16. $mysql_version = $mysql_versions[0].".".$mysql_versions[1];
  17. $row = $dsql->GetOne("Select `table`,`info` From #@__diyforms where diyid='$diyid'");
  18. $fieldset = $row['info'];
  19. $trueTable = $row['table'];
  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(DEDEADMIN."/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.  
  46.         if(!isset($fieldtypes[$dtype]))
  47.         {
  48.                 ShowMsg("你修改的是系统专用类型的数据,禁止操作!","-1");
  49.                 exit();
  50.         }
  51.  
  52.         //检测数据库是否存在附加表,不存在则新建一个
  53.         $tabsql = "CREATE TABLE IF NOT EXISTS  `$trueTable`(
  54.         `id` int(10) unsigned NOT NULL auto_increment,
  55.         `ifcheck` tinyint(1) NOT NULL default '0',
  56.         ";
  57.         if($mysql_version < 4.1)
  58.         {
  59.                 $tabsql .= " PRIMARY KEY  (`id`)\r\n) TYPE=MyISAM; ";
  60.         }
  61.         else
  62.         {
  63.                 $tabsql .= " PRIMARY KEY  (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; ";
  64.         }
  65.         $dsql->ExecuteNoneQuery($tabsql);
  66.  
  67.         //检测表里含有的字段
  68.         $fields = array();
  69.         $rs = $dsql->SetQuery("show fields from `$trueTable`");
  70.         $dsql->Execute('a');
  71.         while($nrow = $dsql->GetArray('a',MYSQL_ASSOC))
  72.         {
  73.                 $fields[ strtolower($nrow['Field']) ] = $nrow['Type'];
  74.         }
  75.  
  76.         //修改字段配置信息
  77.         $dfvalue = $vdefault;
  78.         $isnull = ($isnull==1 ? "true" : "false");
  79.         $mxlen = $maxlength;
  80.         $fieldname = strtolower($fname);
  81.  
  82.         //检测被修改的字段类型,并更新数据表
  83.         $fieldinfos = GetFieldMake($dtype,$fieldname,$dfvalue,$mxlen);
  84.         $ntabsql = $fieldinfos[0];
  85.         $buideType = $fieldinfos[1];
  86.         $tabsql  = '';
  87.  
  88.         //检测旧数据类型,并替换为新配置
  89.         foreach($dtp->CTags as $tagid=>$ctag)
  90.         {
  91.                 if(trim($fieldname)==trim(strtolower($ctag->GetName())))
  92.                 {
  93.  
  94.                         if(isset($fields[$fieldname]) && $fields[$fieldname]!=$buideType)
  95.                         {
  96.                                 $tabsql = "ALTER TABLE `$trueTable` CHANGE `$fieldname` ".$ntabsql;
  97.                                 $dsql->ExecuteNoneQuery($tabsql);
  98.                         }
  99.                         else if(!isset($fields[$fieldname]))
  100.                         {
  101.                                 $tabsql = "ALTER TABLE `$trueTable` ADD ".$ntabsql;
  102.                                 $dsql->ExecuteNoneQuery($tabsql);
  103.                         }
  104.                         else
  105.                         {
  106.                                 $tabsql = '';
  107.                         }
  108.                         $dtp->Assign($tagid,stripslashes($fieldstring),false);
  109.                         break;
  110.                 }
  111.         }
  112.         $oksetting = $dtp->GetResultNP();
  113.  
  114.         $oksetting = addslashes($oksetting);
  115.         $dsql->ExecuteNoneQuery("Update #@__diyforms set info='$oksetting' where diyid='$diyid' ");
  116.         ShowMsg("成功更改一个字段的配置!","diy_edit.php?diyid={$diyid}");
  117.         exit();
  118. }
  119.  
  120. /*------------------
  121. 删除字段
  122. function _DELETE()
  123. -------------------*/
  124. else if($action=="delete")
  125. {
  126.         //检测旧数据类型,并替换为新配置
  127.         foreach($dtp->CTags as $tagid=>$ctag)
  128.         {
  129.                 if(strtolower($ctag->GetName())==strtolower($fname))
  130.                 {
  131.                         $dtp->Assign($tagid,"#@Delete@#");
  132.                 }
  133.         }
  134.         $oksetting = addslashes($dtp->GetResultNP());
  135.         $dsql->ExecuteNoneQuery("Update #@__diyforms set info='$oksetting' where diyid='$diyid' ");
  136.         $dsql->ExecuteNoneQuery("ALTER TABLE `$trueTable` DROP `$fname` ");
  137.         ShowMsg("成功删除一个字段!","diy_edit.php?diyid=$diyid");
  138.         exit();
  139. }
  140. require_once(DEDEADMIN."/templets/diy_field_edit.htm");
  141.  
  142. ?>
downloaddiy_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