Back to top
function delete($adid,$conf,$plugins=null) { $adid = (int) $adid; $this->_db->setQuery("SELECT * FROM #__adsmanager_ads WHERE id=$adid"); $ad = $this->_db->loadObject(); $this->_db->setQuery("DELETE FROM #__adsmanager_adcat WHERE adid=$adid"); $this->_db->query(); /*$this->_db->setQuery( "UPDATE #__adsmanager_ads SET published=0,recall_mail_sent = 0 WHERE id = $adid"); $this->_db->query(); $this->_db->setQuery( "INSERT INTO #__adsmanager_adcat (adid,catid) VALUES ($adid,$conf->archive_catid)"); $this->_db->query(); */ $this->_db->setQuery("DELETE FROM #__adsmanager_ads WHERE id=$adid"); $this->_db->query(); $this->_db->setQuery( "SELECT name FROM #__adsmanager_fields WHERE `type` = 'file'"); $file_fields = $this->_db->loadObjectList(); foreach($file_fields as $file_field) { $filename = "\$ad->".$file_field->name; eval("\$filename = \"$filename\";"); if ( is_file(JPATH_ROOT."/images/com_adsmanager/files/".$filename)) { JFile::delete(JPATH_ROOT."/images/com_adsmanager/files/".$filename); } } $current_images = json_decode($ad->images); if ($current_images == null) $current_images = array(); foreach($current_images as $img) { $pict = JPATH_ROOT."/images/com_adsmanager/ads/".$img->image; if ( is_file( $pict)) { JFile::delete($pict); } $pic = JPATH_ROOT."/images/com_adsmanager/ads/".$img->thumbnail; if ( is_file( $pic)) { JFile::delete($pic); } $pic = JPATH_ROOT."/images/com_adsmanager/ads/".$img->medium; if ( is_file( $pic)) { JFile::delete($pic); } } foreach($plugins as $plugin) { $plugin->onDelete(0,$adid); } if (function_exists('deletePaidAd')){ deletePaidAd($adid); } }}
Copyleft: Tutto il materiale pubblicato o comunque presente all'interno del sito www.joomla.it può essere utilizzato, diffuso e modificato liberamente. Hosting fornito gratuitamente da Joomlahost.it Disegno web da kreatif multimedia srl