From b446c02b75d2974e840cae30890b72772fd7f81c Mon Sep 17 00:00:00 2001 From: Daniel kerr Date: Tue, 30 Sep 2014 14:14:17 +0800 Subject: [PATCH] https://github.com/opencart/opencart/issues/1869 --- .gitignore | 4 + install.txt | 158 +++++++++++----------- upload/admin/controller/tool/upload.php | 6 +- upload/catalog/controller/tool/upload.php | 2 +- upload/install/controller/step_2.php | 17 ++- upload/install/controller/step_3.php | 2 + upload/install/language/english.php | 2 +- upload/install/view/template/step_2.tpl | 11 +- upload/system/upload/index.html | 0 9 files changed, 112 insertions(+), 90 deletions(-) create mode 100644 upload/system/upload/index.html diff --git a/.gitignore b/.gitignore index 32676aabe33..eca48c9b350 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,10 @@ /upload/system/download/* !/upload/system/download/index.html +# Upload Files +/upload/system/upload/* +!/upload/system/upload/index.html + !/upload/data/index.html # Flags diff --git a/install.txt b/install.txt index ce9755a8e75..257e261c705 100644 --- a/install.txt +++ b/install.txt @@ -1,79 +1,81 @@ -///////////////////////////////// -/// OpenCart V2.0.x /// -/// Install Instructions /// -/// http://www.opencart.com /// -///////////////////////////////// - - -NOTE: THIS IS FOR NEW INSTALL ONLY! -IF UPGRADING YOUR EXISTING CART, BE SURE TO READ THE UPGRADE.TXT FILE INSTEAD - - -------- -INSTALL -------- -These instructions are for a manual installation using FTP, cPanel or other web hosting Control Panel. - -- Linux Install - - -1. Upload all of the files and folders to your server from the "Upload" folder, place them in your web root. The web root is different on some servers, cPanel it should be public_html/ and on Plesk it should be httpdocs/. - -2. Rename config-dist.php to config.php and admin/config-dist.php to admin/config.php - -3. For Linux/Unix make sure the following folders and files are writeable. - - chmod 0755 or 0777 system/cache/ - chmod 0755 or 0777 system/logs/ - chmod 0755 or 0777 system/download/ - chmod 0755 or 0777 image/ - chmod 0755 or 0777 image/cache/ - chmod 0755 or 0777 image/catalog/ - chmod 0755 or 0777 config.php - chmod 0755 or 0777 admin/config.php - - If 0755 does not work try 0777. - -4. Make sure you have installed a MySQL Database which has a user assigned to it - DO NOT USE YOUR ROOT USERNAME AND ROOT PASSWORD - -5. Visit the store homepage e.g. http://www.example.com or http://www.example.com/store/ - -6. You should be taken to the installer page. Follow the on screen instructions. - -7. After successful install, delete the /install/ directory from ftp. - - -- Windows Install - - -1. Upload all the files and folders to your server from the "Upload" folder. This can be to anywhere of your choice. e.g. /wwwroot/store or /wwwroot - -2. Rename config-dist.php to config.php and admin/config-dist.php to admin/config.php - -3. For Windows make sure the following folders and files permissions allow Read and Write. - - system/cache/ - system/logs/ - system/download/ - image/ - image/cache/ - image/catalog/ - config.php - admin/config.php - -4. Make sure you have installed a MySQL Database which has a user assigned to it - DO NOT USE YOUR ROOT USERNAME AND ROOT PASSWORD - -5. You should be taken to the installer page. Follow the on screen instructions. - -6. After successful install, delete the /install/ directory. - - - -- Local Install - - -There are many all-in-one web servers out there and most of them should work with OpenCart out of the box. Some examples... - -http://www.apachefriends.org/en/xampp.html -http://www.ampps.com/ -http://www.usbwebserver.net +///////////////////////////////// +/// OpenCart V2.0.x /// +/// Install Instructions /// +/// http://www.opencart.com /// +///////////////////////////////// + + +NOTE: THIS IS FOR NEW INSTALL ONLY! +IF UPGRADING YOUR EXISTING CART, BE SURE TO READ THE UPGRADE.TXT FILE INSTEAD + + +------- +INSTALL +------- +These instructions are for a manual installation using FTP, cPanel or other web hosting Control Panel. + +- Linux Install - + +1. Upload all of the files and folders to your server from the "Upload" folder, place them in your web root. The web root is different on some servers, cPanel it should be public_html/ and on Plesk it should be httpdocs/. + +2. Rename config-dist.php to config.php and admin/config-dist.php to admin/config.php + +3. For Linux/Unix make sure the following folders and files are writeable. + + chmod 0755 or 0777 system/cache/ + chmod 0755 or 0777 system/logs/ + chmod 0755 or 0777 system/download/ + chmod 0755 or 0777 system/upload/ + chmod 0755 or 0777 image/ + chmod 0755 or 0777 image/cache/ + chmod 0755 or 0777 image/catalog/ + chmod 0755 or 0777 config.php + chmod 0755 or 0777 admin/config.php + + If 0755 does not work try 0777. + +4. Make sure you have installed a MySQL Database which has a user assigned to it + DO NOT USE YOUR ROOT USERNAME AND ROOT PASSWORD + +5. Visit the store homepage e.g. http://www.example.com or http://www.example.com/store/ + +6. You should be taken to the installer page. Follow the on screen instructions. + +7. After successful install, delete the /install/ directory from ftp. + + +- Windows Install - + +1. Upload all the files and folders to your server from the "Upload" folder. This can be to anywhere of your choice. e.g. /wwwroot/store or /wwwroot + +2. Rename config-dist.php to config.php and admin/config-dist.php to admin/config.php + +3. For Windows make sure the following folders and files permissions allow Read and Write. + + system/cache/ + system/logs/ + system/download/ + system/upload/ + image/ + image/cache/ + image/catalog/ + config.php + admin/config.php + +4. Make sure you have installed a MySQL Database which has a user assigned to it + DO NOT USE YOUR ROOT USERNAME AND ROOT PASSWORD + +5. You should be taken to the installer page. Follow the on screen instructions. + +6. After successful install, delete the /install/ directory. + + + +- Local Install - + +There are many all-in-one web servers out there and most of them should work with OpenCart out of the box. Some examples... + +http://www.apachefriends.org/en/xampp.html +http://www.ampps.com/ +http://www.usbwebserver.net http://www.wampserver.com/en/ \ No newline at end of file diff --git a/upload/admin/controller/tool/upload.php b/upload/admin/controller/tool/upload.php index 73d71a7f3b2..9d1debe6cbd 100644 --- a/upload/admin/controller/tool/upload.php +++ b/upload/admin/controller/tool/upload.php @@ -25,7 +25,7 @@ public function delete() { $upload_info = $this->model_tool_upload->getUpload($upload_id); if ($upload_info && is_file(DIR_DOWNLOAD . $upload_info['filename'])) { - unlink(DIR_DOWNLOAD . $upload_info['filename']); + unlink(DIR_UPLOAD . $upload_info['filename']); } $this->model_tool_upload->deleteUpload($upload_id); @@ -270,7 +270,7 @@ public function download() { $upload_info = $this->model_tool_upload->getUploadByCode($code); if ($upload_info) { - $file = DIR_DOWNLOAD . $upload_info['filename']; + $file = DIR_UPLOAD . $upload_info['filename']; $mask = basename($upload_info['name']); if (!headers_sent()) { @@ -389,7 +389,7 @@ public function upload() { if (!$json) { $file = $filename . '.' . md5(mt_rand()); - move_uploaded_file($this->request->files['file']['tmp_name'], DIR_DOWNLOAD . $file); + move_uploaded_file($this->request->files['file']['tmp_name'], DIR_UPLOAD . $file); // Hide the uploaded file name so people can not link to it directly. $this->load->model('tool/upload'); diff --git a/upload/catalog/controller/tool/upload.php b/upload/catalog/controller/tool/upload.php index 11bd17177ec..e9d418015c1 100644 --- a/upload/catalog/controller/tool/upload.php +++ b/upload/catalog/controller/tool/upload.php @@ -62,7 +62,7 @@ public function index() { if (!$json) { $file = $filename . '.' . md5(mt_rand()); - move_uploaded_file($this->request->files['file']['tmp_name'], DIR_DOWNLOAD . $file); + move_uploaded_file($this->request->files['file']['tmp_name'], DIR_UPLOAD . $file); // Hide the uploaded file name so people can not link to it directly. $this->load->model('tool/upload'); diff --git a/upload/install/controller/step_2.php b/upload/install/controller/step_2.php index 7557f0228cc..cae3efc13a2 100644 --- a/upload/install/controller/step_2.php +++ b/upload/install/controller/step_2.php @@ -35,7 +35,7 @@ public function index() { $data['text_version'] = $this->language->get('text_version'); $data['text_global'] = $this->language->get('text_global'); $data['text_magic'] = $this->language->get('text_magic'); - $data['text_upload'] = $this->language->get('text_upload'); + $data['text_file_upload'] = $this->language->get('text_file_upload'); $data['text_session'] = $this->language->get('text_session'); $data['text_global'] = $this->language->get('text_global'); $data['text_db'] = $this->language->get('text_db'); @@ -87,6 +87,7 @@ public function index() { $data['cache'] = DIR_SYSTEM . 'cache'; $data['logs'] = DIR_SYSTEM . 'logs'; $data['download'] = DIR_SYSTEM . 'download'; + $data['upload'] = DIR_SYSTEM . 'upload'; $data['image'] = DIR_OPENCART . 'image'; $data['image_cache'] = DIR_OPENCART . 'image/cache'; $data['image_data'] = DIR_OPENCART . 'image/catalog'; @@ -162,6 +163,14 @@ private function validate() { $this->error['warning'] = 'Warning: Logs directory needs to be writable for OpenCart to work!'; } + if (!is_writable(DIR_SYSTEM . 'download')) { + $this->error['warning'] = 'Warning: Download directory needs to be writable for OpenCart to work!'; + } + + if (!is_writable(DIR_SYSTEM . 'upload')) { + $this->error['warning'] = 'Warning: Upload directory needs to be writable for OpenCart to work!'; + } + if (!is_writable(DIR_OPENCART . 'image')) { $this->error['warning'] = 'Warning: Image directory needs to be writable for OpenCart to work!'; } @@ -173,11 +182,7 @@ private function validate() { if (!is_writable(DIR_OPENCART . 'image/catalog')) { $this->error['warning'] = 'Warning: Image catalog directory needs to be writable for OpenCart to work!'; } - - if (!is_writable(DIR_SYSTEM . 'download')) { - $this->error['warning'] = 'Warning: Download directory needs to be writable for OpenCart to work!'; - } - + if (!$this->error) { return true; } else { diff --git a/upload/install/controller/step_3.php b/upload/install/controller/step_3.php index f8170852290..104e7607677 100644 --- a/upload/install/controller/step_3.php +++ b/upload/install/controller/step_3.php @@ -24,6 +24,7 @@ public function index() { $output .= 'define(\'DIR_IMAGE\', \'' . DIR_OPENCART . 'image/\');' . "\n"; $output .= 'define(\'DIR_CACHE\', \'' . DIR_OPENCART . 'system/cache/\');' . "\n"; $output .= 'define(\'DIR_DOWNLOAD\', \'' . DIR_OPENCART . 'system/download/\');' . "\n"; + $output .= 'define(\'DIR_UPLOAD\', \'' . DIR_OPENCART . 'system/upload/\');' . "\n"; $output .= 'define(\'DIR_MODIFICATION\', \'' . DIR_OPENCART . 'system/modification/\');' . "\n"; $output .= 'define(\'DIR_LOGS\', \'' . DIR_OPENCART . 'system/logs/\');' . "\n\n"; @@ -59,6 +60,7 @@ public function index() { $output .= 'define(\'DIR_IMAGE\', \'' . DIR_OPENCART . 'image/\');' . "\n"; $output .= 'define(\'DIR_CACHE\', \'' . DIR_OPENCART . 'system/cache/\');' . "\n"; $output .= 'define(\'DIR_DOWNLOAD\', \'' . DIR_OPENCART . 'system/download/\');' . "\n"; + $output .= 'define(\'DIR_UPLOAD\', \'' . DIR_OPENCART . 'system/upload/\');' . "\n"; $output .= 'define(\'DIR_LOGS\', \'' . DIR_OPENCART . 'system/logs/\');' . "\n"; $output .= 'define(\'DIR_MODIFICATION\', \'' . DIR_OPENCART . 'system/modification/\');' . "\n"; $output .= 'define(\'DIR_CATALOG\', \'' . DIR_OPENCART . 'catalog/\');' . "\n\n"; diff --git a/upload/install/language/english.php b/upload/install/language/english.php index bdecd037476..5365378e57f 100644 --- a/upload/install/language/english.php +++ b/upload/install/language/english.php @@ -37,7 +37,7 @@ $_['text_version'] = 'PHP Version'; $_['text_global'] = 'Register Globals'; $_['text_magic'] = 'Magic Quotes GPC'; -$_['text_upload'] = 'File Uploads'; +$_['text_file_upload'] = 'File Uploads'; $_['text_session'] = 'Session Auto Start'; $_['text_db'] = 'Database'; $_['text_mysqli'] = 'MySQLi'; diff --git a/upload/install/view/template/step_2.tpl b/upload/install/view/template/step_2.tpl index 24d88ff62d8..de5ebc647a2 100644 --- a/upload/install/view/template/step_2.tpl +++ b/upload/install/view/template/step_2.tpl @@ -77,7 +77,7 @@ - + @@ -314,6 +314,15 @@ + + + + + + + + + diff --git a/upload/system/upload/index.html b/upload/system/upload/index.html new file mode 100644 index 00000000000..e69de29bb2d