DefaultTable.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. if(!defined('InEmpireCMS'))
  3. {
  4. exit();
  5. }
  6. //------- 建立数据表 -------
  7. //公共表
  8. $tablename=$dbtbpre."ecms_".$tbname."_index";
  9. $sqlindex=$empire->query(SetCreateTable("CREATE TABLE `".$tablename."` (
  10. `id` int(10) unsigned NOT NULL auto_increment,
  11. `classid` smallint(5) unsigned NOT NULL default '0',
  12. `checked` tinyint(1) NOT NULL default '0',
  13. `newstime` int(10) unsigned NOT NULL default '0',
  14. `truetime` int(10) unsigned NOT NULL default '0',
  15. `lastdotime` int(10) unsigned NOT NULL default '0',
  16. `havehtml` tinyint(1) NOT NULL default '0',
  17. PRIMARY KEY (`id`),
  18. KEY `classid` (`classid`),
  19. KEY `checked` (`checked`),
  20. KEY `newstime` (`newstime`),
  21. KEY `truetime` (`truetime`,`id`),
  22. KEY `havehtml` (`classid`,`truetime`,`havehtml`,`checked`,`id`)
  23. ) TYPE=MyISAM;",$ecms_config['db']['dbchar']));
  24. //主表
  25. $tablename=$dbtbpre."ecms_".$tbname;
  26. $sql=$empire->query(SetCreateTable("CREATE TABLE `".$tablename."` (
  27. `id` int(10) unsigned NOT NULL auto_increment,
  28. `classid` smallint(5) unsigned NOT NULL default '0',
  29. `ttid` smallint(5) unsigned NOT NULL default '0',
  30. `onclick` int(10) unsigned NOT NULL default '0',
  31. `plnum` mediumint(8) unsigned NOT NULL default '0',
  32. `totaldown` mediumint(8) unsigned NOT NULL default '0',
  33. `newspath` char(20) NOT NULL default '',
  34. `filename` char(36) NOT NULL default '',
  35. `userid` mediumint(8) unsigned NOT NULL default '0',
  36. `username` char(20) NOT NULL default '',
  37. `firsttitle` tinyint(1) NOT NULL default '0',
  38. `isgood` tinyint(1) NOT NULL default '0',
  39. `ispic` tinyint(1) NOT NULL default '0',
  40. `istop` tinyint(1) NOT NULL default '0',
  41. `isqf` tinyint(1) NOT NULL default '0',
  42. `ismember` tinyint(1) NOT NULL default '0',
  43. `isurl` tinyint(1) NOT NULL default '0',
  44. `truetime` int(10) unsigned NOT NULL default '0',
  45. `lastdotime` int(10) unsigned NOT NULL default '0',
  46. `havehtml` tinyint(1) NOT NULL default '0',
  47. `groupid` smallint(6) NOT NULL default '0',
  48. `userfen` smallint(5) unsigned NOT NULL default '0',
  49. `titlefont` char(14) NOT NULL default '',
  50. `titleurl` char(200) NOT NULL default '',
  51. `stb` tinyint(3) unsigned NOT NULL default '1',
  52. `fstb` tinyint(3) unsigned NOT NULL default '1',
  53. `restb` tinyint(3) unsigned NOT NULL default '1',
  54. `keyboard` char(80) NOT NULL default '',
  55. `title` char(100) NOT NULL default '',
  56. `newstime` int(10) unsigned NOT NULL default '0',
  57. `titlepic` char(120) NOT NULL default '',
  58. `eckuid` int(11) NOT NULL default '0',
  59. PRIMARY KEY (`id`),
  60. KEY `classid` (`classid`),
  61. KEY `newstime` (`newstime`),
  62. KEY `ttid` (`ttid`),
  63. KEY `firsttitle` (`firsttitle`),
  64. KEY `isgood` (`isgood`),
  65. KEY `ispic` (`ispic`),
  66. KEY `useridis` (`userid`,`ismember`)
  67. ) TYPE=MyISAM;",$ecms_config['db']['dbchar']));
  68. //副表
  69. $tablename=$dbtbpre."ecms_".$tbname."_data_1";
  70. $sqldata=$empire->query(SetCreateTable("CREATE TABLE `".$tablename."` (
  71. `id` int(10) unsigned NOT NULL default '0',
  72. `classid` smallint(5) unsigned NOT NULL default '0',
  73. `keyid` char(255) NOT NULL default '',
  74. `dokey` tinyint(1) NOT NULL default '0',
  75. `newstempid` smallint(5) unsigned NOT NULL default '0',
  76. `closepl` tinyint(1) NOT NULL default '0',
  77. `haveaddfen` tinyint(1) NOT NULL default '0',
  78. `infotags` char(80) NOT NULL default '',
  79. PRIMARY KEY (`id`),
  80. KEY `classid` (`classid`)
  81. ) TYPE=MyISAM;",$ecms_config['db']['dbchar']));
  82. //采集节点附加表
  83. $tablename=$dbtbpre."ecms_infoclass_".$tbname;
  84. $infoclass=$empire->query(SetCreateTable("CREATE TABLE `".$tablename."` (
  85. `classid` int(10) unsigned not null default '0',
  86. `zz_title` text NOT NULL,
  87. `z_title` varchar(255) NOT NULL default '',
  88. `qz_title` varchar(255) NOT NULL default '',
  89. `save_title` varchar(10) NOT NULL default '',
  90. `zz_titlepic` text NOT NULL,
  91. `z_titlepic` varchar(255) NOT NULL default '',
  92. `qz_titlepic` varchar(255) NOT NULL default '',
  93. `save_titlepic` varchar(10) NOT NULL default '',
  94. `zz_newstime` text NOT NULL,
  95. `z_newstime` varchar(255) NOT NULL default '',
  96. `qz_newstime` varchar(255) NOT NULL default '',
  97. `save_newstime` varchar(10) NOT NULL default '',
  98. PRIMARY KEY (`classid`)
  99. ) TYPE=MyISAM;",$ecms_config['db']['dbchar']));
  100. //采集数据临时表
  101. $tablename=$dbtbpre."ecms_infotmp_".$tbname;
  102. $infotmp=$empire->query(SetCreateTable("CREATE TABLE `".$tablename."` (
  103. `id` bigint(20) unsigned NOT NULL auto_increment,
  104. `classid` int(10) unsigned NOT NULL default '0',
  105. `oldurl` char(200) NOT NULL default '',
  106. `checked` tinyint(1) NOT NULL default '0',
  107. `tmptime` datetime NOT NULL default '0000-00-00 00:00:00',
  108. `userid` mediumint(8) unsigned NOT NULL default '0',
  109. `username` char(20) NOT NULL default '',
  110. `truetime` int(10) unsigned NOT NULL default '0',
  111. `keyboard` char(100) NOT NULL default '',
  112. `title` char(100) NOT NULL default '',
  113. `newstime` datetime NOT NULL default '0000-00-00 00:00:00',
  114. `titlepic` char(120) NOT NULL default '',
  115. PRIMARY KEY (`id`),
  116. KEY `classid` (`classid`),
  117. KEY `checked` (`checked`)
  118. ) TYPE=MyISAM;",$ecms_config['db']['dbchar']));
  119. //字段表数据
  120. $sysfdata=ReadFiletext('../data/html/sysfhtml.txt');
  121. $sys_selectf='fid,f,fname,fform,fhtml,fzs,isadd,isshow,iscj,cjhtml,myorder,ftype,flen,dotemp,tid,tbname,savetxt,fvalue,iskey,tobr,dohtml,qfhtml,isonly,linkfieldval,samedata,fformsize,tbdataf,ispage,adddofun,editdofun,qadddofun,qeditdofun,linkfieldtb,linkfieldshow,editorys,issmalltext';
  122. $sysf_titler=explode('[!--sys.title--]',$sysfdata);
  123. $sysf_titletr=explode('[!--sys.qf.exp--]',$sysf_titler[1]);
  124. $empire->query("insert into `{$dbtbpre}enewsf`($sys_selectf) values(NULL,'title','标题','text','".addslashes($sysf_titletr[0])."','标题','0','1','1','".addslashes($sysf_titletr[2])."','0','CHAR','100','1','$tid','$tbname','0','','0','0','0','".addslashes($sysf_titletr[1])."','0','','0','60','0','0','','','','','','','0','0');");
  125. $sysf_specialr=explode('[!--sys.special.field--]',$sysfdata);
  126. $sysf_specialtr=explode('[!--sys.qf.exp--]',$sysf_specialr[1]);
  127. $empire->query("insert into `{$dbtbpre}enewsf`($sys_selectf) values(NULL,'special.field','特殊属性','','".addslashes($sysf_specialtr[0])."','特殊属性','0','1','0','".addslashes($sysf_specialtr[2])."','0','','0','0','$tid','$tbname','0','','0','0','0','".addslashes($sysf_specialtr[1])."','0','','0','','0','0','','','','','','','0','0');");
  128. $sysf_titlepicr=explode('[!--sys.titlepic--]',$sysfdata);
  129. $sysf_titlepictr=explode('[!--sys.qf.exp--]',$sysf_titlepicr[1]);
  130. $empire->query("insert into `{$dbtbpre}enewsf`($sys_selectf) values(NULL,'titlepic','标题图片','img','".addslashes($sysf_titlepictr[0])."','标题图片','0','1','1','".addslashes($sysf_titlepictr[2])."','0','CHAR','120','1','$tid','$tbname','0','','0','0','0','".addslashes($sysf_titlepictr[1])."','0','','0','60','0','0','','','','','','','0','0');");
  131. $sysf_newstimer=explode('[!--sys.newstime--]',$sysfdata);
  132. $sysf_newstimetr=explode('[!--sys.qf.exp--]',$sysf_newstimer[1]);
  133. $empire->query("insert into `{$dbtbpre}enewsf`($sys_selectf) values(NULL,'newstime','发布时间','text','".addslashes($sysf_newstimetr[0])."','发布时间','0','1','1','".addslashes($sysf_newstimetr[2])."','0','INT','11','1','$tid','$tbname','0','','1','0','0','".addslashes($sysf_newstimetr[1])."','0','','0','','0','0','','','','','','','0','0');");
  134. ?>