diff --git a/src/admin/inc/inc_archives_functions.php b/src/admin/inc/inc_archives_functions.php index 4c85e9e9..799a3426 100644 --- a/src/admin/inc/inc_archives_functions.php +++ b/src/admin/inc/inc_archives_functions.php @@ -396,7 +396,7 @@ function GetDDImage($litpic, $picname, $isremote) $oldpic = $cfg_basedir.$picname; $litpic = str_replace('.', '-ty.', $picname); @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 { $litpic = $picname; return $litpic; diff --git a/src/system/common.func.php b/src/system/common.func.php index e11c46b1..0688cb31 100755 --- a/src/system/common.func.php +++ b/src/system/common.func.php @@ -539,149 +539,6 @@ function GetUpdateSQL() fclose($fp); return $result; } -/*会员中心调用主题模板*/ -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==''?"{$row['tag']}" : "{$row['tag']}"); - } - return $tags; - } -} -//提取文档多图片[field:body function='obtainimgs(@me,3)'/]3表示调用文档3张图片,则附加字段需添加body字段调用 -if (!function_exists('obtainimgs')) { - function obtainimgs($string, $num) - { - preg_match_all("/]*)\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 .= '
'; - $biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? 'GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-outline-success btn-sm">全部' : 'GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-success btn-sm">全部'); - $addonfields_items = explode(",",$ctag->GetAtt('default')); - for ($i=0; $iGetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); - $biz_addonfields .= ($fields_value!=urlencode($addonfields_items[$i]) ? ''.$addonfields_items[$i].'' : ''.$addonfields_items[$i].''); - } - $biz_addonfields .= '
'; - break; - case 2: - $biz_addonfields .= ''; - break; - case 3: - $biz_addonfields .= '
'; - $biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? 'GetName()."=".$fields_value,"",$filterarr).'">GetName()."=".$fields_value,"",$filterarr).'" onclick="window.location=this.value">全部' : '全部'); - $addonfields_items = explode(",",$ctag->GetAtt('default')); - for ($i=0; $iGetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); - $biz_addonfields .= ($fields_value!=urlencode($addonfields_items[$i]) ? ''.$addonfields_items[$i].'' : ''.$addonfields_items[$i].''); - } - $biz_addonfields .= '
'; - 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 * diff --git a/src/system/datalistcp.class.php b/src/system/datalistcp.class.php index 9a50e8ad..f09f761c 100755 --- a/src/system/datalistcp.class.php +++ b/src/system/datalistcp.class.php @@ -1,7 +1,7 @@ (#)匹配的网址; (*)=>(*)的范围,如:1-20; typeid=>栏目id; addurl=>附加的网址(用|分开多个)] + //匹配多个栏目,规则表达式[(#)=>(#)匹配的网址; (*)=>(*)的范围,如:1-20;typeid=>栏目id;addurl=>附加的网址(用|分开多个)] else { $nrules = explode(']', trim($batchrule)); foreach ($nrules as $nrule) { diff --git a/src/system/extend.func.php b/src/system/extend.func.php index d8d3c001..88c8bc68 100755 --- a/src/system/extend.func.php +++ b/src/system/extend.func.php @@ -1,4 +1,154 @@ */ +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 == '' ? "{$row['tag']}":"{$row['tag']}"); + } + 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("/]*)\s*src=('|\")([^'\"]+)('|\")/", $string, $matches); + $imgsrc_arr = array_unique($matches[3]); + $i = 0; + $result = ""; + foreach($imgsrc_arr as $imgsrc) + { + if ($i == $num) break; + $result .= ""; + $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 .= '
'; + $biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? 'GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-outline-success btn-sm">全部' : 'GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-success btn-sm">全部'); + $addonfields_items = explode(",",$ctag->GetAtt('default')); + for ($i=0; $iGetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); + $biz_addonfields .= ($fields_value!=urlencode($addonfields_items[$i]) ? ''.$addonfields_items[$i].'' : ''.$addonfields_items[$i].''); + } + $biz_addonfields .= '
'; + break; + case 2: + $biz_addonfields .= ''; + break; + case 3: + $biz_addonfields .= '
'; + $biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? 'GetName()."=".$fields_value,"",$filterarr).'">GetName()."=".$fields_value,"",$filterarr).'" onclick="window.location=this.value">全部' : '全部'); + $addonfields_items = explode(",",$ctag->GetAtt('default')); + for ($i=0; $iGetName().'=') ? str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr) : $filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]); + $biz_addonfields .= ($fields_value!=urlencode($addonfields_items[$i]) ? ''.$addonfields_items[$i].'' : ''.$addonfields_items[$i].''); + } + $biz_addonfields .= '
'; + 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; +} ?> \ No newline at end of file diff --git a/src/system/helpers/image.helper.php b/src/system/helpers/image.helper.php index e68b49fa..0a807616 100755 --- a/src/system/helpers/image.helper.php +++ b/src/system/helpers/image.helper.php @@ -11,8 +11,7 @@ require_once DEDEINC."/libraries/imageresize.class.php"; * @link https://www.dedebiz.com */ /** - * 缩图片自动生成函数,来源支持bmp、gif、jpg、png - * 但生成的小图只用jpg或png格式 + * 缩图片自动生成函数,来源支持bmp、gif、jpg、png但生成的小图只用jpg或png格式 * * @access public * @param string $srcFile 图片路径 @@ -24,7 +23,7 @@ require_once DEDEINC."/libraries/imageresize.class.php"; if (!function_exists('ImageResize')) { function ImageResize($srcFile, $toW, $toH, $toFile = "") { - try{ + try { $image = new ImageResize($srcFile); $image->resizeToBestFit($toW, $toH); $image->save($toFile); @@ -137,7 +136,7 @@ if (!function_exists('WaterImg')) { if (!function_exists('ImageResizeNew')) { function ImageResizeNew($srcFile, $toW, $toH, $toFile = '', $issave = TRUE) { - try{ + try { $image = new ImageResize($srcFile); $image->resizeToBestFit($toW, $toH); if ($issave) { @@ -151,3 +150,4 @@ if (!function_exists('ImageResizeNew')) { } } } +?> \ No newline at end of file diff --git a/src/system/libraries/imageresize.class.php b/src/system/libraries/imageresize.class.php index 69252892..b58f23c2 100644 --- a/src/system/libraries/imageresize.class.php +++ b/src/system/libraries/imageresize.class.php @@ -264,7 +264,6 @@ class ImageResize imagecolortransparent($dest_image, $background); imagefill($dest_image, 0, 0, $background); break; - case IMAGETYPE_BMP: if (version_compare(PHP_VERSION, '7.2.0', '<')) { throw new ImageResizeException('For WebP support PHP >= 7.2.0 is required'); @@ -650,4 +649,5 @@ class ImageResize $this->gamma_correct = $enable; return $this; } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/src/system/libraries/splitword.class.php b/src/system/libraries/splitword.class.php index f24dfaaa..9f714abf 100755 --- a/src/system/libraries/splitword.class.php +++ b/src/system/libraries/splitword.class.php @@ -1031,3 +1031,4 @@ class SplitWord return TRUE; } } +?> \ No newline at end of file