@@ -1,86 +1,86 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * processing the uploaded files |
|
| 4 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | - * @link www.phpletter.com |
|
| 6 | - * @since 22/May/2007 |
|
| 7 | - * |
|
| 8 | - */ |
|
| 2 | + /** |
|
| 3 | + * processing the uploaded files |
|
| 4 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | + * @link www.phpletter.com |
|
| 6 | + * @since 22/May/2007 |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 11 | - echo "{"; |
|
| 12 | - $error = ""; |
|
| 13 | - $info = ""; |
|
| 10 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 11 | + echo "{"; |
|
| 12 | + $error = ""; |
|
| 13 | + $info = ""; |
|
| 14 | 14 | |
| 15 | - include_once(CLASS_UPLOAD); |
|
| 16 | - $upload = new Upload(); |
|
| 15 | + include_once(CLASS_UPLOAD); |
|
| 16 | + $upload = new Upload(); |
|
| 17 | 17 | |
| 18 | - $upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS)); |
|
| 19 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) |
|
| 20 | - { |
|
| 21 | - $error = SYS_DISABLED; |
|
| 22 | - } |
|
| 23 | - elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder'])) |
|
| 24 | - { |
|
| 25 | - $error = ERR_FOLDER_PATH_NOT_ALLOWED; |
|
| 26 | - }else if(!$upload->isFileUploaded('file')) |
|
| 27 | - { |
|
| 28 | - $error = ERR_FILE_NOT_UPLOADED; |
|
| 29 | - }else if(!$upload->moveUploadedFile($_GET['folder'])) |
|
| 30 | - { |
|
| 31 | - $error = ERR_FILE_MOVE_FAILED; |
|
| 32 | - } |
|
| 33 | - elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) |
|
| 34 | - { |
|
| 35 | - $error = ERR_FILE_TYPE_NOT_ALLOWED; |
|
| 36 | - }elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) |
|
| 37 | - { |
|
| 38 | - $error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE)); |
|
| 39 | - }else |
|
| 40 | - { |
|
| 41 | - include_once(CLASS_FILE); |
|
| 42 | - $path = $upload->getFilePath(); |
|
| 43 | - $obj = new file($path); |
|
| 44 | - $tem = $obj->getFileInfo(); |
|
| 45 | - if(sizeof($tem)) |
|
| 46 | - { |
|
| 47 | - include_once(CLASS_MANAGER); |
|
| 18 | + $upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS)); |
|
| 19 | + if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) |
|
| 20 | + { |
|
| 21 | + $error = SYS_DISABLED; |
|
| 22 | + } |
|
| 23 | + elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder'])) |
|
| 24 | + { |
|
| 25 | + $error = ERR_FOLDER_PATH_NOT_ALLOWED; |
|
| 26 | + }else if(!$upload->isFileUploaded('file')) |
|
| 27 | + { |
|
| 28 | + $error = ERR_FILE_NOT_UPLOADED; |
|
| 29 | + }else if(!$upload->moveUploadedFile($_GET['folder'])) |
|
| 30 | + { |
|
| 31 | + $error = ERR_FILE_MOVE_FAILED; |
|
| 32 | + } |
|
| 33 | + elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) |
|
| 34 | + { |
|
| 35 | + $error = ERR_FILE_TYPE_NOT_ALLOWED; |
|
| 36 | + }elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) |
|
| 37 | + { |
|
| 38 | + $error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE)); |
|
| 39 | + }else |
|
| 40 | + { |
|
| 41 | + include_once(CLASS_FILE); |
|
| 42 | + $path = $upload->getFilePath(); |
|
| 43 | + $obj = new file($path); |
|
| 44 | + $tem = $obj->getFileInfo(); |
|
| 45 | + if(sizeof($tem)) |
|
| 46 | + { |
|
| 47 | + include_once(CLASS_MANAGER); |
|
| 48 | 48 | |
| 49 | - $manager = new manager($upload->getFilePath(), false); |
|
| 49 | + $manager = new manager($upload->getFilePath(), false); |
|
| 50 | 50 | |
| 51 | - $fileType = $manager->getFileType($upload->getFileName()); |
|
| 51 | + $fileType = $manager->getFileType($upload->getFileName()); |
|
| 52 | 52 | |
| 53 | - foreach($fileType as $k=>$v) |
|
| 54 | - { |
|
| 55 | - $tem[$k] = $v; |
|
| 56 | - } |
|
| 53 | + foreach($fileType as $k=>$v) |
|
| 54 | + { |
|
| 55 | + $tem[$k] = $v; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - $tem['path'] = backslashToSlash($path); |
|
| 59 | - $tem['type'] = "file"; |
|
| 60 | - $tem['size'] = transformFileSize($tem['size']); |
|
| 61 | - $tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); |
|
| 62 | - $tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']); |
|
| 63 | - $tem['short_name'] = shortenFileName($tem['name']); |
|
| 64 | - $tem['flag'] = 'noFlag'; |
|
| 65 | - $obj->close(); |
|
| 66 | - foreach($tem as $k=>$v) |
|
| 67 | - { |
|
| 68 | - $info .= sprintf(", %s:'%s'", $k, $v); |
|
| 69 | - } |
|
| 58 | + $tem['path'] = backslashToSlash($path); |
|
| 59 | + $tem['type'] = "file"; |
|
| 60 | + $tem['size'] = transformFileSize($tem['size']); |
|
| 61 | + $tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); |
|
| 62 | + $tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']); |
|
| 63 | + $tem['short_name'] = shortenFileName($tem['name']); |
|
| 64 | + $tem['flag'] = 'noFlag'; |
|
| 65 | + $obj->close(); |
|
| 66 | + foreach($tem as $k=>$v) |
|
| 67 | + { |
|
| 68 | + $info .= sprintf(", %s:'%s'", $k, $v); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - $info .= sprintf(", url:'%s'", getFileUrl($path)); |
|
| 72 | - $info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME); |
|
| 71 | + $info .= sprintf(", url:'%s'", getFileUrl($path)); |
|
| 72 | + $info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME); |
|
| 73 | 73 | |
| 74 | 74 | |
| 75 | - }else |
|
| 76 | - { |
|
| 77 | - $error = ERR_FILE_NOT_AVAILABLE; |
|
| 78 | - } |
|
| 75 | + }else |
|
| 76 | + { |
|
| 77 | + $error = ERR_FILE_NOT_AVAILABLE; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | - } |
|
| 82 | - echo "error:'" . $error . "'"; |
|
| 83 | - echo $info; |
|
| 84 | - echo "}"; |
|
| 81 | + } |
|
| 82 | + echo "error:'" . $error . "'"; |
|
| 83 | + echo $info; |
|
| 84 | + echo "}"; |
|
| 85 | 85 | |
| 86 | 86 | ?> |
| 87 | 87 | \ No newline at end of file |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 11 | 11 | echo "{"; |
| 12 | 12 | $error = ""; |
| 13 | 13 | $info = ""; |
@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | $upload = new Upload(); |
| 17 | 17 | |
| 18 | 18 | $upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS)); |
| 19 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) |
|
| 19 | + if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) |
|
| 20 | 20 | { |
| 21 | 21 | $error = SYS_DISABLED; |
| 22 | 22 | } |
| 23 | - elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder'])) |
|
| 23 | + elseif (empty($_GET['folder']) || !isUnderRoot($_GET['folder'])) |
|
| 24 | 24 | { |
| 25 | 25 | $error = ERR_FOLDER_PATH_NOT_ALLOWED; |
| 26 | - }else if(!$upload->isFileUploaded('file')) |
|
| 26 | + } else if (!$upload->isFileUploaded('file')) |
|
| 27 | 27 | { |
| 28 | 28 | $error = ERR_FILE_NOT_UPLOADED; |
| 29 | - }else if(!$upload->moveUploadedFile($_GET['folder'])) |
|
| 29 | + } else if (!$upload->moveUploadedFile($_GET['folder'])) |
|
| 30 | 30 | { |
| 31 | 31 | $error = ERR_FILE_MOVE_FAILED; |
| 32 | 32 | } |
| 33 | - elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) |
|
| 33 | + elseif (!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) |
|
| 34 | 34 | { |
| 35 | 35 | $error = ERR_FILE_TYPE_NOT_ALLOWED; |
| 36 | - }elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) |
|
| 36 | + }elseif (defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) |
|
| 37 | 37 | { |
| 38 | 38 | $error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE)); |
| 39 | - }else |
|
| 39 | + } else |
|
| 40 | 40 | { |
| 41 | 41 | include_once(CLASS_FILE); |
| 42 | 42 | $path = $upload->getFilePath(); |
| 43 | 43 | $obj = new file($path); |
| 44 | 44 | $tem = $obj->getFileInfo(); |
| 45 | - if(sizeof($tem)) |
|
| 45 | + if (sizeof($tem)) |
|
| 46 | 46 | { |
| 47 | 47 | include_once(CLASS_MANAGER); |
| 48 | 48 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $fileType = $manager->getFileType($upload->getFileName()); |
| 52 | 52 | |
| 53 | - foreach($fileType as $k=>$v) |
|
| 53 | + foreach ($fileType as $k=>$v) |
|
| 54 | 54 | { |
| 55 | 55 | $tem[$k] = $v; |
| 56 | 56 | } |
@@ -63,23 +63,23 @@ discard block |
||
| 63 | 63 | $tem['short_name'] = shortenFileName($tem['name']); |
| 64 | 64 | $tem['flag'] = 'noFlag'; |
| 65 | 65 | $obj->close(); |
| 66 | - foreach($tem as $k=>$v) |
|
| 66 | + foreach ($tem as $k=>$v) |
|
| 67 | 67 | { |
| 68 | 68 | $info .= sprintf(", %s:'%s'", $k, $v); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - $info .= sprintf(", url:'%s'", getFileUrl($path)); |
|
| 72 | - $info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME); |
|
| 71 | + $info .= sprintf(", url:'%s'", getFileUrl($path)); |
|
| 72 | + $info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME); |
|
| 73 | 73 | |
| 74 | 74 | |
| 75 | - }else |
|
| 75 | + } else |
|
| 76 | 76 | { |
| 77 | 77 | $error = ERR_FILE_NOT_AVAILABLE; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | } |
| 82 | - echo "error:'" . $error . "'"; |
|
| 82 | + echo "error:'".$error."'"; |
|
| 83 | 83 | echo $info; |
| 84 | 84 | echo "}"; |
| 85 | 85 | |
@@ -19,24 +19,22 @@ discard block |
||
| 19 | 19 | if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) |
| 20 | 20 | { |
| 21 | 21 | $error = SYS_DISABLED; |
| 22 | - } |
|
| 23 | - elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder'])) |
|
| 22 | + } elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder'])) |
|
| 24 | 23 | { |
| 25 | 24 | $error = ERR_FOLDER_PATH_NOT_ALLOWED; |
| 26 | - }else if(!$upload->isFileUploaded('file')) |
|
| 25 | + } else if(!$upload->isFileUploaded('file')) |
|
| 27 | 26 | { |
| 28 | 27 | $error = ERR_FILE_NOT_UPLOADED; |
| 29 | - }else if(!$upload->moveUploadedFile($_GET['folder'])) |
|
| 28 | + } else if(!$upload->moveUploadedFile($_GET['folder'])) |
|
| 30 | 29 | { |
| 31 | 30 | $error = ERR_FILE_MOVE_FAILED; |
| 32 | - } |
|
| 33 | - elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) |
|
| 31 | + } elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) |
|
| 34 | 32 | { |
| 35 | 33 | $error = ERR_FILE_TYPE_NOT_ALLOWED; |
| 36 | - }elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) |
|
| 34 | + } elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) |
|
| 37 | 35 | { |
| 38 | 36 | $error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE)); |
| 39 | - }else |
|
| 37 | + } else |
|
| 40 | 38 | { |
| 41 | 39 | include_once(CLASS_FILE); |
| 42 | 40 | $path = $upload->getFilePath(); |
@@ -72,7 +70,7 @@ discard block |
||
| 72 | 70 | $info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME); |
| 73 | 71 | |
| 74 | 72 | |
| 75 | - }else |
|
| 73 | + } else |
|
| 76 | 74 | { |
| 77 | 75 | $error = ERR_FILE_NOT_AVAILABLE; |
| 78 | 76 | } |
@@ -1,32 +1,32 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * delete selected files |
|
| 4 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | - * @link www.phpletter.com |
|
| 6 | - * @since 22/April/2007 |
|
| 7 | - * |
|
| 8 | - */ |
|
| 2 | + /** |
|
| 3 | + * delete selected files |
|
| 4 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | + * @link www.phpletter.com |
|
| 6 | + * @since 22/April/2007 |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 11 | - if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 12 | - { |
|
| 10 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 11 | + if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 12 | + { |
|
| 13 | 13 | |
| 14 | - $path = $_GET['path']; |
|
| 15 | - //check if the file size |
|
| 16 | - $fileSize = @filesize($path); |
|
| 14 | + $path = $_GET['path']; |
|
| 15 | + //check if the file size |
|
| 16 | + $fileSize = @filesize($path); |
|
| 17 | 17 | |
| 18 | - if($fileSize > getMemoryLimit()) |
|
| 19 | - {//larger then the php memory limit, redirect to the file |
|
| 18 | + if($fileSize > getMemoryLimit()) |
|
| 19 | + {//larger then the php memory limit, redirect to the file |
|
| 20 | 20 | |
| 21 | - header('Location: ' . $path); |
|
| 22 | - exit; |
|
| 23 | - }else |
|
| 24 | - {//open it up and send out with php |
|
| 25 | - downloadFile($path); |
|
| 21 | + header('Location: ' . $path); |
|
| 22 | + exit; |
|
| 23 | + }else |
|
| 24 | + {//open it up and send out with php |
|
| 25 | + downloadFile($path); |
|
| 26 | 26 | |
| 27 | - } |
|
| 28 | - }else |
|
| 29 | - { |
|
| 30 | - die(ERR_DOWNLOAD_FILE_NOT_FOUND); |
|
| 31 | - } |
|
| 27 | + } |
|
| 28 | + }else |
|
| 29 | + { |
|
| 30 | + die(ERR_DOWNLOAD_FILE_NOT_FOUND); |
|
| 31 | + } |
|
| 32 | 32 | ?> |
| 33 | 33 | \ No newline at end of file |
@@ -7,25 +7,25 @@ |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 11 | - if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 10 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 11 | + if (!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 12 | 12 | { |
| 13 | 13 | |
| 14 | 14 | $path = $_GET['path']; |
| 15 | 15 | //check if the file size |
| 16 | 16 | $fileSize = @filesize($path); |
| 17 | 17 | |
| 18 | - if($fileSize > getMemoryLimit()) |
|
| 18 | + if ($fileSize > getMemoryLimit()) |
|
| 19 | 19 | {//larger then the php memory limit, redirect to the file |
| 20 | 20 | |
| 21 | - header('Location: ' . $path); |
|
| 21 | + header('Location: '.$path); |
|
| 22 | 22 | exit; |
| 23 | - }else |
|
| 23 | + } else |
|
| 24 | 24 | {//open it up and send out with php |
| 25 | 25 | downloadFile($path); |
| 26 | 26 | |
| 27 | 27 | } |
| 28 | - }else |
|
| 28 | + } else |
|
| 29 | 29 | { |
| 30 | 30 | die(ERR_DOWNLOAD_FILE_NOT_FOUND); |
| 31 | 31 | } |
@@ -20,12 +20,12 @@ |
||
| 20 | 20 | |
| 21 | 21 | header('Location: ' . $path); |
| 22 | 22 | exit; |
| 23 | - }else |
|
| 23 | + } else |
|
| 24 | 24 | {//open it up and send out with php |
| 25 | 25 | downloadFile($path); |
| 26 | 26 | |
| 27 | 27 | } |
| 28 | - }else |
|
| 28 | + } else |
|
| 29 | 29 | { |
| 30 | 30 | die(ERR_DOWNLOAD_FILE_NOT_FOUND); |
| 31 | 31 | } |
@@ -1,42 +1,42 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * Ajax image editor platform |
|
| 4 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | - * @link www.phpletter.com |
|
| 6 | - * @since 22/May/2007 |
|
| 7 | - * |
|
| 8 | - */ |
|
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 11 | - { |
|
| 12 | - die(SYS_DISABLED); |
|
| 13 | - } |
|
| 14 | - $session->gc(); |
|
| 15 | - $_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path']; |
|
| 16 | - if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 17 | - { |
|
| 18 | - $path = $_GET['path']; |
|
| 19 | - }else |
|
| 20 | - { |
|
| 21 | - die(IMG_GEN_IMG_NOT_EXISTS); |
|
| 22 | - } |
|
| 23 | - require_once(CLASS_HISTORY); |
|
| 24 | - $history = new History($path, $session); |
|
| 25 | - if(CONFIG_SYS_DEMO_ENABLE) |
|
| 26 | - { |
|
| 27 | - $sessionImageInfo = $history->getLastestRestorable(); |
|
| 28 | - $originalSessionImageInfo = $history->getOriginalImage(); |
|
| 29 | - if(sizeof($originalSessionImageInfo)) |
|
| 30 | - { |
|
| 31 | - $path = backslashToSlash($session->getSessionDir() . $originalSessionImageInfo['info']['name']); |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php"); |
|
| 35 | - $image = new Image(); |
|
| 2 | + /** |
|
| 3 | + * Ajax image editor platform |
|
| 4 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | + * @link www.phpletter.com |
|
| 6 | + * @since 22/May/2007 |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | + if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 11 | + { |
|
| 12 | + die(SYS_DISABLED); |
|
| 13 | + } |
|
| 14 | + $session->gc(); |
|
| 15 | + $_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path']; |
|
| 16 | + if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 17 | + { |
|
| 18 | + $path = $_GET['path']; |
|
| 19 | + }else |
|
| 20 | + { |
|
| 21 | + die(IMG_GEN_IMG_NOT_EXISTS); |
|
| 22 | + } |
|
| 23 | + require_once(CLASS_HISTORY); |
|
| 24 | + $history = new History($path, $session); |
|
| 25 | + if(CONFIG_SYS_DEMO_ENABLE) |
|
| 26 | + { |
|
| 27 | + $sessionImageInfo = $history->getLastestRestorable(); |
|
| 28 | + $originalSessionImageInfo = $history->getOriginalImage(); |
|
| 29 | + if(sizeof($originalSessionImageInfo)) |
|
| 30 | + { |
|
| 31 | + $path = backslashToSlash($session->getSessionDir() . $originalSessionImageInfo['info']['name']); |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php"); |
|
| 35 | + $image = new Image(); |
|
| 36 | 36 | |
| 37 | - $imageInfo = $image->getImageInfo($path); |
|
| 37 | + $imageInfo = $image->getImageInfo($path); |
|
| 38 | 38 | |
| 39 | - ?> |
|
| 39 | + ?> |
|
| 40 | 40 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 41 | 41 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 42 | 42 | <head> |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | </head> |
| 103 | 103 | <body> |
| 104 | 104 | <?php |
| 105 | - //displayArray($_SESSION); |
|
| 105 | + //displayArray($_SESSION); |
|
| 106 | 106 | |
| 107 | 107 | ?> |
| 108 | 108 | <div id="controls"> |
@@ -6,32 +6,32 @@ |
||
| 6 | 6 | * @since 22/May/2007 |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 9 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 10 | + if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 11 | 11 | { |
| 12 | 12 | die(SYS_DISABLED); |
| 13 | 13 | } |
| 14 | 14 | $session->gc(); |
| 15 | - $_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path']; |
|
| 16 | - if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 15 | + $_GET['path'] = empty($_GET['path']) ? CONFIG_SYS_ROOT_PATH."ajax_image_editor_demo.jpg" : $_GET['path']; |
|
| 16 | + if (!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 17 | 17 | { |
| 18 | 18 | $path = $_GET['path']; |
| 19 | - }else |
|
| 19 | + } else |
|
| 20 | 20 | { |
| 21 | 21 | die(IMG_GEN_IMG_NOT_EXISTS); |
| 22 | 22 | } |
| 23 | 23 | require_once(CLASS_HISTORY); |
| 24 | 24 | $history = new History($path, $session); |
| 25 | - if(CONFIG_SYS_DEMO_ENABLE) |
|
| 25 | + if (CONFIG_SYS_DEMO_ENABLE) |
|
| 26 | 26 | { |
| 27 | 27 | $sessionImageInfo = $history->getLastestRestorable(); |
| 28 | 28 | $originalSessionImageInfo = $history->getOriginalImage(); |
| 29 | - if(sizeof($originalSessionImageInfo)) |
|
| 29 | + if (sizeof($originalSessionImageInfo)) |
|
| 30 | 30 | { |
| 31 | - $path = backslashToSlash($session->getSessionDir() . $originalSessionImageInfo['info']['name']); |
|
| 31 | + $path = backslashToSlash($session->getSessionDir().$originalSessionImageInfo['info']['name']); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php"); |
|
| 34 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."class.image.php"); |
|
| 35 | 35 | $image = new Image(); |
| 36 | 36 | |
| 37 | 37 | $imageInfo = $image->getImageInfo($path); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
| 17 | 17 | { |
| 18 | 18 | $path = $_GET['path']; |
| 19 | - }else |
|
| 19 | + } else |
|
| 20 | 20 | { |
| 21 | 21 | die(IMG_GEN_IMG_NOT_EXISTS); |
| 22 | 22 | } |
@@ -6,10 +6,10 @@ discard block |
||
| 6 | 6 | * @since 22/April/2007 |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 9 | +require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 10 | 10 | |
| 11 | 11 | $user = PMF_User_CurrentUser::getFromCookie($faqConfig); |
| 12 | -if (! $user instanceof PMF_User_CurrentUser) { |
|
| 12 | +if (!$user instanceof PMF_User_CurrentUser) { |
|
| 13 | 13 | $user = PMF_User_CurrentUser::getFromSession($faqConfig); |
| 14 | 14 | } |
| 15 | 15 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | if ($permission['addattachment']) { |
| 33 | 33 | $_SESSION['ajax_user'] = true; |
| 34 | - header('Location: ' . appendQueryString(CONFIG_URL_HOME, makeQueryString())); |
|
| 34 | + header('Location: '.appendQueryString(CONFIG_URL_HOME, makeQueryString())); |
|
| 35 | 35 | exit; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -75,8 +75,9 @@ |
||
| 75 | 75 | // check user rights, set them TRUE |
| 76 | 76 | $allUserRights = $user->perm->getAllUserRights($user->getUserId()); |
| 77 | 77 | foreach ($allRights as $right) { |
| 78 | - if (in_array($right['right_id'], $allUserRights)) |
|
| 79 | - $permission[$right['name']] = true; |
|
| 78 | + if (in_array($right['right_id'], $allUserRights)) { |
|
| 79 | + $permission[$right['name']] = true; |
|
| 80 | + } |
|
| 80 | 81 | } |
| 81 | 82 | } |
| 82 | 83 | |
@@ -1,34 +1,34 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 3 | - { |
|
| 4 | - die('Permission denied'); |
|
| 5 | - } |
|
| 2 | + if(!defined('AJAX_INIT_DONE')) |
|
| 3 | + { |
|
| 4 | + die('Permission denied'); |
|
| 5 | + } |
|
| 6 | 6 | ?><div id="content"> |
| 7 | 7 | <?php |
| 8 | 8 | |
| 9 | - $count = 1; |
|
| 10 | - $thumbnailBaseUrl = appendQueryString(CONFIG_URL_IMG_THUMBNAIL, makeQueryString(array('path'))); |
|
| 11 | - foreach($fileList as $file) |
|
| 9 | + $count = 1; |
|
| 10 | + $thumbnailBaseUrl = appendQueryString(CONFIG_URL_IMG_THUMBNAIL, makeQueryString(array('path'))); |
|
| 11 | + foreach($fileList as $file) |
|
| 12 | 12 | |
| 13 | - { |
|
| 14 | - ?> |
|
| 13 | + { |
|
| 14 | + ?> |
|
| 15 | 15 | <dl class="thumbnailListing" id="dl<?php echo $count; ?>"> |
| 16 | 16 | <dt id="dt<?php echo $count; ?>" class="<?php echo ($file['type'] == 'folder' && empty($file['file']) && empty($file['subdir'])?'folderEmpty':$file['cssClass']); ?>" class="<?php echo $file['cssClass']; ?>"> |
| 17 | 17 | <?php |
| 18 | - switch($file['cssClass']) |
|
| 19 | - { |
|
| 20 | - case 'filePicture': |
|
| 21 | - echo '<a id="thumbUrl' . $count . '" rel="thumbPhotos" href="' . $file['path'] . '">'; |
|
| 22 | - echo '<img src="' . appendQueryString($thumbnailBaseUrl, 'path=' . $file['path']) . '" id="thumbImg' . $count . '"></a>' . "\n"; |
|
| 23 | - break; |
|
| 24 | - case 'fileFlash': |
|
| 25 | - case 'fileVideo': |
|
| 26 | - case 'fileMusic': |
|
| 27 | - break; |
|
| 28 | - default: |
|
| 29 | - echo ' '; |
|
| 30 | - } |
|
| 31 | - ?> |
|
| 18 | + switch($file['cssClass']) |
|
| 19 | + { |
|
| 20 | + case 'filePicture': |
|
| 21 | + echo '<a id="thumbUrl' . $count . '" rel="thumbPhotos" href="' . $file['path'] . '">'; |
|
| 22 | + echo '<img src="' . appendQueryString($thumbnailBaseUrl, 'path=' . $file['path']) . '" id="thumbImg' . $count . '"></a>' . "\n"; |
|
| 23 | + break; |
|
| 24 | + case 'fileFlash': |
|
| 25 | + case 'fileVideo': |
|
| 26 | + case 'fileMusic': |
|
| 27 | + break; |
|
| 28 | + default: |
|
| 29 | + echo ' '; |
|
| 30 | + } |
|
| 31 | + ?> |
|
| 32 | 32 | |
| 33 | 33 | </dt> |
| 34 | 34 | <dd id="dd<?php echo $count; ?>" class="thumbnailListing_info"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input id="cb<?php echo $count; ?>" type="checkbox" name="check[]" <?php echo ($file['is_writable']?'':'disabled'); ?> class="radio" value="<?php echo $file['path']; ?>" /> |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | </dl> |
| 38 | 38 | <?php |
| 39 | - $count++; |
|
| 40 | - } |
|
| 39 | + $count++; |
|
| 40 | + } |
|
| 41 | 41 | ?> |
| 42 | 42 | </div> |
| 43 | 43 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 2 | + if (!defined('AJAX_INIT_DONE')) |
|
| 3 | 3 | { |
| 4 | 4 | die('Permission denied'); |
| 5 | 5 | } |
@@ -8,18 +8,18 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | $count = 1; |
| 10 | 10 | $thumbnailBaseUrl = appendQueryString(CONFIG_URL_IMG_THUMBNAIL, makeQueryString(array('path'))); |
| 11 | - foreach($fileList as $file) |
|
| 11 | + foreach ($fileList as $file) |
|
| 12 | 12 | |
| 13 | 13 | { |
| 14 | 14 | ?> |
| 15 | 15 | <dl class="thumbnailListing" id="dl<?php echo $count; ?>"> |
| 16 | - <dt id="dt<?php echo $count; ?>" class="<?php echo ($file['type'] == 'folder' && empty($file['file']) && empty($file['subdir'])?'folderEmpty':$file['cssClass']); ?>" class="<?php echo $file['cssClass']; ?>"> |
|
| 16 | + <dt id="dt<?php echo $count; ?>" class="<?php echo ($file['type'] == 'folder' && empty($file['file']) && empty($file['subdir']) ? 'folderEmpty' : $file['cssClass']); ?>" class="<?php echo $file['cssClass']; ?>"> |
|
| 17 | 17 | <?php |
| 18 | - switch($file['cssClass']) |
|
| 18 | + switch ($file['cssClass']) |
|
| 19 | 19 | { |
| 20 | 20 | case 'filePicture': |
| 21 | - echo '<a id="thumbUrl' . $count . '" rel="thumbPhotos" href="' . $file['path'] . '">'; |
|
| 22 | - echo '<img src="' . appendQueryString($thumbnailBaseUrl, 'path=' . $file['path']) . '" id="thumbImg' . $count . '"></a>' . "\n"; |
|
| 21 | + echo '<a id="thumbUrl'.$count.'" rel="thumbPhotos" href="'.$file['path'].'">'; |
|
| 22 | + echo '<img src="'.appendQueryString($thumbnailBaseUrl, 'path='.$file['path']).'" id="thumbImg'.$count.'"></a>'."\n"; |
|
| 23 | 23 | break; |
| 24 | 24 | case 'fileFlash': |
| 25 | 25 | case 'fileVideo': |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | ?> |
| 32 | 32 | |
| 33 | 33 | </dt> |
| 34 | - <dd id="dd<?php echo $count; ?>" class="thumbnailListing_info"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input id="cb<?php echo $count; ?>" type="checkbox" name="check[]" <?php echo ($file['is_writable']?'':'disabled'); ?> class="radio" value="<?php echo $file['path']; ?>" /> |
|
| 35 | - <a <?php echo ($file['cssClass']== 'filePicture'?'rel="orgImg"':''); ?> href="<?php echo $file['path']; ?>" title="<?php echo $file['name']; ?>" id="a<?php echo $count; ?>"><?php echo shortenFileName($file['name']); ?></a></dd> |
|
| 34 | + <dd id="dd<?php echo $count; ?>" class="thumbnailListing_info"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input id="cb<?php echo $count; ?>" type="checkbox" name="check[]" <?php echo ($file['is_writable'] ? '' : 'disabled'); ?> class="radio" value="<?php echo $file['path']; ?>" /> |
|
| 35 | + <a <?php echo ($file['cssClass'] == 'filePicture' ? 'rel="orgImg"' : ''); ?> href="<?php echo $file['path']; ?>" title="<?php echo $file['name']; ?>" id="a<?php echo $count; ?>"><?php echo shortenFileName($file['name']); ?></a></dd> |
|
| 36 | 36 | |
| 37 | 37 | </dl> |
| 38 | 38 | <?php |
@@ -1,44 +1,44 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * Ajax image editor platform |
|
| 4 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | - * @link www.phpletter.com |
|
| 6 | - * @since 22/May/2007 |
|
| 7 | - * |
|
| 8 | - */ |
|
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 11 | - { |
|
| 12 | - die(SYS_DISABLED); |
|
| 13 | - } |
|
| 14 | - $session->gc(); |
|
| 15 | - $_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path']; |
|
| 16 | - if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 17 | - { |
|
| 18 | - $path = $_GET['path']; |
|
| 19 | - }else |
|
| 20 | - { |
|
| 21 | - die(TXT_FILE_NOT_FOUND); |
|
| 22 | - } |
|
| 23 | - if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js")) |
|
| 24 | - { |
|
| 25 | - $syntax = getFileExt($path); |
|
| 26 | - }else |
|
| 27 | - { |
|
| 28 | - switch (getFileExt($path)) |
|
| 29 | - { |
|
| 30 | - case 'htm': |
|
| 31 | - $syntax = 'html'; |
|
| 32 | - break; |
|
| 33 | - default: |
|
| 34 | - $syntax = 'basic'; |
|
| 35 | - } |
|
| 36 | - } |
|
| 37 | - if(array_search(getFileExt($path), getValidTextEditorExts())=== false) |
|
| 38 | - { |
|
| 39 | - die(TXT_DISALLOWED_EXT); |
|
| 40 | - } |
|
| 41 | - ?> |
|
| 2 | + /** |
|
| 3 | + * Ajax image editor platform |
|
| 4 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | + * @link www.phpletter.com |
|
| 6 | + * @since 22/May/2007 |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | + if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 11 | + { |
|
| 12 | + die(SYS_DISABLED); |
|
| 13 | + } |
|
| 14 | + $session->gc(); |
|
| 15 | + $_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path']; |
|
| 16 | + if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 17 | + { |
|
| 18 | + $path = $_GET['path']; |
|
| 19 | + }else |
|
| 20 | + { |
|
| 21 | + die(TXT_FILE_NOT_FOUND); |
|
| 22 | + } |
|
| 23 | + if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js")) |
|
| 24 | + { |
|
| 25 | + $syntax = getFileExt($path); |
|
| 26 | + }else |
|
| 27 | + { |
|
| 28 | + switch (getFileExt($path)) |
|
| 29 | + { |
|
| 30 | + case 'htm': |
|
| 31 | + $syntax = 'html'; |
|
| 32 | + break; |
|
| 33 | + default: |
|
| 34 | + $syntax = 'basic'; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | + if(array_search(getFileExt($path), getValidTextEditorExts())=== false) |
|
| 38 | + { |
|
| 39 | + die(TXT_DISALLOWED_EXT); |
|
| 40 | + } |
|
| 41 | + ?> |
|
| 42 | 42 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 43 | 43 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 44 | 44 | <head> |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | <input type="text" id="new_name" class="input" name="new_name" value="" /> |
| 124 | 124 | . <select id="ext" name="ext"> |
| 125 | 125 | <?php |
| 126 | - foreach(getValidTextEditorExts() as $v) |
|
| 127 | - { |
|
| 128 | - ?> |
|
| 126 | + foreach(getValidTextEditorExts() as $v) |
|
| 127 | + { |
|
| 128 | + ?> |
|
| 129 | 129 | <option value="<?php echo $v; ?>" <?php echo (strtolower($v) == strtolower(getFileExt($path))?'selected':''); ?>><?php echo $v; ?></option> |
| 130 | 130 | <?php |
| 131 | - } |
|
| 132 | - ?> |
|
| 131 | + } |
|
| 132 | + ?> |
|
| 133 | 133 | </select> |
| 134 | 134 | </td> |
| 135 | 135 | </tr> |
@@ -6,24 +6,24 @@ discard block |
||
| 6 | 6 | * @since 22/May/2007 |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 9 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 10 | + if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 11 | 11 | { |
| 12 | 12 | die(SYS_DISABLED); |
| 13 | 13 | } |
| 14 | 14 | $session->gc(); |
| 15 | - $_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path']; |
|
| 16 | - if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 15 | + $_GET['path'] = empty($_GET['path']) ? CONFIG_SYS_ROOT_PATH."ajax_image_editor_demo.jpg" : $_GET['path']; |
|
| 16 | + if (!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
|
| 17 | 17 | { |
| 18 | 18 | $path = $_GET['path']; |
| 19 | - }else |
|
| 19 | + } else |
|
| 20 | 20 | { |
| 21 | 21 | die(TXT_FILE_NOT_FOUND); |
| 22 | 22 | } |
| 23 | - if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js")) |
|
| 23 | + if (file_exists(DIR_AJAX_EDIT_AREA."reg_syntax".DIRECTORY_SEPARATOR.getFileExt($path).".js")) |
|
| 24 | 24 | { |
| 25 | 25 | $syntax = getFileExt($path); |
| 26 | - }else |
|
| 26 | + } else |
|
| 27 | 27 | { |
| 28 | 28 | switch (getFileExt($path)) |
| 29 | 29 | { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $syntax = 'basic'; |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | - if(array_search(getFileExt($path), getValidTextEditorExts())=== false) |
|
| 37 | + if (array_search(getFileExt($path), getValidTextEditorExts()) === false) |
|
| 38 | 38 | { |
| 39 | 39 | die(TXT_DISALLOWED_EXT); |
| 40 | 40 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | ,toolbar:"search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, save, save_as" |
| 74 | 74 | ,save_callback:"save" |
| 75 | 75 | ,save_as_callback:"save_as" |
| 76 | - ,language: "<?php echo (file_exists(DIR_AJAX_EDIT_AREA . 'langs' . DIRECTORY_SEPARATOR .CONFIG_LANG_INDEX . ".js")?CONFIG_LANG_INDEX:'en'); ?>" |
|
| 76 | + ,language: "<?php echo (file_exists(DIR_AJAX_EDIT_AREA.'langs'.DIRECTORY_SEPARATOR.CONFIG_LANG_INDEX.".js") ? CONFIG_LANG_INDEX : 'en'); ?>" |
|
| 77 | 77 | ,syntax: "<?php echo $syntax; ?>" |
| 78 | 78 | }); |
| 79 | 79 | jQuery('#windowSaveAs').jqm(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | <textarea name="content" id="content" style="height:500px; width: 97%;"><?php echo getFileContent($path); ?></textarea> |
| 97 | 97 | </div> |
| 98 | 98 | <div id="windowProcessing" class="jqmWindow" style="display:none"> |
| 99 | - <form name="frmProcessing" id="frmProcessing" method="POST" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path')));?>"> |
|
| 99 | + <form name="frmProcessing" id="frmProcessing" method="POST" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path'))); ?>"> |
|
| 100 | 100 | <input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?>" /> |
| 101 | 101 | <input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" /> |
| 102 | 102 | <input type="hidden" name="save_as_request" id="save_as_request" value="0" /> |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | <input type="text" id="new_name" class="input" name="new_name" value="" /> |
| 124 | 124 | . <select id="ext" name="ext"> |
| 125 | 125 | <?php |
| 126 | - foreach(getValidTextEditorExts() as $v) |
|
| 126 | + foreach (getValidTextEditorExts() as $v) |
|
| 127 | 127 | { |
| 128 | 128 | ?> |
| 129 | - <option value="<?php echo $v; ?>" <?php echo (strtolower($v) == strtolower(getFileExt($path))?'selected':''); ?>><?php echo $v; ?></option> |
|
| 129 | + <option value="<?php echo $v; ?>" <?php echo (strtolower($v) == strtolower(getFileExt($path)) ? 'selected' : ''); ?>><?php echo $v; ?></option> |
|
| 130 | 130 | <?php |
| 131 | 131 | } |
| 132 | 132 | ?> |
@@ -16,14 +16,14 @@ |
||
| 16 | 16 | if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) |
| 17 | 17 | { |
| 18 | 18 | $path = $_GET['path']; |
| 19 | - }else |
|
| 19 | + } else |
|
| 20 | 20 | { |
| 21 | 21 | die(TXT_FILE_NOT_FOUND); |
| 22 | 22 | } |
| 23 | 23 | if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js")) |
| 24 | 24 | { |
| 25 | 25 | $syntax = getFileExt($path); |
| 26 | - }else |
|
| 26 | + } else |
|
| 27 | 27 | { |
| 28 | 28 | switch (getFileExt($path)) |
| 29 | 29 | { |
@@ -1,116 +1,116 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * reset the image |
|
| 4 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | - * @link www.phpletter.com |
|
| 6 | - * @since 22/May/2007 |
|
| 7 | - * |
|
| 8 | - */ |
|
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | - if(!isset($_POST['path'])) |
|
| 11 | - { |
|
| 12 | - $_POST['path'] = "uploaded/Winter.jpg" . "?" . makeQueryString(array('path')); |
|
| 13 | - //for crop |
|
| 14 | - $_POST['mode'] = "crop"; |
|
| 15 | - $_POST['x'] = 100; |
|
| 16 | - $_POST['y'] = 100; |
|
| 17 | - $imageInfo = @GetImageSize($_POST['path']); |
|
| 18 | - $_POST['width'] = $imageInfo[0]; |
|
| 19 | - $_POST['height'] = $imageInfo[1]; |
|
| 2 | + /** |
|
| 3 | + * reset the image |
|
| 4 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | + * @link www.phpletter.com |
|
| 6 | + * @since 22/May/2007 |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | + if(!isset($_POST['path'])) |
|
| 11 | + { |
|
| 12 | + $_POST['path'] = "uploaded/Winter.jpg" . "?" . makeQueryString(array('path')); |
|
| 13 | + //for crop |
|
| 14 | + $_POST['mode'] = "crop"; |
|
| 15 | + $_POST['x'] = 100; |
|
| 16 | + $_POST['y'] = 100; |
|
| 17 | + $imageInfo = @GetImageSize($_POST['path']); |
|
| 18 | + $_POST['width'] = $imageInfo[0]; |
|
| 19 | + $_POST['height'] = $imageInfo[1]; |
|
| 20 | 20 | |
| 21 | - } |
|
| 22 | - initSessionHistory($_POST['path']); |
|
| 21 | + } |
|
| 22 | + initSessionHistory($_POST['path']); |
|
| 23 | 23 | |
| 24 | - echo "{"; |
|
| 25 | - $error = ""; |
|
| 26 | - $info = ""; |
|
| 24 | + echo "{"; |
|
| 25 | + $error = ""; |
|
| 26 | + $info = ""; |
|
| 27 | 27 | |
| 28 | - if(empty($_POST['path'])) |
|
| 29 | - { |
|
| 30 | - $error = IMG_SAVE_EMPTY_PATH; |
|
| 31 | - }elseif(!file_exists($_POST['path'])) |
|
| 32 | - { |
|
| 33 | - $error = IMG_SAVE_NOT_EXISTS; |
|
| 34 | - }else if(!isUnderRoot($_POST['path'])) |
|
| 35 | - { |
|
| 36 | - $error = IMG_SAVE_PATH_DISALLOWED; |
|
| 37 | - } |
|
| 38 | - else |
|
| 39 | - { |
|
| 40 | - if(!empty($_POST['mode'])) |
|
| 41 | - { |
|
| 28 | + if(empty($_POST['path'])) |
|
| 29 | + { |
|
| 30 | + $error = IMG_SAVE_EMPTY_PATH; |
|
| 31 | + }elseif(!file_exists($_POST['path'])) |
|
| 32 | + { |
|
| 33 | + $error = IMG_SAVE_NOT_EXISTS; |
|
| 34 | + }else if(!isUnderRoot($_POST['path'])) |
|
| 35 | + { |
|
| 36 | + $error = IMG_SAVE_PATH_DISALLOWED; |
|
| 37 | + } |
|
| 38 | + else |
|
| 39 | + { |
|
| 40 | + if(!empty($_POST['mode'])) |
|
| 41 | + { |
|
| 42 | 42 | |
| 43 | - include_once(CLASS_IMAGE); |
|
| 44 | - $image = new Image(); |
|
| 45 | - $image->loadImage($_POST['path']); |
|
| 43 | + include_once(CLASS_IMAGE); |
|
| 44 | + $image = new Image(); |
|
| 45 | + $image->loadImage($_POST['path']); |
|
| 46 | 46 | |
| 47 | - switch($_POST['mode']) |
|
| 48 | - { |
|
| 49 | - case "resize": |
|
| 50 | - if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false))) |
|
| 51 | - { |
|
| 52 | - $error = IMG_SAVE_RESIZE_FAILED; |
|
| 53 | - } |
|
| 54 | - break; |
|
| 55 | - case "crop": |
|
| 56 | - if(!$image->cropToDimensions($_POST['x'], $_POST['y'], intval($_POST['x']) + intval($_POST['width']), intval($_POST['y']) + intval($_POST['height']))) |
|
| 57 | - { |
|
| 58 | - $error = IMG_SAVE_CROP_FAILED; |
|
| 59 | - } |
|
| 47 | + switch($_POST['mode']) |
|
| 48 | + { |
|
| 49 | + case "resize": |
|
| 50 | + if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false))) |
|
| 51 | + { |
|
| 52 | + $error = IMG_SAVE_RESIZE_FAILED; |
|
| 53 | + } |
|
| 54 | + break; |
|
| 55 | + case "crop": |
|
| 56 | + if(!$image->cropToDimensions($_POST['x'], $_POST['y'], intval($_POST['x']) + intval($_POST['width']), intval($_POST['y']) + intval($_POST['height']))) |
|
| 57 | + { |
|
| 58 | + $error = IMG_SAVE_CROP_FAILED; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - break; |
|
| 62 | - case "flip": |
|
| 63 | - if(!$image->flip($_POST['flip_angle'])) |
|
| 64 | - { |
|
| 65 | - $error = IMG_SAVE_FLIP_FAILED; |
|
| 66 | - } |
|
| 67 | - break; |
|
| 68 | - case "rotate": |
|
| 69 | - if(!$image->rotate(intval($_POST['angle']))) |
|
| 70 | - { |
|
| 71 | - $error = IMG_SAVE_ROTATE_FAILED; |
|
| 72 | - } |
|
| 73 | - break; |
|
| 74 | - default: |
|
| 75 | - $error = IMG_SAVE_UNKNOWN_MODE; |
|
| 76 | - } |
|
| 77 | - if(empty($error)) |
|
| 78 | - { |
|
| 61 | + break; |
|
| 62 | + case "flip": |
|
| 63 | + if(!$image->flip($_POST['flip_angle'])) |
|
| 64 | + { |
|
| 65 | + $error = IMG_SAVE_FLIP_FAILED; |
|
| 66 | + } |
|
| 67 | + break; |
|
| 68 | + case "rotate": |
|
| 69 | + if(!$image->rotate(intval($_POST['angle']))) |
|
| 70 | + { |
|
| 71 | + $error = IMG_SAVE_ROTATE_FAILED; |
|
| 72 | + } |
|
| 73 | + break; |
|
| 74 | + default: |
|
| 75 | + $error = IMG_SAVE_UNKNOWN_MODE; |
|
| 76 | + } |
|
| 77 | + if(empty($error)) |
|
| 78 | + { |
|
| 79 | 79 | |
| 80 | - $sessionNewPath = $session->getSessionDir() . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
|
| 81 | - if(!@copy($_POST['path'], $sessionNewPath)) |
|
| 82 | - { |
|
| 83 | - $error = IMG_SAVE_BACKUP_FAILED; |
|
| 84 | - }else |
|
| 85 | - { |
|
| 86 | - addSessionHistory($_POST['path'], $sessionNewPath); |
|
| 87 | - if($image->saveImage($_POST['path'])) |
|
| 88 | - { |
|
| 89 | - $imageInfo = $image->getFinalImageInfo(); |
|
| 90 | - $info .= ",width:" . $imageInfo['width'] . "\n"; |
|
| 91 | - $info .= ",height:" . $imageInfo['height'] . "\n"; |
|
| 92 | - $info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n"; |
|
| 93 | - }else |
|
| 94 | - { |
|
| 95 | - $error = IMG_SAVE_FAILED; |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - }else |
|
| 99 | - { |
|
| 100 | - //$image->DestroyImages(); |
|
| 101 | - } |
|
| 102 | - }else |
|
| 103 | - { |
|
| 104 | - $error = IMG_SAVE_UNKNOWN_MODE; |
|
| 105 | - } |
|
| 106 | - } |
|
| 80 | + $sessionNewPath = $session->getSessionDir() . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
|
| 81 | + if(!@copy($_POST['path'], $sessionNewPath)) |
|
| 82 | + { |
|
| 83 | + $error = IMG_SAVE_BACKUP_FAILED; |
|
| 84 | + }else |
|
| 85 | + { |
|
| 86 | + addSessionHistory($_POST['path'], $sessionNewPath); |
|
| 87 | + if($image->saveImage($_POST['path'])) |
|
| 88 | + { |
|
| 89 | + $imageInfo = $image->getFinalImageInfo(); |
|
| 90 | + $info .= ",width:" . $imageInfo['width'] . "\n"; |
|
| 91 | + $info .= ",height:" . $imageInfo['height'] . "\n"; |
|
| 92 | + $info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n"; |
|
| 93 | + }else |
|
| 94 | + { |
|
| 95 | + $error = IMG_SAVE_FAILED; |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + }else |
|
| 99 | + { |
|
| 100 | + //$image->DestroyImages(); |
|
| 101 | + } |
|
| 102 | + }else |
|
| 103 | + { |
|
| 104 | + $error = IMG_SAVE_UNKNOWN_MODE; |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - echo "error:'" . $error . "'\n"; |
|
| 109 | - if(isset($image) && is_object($image)) |
|
| 110 | - { |
|
| 111 | - $image->DestroyImages(); |
|
| 112 | - } |
|
| 113 | - echo $info; |
|
| 114 | - echo ",history:" . sizeof($_SESSION[$_POST['path']]) . "\n"; |
|
| 115 | - echo "}"; |
|
| 108 | + echo "error:'" . $error . "'\n"; |
|
| 109 | + if(isset($image) && is_object($image)) |
|
| 110 | + { |
|
| 111 | + $image->DestroyImages(); |
|
| 112 | + } |
|
| 113 | + echo $info; |
|
| 114 | + echo ",history:" . sizeof($_SESSION[$_POST['path']]) . "\n"; |
|
| 115 | + echo "}"; |
|
| 116 | 116 | ?> |
| 117 | 117 | \ No newline at end of file |
@@ -6,10 +6,10 @@ discard block |
||
| 6 | 6 | * @since 22/May/2007 |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | - if(!isset($_POST['path'])) |
|
| 9 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 10 | + if (!isset($_POST['path'])) |
|
| 11 | 11 | { |
| 12 | - $_POST['path'] = "uploaded/Winter.jpg" . "?" . makeQueryString(array('path')); |
|
| 12 | + $_POST['path'] = "uploaded/Winter.jpg"."?".makeQueryString(array('path')); |
|
| 13 | 13 | //for crop |
| 14 | 14 | $_POST['mode'] = "crop"; |
| 15 | 15 | $_POST['x'] = 100; |
@@ -25,48 +25,48 @@ discard block |
||
| 25 | 25 | $error = ""; |
| 26 | 26 | $info = ""; |
| 27 | 27 | |
| 28 | - if(empty($_POST['path'])) |
|
| 28 | + if (empty($_POST['path'])) |
|
| 29 | 29 | { |
| 30 | - $error = IMG_SAVE_EMPTY_PATH; |
|
| 31 | - }elseif(!file_exists($_POST['path'])) |
|
| 30 | + $error = IMG_SAVE_EMPTY_PATH; |
|
| 31 | + }elseif (!file_exists($_POST['path'])) |
|
| 32 | 32 | { |
| 33 | - $error = IMG_SAVE_NOT_EXISTS; |
|
| 34 | - }else if(!isUnderRoot($_POST['path'])) |
|
| 33 | + $error = IMG_SAVE_NOT_EXISTS; |
|
| 34 | + } else if (!isUnderRoot($_POST['path'])) |
|
| 35 | 35 | { |
| 36 | 36 | $error = IMG_SAVE_PATH_DISALLOWED; |
| 37 | 37 | } |
| 38 | 38 | else |
| 39 | 39 | { |
| 40 | - if(!empty($_POST['mode'])) |
|
| 40 | + if (!empty($_POST['mode'])) |
|
| 41 | 41 | { |
| 42 | 42 | |
| 43 | 43 | include_once(CLASS_IMAGE); |
| 44 | 44 | $image = new Image(); |
| 45 | 45 | $image->loadImage($_POST['path']); |
| 46 | 46 | |
| 47 | - switch($_POST['mode']) |
|
| 47 | + switch ($_POST['mode']) |
|
| 48 | 48 | { |
| 49 | 49 | case "resize": |
| 50 | - if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false))) |
|
| 50 | + if (!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint']) ? true : false))) |
|
| 51 | 51 | { |
| 52 | 52 | $error = IMG_SAVE_RESIZE_FAILED; |
| 53 | 53 | } |
| 54 | 54 | break; |
| 55 | 55 | case "crop": |
| 56 | - if(!$image->cropToDimensions($_POST['x'], $_POST['y'], intval($_POST['x']) + intval($_POST['width']), intval($_POST['y']) + intval($_POST['height']))) |
|
| 56 | + if (!$image->cropToDimensions($_POST['x'], $_POST['y'], intval($_POST['x']) + intval($_POST['width']), intval($_POST['y']) + intval($_POST['height']))) |
|
| 57 | 57 | { |
| 58 | 58 | $error = IMG_SAVE_CROP_FAILED; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | break; |
| 62 | 62 | case "flip": |
| 63 | - if(!$image->flip($_POST['flip_angle'])) |
|
| 63 | + if (!$image->flip($_POST['flip_angle'])) |
|
| 64 | 64 | { |
| 65 | 65 | $error = IMG_SAVE_FLIP_FAILED; |
| 66 | 66 | } |
| 67 | 67 | break; |
| 68 | 68 | case "rotate": |
| 69 | - if(!$image->rotate(intval($_POST['angle']))) |
|
| 69 | + if (!$image->rotate(intval($_POST['angle']))) |
|
| 70 | 70 | { |
| 71 | 71 | $error = IMG_SAVE_ROTATE_FAILED; |
| 72 | 72 | } |
@@ -74,43 +74,43 @@ discard block |
||
| 74 | 74 | default: |
| 75 | 75 | $error = IMG_SAVE_UNKNOWN_MODE; |
| 76 | 76 | } |
| 77 | - if(empty($error)) |
|
| 77 | + if (empty($error)) |
|
| 78 | 78 | { |
| 79 | 79 | |
| 80 | - $sessionNewPath = $session->getSessionDir() . uniqid(md5(time())) . "." . getFileExt($_POST['path']); |
|
| 81 | - if(!@copy($_POST['path'], $sessionNewPath)) |
|
| 80 | + $sessionNewPath = $session->getSessionDir().uniqid(md5(time())).".".getFileExt($_POST['path']); |
|
| 81 | + if (!@copy($_POST['path'], $sessionNewPath)) |
|
| 82 | 82 | { |
| 83 | 83 | $error = IMG_SAVE_BACKUP_FAILED; |
| 84 | - }else |
|
| 84 | + } else |
|
| 85 | 85 | { |
| 86 | 86 | addSessionHistory($_POST['path'], $sessionNewPath); |
| 87 | - if($image->saveImage($_POST['path'])) |
|
| 87 | + if ($image->saveImage($_POST['path'])) |
|
| 88 | 88 | { |
| 89 | 89 | $imageInfo = $image->getFinalImageInfo(); |
| 90 | - $info .= ",width:" . $imageInfo['width'] . "\n"; |
|
| 91 | - $info .= ",height:" . $imageInfo['height'] . "\n"; |
|
| 92 | - $info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n"; |
|
| 93 | - }else |
|
| 90 | + $info .= ",width:".$imageInfo['width']."\n"; |
|
| 91 | + $info .= ",height:".$imageInfo['height']."\n"; |
|
| 92 | + $info .= ",size:'".transformFileSize($imageInfo['size'])."'\n"; |
|
| 93 | + } else |
|
| 94 | 94 | { |
| 95 | 95 | $error = IMG_SAVE_FAILED; |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | - }else |
|
| 98 | + } else |
|
| 99 | 99 | { |
| 100 | 100 | //$image->DestroyImages(); |
| 101 | 101 | } |
| 102 | - }else |
|
| 102 | + } else |
|
| 103 | 103 | { |
| 104 | 104 | $error = IMG_SAVE_UNKNOWN_MODE; |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - echo "error:'" . $error . "'\n"; |
|
| 109 | - if(isset($image) && is_object($image)) |
|
| 108 | + echo "error:'".$error."'\n"; |
|
| 109 | + if (isset($image) && is_object($image)) |
|
| 110 | 110 | { |
| 111 | 111 | $image->DestroyImages(); |
| 112 | 112 | } |
| 113 | 113 | echo $info; |
| 114 | - echo ",history:" . sizeof($_SESSION[$_POST['path']]) . "\n"; |
|
| 114 | + echo ",history:".sizeof($_SESSION[$_POST['path']])."\n"; |
|
| 115 | 115 | echo "}"; |
| 116 | 116 | ?> |
| 117 | 117 | \ No newline at end of file |
@@ -28,14 +28,13 @@ discard block |
||
| 28 | 28 | if(empty($_POST['path'])) |
| 29 | 29 | { |
| 30 | 30 | $error = IMG_SAVE_EMPTY_PATH; |
| 31 | - }elseif(!file_exists($_POST['path'])) |
|
| 31 | + } elseif(!file_exists($_POST['path'])) |
|
| 32 | 32 | { |
| 33 | 33 | $error = IMG_SAVE_NOT_EXISTS; |
| 34 | - }else if(!isUnderRoot($_POST['path'])) |
|
| 34 | + } else if(!isUnderRoot($_POST['path'])) |
|
| 35 | 35 | { |
| 36 | 36 | $error = IMG_SAVE_PATH_DISALLOWED; |
| 37 | - } |
|
| 38 | - else |
|
| 37 | + } else |
|
| 39 | 38 | { |
| 40 | 39 | if(!empty($_POST['mode'])) |
| 41 | 40 | { |
@@ -81,7 +80,7 @@ discard block |
||
| 81 | 80 | if(!@copy($_POST['path'], $sessionNewPath)) |
| 82 | 81 | { |
| 83 | 82 | $error = IMG_SAVE_BACKUP_FAILED; |
| 84 | - }else |
|
| 83 | + } else |
|
| 85 | 84 | { |
| 86 | 85 | addSessionHistory($_POST['path'], $sessionNewPath); |
| 87 | 86 | if($image->saveImage($_POST['path'])) |
@@ -90,16 +89,16 @@ discard block |
||
| 90 | 89 | $info .= ",width:" . $imageInfo['width'] . "\n"; |
| 91 | 90 | $info .= ",height:" . $imageInfo['height'] . "\n"; |
| 92 | 91 | $info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n"; |
| 93 | - }else |
|
| 92 | + } else |
|
| 94 | 93 | { |
| 95 | 94 | $error = IMG_SAVE_FAILED; |
| 96 | 95 | } |
| 97 | 96 | } |
| 98 | - }else |
|
| 97 | + } else |
|
| 99 | 98 | { |
| 100 | 99 | //$image->DestroyImages(); |
| 101 | 100 | } |
| 102 | - }else |
|
| 101 | + } else |
|
| 103 | 102 | { |
| 104 | 103 | $error = IMG_SAVE_UNKNOWN_MODE; |
| 105 | 104 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 2 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 3 | 3 | |
| 4 | 4 | ?> |
| 5 | 5 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 2 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 3 | 3 | |
| 4 | 4 | ?> |
| 5 | 5 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 3 | - { |
|
| 4 | - die('Permission denied'); |
|
| 5 | - } |
|
| 2 | + if(!defined('AJAX_INIT_DONE')) |
|
| 3 | + { |
|
| 4 | + die('Permission denied'); |
|
| 5 | + } |
|
| 6 | 6 | ?> |
| 7 | 7 | <div id="content"> |
| 8 | 8 | <table class="tableList" id="tableList" cellpadding="0" cellspacing="0" border="0"> |
@@ -17,19 +17,19 @@ discard block |
||
| 17 | 17 | </thead> |
| 18 | 18 | <tbody id="fileList"> |
| 19 | 19 | <?php |
| 20 | - $count = 1; |
|
| 21 | - $css = ""; |
|
| 22 | - //list all documents (files and folders) under this current folder, |
|
| 23 | - //<?php echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path'))); |
|
| 24 | - foreach($fileList as $file) |
|
| 25 | - { |
|
| 26 | - $css = ($css == "" || $css == "even"?"odd":"even"); |
|
| 27 | - $strDisabled = ($file['is_writable']?"":" disabled"); |
|
| 28 | - $strClass = ($file['is_writable']?"left":" leftDisabled"); |
|
| 29 | - if($file['type'] == 'file') |
|
| 30 | - { |
|
| 20 | + $count = 1; |
|
| 21 | + $css = ""; |
|
| 22 | + //list all documents (files and folders) under this current folder, |
|
| 23 | + //<?php echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path'))); |
|
| 24 | + foreach($fileList as $file) |
|
| 25 | + { |
|
| 26 | + $css = ($css == "" || $css == "even"?"odd":"even"); |
|
| 27 | + $strDisabled = ($file['is_writable']?"":" disabled"); |
|
| 28 | + $strClass = ($file['is_writable']?"left":" leftDisabled"); |
|
| 29 | + if($file['type'] == 'file') |
|
| 30 | + { |
|
| 31 | 31 | |
| 32 | - ?> |
|
| 32 | + ?> |
|
| 33 | 33 | <tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" > |
| 34 | 34 | <td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?> /> |
| 35 | 35 | </td> |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | <td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> |
| 40 | 40 | </tr> |
| 41 | 41 | <?php |
| 42 | - }else |
|
| 43 | - { |
|
| 44 | - ?> |
|
| 42 | + }else |
|
| 43 | + { |
|
| 44 | + ?> |
|
| 45 | 45 | <tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" > |
| 46 | 46 | <td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?>/> |
| 47 | 47 | </td> |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | <td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> |
| 52 | 52 | </tr> |
| 53 | 53 | <?php |
| 54 | - } |
|
| 55 | - $count++; |
|
| 56 | - } |
|
| 57 | - ?> |
|
| 54 | + } |
|
| 55 | + $count++; |
|
| 56 | + } |
|
| 57 | + ?> |
|
| 58 | 58 | </tbody> |
| 59 | 59 | </table> |
| 60 | 60 | </div> |
| 61 | 61 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(!defined('AJAX_INIT_DONE')) |
|
| 2 | + if (!defined('AJAX_INIT_DONE')) |
|
| 3 | 3 | { |
| 4 | 4 | die('Permission denied'); |
| 5 | 5 | } |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | $css = ""; |
| 22 | 22 | //list all documents (files and folders) under this current folder, |
| 23 | 23 | //<?php echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path'))); |
| 24 | - foreach($fileList as $file) |
|
| 24 | + foreach ($fileList as $file) |
|
| 25 | 25 | { |
| 26 | - $css = ($css == "" || $css == "even"?"odd":"even"); |
|
| 27 | - $strDisabled = ($file['is_writable']?"":" disabled"); |
|
| 28 | - $strClass = ($file['is_writable']?"left":" leftDisabled"); |
|
| 29 | - if($file['type'] == 'file') |
|
| 26 | + $css = ($css == "" || $css == "even" ? "odd" : "even"); |
|
| 27 | + $strDisabled = ($file['is_writable'] ? "" : " disabled"); |
|
| 28 | + $strClass = ($file['is_writable'] ? "left" : " leftDisabled"); |
|
| 29 | + if ($file['type'] == 'file') |
|
| 30 | 30 | { |
| 31 | 31 | |
| 32 | 32 | ?> |
@@ -36,19 +36,19 @@ discard block |
||
| 36 | 36 | <td align="center" class="fileColumns" id="tdst<?php echo $count; ?>"> <a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" target="_blank"><span class="<?php echo $file['cssClass']; ?>"> </span></a></td> |
| 37 | 37 | <td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>"><?php echo $file['name']; ?></a></td> |
| 38 | 38 | <td class="docInfo" id="tdrd<?php echo $count; ?>"><?php echo transformFileSize($file['size']); ?></td> |
| 39 | - <td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> |
|
| 39 | + <td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT, $file['mtime']); ?></td> |
|
| 40 | 40 | </tr> |
| 41 | 41 | <?php |
| 42 | - }else |
|
| 42 | + } else |
|
| 43 | 43 | { |
| 44 | 44 | ?> |
| 45 | 45 | <tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" > |
| 46 | 46 | <td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?>/> |
| 47 | 47 | </td> |
| 48 | - <td align="center" class="fileColumns" id="tdst<?php echo $count; ?>"> <a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" <?php echo $file['cssClass'] == 'filePicture'?'rel="ajaxPhotos"':''; ?> ><span class="<?php echo ($file['file']||$file['subdir']?$file['cssClass']:"folderEmpty"); ?>"> </span></a></td> |
|
| 48 | + <td align="center" class="fileColumns" id="tdst<?php echo $count; ?>"> <a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" <?php echo $file['cssClass'] == 'filePicture' ? 'rel="ajaxPhotos"' : ''; ?> ><span class="<?php echo ($file['file'] || $file['subdir'] ? $file['cssClass'] : "folderEmpty"); ?>"> </span></a></td> |
|
| 49 | 49 | <td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><?php echo $file['name']; ?></td> |
| 50 | 50 | <td class="docInfo" id="tdrd<?php echo $count; ?>"> </td> |
| 51 | - <td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> |
|
| 51 | + <td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT, $file['mtime']); ?></td> |
|
| 52 | 52 | </tr> |
| 53 | 53 | <?php |
| 54 | 54 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | <td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> |
| 40 | 40 | </tr> |
| 41 | 41 | <?php |
| 42 | - }else |
|
| 42 | + } else |
|
| 43 | 43 | { |
| 44 | 44 | ?> |
| 45 | 45 | <tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" > |