<?php
if(!defined('InEmpireCMS'))
{
	exit();
}

//建立数据表
$tablename=$dbtbpre."ecms_".$tbname;
$sql=$empire->query(SetCreateTable("CREATE TABLE `".$tablename."` (
  `id` int(11) NOT NULL auto_increment,
  `classid` smallint(6) NOT NULL default '0',
  `onclick` int(11) NOT NULL default '0',
  `newspath` varchar(50) NOT NULL default '',
  `keyboard` varchar(255) NOT NULL default '',
  `keyid` varchar(255) NOT NULL default '',
  `userid` int(11) NOT NULL default '0',
  `username` varchar(30) NOT NULL default '',
  `ztid` text NOT NULL,
  `checked` tinyint(1) NOT NULL default '0',
  `istop` tinyint(4) NOT NULL default '0',
  `truetime` int(11) NOT NULL default '0',
  `ismember` tinyint(1) NOT NULL default '0',
  `dokey` tinyint(1) NOT NULL default '0',
  `userfen` int(11) NOT NULL default '0',
  `isgood` tinyint(1) NOT NULL default '0',
  `titlecolor` varchar(10) NOT NULL default '',
  `titlefont` varchar(255) NOT NULL default '',
  `titleurl` varchar(200) NOT NULL default '',
  `filename` varchar(60) NOT NULL default '',
  `filenameqz` varchar(28) NOT NULL default '',
  `fh` tinyint(1) NOT NULL default '0',
  `groupid` smallint(6) NOT NULL default '0',
  `newstempid` smallint(6) NOT NULL default '0',
  `plnum` int(11) NOT NULL default '0',
  `firsttitle` tinyint(1) NOT NULL default '0',
  `checkuser` text NOT NULL,
  `docheckuser` text NOT NULL,
  `viewcheckuser` text NOT NULL,
  `returncheck` tinyint(1) NOT NULL default '0',
  `notdocheckuser` text NOT NULL,
  `totaldown` int(11) NOT NULL default '0',
  `title` varchar(200) NOT NULL default '',
  `newstime` datetime NOT NULL default '0000-00-00 00:00:00',
  `titlepic` varchar(200) NOT NULL default '',
  `wplay` tinyint(1) NOT NULL default '0',
  `closepl` tinyint(1) NOT NULL default '0',
  `havehtml` tinyint(1) NOT NULL default '0',
  `lastdotime` int(11) NOT NULL default '0',
  `haveaddfen` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `newstime` (`newstime`),
  KEY `truetime` (`truetime`),
  KEY `classid` (`classid`)
  ) TYPE=MyISAM;",$phome_db_dbchar));

//字段表数据
$dof1=$empire->query("insert into `{$dbtbpre}enewsf` values(NULL,'title','标题','text','<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#DBEAF5\">\r\n          <tr> \r\n            <td bgcolor=\"#FFFFFF\"> <input type=text name=title value=\"<?=htmlspecialchars(stripSlashes(\$r[title]))?>\" size=60> \r\n              <input type=\"button\" name=\"button\" value=\"图文\" onclick=\"document.add.title.value=document.add.title.value+''(图文)'';\"> \r\n            </td>\r\n          </tr>\r\n          <tr> \r\n            <td bgcolor=\"#FFFFFF\"> <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n                <tr> \r\n                  <td width=\"45%\">属性： \r\n                    <input name=\"titlefont[b]\" type=\"checkbox\" id=\"titlefont[b]\" value=\"b\"<?=\$titlefontb?>>\r\n                    粗体 \r\n                    <input name=\"titlefont[i]\" type=\"checkbox\" id=\"titlefont[i]\" value=\"i\"<?=\$titlefonti?>>\r\n                    斜体 \r\n                    <input name=\"titlefont[s]\" type=\"checkbox\" id=\"titlefont[s]\" value=\"s\"<?=\$titlefonts?>>\r\n                    删除线</td>\r\n                  <td width=\"55%\">颜色： \r\n                    <input name=\"titlecolor\" type=\"text\" id=\"titlecolor\" value=\"<?=stripSlashes(\$r[titlecolor])?>\" size=\"10\"> \r\n                    <a onclick=\"foreColor();\"><img src=\"../data/images/color.gif\" width=\"21\" height=\"21\" align=\"absbottom\"></a></td>\r\n                </tr>\r\n              </table></td>\r\n          </tr>\r\n        </table>','标题','0','1','1','  <tr bgcolor=\"#FFFFFF\"> \r\n    <td height=\"22\" valign=\"top\"><strong>[!--enews.name--]正则：</strong><br>\r\n      (<input name=\"textfield\" type=\"text\" id=\"textfield\" value=\"[!--title--]\" size=\"20\">)</td>\r\n    <td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\">\r\n        <tr> \r\n          <td><textarea name=\"add[zz_title]\" cols=\"60\" rows=\"10\" id=\"textarea\"><?=htmlspecialchars(stripSlashes(\$r[zz_title]))?></textarea></td>\r\n        </tr>\r\n        <tr> \r\n          <td><input name=\"add[z_title]\" type=\"text\" id=\"add[z_title]\" value=\"<?=stripSlashes(\$r[z_title])?>\">\r\n            (如填写这里，将为字段的值)</td>\r\n        </tr>\r\n      </table></td>\r\n  </tr>','0','','0','1','$tid','$tbname',1,'',0,1,1,'<input name=\"title\" type=\"text\" id=\"title\" value=\"<?=DoReqValue(\$tbname,\'title\',stripSlashes(\$r[title]))?>\">');");

$dof2=$empire->query("insert into `{$dbtbpre}enewsf` values(NULL,'special.field','特殊属性','',' <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#DBEAF5\">\r\n  <tr> \r\n    <td height=\"25\" bgcolor=\"#FFFFFF\"> <input name=\"isgood\" type=\"checkbox\" id=\"isgood2\" value=\"1\"<?=\$isgood?>>\r\n      推荐&nbsp;&nbsp; <input name=\"checked\" type=\"checkbox\" id=\"checked4\" value=\"1\"<?=\$checked?>>\r\n      审核&nbsp;&nbsp; <input name=\"firsttitle\" type=\"checkbox\" id=\"firsttitle2\" value=\"1\"<?=\$firsttitle?>>\r\n      头条&nbsp;&nbsp;&nbsp;<strong>&nbsp;置顶级别：</strong> <select name=\"istop\" id=\"select3\">\r\n        <option value=\"0\"<?=\$istop0?>>0级置顶</option>\r\n        <option value=\"1\"<?=\$istop1?>>1级置顶</option>\r\n        <option value=\"2\"<?=\$istop2?>>2级置顶</option>\r\n        <option value=\"3\"<?=\$istop3?>>3级置顶</option>\r\n        <option value=\"4\"<?=\$istop4?>>4级置顶</option>\r\n        <option value=\"5\"<?=\$istop5?>>5级置顶</option>\r\n        <option value=\"6\"<?=\$istop6?>>6级置顶</option>\r\n      </select> <strong>所用内容模板:</strong> <select name=\"newstempid\" id=\"select4\">\r\n        <?=\$newstemp?>\r\n      </select> </td>\r\n  </tr>\r\n  <tr> \r\n    <td height=\"25\" bgcolor=\"#FFFFFF\"><strong>权限设置:</strong> <select name=\"fh\" id=\"select5\">\r\n        <option value=\"0\"<?=\$fh0?>>&gt;=</option>\r\n        <option value=\"1\"<?=\$fh1?>>=</option>\r\n      </select> <select name=\"groupid\" id=\"select6\">\r\n        <option value=\"0\">游客</option>\r\n        <?=\$group?>\r\n      </select>\r\n      查看扣除点数: \r\n      <input name=\"userfen\" type=\"text\" id=\"userfen\" value=\"<?=\$r[userfen]?>\" size=\"6\">\r\n      (&quot;=&quot;：本级别的用户才能查看[对游客无效])</td>\r\n  </tr>\r\n  <tr> \r\n    <td height=\"25\" bgcolor=\"#FFFFFF\">文件名前缀: <input name=\"filenameqz\" type=\"text\" id=\"filenameqz\" value=\"<?=stripSlashes(\$r[filenameqz])?>\">\r\n      (如photeshop_),<input type=checkbox name=closepl value=1<?=\$r[closepl]==1?\" checked\":\"\"?>>关闭评论</td>\r\n  </tr>\r\n</table>\r\n        <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#DBEAF5\">\r\n          <tr> \r\n            <td height=\"25\">签发(多个签发人员，请用&quot;,&quot;格开．不想使用签发，请留空) </td>\r\n          </tr>\r\n          <tr> \r\n            <td height=\"25\" bgcolor=\"#FFFFFF\"> <input name=\"checkuser\" type=\"text\" id=\"checkuser\" value=\"<?=stripSlashes(\$r[checkuser])?>\" size=\"66\"<?=\$checkuserreadonly?>> \r\n              <?=\$changeuser?> \r\n            </td>\r\n          </tr>\r\n          <tr>\r\n            <td height=\"25\" bgcolor=\"#FFFFFF\"><input name=\"recheckuser\" type=\"checkbox\" id=\"recheckuser\" value=\"1\">\r\n              重新签发（稿件被退下来后重新提交给未签发的人员的操作，如修改签发人员，所有人员需重新签发）</td>\r\n          </tr>\r\n        </table>\r\n        <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#DBEAF5\">\r\n          <tr> \r\n            <td height=\"25\">所属专题:</td>\r\n          </tr>\r\n          <tr> \r\n            <td height=\"25\" bgcolor=\"#FFFFFF\"> \r\n              <?=\$z_class?>\r\n            </td>\r\n          </tr>\r\n        </table> <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#DBEAF5\">\r\n          <tr> \r\n            <td height=\"25\" bgcolor=\"#FFFFFF\"><strong>关键字:</strong> <input name=\"keyboard\" type=\"text\" id=\"keyboard\" size=\"43\" value=\"<?=stripSlashes(\$r[keyboard])?>\">\r\n              (多个请用&quot;,&quot;格开)</td>\r\n          </tr>\r\n          <tr> \r\n            <td height=\"25\" bgcolor=\"#FFFFFF\">外部链接: \r\n              <input name=\"titleurl\" type=\"text\" id=\"titleurl2\" value=\"<?=stripSlashes(\$r[titleurl])?>\" size=\"42\">\r\n              (填写后标题的连接地址将是此链接)</td>\r\n          </tr>\r\n        </table>','特殊属性','0','1','0','','0','','0','0','$tid','$tbname',1,'',0,1,1,'');");

$dof3=$empire->query("insert into `{$dbtbpre}enewsf` values(NULL,'titlepic','标题图片','img','<input name=\"titlepic\" type=\"text\" id=\"titlepic\" value=\"<?=stripSlashes(\$r[titlepic])?>\" size=\"56\"> \r\n        <a onclick=\"window.open(''editor/file.php?userid=<?=\$logininid?>&username=<?=\$loginin?>&rnd=<?=\$loginrnd?>&type=1&classid=<?=\$classid?>&filepass=<?=\$filepass?>&doing=1&field=titlepic'','''',''width=700,height=550,scrollbars=yes'');\" title=\"选择已上传的图片\"><img src=\"../data/images/changeimg.gif\" width=\"22\" height=\"22\" border=\"0\" align=\"absbottom\"></a>(用于图片调用信息) ','标题图片','0','1','1','  <tr bgcolor=\"#FFFFFF\"> \r\n    <td height=\"22\" valign=\"top\"><strong>[!--enews.name--]正则：</strong><br>\r\n      ( \r\n      <input name=\"textfield\" type=\"text\" id=\"textfield\" value=\"[!--titlepic--]\" size=\"20\">\r\n      )</td>\r\n    <td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\">\r\n    <tr>\r\n      <td>附件前缀 \r\n        <input name=\"add[qz_titlepic]\" type=\"text\" id=\"add[qz_titlepic]\" value=\"<?=stripSlashes(\$r[qz_titlepic])?>\"> \r\n        <input name=\"add[save_titlepic]\" type=\"checkbox\" id=\"add[save_titlepic]\" value=\" checked\"<?=\$r[save_titlepic]?>>\r\n        远程保存 </td>\r\n    </tr>\r\n    <tr> \r\n      <td><textarea name=\"add[zz_titlepic]\" cols=\"60\" rows=\"10\" id=\"add[zz_titlepic]\"><?=htmlspecialchars(stripSlashes(\$r[zz_titlepic]))?></textarea></td>\r\n    </tr>\r\n    <tr> \r\n      <td><input name=\"add[z_titlepic]\" type=\"text\" id=\"titlepic5\" value=\"<?=stripSlashes(\$r[z_titlepic])?>\">\r\n        (如填写这里，这就是字段的值)</td>\r\n    </tr>\r\n  </table></td>\r\n  </tr>','0','','0','1','$tid','$tbname',1,'',0,1,1,'<input type=\"file\" name=\"titlepicfile\">');");

$dof4=$empire->query("insert into `{$dbtbpre}enewsf` values(NULL,'newstime','发布时间','','<input name=\"newstime\" type=\"text\" id=\"newstime\" value=\"<?=\$r[newstime]?>\"><input type=button name=button value=\"设为当前时间\" onclick=\"document.add.newstime.value=\'<?=\$todaytime?>\'\">','发布时间','0','1','1','  <tr bgcolor=\"#FFFFFF\"> \r\n    <td height=\"22\" valign=\"top\"><strong>[!--enews.name--]正则：</strong><br>\r\n      (<input name=\"textfield\" type=\"text\" id=\"textfield\" value=\"[!--newstime--]\" size=\"20\">)</td>\r\n    <td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\">\r\n        <tr> \r\n          <td><textarea name=\"add[zz_newstime]\" cols=\"60\" rows=\"10\" id=\"textarea\"><?=htmlspecialchars(stripSlashes(\$r[zz_newstime]))?></textarea></td>\r\n        </tr>\r\n        <tr> \r\n          <td><input name=\"add[z_newstime]\" type=\"text\" id=\"add[z_newstime]\" value=\"<?=stripSlashes(\$r[z_newstime])?>\">\r\n            (如填写这里，将为字段的值)</td>\r\n        </tr>\r\n      </table></td>\r\n  </tr>','0','','0','1','$tid','$tbname',1,'',0,1,1,'');");

//采集节点附加表
$tablename=$dbtbpre."ecms_infoclass_".$tbname;
$infoclass=$empire->query(SetCreateTable("CREATE TABLE `".$tablename."` (
  `classid` int not null default '0',
  `zz_title` text NOT NULL,
  `z_title` varchar(255) NOT NULL default '',
  `qz_title` varchar(255) NOT NULL default '',
  `save_title` varchar(10) NOT NULL default '',
  `zz_titlepic` text NOT NULL,
  `z_titlepic` varchar(255) NOT NULL default '',
  `qz_titlepic` varchar(255) NOT NULL default '',
  `save_titlepic` varchar(10) NOT NULL default '',
  `zz_newstime` text NOT NULL,
  `z_newstime` varchar(255) NOT NULL default '',
  `qz_newstime` varchar(255) NOT NULL default '',
  `save_newstime` varchar(10) NOT NULL default '',
   KEY `classid` (`classid`)
  ) TYPE=MyISAM;",$phome_db_dbchar));

//采集数据临时表
$tablename=$dbtbpre."ecms_infotmp_".$tbname;
$infotmp=$empire->query(SetCreateTable("CREATE TABLE `".$tablename."` (
  `id` bigint(20) NOT NULL auto_increment,
  `classid` int NOT NULL default '0',
  `oldurl` varchar(255) NOT NULL default '',
  `checked` tinyint(1) NOT NULL default '0',
  `tmptime` datetime NOT NULL default '0000-00-00 00:00:00',
  `title` varchar(200) NOT NULL default '',
  `newstime` datetime NOT NULL default '0000-00-00 00:00:00',
  `username` varchar(30) NOT NULL default '',
  `userid` int(11) NOT NULL default '0',
  `truetime` int(11) NOT NULL default '0',
  `keyboard` varchar(255) NOT NULL default '',
  `titlepic` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `classid` (`classid`)
  ) TYPE=MyISAM;",$phome_db_dbchar));
?>