X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;ds=inline;f=mw%2Flibs%2Ftiny_mce%2Fplugins%2Ftinybrowser%2Fedit.php;fp=mw%2Flibs%2Ftiny_mce%2Fplugins%2Ftinybrowser%2Fedit.php;h=0000000000000000000000000000000000000000;hb=422d883e3ed8ee55ee41e3b7826f32b79cea646d;hp=d804eb2b012394db82a16ae7ce5cb070191a5650;hpb=e1b64e4088232b9d7b4acb2dc24279bb38fcafba;p=mtweb diff --git a/mw/libs/tiny_mce/plugins/tinybrowser/edit.php b/mw/libs/tiny_mce/plugins/tinybrowser/edit.php deleted file mode 100644 index d804eb2..0000000 --- a/mw/libs/tiny_mce/plugins/tinybrowser/edit.php +++ /dev/null @@ -1,537 +0,0 @@ - array(), - 'message' => array() -); -$deleteqty = 0; -$renameqty = 0; -$resizeqty = 0; -$rotateqty = 0; -$moveqty = 0; -$errorqty = 0; - -// Set when rotating images to force thumbnail refresh -$imagerefresh =''; - -// Delete any checked files -if(isset($_POST['deletefile'])) - { - foreach($_POST['deletefile'] as $delthis => $val) - { - $delthisfile = $tinybrowser['docroot'].$editpath.$_POST['actionfile'][$delthis]; - if (file_exists($delthisfile) && unlink($delthisfile)) $deleteqty++; else $errorqty++; - if($typenow=='image') - { - $delthisthumb = $tinybrowser['docroot'].$editpath.'_thumbs/_'.$_POST['actionfile'][$delthis]; - if (file_exists($delthisthumb)) unlink($delthisthumb); - } - } - } - -// Rename any files with changed name -if(isset($_POST['renamefile'])) - { - foreach($_POST['renamefile'] as $namethis => $newname) - { - if($_POST['actionfile'][$namethis] != $newname.$_POST['renameext'][$namethis]) - { - $namethisfilefrom = $tinybrowser['docroot'].$editpath.$_POST['actionfile'][$namethis]; - $namethisfileto = $tinybrowser['docroot'].$editpath.clean_filename($newname.$_POST['renameext'][$namethis]); - if (file_exists($namethisfilefrom) && rename($namethisfilefrom,$namethisfileto)) $renameqty++; else $errorqty++; - if($typenow=='image') - { - $namethisthumbfrom = $tinybrowser['docroot'].$editpath.'_thumbs/_'.$_POST['actionfile'][$namethis]; - $namethisthumbto = $tinybrowser['docroot'].$editpath.'_thumbs/_'.clean_filename($newname.$_POST['renameext'][$namethis]); - if (file_exists($namethisthumbfrom)) rename($namethisthumbfrom,$namethisthumbto); - } - } - } - } - -// Move any checked files -if(isset($_POST['movefile'])) - { - foreach($_POST['movefile'] as $movethis => $val) - { - $movethisfile = $tinybrowser['docroot'].$editpath.$_POST['actionfile'][$movethis]; - $movefiledest = $tinybrowser['docroot'].$destfolder.$_POST['actionfile'][$movethis]; - if (!file_exists($movefiledest) && file_exists($movethisfile) && copy($movethisfile,$movefiledest)) - { - $moveqty++; - unlink($movethisfile); - if($typenow=='image') - { - $movethisthumb = $tinybrowser['docroot'].$editpath.'_thumbs/_'.$_POST['actionfile'][$movethis]; - $movethumbdest = $tinybrowser['docroot'].$destfolder.'_thumbs/_'.$_POST['actionfile'][$movethis]; - if (file_exists($movethisthumb) && copy($movethisthumb,$movethumbdest)) unlink($movethisthumb); - } - } - else $errorqty++; - } - } - -// Resize any files with new size -if(isset($_POST['resizefile'])) - { - foreach($_POST['resizefile'] as $sizethis => $newsize) - { - $newsize = intval($newsize); - if($newsize) - { - // detect silly sizes - if($newsize > $tinybrowser['thumbsize']) - { - // do image resize - $targetimg = $tinybrowser['docroot'].$editpath.$_POST['actionfile'][$sizethis]; - if (file_exists($targetimg)) - { - $mime = getimagesize($targetimg); - if($_POST['resizetype'][$sizethis]=='width') - { - $rw = $newsize; - $rh = $mime[1]; - } - else - { - $rw = $mime[0]; - $rh = $newsize; - } - $im = convert_image($targetimg,$mime['mime']); - resizeimage($im,$rw,$rh,$targetimg,$tinybrowser['imagequality'],$mime['mime']); - imagedestroy($im); - $resizeqty++; - } - else $errorqty++; - } - else $errorqty++; - } - } - } - -// Rotate any selected files -if(isset($_POST['rotatefile'])) - { - $imagerefresh = '?refresh='.uniqid(''); - foreach($_POST['rotatefile'] as $rotatethis => $direction) - { - if($direction != 'none') - { - $targetimg = $tinybrowser['docroot'].$editpath.$_POST['actionfile'][$rotatethis]; - if (file_exists($targetimg)) - { - // rotate image - if($direction == 'clock') $degree=270; else $degree=90; - $mime = getimagesize($targetimg); - $im = convert_image($targetimg,$mime['mime']); - - // additional processing for png / gif transparencies (credit to Dirk Bohl) - if($mime['mime'] == 'image/x-png' || $mime['mime'] == 'image/png') - { - imagealphablending($newim, false); - imagesavealpha($newim, true); - } - elseif($mime['mime'] == 'image/gif') - { - $originaltransparentcolor = imagecolortransparent( $im ); - if($originaltransparentcolor >= 0 && $originaltransparentcolor < imagecolorstotal( $im )) - { - $transparentcolor = imagecolorsforindex( $im, $originaltransparentcolor ); - $newtransparentcolor = imagecolorallocate($newim,$transparentcolor['red'],$transparentcolor['green'],$transparentcolor['blue']); - imagefill( $newim, 0, 0, $newtransparentcolor ); - imagecolortransparent( $newim, $newtransparentcolor ); - } - } - $newim = imagerotate($im, $degree, 0); - imagedestroy($im); - - if($mime['mime'] == 'image/pjpeg' || $mime['mime'] == 'image/jpeg') - imagejpeg ($newim,$targetimg,$tinybrowser['imagequality']); - elseif($mime['mime'] == 'image/x-png' || $mime['mime'] == 'image/png') - imagepng ($newim,$targetimg,substr($tinybrowser['imagequality'],0,1)); - elseif($mime['mime'] == 'image/gif') - imagegif ($newim,$targetimg); - imagedestroy($newim); - $rotateqty++; - - // delete and recreate thumbnail image - $targetthumb = $tinybrowser['docroot'].$editpath.'_thumbs/_'.$_POST['actionfile'][$rotatethis]; - if (file_exists($targetthumb)) unlink($targetthumb); - $mime = getimagesize($targetimg); - $im = convert_image($targetimg,$mime['mime']); - resizeimage($im,$tinybrowser['thumbsize'],$tinybrowser['thumbsize'],$targetthumb,$tinybrowser['thumbquality'],$mime['mime']); - imagedestroy($im); - } - else $errorqty++; - } - } - } - -// Read directory contents and populate $file array -$dh = opendir($tinybrowser['docroot'].$editpath); -$file = array(); -while (($filename = readdir($dh)) !== false) - { - // get file extension - $nameparts = explode('.',$filename); - $ext = end($nameparts); - - // filter directories and prohibited file types - if($filename != '.' && $filename != '..' && !is_dir($tinybrowser['docroot'].$editpath.$filename) && !in_array($ext, $tinybrowser['prohibited']) && ($typenow == 'file' || strpos(strtolower($tinybrowser['filetype'][$typenow]),strtolower($ext)))) - { - // search file name if search term entered - if($findnow) $exists = strpos(strtolower($filename),strtolower($findnow)); - - // assign file details to array, for all files or those that match search - if(!$findnow || ($findnow && $exists !== false)) - { - $file['name'][] = $filename; - $file['sortname'][] = strtolower($filename); - $file['modified'][] = filemtime($tinybrowser['docroot'].$editpath.$filename); - $file['size'][] = filesize($tinybrowser['docroot'].$editpath.$filename); - - // image specific info or general - if($typenow=='image' && $imginfo = getimagesize($tinybrowser['docroot'].$editpath.$filename)) - { - $file['width'][] = $imginfo[0]; - $file['height'][] = $imginfo[1]; - $file['dimensions'][] = $imginfo[0] + $imginfo[1]; - $file['type'][] = $imginfo['mime']; - } - else - { - $file['width'][] = 'N/A'; - $file['height'][] = 'N/A'; - $file['dimensions'][] = 'N/A'; - $file['type'][] = returnMIMEType($filename); - } - } - } - } -closedir($dh); - -// Assign directory structure to array -$editdirs=array(); -dirtree($editdirs,$tinybrowser['filetype'][$typenow],$tinybrowser['docroot'],$tinybrowser['path'][$typenow]); - -// generate alert if files deleted -if($deleteqty>0) - { - $notify['type'][]='success'; - $notify['message'][]=sprintf(TB_MSGDELETE, $deleteqty); - } -// generate alert if files renamed -elseif($renameqty>0) - { - $notify['type'][]='success'; - $notify['message'][]=sprintf(TB_MSGRENAME, $renameqty); - } -// generate alert if files renamed -elseif($moveqty>0) - { - $notify['type'][]='success'; - $notify['message'][]=sprintf(TB_MSGMOVE, $moveqty); - } -// generate alert if images resized -elseif($resizeqty>0) - { - $notify['type'][]='success'; - $notify['message'][]=sprintf(TB_MSGRESIZE, $resizeqty); - } -// generate alert if images rotated -elseif($rotateqty>0) - { - $notify['type'][]='success'; - $notify['message'][]=sprintf(TB_MSGROTATE, $rotateqty); - } - -// generate alert if file errors encountered -if($errorqty>0) - { - $notify['type'][]='failure'; - $notify['message'][]=sprintf(TB_MSGEDITERR, $errorqty); - } - -// determine sort order -$sortorder = ($sorttypenow == 'asc' ? SORT_ASC : SORT_DESC); -$num_of_files = (isset($file['name']) ? count($file['name']) : 0); - -if($num_of_files>0) - { - // sort files by selected order - sortfileorder($sortbynow,$sortorder,$file); - } - -// determine pagination -if($tinybrowser['pagination']>0) - { - $showpagestart = ($showpagenow ? ($_REQUEST['showpage']*$tinybrowser['pagination'])-$tinybrowser['pagination'] : 0); - $showpageend = $showpagestart+$tinybrowser['pagination']; - if($showpageend>$num_of_files) $showpageend = $num_of_files; - } -else - { - $showpagestart = 0; - $showpageend = $num_of_files; - } -?> - - -
-