]> git.andy128k.dev Git - ipf.git/commitdiff
simplify settings
authorAndrey Kutejko <andy128k@gmail.com>
Sun, 7 Jul 2013 11:09:52 +0000 (14:09 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sun, 7 Jul 2013 11:09:52 +0000 (14:09 +0300)
ipf.php
ipf/admin/views.php
ipf/image/processor.php
t/ImageProcessorTest.php
t/project/project/settings.php

diff --git a/ipf.php b/ipf.php
index 79789a33d09d6e69cc99ef83161b6d2acb1455b1..9116d31759add3462f27aab5d48b4b9ca9edaed9 100644 (file)
--- 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');
     }
 }
 
index 98d6f88fef75c3a525a343cc1ad1b6d25c7c140a..527e4606271508ce71670edaa81a792e6e8c4a9c 100644 (file)
@@ -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"){
index 37d3c8f4bf99c8fcfcf00f504e259d92a1937d02..bff96adf4279d999a3eeb9273b1887fc54becd8a 100644 (file)
@@ -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;
index d364db2a774529d2d479a80fa8245ed8e437ab4a..22f81f085b5589ab16e7a2b096e5fcf5fc2bfc3b 100644 (file)
@@ -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');
     }
 
index a4994211df364658290d4169341c5b6109653819..786ab4fff010a5ca79107b12542569cdbee6558c 100644 (file)
@@ -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;