Browse Source

调整安装程序

master
llgoer 1 month ago
parent
commit
da8fc94404
18 changed files with 71 additions and 1705 deletions
  1. +1
    -1
      src/include/common.inc.php
  2. +0
    -1019
      src/include/dedecollection.class.php
  3. +0
    -672
      src/include/dedehtml2.class.php
  4. BIN
      src/install/images/ajax-loader.gif
  5. BIN
      src/install/images/boxtitle_bg.gif
  6. BIN
      src/install/images/but_back.gif
  7. BIN
      src/install/images/but_next.gif
  8. BIN
      src/install/images/ico-step-now.png
  9. BIN
      src/install/images/ico-step-succeed.png
  10. BIN
      src/install/images/leftbox-tbg.png
  11. BIN
      src/install/images/loading1.gif
  12. BIN
      src/install/images/step-ico-bg.png
  13. BIN
      src/install/images/top-bg.png
  14. BIN
      src/install/images/top-logo.png
  15. +38
    -6
      src/install/index.php
  16. +32
    -5
      src/install/templates/step-1.html
  17. +0
    -1
      src/templets/templet-dirlist.inc
  18. +0
    -1
      src/templets/templet-filelist.inc

+ 1
- 1
src/include/common.inc.php View File

@@ -237,7 +237,7 @@ $cfg_other_medias = $cfg_medias_dir . '/media';

//软件摘要信息,****请不要删除本项**** 否则系统无法正确接收系统漏洞或升级信息
$cfg_version = 'V6';
$cfg_version_detail = '6.0.1'; // 详细版本号
$cfg_version_detail = '6.0.3'; // 详细版本号
$cfg_soft_lang = 'utf-8';
$cfg_soft_public = 'base';



+ 0
- 1019
src/include/dedecollection.class.php
File diff suppressed because it is too large
View File


+ 0
- 672
src/include/dedehtml2.class.php View File

