From: Andrey Kutejko Date: Sun, 7 Jul 2013 11:09:52 +0000 (+0300) Subject: simplify settings X-Git-Tag: 0.5~183 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=66581f0b29ef36a7bc20efe28dcd2c4ab8e3f308;p=ipf.git simplify settings --- diff --git a/ipf.php b/ipf.php index 79789a3..9116d31 100644 --- a/ipf.php +++ b/ipf.php @@ -6,6 +6,7 @@ final class IPF 'app_base' => '', 'debug' => false, 'media_url' => '/media/', + 'media_url' => '/media/upload/', 'static_url' => '/static/', 'session_cookie_id' => 'sessionid', 'dir_permission' => 0777, @@ -129,12 +130,12 @@ final class IPF public static function getUploadPath() { - return IPF::get('upload_path', '/tmp'); + return IPF::get('document_root') . getUploadUrl(); } public static function getUploadUrl() { - return IPF::get('upload_url', '/media/upload'); + return IPF::get('upload_url'); } } diff --git a/ipf/admin/views.php b/ipf/admin/views.php index 98d6f88..527e460 100644 --- a/ipf/admin/views.php +++ b/ipf/admin/views.php @@ -350,7 +350,8 @@ function dir_recursive($dir, $path=DIRECTORY_SEPARATOR, $level='') //print_r($dirtree); } -function IPF_Admin_Views_FileBrowser($request, $match){ +function IPF_Admin_Views_FileBrowser($request, $match) +{ $ca = IPF_Admin_App::checkAdminAuth($request); if ($ca!==true) return $ca; @@ -358,14 +359,10 @@ function IPF_Admin_Views_FileBrowser($request, $match){ if (substr($curr_dir, -1) == '/') $curr_dir = substr($curr_dir, 0, strlen($curr_dir)-1); - $upload_path = IPF::get('editor_upload_path',''); - if ($upload_path=='') - $upload_path = IPF::get('upload_path',''); - $upload_url = IPF::get('editor_upload_url',''); - if ($upload_url=='') - $upload_url = IPF::get('upload_url',''); + $upload_path = IPF::getUploadPath(); + $upload_url = IPF::getUploadUrl(); - $dir = $upload_path.$curr_dir; + $dir = $upload_path . $curr_dir; $_dir = substr($dir, -1) !== DIRECTORY_SEPARATOR ? $dir.DIRECTORY_SEPARATOR : $dir; if ($request->method=="GET"){ diff --git a/ipf/image/processor.php b/ipf/image/processor.php index 37d3c8f..bff96ad 100644 --- a/ipf/image/processor.php +++ b/ipf/image/processor.php @@ -27,7 +27,7 @@ class IPF_Image_Processor public function execute($sourceUrl, $directory, $root=null) { if ($root === null) - $root = IPF::get('upload_path') . DIRECTORY_SEPARATOR; + $root = IPF::getUploadPath(); $destinationUrl = IPF_Utils::insertDirectory($sourceUrl, $directory); $path = $root . $destinationUrl; diff --git a/t/ImageProcessorTest.php b/t/ImageProcessorTest.php index d364db2..22f81f0 100644 --- a/t/ImageProcessorTest.php +++ b/t/ImageProcessorTest.php @@ -4,7 +4,7 @@ class Image_Processor_Test extends PHPUnit_Framework_TestCase { protected function setUp() { - $this->root = IPF::get('upload_path'); + $this->root = IPF::getUploadPath(); IPF_Utils::removeDirectories($this->root . '/thumbs'); } diff --git a/t/project/project/settings.php b/t/project/project/settings.php index a499421..786ab4f 100644 --- a/t/project/project/settings.php +++ b/t/project/project/settings.php @@ -7,9 +7,6 @@ $set['dsn'] = 'mysql://fake:fake@localhost/fake'; $set['tmp'] = $project_root . '/tmp'; -$set['upload_url'] = '/media/upload/'; -$set['upload_path'] = $project_root . '/htdocs/media/upload/'; - $set['secret_key'] = '123456'; $set['debug'] = true;