⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 doc.func.php

📁 hudong维客系统
💻 PHP
字号:
<?php
if (basename($_SERVER['PHP_SELF']) == "doc.func.php") {
	exit("<h1>Access Denied</h1>");
}

function splitHtml($html,$preg='/(<div\s+class=\"hdwiki_tmml\">.+?<\/div>)/i')
{
	$arrhtml=preg_split($preg,$html,-1,PREG_SPLIT_DELIM_CAPTURE);
	$count=count($arrhtml);
	for($i=0;$i<$count;$i++)
	{
		if(preg_match($preg,$arrhtml[$i])){
			$resarr[$i]['value']=strip_tags($arrhtml[$i]);
			$resarr[$i]['flag']=1;
			continue;
		}
		$resarr[$i]['value']=$arrhtml[$i];
		$resarr[$i]['flag']=0;
	}
	unset($arrhtml);
	return $resarr;
}


function joinHtml($arrhtml)
{
	$count=count($arrhtml);
	$str='';
	for($i=0;$i<$count;$i++)
	{
		if($arrhtml[$i]['flag']==1)
		{
			$str.="<div class=\"hdwiki_tmml\">".$arrhtml[$i]['value']."</div>";
		}else {
			$str.=$arrhtml[$i]['value'];
		}
	}
	return $str;
}


function getSections($resarr)
{
	$arrsection=array();
	for($i=0;$i<count($resarr);$i++)
	{
		if($resarr[$i]['flag']==1)
		{
			$arrsection[]=array('key'=>$i,'value'=>$resarr[$i]['value']);
		}
	}
	unset($resarr);
	return $arrsection;
}


function  getDocByTitle( $title )
{
	$title=strtoupper($title);
	global $g_table_prefix,$DB;
	$sql=" select * from {$g_table_prefix}doc where doc_title_upper ='{$title}' and state=1 ";
	$res = $DB->execQuery( $sql );
	if($DB->getNumRows()>0){
		$arr_doc_info = $DB->fetchArray0( $res );
	}
	return $arr_doc_info;
}


function spiltTags($doc_tags)
{
	$tags=split(';',$doc_tags) ;
	$arrTags=array();
	foreach ($tags as $tag)
	{
		if(!empty($tag))
		{
			$arrTags[]=$tag;
		}
	}
	return $arrTags;
}


function joinTags($arrTags)
{
	$arrRes=array();
	foreach ($arrTags as $tag)
	{
		if(!empty($tag))
		{
			$arrRes[]=trim($tag);
		}
	}
	return implode(';',array_unique($arrRes));
}


function  getDocUserList($docid)
{
	global $g_table_prefix,$DB;
	$sql= " SELECT a.* , b.*
			FROM (
				SELECT max( his_created_time ) AS edit_time, his_creator, count( his_id ) AS edit_count
				FROM {$g_table_prefix}his AS h
				WHERE h.doc_id = ".$docid." 
				GROUP BY his_creator
			) AS a, {$g_table_prefix}user b
			WHERE a.his_creator = b.user_id 
			ORDER BY a.edit_count DESC,a.edit_time DESC ";

	$res = $DB->execQuery( $sql );
	if($DB->getNumRows()>0){
		$arr_doc_user_info = $DB->fetchArray( $res );
	}
	return $arr_doc_user_info;
}


function  getDocHisList($docid)
{
	global $g_table_prefix,$DB;
	$sql= " SELECT h.*,u.user_nick
			FROM (				
				SELECT his_created_time, his_creator, his_id, doc_edition_no, his_kind, his_reason
				FROM {$g_table_prefix}his AS h
				WHERE h.doc_id = ".$docid."  
				AND h.state=1 
				ORDER BY doc_edition_no DESC 
			) h, {$g_table_prefix}user u
			WHERE h.his_creator=u.user_id ";

	$res = $DB->execQuery( $sql );
	if($DB->getNumRows()>0){
		$arr_doc_user_info = $DB->fetchArray( $res );
	}
	return $arr_doc_user_info;
}


function  getDocHisInfo($hisid)
{
	global $g_table_prefix,$DB;
	$sql= " SELECT h.*,u.user_nick
			FROM {$g_table_prefix}his h, {$g_table_prefix}user u
			WHERE h.his_id= ".$hisid." 
			AND h.state=1
			AND u.user_id=h.his_creator ";

	$res = $DB->execQuery( $sql );
	if($DB->getNumRows()>0){
		$arr_doc_user_info = $DB->fetchArray0( $res );
	}
	return $arr_doc_user_info;
}
function  getDocHisCompare($hisnewid,$hisoldid)
{
	global $g_table_prefix,$DB;
	$sql= " SELECT h.*,u.user_nick
			FROM {$g_table_prefix}his h, {$g_table_prefix}user u 
			WHERE h.his_id 
			IN (".$hisnewid.",".$hisoldid.")  
			AND h.state=1 
			AND u.user_id=h.his_creator ";

	$res = $DB->execQuery( $sql );
	if($DB->getNumRows()>0){
		$arr_doc_user_info = $DB->fetchArray( $res );
	}
	return $arr_doc_user_info;
}


#鏈

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -