@@ -396,7 +396,7 @@ function GetDDImage($litpic, $picname, $isremote) | |||||
$oldpic = $cfg_basedir.$picname; | $oldpic = $cfg_basedir.$picname; | ||||
$litpic = str_replace('.', '-ty.', $picname); | $litpic = str_replace('.', '-ty.', $picname); | ||||
@ImageResizeNew($oldpic, $cfg_ddimg_width, $cfg_ddimg_height, $cfg_basedir.$litpic); | @ImageResizeNew($oldpic, $cfg_ddimg_width, $cfg_ddimg_height, $cfg_basedir.$litpic); | ||||
if (!is_file($cfg_basedir.$litpic)) $litpic = ''; | |||||
if (!is_file($cfg_basedir.$litpic)) $litpic = $litpic = strstr($oldpic,"/static"); | |||||
} else { | } else { | ||||
$litpic = $picname; | $litpic = $picname; | ||||
return $litpic; | return $litpic; | ||||
@@ -539,149 +539,6 @@ function GetUpdateSQL() | |||||
fclose($fp); | fclose($fp); | ||||
return $result; | return $result; | ||||
} | } | ||||
/*会员中心调用主题模板<?php obtaintheme('head.htm');?>*/ | |||||
if (!function_exists('obtaintheme')) { | |||||
require_once DEDEINC."/archive/partview.class.php"; | |||||
function obtaintheme($path) | |||||
{ | |||||
global $cfg_basedir, $cfg_templets_dir, $cfg_df_style; | |||||
$tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$cfg_df_style.'/'.$path; | |||||
$dtp = new PartView(); | |||||
$dtp->SetTemplet($tmpfile); | |||||
$dtp->Display(); | |||||
} | |||||
} | |||||
//标签调用[field:id function='obtaintags(@me,3)'/]3表示调用文档3个标签 | |||||
if (!function_exists('obtaintags')) { | |||||
function obtaintags($aid, $num = 3) | |||||
{ | |||||
global $dsql; | |||||
$tags = ''; | |||||
$query = "SELECT * FROM `#@__taglist` WHERE aid='$aid' LIMIT $num"; | |||||
$dsql->Execute('tag',$query); | |||||
while($row = $dsql->GetArray('tag')) { | |||||
$link = "/apps/tags.php?/{$row['tid']}"; | |||||
$tags .= ($tags==''?"<a href='{$link}'>{$row['tag']}</a>" : "<a href='{$link}'>{$row['tag']}</a>"); | |||||
} | |||||
return $tags; | |||||
} | |||||
} | |||||
//提取文档多图片[field:body function='obtainimgs(@me,3)'/]3表示调用文档3张图片,则附加字段需添加body字段调用 | |||||
if (!function_exists('obtainimgs')) { | |||||
function obtainimgs($string, $num) | |||||
{ | |||||
preg_match_all("/<img([^>]*)\s*src=('|\")([^'\"]+)('|\")/", $string, $matches); | |||||
$imgsrc_arr = array_unique($matches[3]); | |||||
$i = 0; | |||||
$result = ""; | |||||
foreach($imgsrc_arr as $imgsrc) | |||||
{ | |||||
if ($i == $num) break; | |||||
$result .= "$imgsrc"; | |||||
$i++; | |||||
} | |||||
return $result; | |||||
} | |||||
} | |||||
//联动单筛选{dede:php}obtainfilter(模型id,类型,'字段1,字段2');{/dede:php}类型表示前台展现方式对应case值 | |||||
function obtainfilter($channelid, $type = 1, $fieldsnamef = '', $defaulttid = 0, $toptid = 0, $loadtype = 'autofield') | |||||
{ | |||||
global $tid, $dsql, $id, $aid; | |||||
$tid = $defaulttid ? $defaulttid : $tid; | |||||
if ($id!="" || $aid!="") { | |||||
$arcid = $id!="" ? $id : $aid; | |||||
$tidsq = $dsql->GetOne("SELECT * FROM `#@__archives` WHERE id='$arcid'"); | |||||
$tid = $toptid==0 ? $tidsq["typeid"] : $tidsq["topid"]; | |||||
} | |||||
$nofilter = (isset($_REQUEST['TotalResult']) ? "&TotalResult=".$_REQUEST['TotalResult'] : '').(isset($_REQUEST['PageNo']) ? "&PageNo=".$_REQUEST['PageNo'] : ''); | |||||
$filterarr = string_filter(stripos($_SERVER['REQUEST_URI'], "list.php?tid=") ? str_replace($nofilter, '', $_SERVER['REQUEST_URI']) : $GLOBALS['cfg_cmsurl']."/apps/list.php?tid=".$tid); | |||||
$cInfos = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$channelid'"); | |||||
$fieldset=$cInfos['fieldset']; | |||||
$dtp = new DedeTagParse(); | |||||
$dtp->SetNameSpace('field', '<', '>'); | |||||
$dtp->LoadSource($fieldset); | |||||
$biz_addonfields = ''; | |||||
if (is_array($dtp->CTags)) { | |||||
foreach($dtp->CTags as $tida=>$ctag) | |||||
{ | |||||
$fieldsname = $fieldsnamef ? explode(",", $fieldsnamef) : explode(",", $ctag->GetName()); | |||||
if (($loadtype!='autofield' || ($loadtype=='autofield' && $ctag->GetAtt('autofield')==1)) && in_array($ctag->GetName(), $fieldsname)) { | |||||
$href1 = explode($ctag->GetName().'=', $filterarr); | |||||
$href2 = explode('&', $href1[1]); | |||||
$fields_value = $href2[0]; | |||||
switch ($type) { | |||||
case 1: | |||||
$biz_addonfields .= '<div class="mb-3">'; | |||||
$biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? '<a href="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-outline-success btn-sm">全部</a>' : '<a href="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-success btn-sm">全部</a>'); | |||||
$addonfields_items = explode(",",$ctag->GetAtt('default')); | |||||
for ($i=0; $i<count($addonfields_items); $i++) | |||||
{ | |||||
$href = stripos($filterarr,$ctag->GetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); | |||||
$biz_addonfields .= ($fields_value!=urlencode($addonfields_items[$i]) ? '<a title="'.$addonfields_items[$i].'" href="'.$href.'" class="btn btn-outline-success btn-sm">'.$addonfields_items[$i].'</a>' : '<a href="'.$href.'" class="btn btn-success btn-sm">'.$addonfields_items[$i].'</a>'); | |||||
} | |||||
$biz_addonfields .= '</div>'; | |||||
break; | |||||
case 2: | |||||
$biz_addonfields .= '<select name="filter'.$ctag->GetName().'" onchange="window.location=this.options[this.selectedIndex].value" class="form-control w-25 mr-3"> | |||||
'.'<option value="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'">全部</option>'; | |||||
$addonfields_items = explode(",",$ctag->GetAtt('default')); | |||||
for ($i=0; $i<count($addonfields_items); $i++) | |||||
{ | |||||
$href = stripos($filterarr,$ctag->GetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); | |||||
$biz_addonfields .= '<option value="'.$href.'"'.($fields_value==urlencode($addonfields_items[$i]) ? ' selected="selected"' : '').'>'.$addonfields_items[$i].'</option> | |||||
'; | |||||
} | |||||
$biz_addonfields .= '</select>'; | |||||
break; | |||||
case 3: | |||||
$biz_addonfields .= '<div class="mb-3">'; | |||||
$biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? '<a href="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'"><input type="radio" name="filter'.$ctag->GetName().'" value="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'" onclick="window.location=this.value">全部</a>' : '<span><input type="radio" name="filter'.$ctag->GetName().'" checked="checked">全部</span>'); | |||||
$addonfields_items = explode(",",$ctag->GetAtt('default')); | |||||
for ($i=0; $i<count($addonfields_items); $i++) | |||||
{ | |||||
$href = stripos($filterarr,$ctag->GetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); | |||||
$biz_addonfields .= ($fields_value!=urlencode($addonfields_items[$i]) ? '<a title="'.$addonfields_items[$i].'" href="'.$href.'"><input type="radio" name="filter'.$ctag->GetName().'" value="'.$href.'" onclick="window.location=this.value">'.$addonfields_items[$i].'</a>' : '<span><input type="radio" name="filter'.$ctag->GetName().'" checked="checked">'.$addonfields_items[$i].'</span>'); | |||||
} | |||||
$biz_addonfields .= '</div>'; | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
echo $biz_addonfields; | |||||
} | |||||
//联动单筛选获取附加表 | |||||
function litimgurls($imgid = 0) | |||||
{ | |||||
global $dsql, $lit_imglist; | |||||
$row = $dsql->GetOne("SELECT c.addtable FROM `#@__archives` AS a LEFT JOIN `#@__channeltype` AS c ON a.channel=c.id WHERE a.id='$imgid'"); | |||||
$addtable = trim($row['addtable']); | |||||
$row = $dsql->GetOne("SELECT imgurls FROM `$addtable` WHERE aid='$imgid'"); | |||||
$ChannelUnit = new ChannelUnit(2, $imgid); | |||||
$lit_imglist = $ChannelUnit->GetlitImgLinks($row['imgurls']); | |||||
return $lit_imglist; | |||||
} | |||||
//联动单筛选字符过滤函数 | |||||
function string_filter($str, $stype = "inject") | |||||
{ | |||||
if ($stype == "inject") { | |||||
$str = str_replace( | |||||
array("select", "insert", "update", "delete", "alter", "cas", "union", "into", "load_file", "outfile", "create", "join", "where", "like", "drop", "modify", "rename", "'", "/*", "*", "../", "./"), | |||||
array("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""), | |||||
$str | |||||
); | |||||
} else if ($stype == "xss") { | |||||
$farr = array("/\s+/", "/<(\/?)(script|META|STYLE|HTML|HEAD|BODY|STYLE |i?frame|b|strong|style|html|img|P|o:p|iframe|u|em|strike|BR|div|a|TABLE|TBODY|object|tr|td|st1:chsdate|FONT|span|MARQUEE|body|title|\r\n|link|meta|\?|\%)([^>]*?)>/isU", "/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU",); | |||||
$tarr = array(" ", "", "\\1\\2",); | |||||
$str = preg_replace($farr, $tarr, $str); | |||||
$str = str_replace( | |||||
array("<", ">", "'", "\"", ";", "/*", "*", "../", "./"), | |||||
array("<", ">", "", "", "", "", "", "", ""), | |||||
$str | |||||
); | |||||
} | |||||
return $str; | |||||
} | |||||
/** | /** | ||||
* GetMimeTypeOrExtension | * GetMimeTypeOrExtension | ||||
* | * | ||||
@@ -1,7 +1,7 @@ | |||||
<?php | <?php | ||||
if (!defined('DEDEINC')) exit ('dedebiz'); | if (!defined('DEDEINC')) exit ('dedebiz'); | ||||
/** | /** | ||||
* 动态分页 | |||||
* 系统后台分页 | |||||
* | * | ||||
* @version $id:datalistcp.class.php 3 17:02 2010年7月9日 tianya $ | * @version $id:datalistcp.class.php 3 17:02 2010年7月9日 tianya $ | ||||
* @package DedeBIZ.Libraries | * @package DedeBIZ.Libraries | ||||
@@ -316,7 +316,6 @@ function FillUrl($refurl, $surl) | |||||
$surl = trim($surl); | $surl = trim($surl); | ||||
$urls = @parse_url($refurl); | $urls = @parse_url($refurl); | ||||
$basehost = ((!isset($urls['port']) || $urls['port'] == '80') ? $urls['host'] : $urls['host'].':'.$urls['port']); | $basehost = ((!isset($urls['port']) || $urls['port'] == '80') ? $urls['host'] : $urls['host'].':'.$urls['port']); | ||||
//$basepath = $basehost.(!isset($urls['path']) ? '' : '/'.$urls['path']); | |||||
//由于直接获得的path在处理 http://xxxx/nnn/aaa?fdsafd 这种情况时会有错误,因此用其它方式处理 | //由于直接获得的path在处理 http://xxxx/nnn/aaa?fdsafd 这种情况时会有错误,因此用其它方式处理 | ||||
$basepath = $basehost; | $basepath = $basehost; | ||||
$paths = explode('/', preg_replace("/^http:\/\//i", "", $refurl)); | $paths = explode('/', preg_replace("/^http:\/\//i", "", $refurl)); | ||||
@@ -413,8 +412,7 @@ function GetUrlFromListRule($regxurl = '', $handurl = '', $startid = 0, $endid = | |||||
} | } | ||||
} | } | ||||
} | } | ||||
//匹配多个栏目 | |||||
//规则表达式 [(#)=>(#)匹配的网址; (*)=>(*)的范围,如:1-20; typeid=>栏目id; addurl=>附加的网址(用|分开多个)] | |||||
//匹配多个栏目,规则表达式[(#)=>(#)匹配的网址; (*)=>(*)的范围,如:1-20;typeid=>栏目id;addurl=>附加的网址(用|分开多个)] | |||||
else { | else { | ||||
$nrules = explode(']', trim($batchrule)); | $nrules = explode(']', trim($batchrule)); | ||||
foreach ($nrules as $nrule) { | foreach ($nrules as $nrule) { | ||||
@@ -1,4 +1,154 @@ | |||||
<?php | <?php | ||||
if (!defined('DEDEINC')) exit ('dedebiz'); | if (!defined('DEDEINC')) exit ('dedebiz'); | ||||
//这里扩展自己的函数 | |||||
/** | |||||
* 扩展函数 | |||||
* @version $id:extend.func.php 2 20:50 2010年7月7日 tianya $ | |||||
* @package DedeBIZ.Libraries | |||||
* @copyright Copyright (c) 2022 DedeBIZ.COM | |||||
* @license GNU GPL v2 (https://www.dedebiz.com/license) | |||||
* @link https://www.dedebiz.com | |||||
*/ | |||||
/*会员中心调用主题模板<?php obtaintheme('head.htm');?>*/ | |||||
if (!function_exists('obtaintheme')) { | |||||
require_once DEDEINC."/archive/partview.class.php"; | |||||
function obtaintheme($path) | |||||
{ | |||||
global $cfg_basedir, $cfg_templets_dir, $cfg_df_style; | |||||
$tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$cfg_df_style.'/'.$path; | |||||
$dtp = new PartView(); | |||||
$dtp->SetTemplet($tmpfile); | |||||
$dtp->Display(); | |||||
} | |||||
} | |||||
//标签调用[field:id function='obtaintags(@me,3)'/]3表示调用文档3个标签 | |||||
if (!function_exists('obtaintags')) { | |||||
function obtaintags($aid, $num = 3) | |||||
{ | |||||
global $dsql; | |||||
$tags = ''; | |||||
$query = "SELECT * FROM `#@__taglist` WHERE aid='$aid' LIMIT $num"; | |||||
$dsql->Execute('tag',$query); | |||||
while($row = $dsql->GetArray('tag')) { | |||||
$link = "/apps/tags.php?/{$row['tid']}"; | |||||
$tags .= ($tags == '' ? "<a href='{$link}'>{$row['tag']}</a>":"<a href='{$link}'>{$row['tag']}</a>"); | |||||
} | |||||
return $tags; | |||||
} | |||||
} | |||||
//提取文档多图片[field:body function='obtainimgs(@me,3)'/]3表示调用文档3张图片,则附加字段需添加body字段调用channelid='模型id' addfields='字段1,字段2' | |||||
if (!function_exists('obtainimgs')) { | |||||
function obtainimgs($string, $num) | |||||
{ | |||||
preg_match_all("/<img([^>]*)\s*src=('|\")([^'\"]+)('|\")/", $string, $matches); | |||||
$imgsrc_arr = array_unique($matches[3]); | |||||
$i = 0; | |||||
$result = ""; | |||||
foreach($imgsrc_arr as $imgsrc) | |||||
{ | |||||
if ($i == $num) break; | |||||
$result .= "<img src=\"$imgsrc\">"; | |||||
$i++; | |||||
} | |||||
return $result; | |||||
} | |||||
} | |||||
//联动单筛选{dede:php}obtainfilter(模型id,类型,'字段1,字段2');{/dede:php}类型表示前台展现方式对应case值 | |||||
function obtainfilter($channelid, $type = 1, $fieldsnamef = '', $defaulttid = 0, $toptid = 0, $loadtype = 'autofield') | |||||
{ | |||||
global $tid, $dsql, $id, $aid; | |||||
$tid = $defaulttid ? $defaulttid : $tid; | |||||
if ($id!="" || $aid!="") { | |||||
$arcid = $id!="" ? $id : $aid; | |||||
$tidsq = $dsql->GetOne("SELECT * FROM `#@__archives` WHERE id='$arcid'"); | |||||
$tid = $toptid==0 ? $tidsq["typeid"] : $tidsq["topid"]; | |||||
} | |||||
$nofilter = (isset($_REQUEST['TotalResult']) ? "&TotalResult=".$_REQUEST['TotalResult'] : '').(isset($_REQUEST['PageNo']) ? "&PageNo=".$_REQUEST['PageNo'] : ''); | |||||
$filterarr = string_filter(stripos($_SERVER['REQUEST_URI'], "list.php?tid=") ? str_replace($nofilter, '', $_SERVER['REQUEST_URI']) : $GLOBALS['cfg_cmsurl']."/apps/list.php?tid=".$tid); | |||||
$cInfos = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$channelid'"); | |||||
$fieldset=$cInfos['fieldset']; | |||||
$dtp = new DedeTagParse(); | |||||
$dtp->SetNameSpace('field', '<', '>'); | |||||
$dtp->LoadSource($fieldset); | |||||
$biz_addonfields = ''; | |||||
if (is_array($dtp->CTags)) { | |||||
foreach($dtp->CTags as $tida=>$ctag) | |||||
{ | |||||
$fieldsname = $fieldsnamef ? explode(",", $fieldsnamef) : explode(",", $ctag->GetName()); | |||||
if (($loadtype!='autofield' || ($loadtype=='autofield' && $ctag->GetAtt('autofield')==1)) && in_array($ctag->GetName(), $fieldsname)) { | |||||
$href1 = explode($ctag->GetName().'=', $filterarr); | |||||
$href2 = explode('&', $href1[1]); | |||||
$fields_value = $href2[0]; | |||||
switch ($type) { | |||||
case 1: | |||||
$biz_addonfields .= '<div class="mb-3">'; | |||||
$biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? '<a href="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-outline-success btn-sm">全部</a>' : '<a href="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-success btn-sm">全部</a>'); | |||||
$addonfields_items = explode(",",$ctag->GetAtt('default')); | |||||
for ($i=0; $i<count($addonfields_items); $i++) | |||||
{ | |||||
$href = stripos($filterarr,$ctag->GetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); | |||||
$biz_addonfields .= ($fields_value!=urlencode($addonfields_items[$i]) ? '<a title="'.$addonfields_items[$i].'" href="'.$href.'" class="btn btn-outline-success btn-sm">'.$addonfields_items[$i].'</a>' : '<a href="'.$href.'" class="btn btn-success btn-sm">'.$addonfields_items[$i].'</a>'); | |||||
} | |||||
$biz_addonfields .= '</div>'; | |||||
break; | |||||
case 2: | |||||
$biz_addonfields .= '<select name="filter'.$ctag->GetName().'" onchange="window.location=this.options[this.selectedIndex].value" class="form-control w-25 mr-3"> | |||||
'.'<option value="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'">全部</option>'; | |||||
$addonfields_items = explode(",",$ctag->GetAtt('default')); | |||||
for ($i=0; $i<count($addonfields_items); $i++) | |||||
{ | |||||
$href = stripos($filterarr,$ctag->GetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); | |||||
$biz_addonfields .= '<option value="'.$href.'"'.($fields_value==urlencode($addonfields_items[$i]) ? ' selected="selected"' : '').'>'.$addonfields_items[$i].'</option> | |||||
'; | |||||
} | |||||
$biz_addonfields .= '</select>'; | |||||
break; | |||||
case 3: | |||||
$biz_addonfields .= '<div class="mb-3">'; | |||||
$biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? '<a href="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'"><input type="radio" name="filter'.$ctag->GetName().'" value="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'" onclick="window.location=this.value">全部</a>' : '<span><input type="radio" name="filter'.$ctag->GetName().'" checked="checked">全部</span>'); | |||||
$addonfields_items = explode(",",$ctag->GetAtt('default')); | |||||
for ($i=0; $i<count($addonfields_items); $i++) | |||||
{ | |||||
$href = stripos($filterarr,$ctag->GetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); | |||||
$biz_addonfields .= ($fields_value!=urlencode($addonfields_items[$i]) ? '<a title="'.$addonfields_items[$i].'" href="'.$href.'"><input type="radio" name="filter'.$ctag->GetName().'" value="'.$href.'" onclick="window.location=this.value">'.$addonfields_items[$i].'</a>' : '<span><input type="radio" name="filter'.$ctag->GetName().'" checked="checked">'.$addonfields_items[$i].'</span>'); | |||||
} | |||||
$biz_addonfields .= '</div>'; | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
echo $biz_addonfields; | |||||
} | |||||
//联动单筛选获取附加表 | |||||
function litimgurls($imgid = 0) | |||||
{ | |||||
global $dsql, $lit_imglist; | |||||
$row = $dsql->GetOne("SELECT c.addtable FROM `#@__archives` AS a LEFT JOIN `#@__channeltype` AS c ON a.channel=c.id WHERE a.id='$imgid'"); | |||||
$addtable = trim($row['addtable']); | |||||
$row = $dsql->GetOne("SELECT imgurls FROM `$addtable` WHERE aid='$imgid'"); | |||||
$ChannelUnit = new ChannelUnit(2, $imgid); | |||||
$lit_imglist = $ChannelUnit->GetlitImgLinks($row['imgurls']); | |||||
return $lit_imglist; | |||||
} | |||||
//联动单筛选字符过滤函数 | |||||
function string_filter($str, $stype = "inject") | |||||
{ | |||||
if ($stype == "inject") { | |||||
$str = str_replace( | |||||
array("select", "insert", "update", "delete", "alter", "cas", "union", "into", "load_file", "outfile", "create", "join", "where", "like", "drop", "modify", "rename", "'", "/*", "*", "../", "./"), | |||||
array("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""), | |||||
$str | |||||
); | |||||
} else if ($stype == "xss") { | |||||
$farr = array("/\s+/", "/<(\/?)(script|META|STYLE|HTML|HEAD|BODY|STYLE |i?frame|b|strong|style|html|img|P|o:p|iframe|u|em|strike|BR|div|a|TABLE|TBODY|object|tr|td|st1:chsdate|FONT|span|MARQUEE|body|title|\r\n|link|meta|\?|\%)([^>]*?)>/isU", "/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU",); | |||||
$tarr = array(" ", "", "\\1\\2",); | |||||
$str = preg_replace($farr, $tarr, $str); | |||||
$str = str_replace( | |||||
array("<", ">", "'", "\"", ";", "/*", "*", "../", "./"), | |||||
array("<", ">", "", "", "", "", "", "", ""), | |||||
$str | |||||
); | |||||
} | |||||
return $str; | |||||
} | |||||
?> | ?> |
@@ -11,8 +11,7 @@ require_once DEDEINC."/libraries/imageresize.class.php"; | |||||
* @link https://www.dedebiz.com | * @link https://www.dedebiz.com | ||||
*/ | */ | ||||
/** | /** | ||||
* 缩图片自动生成函数,来源支持bmp、gif、jpg、png | |||||
* 但生成的小图只用jpg或png格式 | |||||
* 缩图片自动生成函数,来源支持bmp、gif、jpg、png但生成的小图只用jpg或png格式 | |||||
* | * | ||||
* @access public | * @access public | ||||
* @param string $srcFile 图片路径 | * @param string $srcFile 图片路径 | ||||
@@ -24,7 +23,7 @@ require_once DEDEINC."/libraries/imageresize.class.php"; | |||||
if (!function_exists('ImageResize')) { | if (!function_exists('ImageResize')) { | ||||
function ImageResize($srcFile, $toW, $toH, $toFile = "") | function ImageResize($srcFile, $toW, $toH, $toFile = "") | ||||
{ | { | ||||
try{ | |||||
try { | |||||
$image = new ImageResize($srcFile); | $image = new ImageResize($srcFile); | ||||
$image->resizeToBestFit($toW, $toH); | $image->resizeToBestFit($toW, $toH); | ||||
$image->save($toFile); | $image->save($toFile); | ||||
@@ -137,7 +136,7 @@ if (!function_exists('WaterImg')) { | |||||
if (!function_exists('ImageResizeNew')) { | if (!function_exists('ImageResizeNew')) { | ||||
function ImageResizeNew($srcFile, $toW, $toH, $toFile = '', $issave = TRUE) | function ImageResizeNew($srcFile, $toW, $toH, $toFile = '', $issave = TRUE) | ||||
{ | { | ||||
try{ | |||||
try { | |||||
$image = new ImageResize($srcFile); | $image = new ImageResize($srcFile); | ||||
$image->resizeToBestFit($toW, $toH); | $image->resizeToBestFit($toW, $toH); | ||||
if ($issave) { | if ($issave) { | ||||
@@ -151,3 +150,4 @@ if (!function_exists('ImageResizeNew')) { | |||||
} | } | ||||
} | } | ||||
} | } | ||||
?> |
@@ -264,7 +264,6 @@ class ImageResize | |||||
imagecolortransparent($dest_image, $background); | imagecolortransparent($dest_image, $background); | ||||
imagefill($dest_image, 0, 0, $background); | imagefill($dest_image, 0, 0, $background); | ||||
break; | break; | ||||
case IMAGETYPE_BMP: | case IMAGETYPE_BMP: | ||||
if (version_compare(PHP_VERSION, '7.2.0', '<')) { | if (version_compare(PHP_VERSION, '7.2.0', '<')) { | ||||
throw new ImageResizeException('For WebP support PHP >= 7.2.0 is required'); | throw new ImageResizeException('For WebP support PHP >= 7.2.0 is required'); | ||||
@@ -650,4 +649,5 @@ class ImageResize | |||||
$this->gamma_correct = $enable; | $this->gamma_correct = $enable; | ||||
return $this; | return $this; | ||||
} | } | ||||
} | |||||
} | |||||
?> |
@@ -1031,3 +1031,4 @@ class SplitWord | |||||
return TRUE; | return TRUE; | ||||
} | } | ||||
} | } | ||||
?> |