@@ -93,9 +93,6 @@ function dede_random_bytes($length) | |||||
return FALSE; | 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) { | if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE) { | ||||
version_compare(PHP_VERSION, '5.4.0', '>=') && stream_set_chunk_size($fp, $length); | version_compare(PHP_VERSION, '5.4.0', '>=') && stream_set_chunk_size($fp, $length); | ||||
$output = fread($fp, $length); | $output = fread($fp, $length); | ||||
@@ -322,7 +319,7 @@ function string_filter($str,$stype="inject") { | |||||
return $str; | 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; | global $tid,$dsql,$id; | ||||
$tid = $defaulttid ? $defaulttid : $tid; | $tid = $defaulttid ? $defaulttid : $tid; | ||||
@@ -185,36 +185,7 @@ function GetHostInfo($gurl) | |||||
$garr['query'] = "/".preg_replace("/^([^\/]*)\//i", "", $gurl); | $garr['query'] = "/".preg_replace("/^([^\/]*)\//i", "", $gurl); | ||||
return $garr; | 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里的网址格式转换 | * HTML里的网址格式转换 | ||||
* | * | ||||
@@ -51,7 +51,7 @@ function MakePublicTag($atts = array(), $refObj = '', $fields = array()) | |||||
* @param array $attlist 属性列表 | * @param array $attlist 属性列表 | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
function FillAtts(&$atts, $attlist) | |||||
function FillAtts(&$atts, $attlist="") | |||||
{ | { | ||||
$attlists = explode(',', $attlist); | $attlists = explode(',', $attlist); | ||||
foreach ($attlists as $att) { | foreach ($attlists as $att) { | ||||
@@ -889,7 +889,7 @@ class DedeTemplate | |||||
} else if (preg_match("/^value/", $vartype)) { | } else if (preg_match("/^value/", $vartype)) { | ||||
$okvalue = '$'.$vartype; | $okvalue = '$'.$vartype; | ||||
} else if ($vartype == 'field') { | } else if ($vartype == 'field') { | ||||
$okvalue = '$'.str_replace($varname); | |||||
$okvalue = '$fields[\''.trim($varname).'\']'; | |||||
} else { | } else { | ||||
$okvalue = '$GLOBALS[\''.$varname.'\']'; | $okvalue = '$GLOBALS[\''.$varname.'\']'; | ||||
} | } | ||||
@@ -76,7 +76,8 @@ class image | |||||
{ | { | ||||
$this->thumb_gd($thumbwidth, $thumbheight, $preview); | $this->thumb_gd($thumbwidth, $thumbheight, $preview); | ||||
if ($this->thumbstatus == 2 && $this->watermarkstatus) { | 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); | $this->attach['size'] = filesize($this->targetfile); | ||||
} | } | ||||
} | } | ||||