@@ -1,672 +0,0 @@
<?php if(!defined('DEDEINC')) exit("Request Error!");
/**
* 织梦HTML解析类V1.6 PHP版
* function c____DedeHtml2();
* 这个类针对于采集程序,主要是获取某区域内的图片、超链接等信息
*
*
* @version $Id: dedehtml2.class.php 1 14:44 2010年7月6日Z tianya $
* @package DedeBIZ.Libraries
* @copyright Copyright (c) 2021, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
// ------------------------------------------------------------------------
/**
* 织梦HTML解析类V1.6 PHP版
*
* @package DedeHtml2
* @subpackage DedeBIZ.Libraries
* @link https://www.dedebiz.com
*/
class DedeHtml2
{
var $CAtt;
var $SourceHtml;
var $Title;
var $Medias;
var $MediaInfos;
var $Links;
var $CharSet;
var $BaseUrl;
var $BaseUrlPath;
var $HomeUrl;
var $IsHead;
var $ImgHeight;
var $ImgWidth;
var $GetLinkType;

//构造函数
function __construct()
{
$this->CAtt = '';
$this->SourceHtml = '';
$this->Title = '';
$this->Medias = Array();
$this->MediaInfos = Array();
$this->Links = Array();
$this->BaseUrl = '';
$this->BaseUrlPath = '';
$this->HomeUrl = '';
$this->IsHead = false;
$this->ImgHeight = 30;
$this->ImgWidth = 50;
$this->GetLinkType = 'link';
}

function DedeHtml2()
{
$this->__construct();
}

/**
* 设置HTML的内容和来源网址
*
* @access public
* @param string $html html资源
* @param string $url 地址
* @param string $linktype 连接类型
* @return void
*/
function SetSource(&$html, $url = '', $linktype='')
{
$this->__construct();
$this->CAtt = new DedeAttribute2();
$url = trim($url);
$this->SourceHtml = $html;
$this->BaseUrl = $url;
//判断文档相对于当前的路径
$urls = @parse_url($url);
$this->HomeUrl = $urls['host'];
$this->BaseUrlPath = $this->HomeUrl.$urls['path'];
$this->BaseUrlPath = preg_replace("/\/([^\/]*)\.(.*)$/","/",$this->BaseUrlPath);
$this->BaseUrlPath = preg_replace("/\/$/",'',$this->BaseUrlPath);
if($linktype!='')
{
$this->GetLinkType = $linktype;
}
if($html != '')
{
$this->Analyser();
}
}

/**
* 解析HTML
*
* @access private
* @return void
*/
function Analyser()
{
$cAtt = new DedeAttribute2();
$cAtt->IsTagName = false;
$c = '';
$i = 0;
$startPos = 0;
$endPos = 0;
$wt = 0;
$ht = 0;
$scriptdd = 0;
$attStr = '';
$tmpValue = '';
$tmpValue2 = '';
$tagName = '';
$hashead = 0;
$slen = strlen($this->SourceHtml);
if($this->GetLinkType=='link' || $this->GetLinkType=='')
{
$needTags = array('a');
}
if($this->GetLinkType=='media')
{
$needTags = array('img','embed','a');
$this->IsHead = true;
}
$tagbreaks = array(' ','<','>',"\r","\n","\t");
for(;isset($this->SourceHtml[$i]);$i++)
{
if($this->SourceHtml[$i]=='<')
{
$tagName = '';
$j = 0;
for($i=$i+1; isset($this->SourceHtml[$i]); $i++)
{
if($j>10)
{
break;
}
$j++;
if( in_array($this->SourceHtml[$i],$tagbreaks) )
{
break;
}
else
{
$tagName .= $this->SourceHtml[$i];
}
}
$tagName = strtolower($tagName);

//标记为注解
if($tagName=='!--')
{
$endPos = strpos($this->SourceHtml,'-->',$i);
if($endPos !== false)
{
$i=$endPos+3;
}
continue;
}

//标记在指定集合内
else if( in_array($tagName,$needTags) )
{
$startPos = $i;
$endPos = strpos($this->SourceHtml,'>',$i+1);
if($endPos===false)
{
break;
}
$attStr = substr($this->SourceHtml,$i+1,$endPos-$startPos-1);
$cAtt->SetSource($attStr);
if($tagName=='img')
{
$this->InsertMedia($cAtt->GetAtt('src'),'img');
}
else if($tagName=='embed')
{
$rurl = $this->InsertMedia($cAtt->GetAtt('src'),'embed');
if($rurl != '')
{
$this->MediaInfos[$rurl][0] = $cAtt->GetAtt('width');
$this->MediaInfos[$rurl][1] = $cAtt->GetAtt('height');
}
}
else if($tagName=='a')
{
$this->InsertLink($this->FillUrl($cAtt->GetAtt('href')),$this->GetInnerText($i,'a'));
}
}
else
{
continue;
}
$i--;
}//End if char

}//End for

if($this->Title == '')
{
$this->Title = $this->BaseUrl;
}
}

/**
* 重置资源
*
* @access private
* @return void
*/
function Clear()
{
$this->CAtt = '';
$this->SourceHtml = '';
$this->Title = '';
$this->Links = '';
$this->Medias = '';
$this->BaseUrl = '';
$this->BaseUrlPath = '';
}

/**
* 分析链接
*
* @access public
* @param string $url 地址
* @param string $mtype 媒体类型
* @return string
*/
function InsertMedia($url, $mtype)
{
if( preg_match("/^(javascript:|#|'|\")/", $url) )
{
return '';
}
if($url == '')
{
return '';
}
$this->Medias[$url]=$mtype;
return $url;
}

/**
* 分析链接
*
* @access public
* @param string $url 地址
* @param string $atitle 文档
* @return string
*/
function InsertLink($url, $atitle)
{
if( preg_match("/^(javascript:|#|'|\")/", $url) )
{
return '';
}
if($url == '')
{
return '';
}
if( preg_match('/^img:/', $atitle) )
{
list($aimg, $atitle) = explode(':txt:', $atitle);
if(!isset($this->Links[$url]))
{
if($atitle != '')
{
$this->Links[$url]['title'] = cn_substr($atitle,50);
}
else
{
$this->Links[$url]['title'] = preg_replace('/img:/', '', $aimg);
}
$this->Links[$url]['link'] = $url;
}
$this->Links[$url]['image'] = preg_replace('/img:/', '', $aimg);
$this->InsertMedia($this->Links[$url]['image'], 'img');
}
else
{
if(!isset($this->Links[$url]))
{
$this->Links[$url]['image'] = '';
$this->Links[$url]['title'] = $atitle;
$this->Links[$url]['link'] = $url;
}
else
{
if(strlen($this->Links[$url]['title']) < strlen($atitle)) $this->Links[$url]['title'] = $atitle;
}
}
return $url;
}

/**
* 分析content-type中的字符类型
*
* @access public
* @param string $att 属性字符串
* @return string
*/
function ParCharSet($att)
{
$startdd=0;
$taglen=0;
$startdd = strpos($att,'=');
if($startdd===false)
{
return '';
}
else
{
$taglen = strlen($att)-$startdd-1;
if($taglen<=0)
{
return '';
}
return trim(substr($att, $startdd+1, $taglen));
}
}

/**
* 补全相对网址
*
* @access public
* @param string $surl 地址
* @return string
*/
function FillUrl($surl)
{
$i = $pathStep = 0;
$dstr = $pstr = $okurl = '';

$surl = trim($surl);
if($surl == '')
{
return '';
}
$pos = strpos($surl,'#');
if($pos>0)
{
$surl = substr($surl,0,$pos);
}
if($surl[0]=='/')
{
$okurl = $this->HomeUrl.'/'.$surl;
}
else if($surl[0]=='.')
{
if(!isset($surl[2]))
{
return '';
}
else if($surl[0]=='/')
{
$okurl = $this->BaseUrlPath."/".substr($surl,2,strlen($surl)-2);
}
else
{
$urls = explode('/',$surl);
foreach($urls as $u)
{
if($u=='..')
{
$pathStep++;
}
else if($i<count($urls)-1)
{
$dstr .= $urls[$i].'/';
}
else
{
$dstr .= $urls[$i];
}
$i++;
}
$urls = explode('/',$this->BaseUrlPath);
if(count($urls) <= $pathStep)
{
return '';
}
else
{
$pstr = '';
for($i=0;$i<count($urls)-$pathStep;$i++){ $pstr .= $urls[$i].'/'; }
$okurl = $pstr.$dstr;
}
}
}
else
{
if( strlen($surl) < 7 )
{
$okurl = $this->BaseUrlPath.'/'.$surl;
}
else if( strtolower(substr($surl,0,7))=='http://' )
{
$okurl = preg_replace('/^http:\/\//i', '', $surl);
}
else
{
$okurl = $this->BaseUrlPath.'/'.$surl;
}
}
$okurl = preg_replace('/\/{1,}/i', '/', $okurl);
return 'http://'.$okurl;
}

/**
* 获得和下一个标记之间的文本内容
*
* @access public
* @param string $pos 位置地址
* @param string $tagname 标签名称
* @return string
*/
function GetInnerText(&$pos,$tagname)
{
$startPos=0;
$endPos=0;
$textLen=0;
$str = '';
$startPos = strpos($this->SourceHtml,'>',$pos);

if($tagname=='title')
{
$endPos = strpos($this->SourceHtml,'<',$startPos);
}
else
{
$endPos1 = strpos($this->SourceHtml,'</a',$startPos);
$endPos2 = strpos($this->SourceHtml,'</A',$startPos);
if($endPos1===false)
{
$endPos = $endPos2;
}
else if($endPos2===false)
{
$endPos = $endPos1;
}
else
{
$endPos = ($endPos1 < $endPos2 ? $endPos1 : $endPos2 );
}
}
if($endPos > $startPos)
{
$textLen = $endPos-$startPos;
$str = substr($this->SourceHtml,$startPos+1,$textLen-1);
}
$pos = $startPos + $textLen + strlen("</".$tagname) + 1;
if($tagname=='title')
{
return trim($str);
}
else
{
preg_match_all("/<img(.*)src=[\"']{0,1}(.*)[\"']{0,1}[> \r\n\t]{1,}/isU",$str,$imgs);
if(isset($imgs[2][0]))
{
$txt = trim(Html2Text($str));
$imgs[2][0] = preg_replace("/[\"']/",'',$imgs[2][0]);
return "img:".$this->FillUrl($imgs[2][0]).':txt:'.$txt;
}
else
{
$str = strip_tags($str);
//$str = preg_replace('/<\/(.*)$/i', '', $str);
//$str = trim(preg_replace('/^(.*)>/i','',$str));
return $str;
}
}
}
}//End class

