english/administrator/components/com_aicontactsafe/models/messages.php
// function to delete other information from the database related to messages
function to delete other information from the database related to messages
function to delete other information from the database related to messages
function deleteOtherInfo( $cids = '' ) {
		$db = &JFactory::getDBO();
		jimport('joomla.filesystem.path');
		jimport('joomla.filesystem.file');
		$upload_folder = str_replace('\\',DS,$this->_config_values['upload_attachments']);
		$upload_folder = str_replace('/',DS,$upload_folder);
		$upload_folder = str_replace('&#92;',DS,$upload_folder);
		$path_upload = JPATH_ROOT.DS.$upload_folder;
		$query = 'SELECT id, name FROM #__aicontactsafe_messagefiles WHERE message_id IN ( '.$cids.' )';
		$db->setQuery($query);
		$files = $db->loadObjectList();
		if (count($files) > 0) {
			foreach($files as $file) {
				$delete_file = $path_upload.DS.$file->name;
				JFile::delete($delete_file);
				$query = 'DELETE FROM #__aicontactsafe_messagefiles WHERE id = '.$file->id;
				$db->setQuery($query);
				$db->query();
			}
		}
		$query = 'DELETE FROM #__aicontactsafe_fieldvalues WHERE message_id IN ( '.$cids.' )';
		$db->setQuery($query);
		$db->query();
	}
function deleteOtherInfo ( $ cids = '' ) { $ db = & JFactory :: getDBO ( ) ; jimport ( 'joomla.filesystem.path' ) ; jimport ( 'joomla.filesystem.file' ) ; $ upload_folder = str_replace ( '\\' , DS , $ this -> _config_values [ 'upload_attachments' ] ) ; $ upload_folder = str_replace ( '/' , DS , $ upload_folder ) ; $ upload_folder = str_replace ( '&#92;' , DS , $ upload_folder ) ; $ path_upload = JPATH_ROOT . DS . $ upload_folder ; $ query = 'SELECT id, name FROM #__aicontactsafe_messagefiles WHERE message_id IN ( ' . $ cids . ' )' ; $ db -> setQuery ( $ query ) ; $ files = $ db -> loadObjectList ( ) ; if ( count ( $ files ) > 0 ) { foreach ( $ files as $ file ) { $ delete_file = $ path_upload . DS . $ file -> name ; JFile :: delete ( $ delete_file ) ; $ query = 'DELETE FROM #__aicontactsafe_messagefiles WHERE id = ' . $ file -> id ; $ db -> setQuery ( $ query ) ; $ db -> query ( ) ; } } $ query = 'DELETE FROM #__aicontactsafe_fieldvalues WHERE message_id IN ( ' . $ cids . ' )' ; $ db -> setQuery ( $ query ) ; $ db -> query ( ) ; }
function to delete other information from the database related to messages
function to delete other information from the database related to messages
// initialize the database // import joomla clases to manage file system // get the path to attachments upload // get the files to delete // delete all field values for the deleted messages // get the files to delete