Index: branches/5.1.x/core/units/helpers/file_helper.php =================================================================== diff -u -N -r13086 -r13569 --- branches/5.1.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 13086) +++ branches/5.1.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 13569) @@ -1,6 +1,6 @@ Application->getUnitOption('#file', 'TableName'); $max_file_count = $this->Application->getUnitOption($object->Prefix, 'FileCount'); // $this->Application->ConfigValue($object->Prefix.'_MaxImageCount'); + $this->CheckFolder(FULL_PATH . ITEM_FILES_PATH); + $i = 0; while ($i < $max_file_count) { $field = 'File'.($i + 1); @@ -230,4 +232,42 @@ readfile($filename); flush(); } + + /** + * Creates folder with given $path + * + * @param string $path + * @return bool + */ + function CheckFolder($path) + { + $result = true; + + if (!file_exists($path) || !is_dir($path)) { + $parent_path = preg_replace('#/[^/]+/?$#', '', $path); + $result = $this->CheckFolder($parent_path); + + if ($result) { + $result = mkdir($path); + + if ($result) { + chmod($path, 0777); + + // don't commit any files from created folder + if (file_exists(FULL_PATH . '/CVS')) { + $cvsignore = fopen($path . '/.cvsignore', 'w'); + fwrite($cvsignore, '*.*'); + fclose($cvsignore); + chmod($path . '/.cvsignore', 0777); + } + } + else { + trigger_error('Cannot create directory "' . $path . '"', E_USER_WARNING); + return false; + } + } + } + + return $result; + } } \ No newline at end of file Index: branches/5.1.x/core/units/configuration/configuration_tag_processor.php =================================================================== diff -u -N -r13545 -r13569 --- branches/5.1.x/core/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 13545) +++ branches/5.1.x/core/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 13569) @@ -1,6 +1,6 @@ ConfigValue($params)); - } - } \ No newline at end of file Index: branches/5.1.x/core/units/helpers/csv_helper.php =================================================================== diff -u -N -r13545 -r13569 --- branches/5.1.x/core/units/helpers/csv_helper.php (.../csv_helper.php) (revision 13545) +++ branches/5.1.x/core/units/helpers/csv_helper.php (.../csv_helper.php) (revision 13569) @@ -1,6 +1,6 @@ Application->recallObject('FileHelper'); + /* @var $file_helper FileHelper */ + + $file_helper->CheckFolder( dirname($export_data['file_name']) ); + $file = fopen($export_data['file_name'], $first_step ? 'w' : 'a'); $prefix_elems = split('\.|_', $export_data['prefix']); @@ -163,9 +168,9 @@ { safeDefine('DBG_SKIP_REPORTING', 1); - $export_data = unserialize($this->Application->RecallVar('export_data')); + $export_data = unserialize($this->Application->RecallVar('export_data')); $filename = preg_replace('/(.*)\.csv$/', '\1', basename($export_data['file_name'])) . '.csv'; - + header('Content-type: text/csv'); header('Content-Disposition: attachment; filename="' . $filename . '"'); readfile($export_data['file_name']); Index: branches/5.1.x/core/admin_templates/tools/backup1.tpl =================================================================== diff -u -N -r12657 -r13569 --- branches/5.1.x/core/admin_templates/tools/backup1.tpl (.../backup1.tpl) (revision 12657) +++ branches/5.1.x/core/admin_templates/tools/backup1.tpl (.../backup1.tpl) (revision 13569) @@ -41,15 +41,12 @@ - -
- -
- ][VariableValue]" class="text" value='' style="width:80%"> + +
+
+