/*******************************
//属性解析器
function c____DedeAttribute2();
********************************/
class DedeAttribute2
{
var $SourceString = '';
var $SourceMaxSize = 1024;
var $CharToLow = FALSE; //属性值是否不分大小写(属性名统一为小写)
var $IsTagName = TRUE; //是否解析标记名称
var $Count = -1;
var $Items = array(); //属性元素的集合

//设置属性解析器源字符串
function SetSource($str = '')
{
$this->Count = -1;
$this->Items =array();
$strLen = 0;
$this->SourceString = trim(preg_replace("/[ \t\r\n]{1,}/"," ",$str));
$strLen = strlen($this->SourceString);
$this->SourceString .= " "; //增加一个空格结尾,以方便处理没有属性的标记
if($strLen>0&&$strLen<=$this->SourceMaxSize)
{
$this->PrivateAttParse();
}
}

//获得某个属性
function GetAtt($str)
{
if($str == '')
{
return '';
}
$str = strtolower($str);
if(isset($this->Items[$str]))
{
return $this->Items[$str];
}
else
{
return '';
}
}

//判断属性是否存在
function IsAtt($str)
{
if($str == '')
{
return false;
}
$str = strtolower($str);
if(isset($this->Items[$str]))
{
return true;
}
else
{
return false;
}
}

//获得标记名称
function GetTagName()
{
return $this->GetAtt("tagname");
}

// 获得属性个数
function GetCount()
{
return $this->Count+1;
}

//解析属性(仅给SetSource调用)
function PrivateAttParse()
{
$d = '';
$tmpatt = '';
$tmpvalue = '';
$startdd = -1;
$ddtag = '';
$strLen = strlen($this->SourceString);
$j = 0;

//这里是获得标记的名称
if($this->IsTagName)
{
//如果属性是注解,不再解析里面的内容,直接返回
if(isset($this->SourceString[2]))
{
if($this->SourceString[0].$this->SourceString[1].$this->SourceString[2]=='!--')
{
$this->Items['tagname'] = '!--';
return ;
}
}
for($i=0;$i<$strLen;$i++)
{
$d = $this->SourceString[$i];
$j++;
if(preg_match("/[ '\"\r\n\t]/i", $d))
{
$this->Count++;
$this->Items["tagname"]=strtolower(trim($tmpvalue));
$tmpvalue = ''; break;
}
else
{
$tmpvalue .= $d;
}
}
if($j>0)
{
$j = $j-1;
}
}

//遍历源字符串,获得各属性
for($i=$j;$i<$strLen;$i++)
{
$d = $this->SourceString[$i];
//获得属性的键
if($startdd==-1)
{
if($d!='=')
{
$tmpatt .= $d;
}
else
{
$tmpatt = strtolower(trim($tmpatt));
$startdd=0;
}
}

//检测属性值是用什么包围的,允许使用 '' '' 或空白
else if($startdd==0)
{
switch($d)
{
case ' ':
// continue;
break;
case '\'':
$ddtag='\'';
$startdd=1;
break;
case '"':
$ddtag='"';
$startdd=1;
break;
default:
$tmpvalue.=$d;
$ddtag=' ';
$startdd=1;
break;
}
}

//获得属性的值
else if($startdd==1)
{
if($d==$ddtag)
{
$this->Count++;
if($this->CharToLow)
{
$this->Items[$tmpatt] = strtolower(trim($tmpvalue));
}
else
{
$this->Items[$tmpatt] = trim($tmpvalue);
}
$tmpatt = '';
$tmpvalue = '';
$startdd=-1;
}
else
{
$tmpvalue.=$d;
}
}
}//End for

//处理没有值的属性(必须放在结尾才有效)如:"input type=radio name=t1 value=aaa checked"
if($tmpatt != '')
{
$this->Items[$tmpatt] = '';
}
}//End Function PrivateAttParse

}//End Class DedeAttribute2

