/** * Overrides the delete function * * @since 1.0 * @access public * @return bool */ public function delete($pk = null) { $state = parent::delete(); // Delete any items that are related to this stream $stream = FD::stream(); $stream->delete($this->id, 'feeds'); return $state; }
public function delete($pk = null) { $state = parent::delete($pk); if (!$state) { return false; } // Delete all the children as well foreach ($this->getChildren() as $child) { $child->delete(); } return true; }
/** * Override * * @since 1.0 * @access public * @param string * @return */ public function delete($pk = null) { // Delete the record from the database first. $state = parent::delete(); // Get the storage path $path = $this->getStoragePath(true); $path = $path . '/' . $this->hash; $storage = FD::storage($this->storage); $state = $storage->delete($path); // Delete the stream item related to this file FD::stream()->delete($this->id, SOCIAL_TYPE_FILES); if (!$state) { $this->setError(JText::_('Unable to delete the file from ' . $storage)); return false; } return true; }
/** * Override parent's delete method * * @since 1.0 * @access public * @param string * @return */ public function delete($pk = null) { // Delete the record from the database first. $state = parent::delete(); // Now, try to delete the folder that houses this photo. $config = FD::config(); // Check if this photo is used as a profile cover if ($this->isProfileCover()) { $cover = FD::table('Cover'); $cover->load(array('photo_id' => $this->id)); $cover->delete(); } // Needs to create an instance of image to create // and instnance of photos $image = FD::image(); $photoLib = FD::get('Photos', $image); $basePath = $photoLib->getStoragePath($this->album_id, $this->id); // Construct the base path to the photos folder $container = FD::cleanPath($config->get('photos.storage.container')); $basePath = '/' . $container . '/' . $this->album_id . '/' . $this->id; // @legacy // @since 1.2.7 // To fix older version issues where the full path is stored for the photo $relative = str_ireplace(JPATH_ROOT, '', $basePath); // below checking is to make sure the computed relative path is not pointing to photos root folder. $photoContainer = FD::cleanPath($config->get('photos.storage.container')); $photoContainer = '/' . ltrim($photoContainer, '/'); $photoContainer = rtrim($photoContainer, '/'); $photoContainer = JPath::clean($photoContainer); $photoRelPath = '/' . ltrim($relative, '/'); $photoRelPath = rtrim($photoRelPath, '/'); $photoRelPath = JPath::clean($photoRelPath); if ($photoContainer != $photoRelPath) { $storage = FD::storage($this->storage); $storage->delete($relative, true); } $model = FD::model('Photos'); // Delete the meta's related to this photo $model->deleteMeta($this->id); // Delete all tags associated with this photo $model->deleteTags($this->id); // Delete all comments associated with this photo $comments = FD::comments($this->id, SOCIAL_TYPE_PHOTO, 'upload', SOCIAL_APPS_GROUP_USER); $comments->delete(); // Delete all likes associated with this photo $likes = FD::get('Likes'); $likes->delete($this->id, SOCIAL_TYPE_PHOTO, 'upload'); // @points: photos.remove // Deduct points for the author $points = FD::points(); $points->assign('photos.remove', 'com_easysocial', $this->uid); // Push the ordering of other photos $model->pushPhotosOrdering($this->album_id, 0, $this->ordering, '-'); // Need to set cover to another photo if ($this->isCover()) { $album = $this->getAlbum(); if ($album->hasPhotos()) { $result = $album->getPhotos(array('limit' => 1)); $album->cover_id = $result['photos'][0]->id; } else { $album->cover_id = 0; } $album->store(); } return $state; }
/** * Overrides parent implementation of delete so that we can delete the mappings. * * @since 1.0 * @access public * @param mixed An optional primary key value to delete. If not set the instance property value is used. * @return boolean True on success, false otherwise. */ public function delete($pk = null) { $model = FD::model('Lists'); $state = $model->deleteMapping($this->id); // When there's some error deleting the mapping, just throw an error. if (!$state) { $this->setError(JText::_('COM_EASYSOCIAL_FRIENDS_LIST_ERROR_REMOVING_MAPPING')); return $state; } $state = parent::delete($pk); // @points: friends.list.delete // Assign points when the user deletes an existing list $points = FD::points(); $points->assign('friends.list.delete', 'com_easysocial', $this->user_id); return $state; }
/** * Override parent's behavior to delete this discussion * * @since 1.2 * @access public * @param int * @return */ public function delete($pk = null) { $state = parent::delete($pk); if ($state) { // Delete all the replies $model = FD::model('Discussions'); $model->deleteReplies($this->id); // Delete all stream items related to this discussion. FD::stream()->delete($this->id, 'discussions'); // Delete any files associated in #__social_discussions_files $model->deleteFiles($this->id); } return $state; }
/** * Deletes a profile off the system. Any related profiles stuffs should also be deleted here. * * @since 1.0 * @access public * @param mixed An optional primary key value to delete. If not set the instance property value is used. */ public function delete($pk = null) { // Try to delete this profile item. $state = parent::delete($pk); // Delete custom fields created for this profile type if ($state) { // Delete all field relations to this profile. $model = FD::model('Fields'); $model->deleteFields($this->id, SOCIAL_TYPE_PROFILES); // Delete all stream related items. $stream = FD::stream(); $stream->delete($this->id, SOCIAL_TYPE_PROFILES); // Delete profile avatar. $avatar = FD::table('Avatar'); if ($avatar->load(array('uid' => $this->id, 'type' => SOCIAL_TYPE_PROFILES))) { $avatar->delete(); } // Delete default avatars for this profile. $avatarModel = FD::model("Avatars"); $avatarModel->deleteDefaultAvatars($this->id, SOCIAL_TYPE_PROFILES); } return $state; }
/** * Override parent's delete behavior. * * @since 1.0 * @access public * @return boolean True on success false otherwise. */ public function delete($pk = null) { // Delete the record from the database $state = parent::delete(); if (!$state) { return false; } // Delete the temporary file. jimport('joomla.filesystem.file'); $file = JPATH_ROOT . '/' . $this->path; if (!JFile::exists($file)) { $this->setError(JText::_('File does not exist on the site')); return false; } $state = JFile::delete(JPATH_ROOT . '/' . $this->path); if (!$state) { $this->setError(JText::_('Unable to delete the phsyical file due to permission issues')); return false; } return true; }
/** * Override parent's delete behavior * * @since 1.0 * @access public * @param string * @return */ public function delete($pk = null) { $state = parent::delete(); // @points: photos.untag // Deduct points from the author for untagging an item $points = FD::points(); $points->assign('photos.untag', 'com_easysocial', $this->created_by); return $state; }
public function delete($pk = null) { $state = parent::delete($pk); if ($state) { $this->removeStream('createTask'); } return $state; }
/** * Override parent's delete behavior * * @since 1.2 * @access public * @return boolean */ public function delete($pk = null) { $state = parent::delete($pk); if ($state) { FD::model('Tasks')->deleteTasks($this->id); $this->removeStream('createMilestone'); } return $state; }
/** * Override's parent delete implementation since we need to also delete the images and perform some * cleanup. * * @since 1.0 * @access public * @param int Primary key (Optional) * @return bool True on success, false otherwise. * * @author Mark Lee <*****@*****.**> */ public function delete($pk = null) { $state = parent::delete($pk); // Remove the avatars physical files. if (!$this->removeImage(SOCIAL_AVATAR_SMALL)) { return false; } if (!$this->removeImage(SOCIAL_AVATAR_MEDIUM)) { return false; } if (!$this->removeImage(SOCIAL_AVATAR_LARGE)) { return false; } // @TODO: Remove any association of user's profile with the current default avatar. return $state; }
/** * Override parent's delete method * * @since 1.0 * @access public * @param string * @return */ public function delete($pk = null) { /* * we need to delete the photos 1st and then only do ao parent::delete to avoid album getting onfindersave issue. */ // Delete the photos from the site first. $photosModel = FD::model('photos'); $photosModel->deleteAlbumPhotos($this->id); // @points: photos.albums.remove // Deduct points for the author for deleting an album $points = FD::points(); $points->assign('photos.albums.remove', 'com_easysocial', $this->uid); // Now, try to delete the folder that houses this photo. $config = FD::config(); $storage = JPATH_ROOT . '/' . FD::cleanPath($config->get('photos.storage.container')); $storage = $storage . '/' . $this->id; jimport('joomla.filesystem.folder'); $exists = JFolder::exists($storage); // Test if the folder really exists first before deleting it. if ($exists) { $state = JFolder::delete($storage); if (!$state) { FD::logError(__FILE__, __LINE__, 'ALBUMS: Unable to delete the photos folder ' . $storage); } } // Delete the record from the database first. $state = parent::delete(); // Delete likes related to the album $likes = FD::get('Likes'); if (!$likes->delete($this->id, SOCIAL_TYPE_ALBUM, 'create')) { FD::logError(__FILE__, __LINE__, 'ALBUMS: Unable to delete the likes for the album ' . $this->id); } // Delete comments related to the album $comments = FD::comments($this->id, SOCIAL_TYPE_ALBUM, 'create', SOCIAL_APPS_GROUP_USER); if (!$comments->delete()) { FD::logError(__FILE__, __LINE__, 'ALBUMS: Unable to delete the comments for the album ' . $this->id); } return $state; }
/** * Override parent's behavior to delete the item. * * @since 1.2 * @access public * @return */ public function delete($pk = null) { $state = parent::delete($pk); if ($state) { // Delete stream items FD::stream()->delete($this->id, 'news'); // Delete comments FD::comments($this->id, 'news', 'create')->delete(); // Delete likes FD::likes()->delete($this->id, 'news', 'create'); } return $state; }
/** * Override the parent's delete method as we need to update the sequence when a * workflow is deleted. * * Example: * <code> * <?php * $table = FD::table( 'Workflow' ); * $table->delete(); * ?> * </code> * * @since 1.0 * @access public * @param Mixed An optional primary key value to delete. If not set the instance property value is used. * @return bool True on success, false otherwise. * * @author Mark Lee <*****@*****.**> */ public function delete($pk = null) { $stepid = $this->id; $result = parent::delete($pk); if ($result) { $this->updateSequence($this->sequence, $this->uid, 'substract'); if ($stepid != 0) { // Get all the fields in this step $fields = $this->getStepFields(); foreach ($fields as $field) { // Delete the fields $field->delete(); } } } return $result; }
/** * Override parent's delete implementation * * @since 1.0 * @access public * @param string * @return boolean True on success, false otherwise. */ public function delete($pk = null) { $state = parent::delete(); // Get the model $model = FD::model('Badges'); // Delete the user's badge associations $model->deleteAssociations($this->id); // Delete the user's badge history $model->deleteHistory($this->id); // Delete any stream related items for this badge $stream = FD::stream(); $stream->delete($this->id, SOCIAL_TYPE_BADGES); return $state; }
public function delete($pk = null) { $state = parent::delete($pk); if ($state) { // TODO: do any triggering here. } return $state; }
public function delete($pk = null) { $state = parent::delete(); if ($state) { // Get dispatcher library $dispatcher = FD::dispatcher(); $args = array(&$this); $group = SOCIAL_APPS_GROUP_USER; $dispatcher->trigger($group, 'onAfterLikeDelete', $args); } return $state; }
/** * Overrides parent's delete behavior * * @since 1.0 * @access public * @param string * @return */ public function delete($pk = null) { $state = parent::delete($pk); // Delete streams that are related to this note. $stream = FD::stream(); $stream->delete($this->id, 'notes'); return $state; }
public function delete($pk = null) { $arguments = array(&$this); // Trigger beforeDelete event $dispatcher = FD::dispatcher(); $dispatcher->trigger(SOCIAL_APPS_GROUP_USER, 'onBeforeDeleteComment', $arguments); $state = parent::delete($pk); if ($state) { // Clear out all the likes for this comment $likesModel = FD::model('likes'); $likesModel->delete($this->uid, 'comments'); // Trigger afterDelete event $dispatcher->trigger(SOCIAL_APPS_GROUP_USER, 'onAfterDeleteComment', $arguments); } return $state; }
/** * Override parent's behavior of deleting as we also need to delete physical files. * * @since 1.0 * @access public * @param string * @return bool */ public function delete($pk = null) { $state = parent::delete(); if (!$state) { return false; } // Get config $config = FD::config(); // Get the default avatars storage location. $avatarsPath = JPATH_ROOT . '/' . FD::cleanPath($config->get('avatars.storage.container')); // Test if the avatars path folder exists. If it doesn't we need to create it. if (!FD::makeFolder($avatarsPath)) { FD::logError(__FILE__, __LINE__, 'AVATARS: Unable to create the path ' . $avatarsPath); $this->setError(JText::_('Errors when creating default container for avatar')); return false; } // Get the default avatars storage location for this type. $typePath = $config->get('avatars.storage.' . $this->type); $storagePath = $avatarsPath . '/' . FD::cleanPath($typePath); // Set the absolute path based on the uid. $storagePath = $storagePath . '/' . $this->uid; $this->deleteFolder($storagePath); return $state; }
/** * delete this stream and its associated stream_items * * @since 1.0 * @access public * @param string * @return */ public function delete($pk = null) { $db = FD::db(); $sql = $db->sql(); $query = 'delete from `#__social_stream_item` where `uid` = ' . $db->Quote($this->id); $sql->raw($query); $db->setQuery($sql); $db->query(); return parent::delete(); }
/** * Override parent's delete behavior * * @since 1.2 * @access public * @param string * @return */ public function delete($pk = null) { $state = parent::delete($pk); if (!$state) { return false; } // Delete all existing create access for this category first. FD::model('ClusterCategory')->deleteAccess($this->id); // Delete this categories fields. FD::model('Fields')->deleteFields($this->id, SOCIAL_TYPE_CLUSTERS); return $state; }
/** * Override the parent's delete method to carry out extra maintenance action * * Example: * <code> * <?php * $table = FD::table('Field'); * $table->delete(); * ?> * </code> * * @since 1.0 * @access public * @param Mixed An optional primary key value to delete. If not set the instance property value is used. * @return bool True on success, false otherwise. * * @author Jason Rey <*****@*****.**> */ public function delete($pk = null) { $fieldid = $this->id; $result = parent::delete($pk); $model = FD::model('fields'); $model->deleteOptions($fieldid); return $result; }