function _verify_folder($data, $column) { if (!(isset($data['new_folder']) && $data['new_folder'])) { return $data['folder']; } if (AMP_add_image_subfolder($data['new_folder'])) { return $data['new_folder']; } return $data['folder']; /* $ok = false; foreach( AMP_lookup( 'image_classes') as $image_class => $image_class_name ) { $class_folder = AMP_LOCAL_PATH . AMP_IMAGE_PATH . $image_class. DIRECTORY_SEPARATOR . $data['new_folder']; $ok = AMP_mkdir( $class_folder ); if( !$ok ) { trigger_error( 'Unable to create folder' . $class_folder ); break; } } if ( $ok ) { AMP_lookup_clear_cached( 'image_folders'); return $data['new_folder']; } return $data['folder']; */ }
function move($folder_name, $create_folder_name = null) { if ($create_folder_name) { if (!AMP_add_image_subfolder($create_folder_name)) { return false; } $folder_name = $create_folder_name; } if (!$folder_name) { return false; } if (file_exists(AMP_image_path($this->getNameForFolder($folder_name)))) { AMP_flashMessage(sprintf(AMP_TEXT_ERROR_FILE_EXISTS, $this->getNameForFolder($folder_name))); return false; } foreach (AMP_lookup('image_classes') as $image_class => $image_class_name) { if (!file_exists(AMP_image_path($this->getName(), $image_class))) { continue; } rename(AMP_image_path($this->getName(), $image_class), AMP_image_path($this->getNameForFolder($folder_name), $image_class)); } //save new location to database $this->update_database_folder($folder_name); return true; }