BIN
src/install/images/ajax-loader.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 847B

BIN
src/install/images/boxtitle_bg.gif View File

Before After
Width: 158  |  Height: 24  |  Size: 236B

BIN
src/install/images/but_back.gif View File

Before After
Width: 104  |  Height: 33  |  Size: 1.3KB

BIN
src/install/images/but_next.gif View File

Before After
Width: 104  |  Height: 33  |  Size: 1.5KB

BIN
src/install/images/ico-step-now.png View File

Before After
Width: 7  |  Height: 7  |  Size: 326B

BIN
src/install/images/ico-step-succeed.png View File

Before After
Width: 7  |  Height: 7  |  Size: 324B

BIN
src/install/images/leftbox-tbg.png View File

Before After
Width: 162  |  Height: 25  |  Size: 2.9KB

BIN
src/install/images/loading1.gif View File

Before After
Width: 199  |  Height: 64  |  Size: 3.3KB

BIN
src/install/images/step-ico-bg.png View File

Before After
Width: 13  |  Height: 173  |  Size: 3.0KB

BIN
src/install/images/top-bg.png View File

Before After
Width: 1  |  Height: 72  |  Size: 2.8KB

BIN
src/install/images/top-logo.png View File

Before After
Width: 280  |  Height: 72  |  Size: 6.6KB

