Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/db/db_event_handler.php
Show First 20 Lines • Show All 3175 Lines • ▼ Show 20 Line(s) | |||||
else { | else { | ||||
move_uploaded_file($value['tmp_name'], $tmp_path . $filename); | move_uploaded_file($value['tmp_name'], $tmp_path . $filename); | ||||
} | } | ||||
echo preg_replace('/^' . preg_quote($id, '/') . '_/', '', $filename); | echo preg_replace('/^' . preg_quote($id, '/') . '_/', '', $filename); | ||||
$this->deleteTempFiles($tmp_path); | $this->deleteTempFiles($tmp_path); | ||||
if ( file_exists($tmp_path . 'resized/') ) { | $thumbs_path = preg_replace('/^' . preg_quote(FULL_PATH, '/') . '/', '', $tmp_path, 1); | ||||
$this->deleteTempFiles($tmp_path . 'resized/'); | $thumbs_path = FULL_PATH . THUMBS_PATH . $thumbs_path; | ||||
if ( file_exists($thumbs_path) ) { | |||||
$this->deleteTempFiles($thumbs_path); | |||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Gets storage format for a given field | * Gets storage format for a given field | ||||
* | * | ||||
* @param string $field_name | * @param string $field_name | ||||
* @param kEvent $event | * @param kEvent $event | ||||
Show All 16 Lines | |||||
* @return void | * @return void | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function deleteTempFiles($path) | protected function deleteTempFiles($path) | ||||
{ | { | ||||
$files = glob($path . '*.*'); | $files = glob($path . '*.*'); | ||||
$max_file_date = strtotime('-1 day'); | $max_file_date = strtotime('-1 day'); | ||||
foreach ($files as $file) { | foreach ( $files as $file ) { | ||||
if (filemtime($file) < $max_file_date) { | if ( filemtime($file) < $max_file_date ) { | ||||
unlink($file); | unlink($file); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Checks, that flash uploader is allowed to perform upload | * Checks, that flash uploader is allowed to perform upload | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
* @return bool | * @return bool | ||||
*/ | */ | ||||
protected function _checkFlashUploaderPermission(kEvent $event) | protected function _checkFlashUploaderPermission(kEvent $event) | ||||
▲ Show 20 Lines • Show All 334 Lines • Show Last 20 Lines |