diff --git a/core/class/class_image.php b/core/class/class_image.php index ea2796c..81cdd4c 100644 --- a/core/class/class_image.php +++ b/core/class/class_image.php @@ -338,7 +338,7 @@ class image { function loadsource() { $imagecreatefromfunc = &$this->imagecreatefromfunc; - if($imagecreatefromfunc == 'imagecreatefromwebp'){ + /*if($imagecreatefromfunc == 'imagecreatefromwebp'){ $info = $this->webpinfo($this->source); if ($info !== false) { if ($info['Animation']) { @@ -350,7 +350,7 @@ class image { }else{ return -1; } - } + }*/ $im = @$imagecreatefromfunc($this->source); if(!$im) { if(!function_exists('imagecreatefromstring')) { diff --git a/core/class/dzz/dzz_upgrade.php b/core/class/dzz/dzz_upgrade.php index 9da6461..4a1cf74 100644 --- a/core/class/dzz/dzz_upgrade.php +++ b/core/class/dzz/dzz_upgrade.php @@ -351,8 +351,8 @@ class dzz_upgrade if (!@mkdir($dir, 0777)) { return false; } - @touch($dir . '/index.htm'); - @chmod($dir . '/index.htm', 0777); + // @touch($dir . '/index.html'); + // @chmod($dir . '/index.html', 0777); } return true; } diff --git a/core/class/dzz/sysreg.php b/core/class/dzz/sysreg.php index 16bbb03..d015b5e 100644 --- a/core/class/dzz/sysreg.php +++ b/core/class/dzz/sysreg.php @@ -17,10 +17,33 @@ class Sysreg{ $chars[date('s')].substr(md5($onlineip.TIMESTAMP), 0, 4).random(4); C::t('setting')->update('machinecode',$mcode); C::t('setting')->update('adminfirstlogin',0); + include_once libfile('function/cache'); + updatecache(array('machinecode','adminfirstlogin')); + self::upgradeinformation($mcode); }else{ C::t('setting')->update('adminfirstlogin',0); } } + private static function upgradeinformation($machinecode) { + global $_SERVER; + $update = array(); + $update[ 'mcode' ] = $machinecode; + $update[ 'usum' ] = 1; + $update[ 'siteurl' ] = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST']; + $update[ 'sitename' ] = getglobal('sitename'); + $update[ 'version' ] = CORE_VERSION; + $update[ 'version_level' ] = CORE_VERSION_LEVEL; + $update[ 'release' ] = CORE_RELEASE; + $update[ 'fixbug' ] = CORE_FIXBUG; + $update[ 'license_version' ] = LICENSE_VERSION; + $update[ 'license_limit' ] = LICENSE_LIMIT; + $data = ''; + foreach ( $update as $key => $value ) { + $data .= $key . '=' . rawurlencode( $value ) . '&'; + } + $upgradeurl = APP_CHECK_URL . "authlicense/count/info/" . rawurlencode( base64_encode( $data ) ) . "/" . time(); + dfopen( $upgradeurl ); + } } diff --git a/core/class/io/io_dzz.php b/core/class/io/io_dzz.php index 861651e..ab245dc 100644 --- a/core/class/io/io_dzz.php +++ b/core/class/io/io_dzz.php @@ -879,6 +879,65 @@ class io_dzz extends io_api $target = $dir . '/' . $subdir; return $target; } + function webpinfo($file) { + if (!is_file($file)) { + return false; + } else { + $file = realpath($file); + } + + $fp = fopen($file, 'rb'); + if (!$fp) { + return false; + } + + $data = fread($fp, 90); + + fclose($fp); + unset($fp); + + $header_format = 'A4Riff/' . // 获取4个字符的字符串 + 'I1Filesize/' . // 获取一个整数(文件大小,但不是实际大小) + 'A4Webp/' . // 获取4个字符的字符串 + 'A4Vp/' . // 获取4个字符的字符串 + 'A74Chunk'; // 获取74个字符的字符串 + $header = unpack($header_format, $data); + unset($data, $header_format); + + if (!isset($header['Riff']) || strtoupper($header['Riff']) !== 'RIFF') { + return false; + } + if (!isset($header['Webp']) || strtoupper($header['Webp']) !== 'WEBP') { + return false; + } + if (!isset($header['Vp']) || strpos(strtoupper($header['Vp']), 'VP8') === false) { + return false; + } + + if ( + strpos(strtoupper($header['Chunk']), 'ANIM') !== false || + strpos(strtoupper($header['Chunk']), 'ANMF') !== false + ) { + $header['Animation'] = true; + } else { + $header['Animation'] = false; + } + + if (strpos(strtoupper($header['Chunk']), 'ALPH') !== false) { + $header['Alpha'] = true; + } else { + if (strpos(strtoupper($header['Vp']), 'VP8L') !== false) { + // 如果是VP8L,假设该图像会有透明度 + // 如Google文档中描述的WebP简单文件格式无损部分 + $header['Alpha'] = true; + } else { + $header['Alpha'] = false; + } + } + + unset($header['Chunk']); + return $header; + } public function createThumbByOriginal($path, $data, $width = 0, $height = 0, $thumbtype = 1, $original = 0, $extraparams = array(), $filesize = 0) { global $_G; @@ -898,7 +957,7 @@ class io_dzz extends io_api fclose($fp); $fileuri = $cachefile; } - + $thumbpath = false; //如果服务器处理完成后,路径非图片类文件的时候,直接获取文件后缀对应的图片 if (!in_array($ext, array('png', 'jpg', 'gif', 'jpeg','webp')) || !$imginfo = @getimagesize($fileuri)) { $thumbpath = false; @@ -920,54 +979,77 @@ class io_dzz extends io_api $extraflag .= '_' . $extraparams['watermarktext']; } - if(in_array($data['ext'],array('gif'))){ + if(in_array($ext,array('gif'))){ $thumbext = 'gif'; }else{ $thumbext = 'webp'; } - $thumbpath = self::getthumbpath('pichomethumb'); + $thumbpathdir = self::getthumbpath('pichomethumb'); if($data['aid']) $thumbname = md5($data['aid'].$data['thumbsign'].$extraflag).'_'.$data['thumbsign'].'.'.$thumbext; else $thumbname = md5($path.$data['thumbsign'].$extraflag).'_'.$data['thumbsign'].'.'.$thumbext; - $targetpath = $thumbpath.$thumbname; + $targetpath = $thumbpathdir.$thumbname; } $target = $targetpath; - //图片小于最小水印最小设置时,不生成水印 - if ($extraparams['nomark'] ||($_G['setting']['IsWatermarkstatus'] == 0 || ($imginfo[0] < $_G['setting']['watermarkminwidth'] || $imginfo[1] < $_G['setting']['watermarkminheight']))) { - $nomark = 1; - } - //返回原图的时候 或者图片小于缩略图宽高的不生成直接返回原图 - if ($original || ($imginfo[0] < $width || $imginfo[1] < $height)) { - $target_attach = $_G['setting']['attachdir'] . './' . $target; - $targetpath = dirname($target_attach); - dmkdir($targetpath); + if($ext == 'webp'){ + $info = $this->webpinfo($fileuri); + if ($info !== false) { + if ($info['Animation'] || $info['Alpha']) { + $target_attach = $_G['setting']['attachdir'] . './' . $target; + $targetpath = dirname($target_attach); + dmkdir($targetpath); - if(copy($fileuri, $target_attach)){ - $thumbpath = $target_attach; - if (!$nomark) self::watermark($target_attach = $_G['setting']['attachdir'] . './' . $target, '', $extraparams); - $thumbpath = $target; + if(copy($fileuri, $target_attach)){ + $thumbpath = $target_attach; + $thumbpath = $target; + }else{ + $thumbpath = false; + } + } + }else{ + $thumbpath = false; } - } else { - //生成缩略图 - include_once libfile('class/image'); - $target_attach = $_G['setting']['attachdir'] . './' . $target; - $targetpath = dirname($target_attach); - dmkdir($targetpath); - $image = new image(); - try { - $thumb = $image->Thumb($fileuri, $target, $width, $height, $thumbtype, 0, $extraparams); + } + if(!$thumbpath){ + //图片小于最小水印最小设置时,不生成水印 + if ($extraparams['nomark'] ||($_G['setting']['IsWatermarkstatus'] == 0 || ($imginfo[0] < $_G['setting']['watermarkminwidth'] || $imginfo[1] < $_G['setting']['watermarkminheight']))) { + $nomark = 1; + } + //返回原图的时候 或者图片小于缩略图宽高的不生成直接返回原图 + if ($original || ($imginfo[0] < $width || $imginfo[1] < $height)) { + $target_attach = $_G['setting']['attachdir'] . './' . $target; + $targetpath = dirname($target_attach); + dmkdir($targetpath); - if ($thumb) { + if(copy($fileuri, $target_attach)){ + $thumbpath = $target_attach; if (!$nomark) self::watermark($target_attach = $_G['setting']['attachdir'] . './' . $target, '', $extraparams); $thumbpath = $target; - } else { - $thumbpath = false; } - } catch (\Exception $e) { - $thumbpath = false; + } else { + //生成缩略图 + include_once libfile('class/image'); + $target_attach = $_G['setting']['attachdir'] . './' . $target; + $targetpath = dirname($target_attach); + dmkdir($targetpath); + $image = new image(); + try { + $thumb = $image->Thumb($fileuri, $target, $width, $height, $thumbtype, 0, $extraparams); + if ($thumb) { + if (!$nomark) self::watermark($target_attach = $_G['setting']['attachdir'] . './' . $target, '', $extraparams); + $thumbpath = $target; + } else { + $thumbpath = false; + } + } catch (\Exception $e) { + $thumbpath = false; + + } } } - } + } + + //echo $thumbpath;die; if($cachefile){ @unlink($cachefile); @@ -1094,9 +1176,14 @@ class io_dzz extends io_api $bz = io_remote::getBzByRemoteid($defaultspace['remoteid']); if($thumbpath)$thumbpath = $bz.$thumbpath; if($thumbpath){ - $img = IO::getFileUri($thumbpath); - if ($returnurl) return $img; - else IO::output_thumb($img); + if($returnurl == 1){ + return IO::getFileUri($thumbpath); + }elseif($returnurl == 2){ + return $thumbpath; + }else { + $img = IO::getStream($thumbpath); + IO::output_thumb($img); + } }else{ return false; } diff --git a/dzz/alonepage/template/page/setting.htm b/dzz/alonepage/template/page/setting.htm index 3097f5b..44e0711 100644 --- a/dzz/alonepage/template/page/setting.htm +++ b/dzz/alonepage/template/page/setting.htm @@ -153,7 +153,7 @@ { key:0, url:fitem.imgurl || '', - img:fitem.imgurl || '', + img:fitem.img || '', aid:fitem.aid || 0, link:fitem.link || '', linkval:fitem.linkval || '', @@ -178,7 +178,7 @@ { key:0, url:fitem.imgurl || '', - img:fitem.imgurl || '', + img:fitem.img || '', aid:fitem.aid || 0, link:fitem.link || '0', linkval:fitem.linkval || '', @@ -206,7 +206,7 @@ key:0, title:ditem.title || '', url:ditem.imgurl || '', - img:ditem.imgurl || '', + img:ditem.img || '', aid:ditem.aid || 0, link:ditem.link || '0', linkval:ditem.linkval || '', diff --git a/dzz/banner/template/components/information/audio.htm b/dzz/banner/template/components/information/audio.htm index 83b743b..ff76e9e 100644 --- a/dzz/banner/template/components/information/audio.htm +++ b/dzz/banner/template/components/information/audio.htm @@ -50,7 +50,6 @@ :showmessage="bannerData.ImageLayout.showmessage" :url="bannerData.ImageLayout.url" :scrollref="scrollref" - :parentbox="bannerData.ImageLayout.parentbox" - :ischecked="false"> + :parentbox="bannerData.ImageLayout.parentbox"> \ No newline at end of file diff --git a/dzz/banner/template/components/information/document.htm b/dzz/banner/template/components/information/document.htm index ddf547c..fe8ba5c 100644 --- a/dzz/banner/template/components/information/document.htm +++ b/dzz/banner/template/components/information/document.htm @@ -51,7 +51,6 @@ :showmessage="bannerData.ImageLayout.showmessage" :url="bannerData.ImageLayout.url" :scrollref="scrollref" - :parentbox="bannerData.ImageLayout.parentbox" - :ischecked="false"> + :parentbox="bannerData.ImageLayout.parentbox"> \ No newline at end of file diff --git a/dzz/banner/template/components/information/image.htm b/dzz/banner/template/components/information/image.htm index 2f83117..9380764 100644 --- a/dzz/banner/template/components/information/image.htm +++ b/dzz/banner/template/components/information/image.htm @@ -50,7 +50,6 @@ :showmessage="bannerData.ImageLayout.showmessage" :url="bannerData.ImageLayout.url" :scrollref="scrollref" - :parentbox="bannerData.ImageLayout.parentbox" - :ischecked="false"> + :parentbox="bannerData.ImageLayout.parentbox"> \ No newline at end of file diff --git a/dzz/banner/template/components/information/other.htm b/dzz/banner/template/components/information/other.htm index 3378cf1..38122d1 100644 --- a/dzz/banner/template/components/information/other.htm +++ b/dzz/banner/template/components/information/other.htm @@ -50,7 +50,6 @@ :showmessage="bannerData.ImageLayout.showmessage" :url="bannerData.ImageLayout.url" :scrollref="scrollref" - :parentbox="bannerData.ImageLayout.parentbox" - :ischecked="false"> + :parentbox="bannerData.ImageLayout.parentbox"> \ No newline at end of file diff --git a/dzz/banner/template/components/information/search.htm b/dzz/banner/template/components/information/search.htm index f5025fb..28184ed 100644 --- a/dzz/banner/template/components/information/search.htm +++ b/dzz/banner/template/components/information/search.htm @@ -9,7 +9,6 @@ :showmessage="bannerData.ImageLayout.showmessage" :url="bannerData.ImageLayout.url" :scrollref="scrollref" - :parentbox="bannerData.ImageLayout.parentbox" - :ischecked="false"> + :parentbox="bannerData.ImageLayout.parentbox"> \ No newline at end of file diff --git a/dzz/banner/template/components/information/video.htm b/dzz/banner/template/components/information/video.htm index f681d64..9dee4cb 100644 --- a/dzz/banner/template/components/information/video.htm +++ b/dzz/banner/template/components/information/video.htm @@ -51,7 +51,6 @@ :showmessage="bannerData.ImageLayout.showmessage" :url="bannerData.ImageLayout.url" :scrollref="scrollref" - :parentbox="bannerData.ImageLayout.parentbox" - :ischecked="false"> + :parentbox="bannerData.ImageLayout.parentbox"> \ No newline at end of file diff --git a/dzz/imageColor/classes/imageColor.php b/dzz/imageColor/classes/imageColor.php index 2045116..d9bfb08 100644 --- a/dzz/imageColor/classes/imageColor.php +++ b/dzz/imageColor/classes/imageColor.php @@ -71,7 +71,7 @@ class imageColor } $width = 64; $height = 64; - $img = IO::gettmpThumb($data['rid'], $width, $height, 1, 1); + $img = IO::gettmpThumb($data['rid'], $width, $height, 2, 1); $img = IO::getStream($img); if (!$img) { C::t('pichome_resources_attr')->update($data['rid'], array('isget' => -1)); diff --git a/dzz/pichome/classes/addfileafter.php b/dzz/pichome/classes/addfileafter.php index e56df60..d24bf06 100644 --- a/dzz/pichome/classes/addfileafter.php +++ b/dzz/pichome/classes/addfileafter.php @@ -5,7 +5,7 @@ use \core as C; class addfileafter{ public function run($data) { - dfsockopen(getglobal('localurl') . 'misc.php?mod=addfileafter&rid='.$data['rid'].'&aid='.$data['aid'], 0, '', '', false, '',0.1); + dfsockopen(getglobal('localurl') . 'misc.php?mod=addfileafter&rid='.$data['rid'].'&aid='.$data['aid'], 0, '', '', false, '',10); } diff --git a/dzz/pichome/library/ajax.php b/dzz/pichome/library/ajax.php index 2652fdb..8da3b9c 100644 --- a/dzz/pichome/library/ajax.php +++ b/dzz/pichome/library/ajax.php @@ -2112,6 +2112,8 @@ elseif($operation == 'realfianllypath'){ }elseif($operation == 'getTaskByAppid'){ $appid = isset($_GET['appid']) ? trim($_GET['appid']):''; + $appdata = C::t('pichome_vapp')->fetch($appid); + if($appdata['type'] == 1 || $appdata['type'] == 3){ $taskarr = [ '改名', '打标签', @@ -2122,12 +2124,9 @@ elseif($operation == 'realfianllypath'){ foreach($taskarr as $k=>$v){ $datanums[] = ['lablename'=>$taskarr[$k],'data'=>$aitaskdata[$k] ? intval($aitaskdata[$k]):0]; } + if($appdata['type'] == 1) unset($datanums[0]); $queryInterval = 0; - //计算待生成缩略图总文件数 - $filenum = DB::result_first("select count(rid) as num from %t where appid = %s and isdelete = 0",array('pichome_resources',$appid)); - $getthumbnum = DB::result_first("select count(t.rid) from %t t left join %t r on r.rid=t.rid where - r.appid = %s and t.sstatus = %d and r.isdelete = 0",['thumb_record','pichome_resources',$appid,1]); - if($getthumbnum < $filenum) $queryInterval = 3; + if(!$queryInterval){ foreach($datanums as $v){ if($v['data']){ @@ -2136,6 +2135,13 @@ elseif($operation == 'realfianllypath'){ } } } - $datanums[] = ['lablename'=>'生成缩略图','data'=>$getthumbnum.'/'.$filenum]; + + //计算待生成缩略图总文件数 + $filenum = DB::result_first("select count(rid) as num from %t where appid = %s and isdelete = 0",array('pichome_resources',$appid)); + $getthumbnum = DB::result_first("select count(t.rid) from %t t left join %t r on r.rid=t.rid where + r.appid = %s and t.sstatus = %d and r.isdelete = 0",['thumb_record','pichome_resources',$appid,1]); + if($getthumbnum < $filenum) $queryInterval = 3; + $datanums[] = ['lablename'=>'生成缩略图','data'=>$getthumbnum.'/'.$filenum]; + } exit(json_encode(['success'=>true,'data'=>$datanums,'queryInterval'=>$queryInterval])); } diff --git a/dzz/pichome/template/librarylist/pc/components/index/header/rightBtn.htm b/dzz/pichome/template/librarylist/pc/components/index/header/rightBtn.htm index 22acd6a..d7d8926 100644 --- a/dzz/pichome/template/librarylist/pc/components/index/header/rightBtn.htm +++ b/dzz/pichome/template/librarylist/pc/components/index/header/rightBtn.htm @@ -23,46 +23,48 @@ - - - 待完成的任务 - - -