+ 38
- 6
src/install/index.php View File

@@ -12,6 +12,7 @@ error_reporting(E_ALL || ~E_NOTICE);

$verMsg = 'V6';
$dfDbname = 'dedecmsv6';
$cfg_version_detail = '6.0.3'; // 详细版本号
$errmsg = '';

define('INSLOCKFILE', dirname(__FILE__).'/install_lock.txt');
@@ -92,6 +93,28 @@ function _2_Setup()
------------------------*/
else if($step==2)
{
$dbtype = empty($dbtype)? "mysql" : $dbtype;
$dblang = "utf8";
if (!in_array($dbtype,array("mysql", "sqlite"))) {
die("当前数据库类型不支持");
}
if(!empty($_SERVER['HTTP_HOST']))
$dfbaseurl = 'http://'.$_SERVER['HTTP_HOST'];
else
$dfbaseurl = "http://".$_SERVER['SERVER_NAME'];
$dfbasepath = preg_replace("#\/install(.*)$#i", '', $scriptName);

$dbhost = empty($dbhost)? "localhost" : $dbhost;
$dbuser = empty($dbuser)? "root" : $dbuser;
$dbuser = empty($dbuser)? "root" : $dbuser;
$dbprefix = empty($dbprefix)? "dede_" : $dbprefix;
$dbname = empty($dbname)? $dfDbname : $dbname;
$adminuser = empty($adminuser)? "admin" : $adminuser;
$adminpwd = empty($adminpwd)? "admin" : $adminpwd;
$webname = empty($webname)? "我的网站" : $webname;
$baseurl = empty($baseurl)? $dfbaseurl : $baseurl;
$cmspath = empty($cmspath)? $dfbasepath : $cmspath;

if ( $dbtype == 'sqlite' )
{
$db = new SQLite3(DEDEDATA.'/'.$dbname.'.db');
@@ -288,7 +311,7 @@ else if($step==2)
$fp = fopen($insLockfile,'w');
fwrite($fp,'ok');
fclose($fp);
header('Location:dede/index.php');
header('Location:../dede/index.php');
exit();
}
/*------------------------
@@ -301,18 +324,27 @@ else if($step==10)
header("Cache-Control:no-cache\r\n");
header("Expires:0\r\n");
$conn = @mysql_connect($dbhost,$dbuser,$dbpwd);
$info = "";
if($conn)
{
if(empty($dbname)){
echo "<font color='green'>信息正确</font>";
$info = "信息正确";
}else{
$info = mysql_select_db($dbname,$conn)?"<font color='red'>数据库已经存在,系统将覆盖数据库</font>":"<font color='green'>数据库不存在,系统将自动创建</font>";
echo $info;
}
$info = mysql_select_db($dbname,$conn)? "数据库已经存在,系统将覆盖数据库": "数据库不存在,系统将自动创建";
}
$result = array(
"code" => 200,
"data" => $info,
);
echo json_encode($result);
}
else
{
echo "<font color='red'>数据库连接失败!</font>";
$result = array(
"code" => -1,
"data" => "数据库连接失败!",
);
echo json_encode($result);
}
@mysql_close($conn);
exit();


+ 32
- 5
src/install/templates/step-1.html View File

@@ -39,11 +39,12 @@
?>
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 fw-normal text-center">首次运行安装包</h4>
<div class="card-header bg-success text-white">
<h5 class="my-0 fw-normal text-center">首次运行安装程序(v<?php echo $cfg_version_detail;?>)</h5>
</div>
<div class="card-body">
<form>
<form action="index.php" method="post" name="form1">
<input type="hidden" name="step" value="2" />
<input type="hidden" name="cookieencode" value="<?php echo $rnd_cookieEncode; ?>">
<input type="hidden" name="adminmail" value="admin@dedebiz.com">
<legend>数据库设置</legend>
@@ -74,8 +75,14 @@
</div>
<div class="mb-3">
<label for="dbname" class="form-label">数据库名称</label>
<input name="dbname" type="text" class="form-control" id="dbname" placeholder="dedecmsv6">
<div class="input-group mb-3">
<input id="dbname" name="dbname" type="text" class="form-control" placeholder="dedecmsv6">
<div class="input-group-append">
<button class="btn btn-outline-success" type="button" id="btnCheckConnect">检查连接</button>
</div>
</div>
</div>
<div id="alertConnect"></div>
<legend>站点设置</legend>
<hr>
<div class="mb-3">
@@ -86,7 +93,6 @@
<div class="mb-3">
<label for="adminpwd" class="form-label">密码</label>
<input name="adminpwd" type="text" class="form-control" id="adminpwd" placeholder="admin">
</div>
<div class="mb-3">
<label for="webname" class="form-label">网站名称</label>
@@ -117,7 +123,28 @@
</main>
<script>
$("#btnCheckConnect").click(function() {
let dbhost = $('#dbhost').val();
let dbuser = $('#dbuser').val();
let dbpwd = $('#dbpwd').val();
if (!dbhost) dbhost = "localhost";
if (!dbuser) dbuser = "root";
$.get('index.php?step=10&dbhost=' + dbhost + '&dbuser=' + dbuser + '&dbpwd=' + dbpwd,function(rs){
console.log(rs);
let result = JSON.parse(rs);
if (result.code === 200) {
ShowAlert("#alertConnect", result.data, "success", 5000);
} else {
ShowAlert("#alertConnect", result.data, "danger", 5000);
}
})
console.log(dbhost);
console.log(dbuser);
console.log(dbpwd);
})
</script>
</body>

+ 0
- 1
src/templets/templet-dirlist.inc View File

@@ -1,4 +1,3 @@
start,默认模板目录说明
default,默认模板文件目录
plus,附加插件模板目录
system,默认底层模板目录

+ 0
- 1
src/templets/templet-filelist.inc View File

@@ -1,4 +1,3 @@
start,系统默认模板文件说明
head.htm,列表页头部模板
head_nocatalog.htm,内容页\主页等无子栏目页面头部模板
index.htm,主页模板


Loading…
Cancel
Save