Browse Source

代码调整

tags/6.1.6
tianya 2 years ago
parent
commit
6c0a398820
4 changed files with 6 additions and 37 deletions
  1. +1
    -4
      src/system/common.func.php
  2. +1
    -30
      src/system/dedecollection.func.php
  3. +2
    -2
      src/system/dedetemplate.class.php
  4. +2
    -1
      src/system/image.class.php

+ 1
- 4
src/system/common.func.php View File

@@ -93,9 +93,6 @@ function dede_random_bytes($length)
return FALSE;
}
}
if (defined('MCRYPT_DEV_URANDOM') && ($output = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)) !== FALSE) {
return $output;
}
if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE) {
version_compare(PHP_VERSION, '5.4.0', '>=') && stream_set_chunk_size($fp, $length);
$output = fread($fp, $length);
@@ -322,7 +319,7 @@ function string_filter($str,$stype="inject") {
return $str;
}
//载入自定义表单,用于发布
function AddFilter($channelid, $type=1, $fieldsnamef=array(), $defaulttid=0, $loadtype='autofield')
function AddFilter($channelid, $type=1, $fieldsnamef="", $defaulttid=0, $loadtype='autofield')
{
global $tid,$dsql,$id;
$tid = $defaulttid ? $defaulttid : $tid;


+ 1
- 30
src/system/dedecollection.func.php View File

@@ -185,36 +185,7 @@ function GetHostInfo($gurl)
$garr['query'] = "/".preg_replace("/^([^\/]*)\//i", "", $gurl);
return $garr;
}
/**
* HTML里的图片转DEDE格式
*
* @access public
* @param string $body 文章内容
* @return string
*/
function TurnImageTag(&$body)
{
global $cfg_album_width, $cfg_ddimg_width;
if (empty($cfg_album_width)) {
$cfg_album_width = 800;
}
if (empty($cfg_ddimg_width)) {
$cfg_ddimg_width = 150;
}
$patten = "/<\\s*img\\s.*?src\\s*=\\s*([\"\\'])?(?(1)(.*?)\\1|([^\\s\\>\"\\']+))/isx";
preg_match_all($patten, $body, $images);
$returnArray1 = $images[2];
$returnArray2 = $images[3];
foreach ($returnArray1 as $key => $value) {
if ($value) {
$ttx .= "{dede:img ddimg='$litpicname' text='图 ".($key + 1)."'}".$value."{/dede:img}"."\r\n";
} else {
$ttx .= "{dede:img ddimg='$litpicname' text='图 ".($key + 1)."'}".$returnArray2[$key]."{/dede:img}"."\r\n";
}
}
$ttx = "\r\n{dede:pagestyle maxwidth='{$cfg_album_width}' ddmaxwidth='{$cfg_ddimg_width}' row='3' col='3' value='2'/}\r\n{dede:comments}图集类型会采集时生成此配置是正常的,不过如果后面没有跟着img标记则表示规则无效{/dede:comments}\r\n".$ttx;
return $ttx;
}
/**
* HTML里的网址格式转换
*


+ 2
- 2
src/system/dedetemplate.class.php View File

@@ -51,7 +51,7 @@ function MakePublicTag($atts = array(), $refObj = '', $fields = array())
* @param array $attlist 属性列表
* @return void
*/
function FillAtts(&$atts, $attlist)
function FillAtts(&$atts, $attlist="")
{
$attlists = explode(',', $attlist);
foreach ($attlists as $att) {
@@ -889,7 +889,7 @@ class DedeTemplate
} else if (preg_match("/^value/", $vartype)) {
$okvalue = '$'.$vartype;
} else if ($vartype == 'field') {
$okvalue = '$'.str_replace($varname);
$okvalue = '$fields[\''.trim($varname).'\']';
} else {
$okvalue = '$GLOBALS[\''.$varname.'\']';
}


+ 2
- 1
src/system/image.class.php View File

@@ -76,7 +76,8 @@ class image
{
$this->thumb_gd($thumbwidth, $thumbheight, $preview);
if ($this->thumbstatus == 2 && $this->watermarkstatus) {
$this->image($this->targetfile, $this->attach);
$this->image($this->targetfile, $this->attach,$this->watermarktext,$this->watermarkstatus,$this->watermarktrans,$this->watermarkminheight
,$this->watermarkminwidth,$this->watermarktype,$this->watermarktrans,true,$this->attach);
$this->attach['size'] = filesize($this->targetfile);
}
}


Loading…
Cancel
Save