Пример #1
0
 /**
  * Remove a single variation file from an image
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function deleteVariation($uri, $name)
 {
     // We only allow deletion of user prefixes.
     $fileName = EBLOG_USER_VARIATION_PREFIX . '_' . $name . '_' . basename($uri);
     $filePath = EBMM::getPath(dirname($uri)) . '/' . $fileName;
     // Test if the file really exists on the site
     $exists = JFile::exists($filePath);
     if (!$exists) {
         return EB::exception('COM_EASYBLOG_FAILED_TO_DELETE_VARIATION_AS_IT_DOESNT_EXISTS');
     }
     // Try to delete the variation now
     $state = JFile::delete($filePath);
     if (!$state) {
         return EB::exception('COM_EASYBLOG_FAILED_TO_DELETE_VARIATION_PERMISSIONS');
     }
     return true;
 }
Пример #2
0
 /**
  * Relocate media files into "My Media"
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function relocateMediaFiles()
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/mediamanager/mediamanager.php';
     // Get a list of folders for this post
     $uri = 'post:' . $this->id;
     // Get the absolute path to the post's folder
     $path = EBMM::getPath($uri);
     // Check if it exists.
     jimport('joomla.filesystem.folder');
     // If it doesn't exist, we wouldn't want to do anything
     if (!JFolder::exists($path)) {
         return true;
     }
     // Construct the new uri
     $newUri = 'user:'******'/' . $title;
     // Move the old folder to the new folder now
     $state = JFolder::move($path, $newPath);
     return $state;
 }