public static function deleteTemplate($templateIDs) { if (empty($templateIDs)) { return false; } $db = JFactory::getDBO(); foreach ($templateIDs as $template_id) { // remove template file from ftp // get namekey of the file... template namekey should be same with the file folder name $template = jNews_Templates::loadOneTemplate('*', $template_id); if (!empty($template->premium)) { continue; } if (!empty($template->namekey) && empty($template->premium)) { // get namekey and remove file jNews_Templates::removeTemplateFile($template->namekey); } if (isset($template->thumbnail) && !empty($template->thumbnail)) { $path = JNEWS_PATH_ADMIN_THUMBNAIL_UPLOAD; $findposhttp = strpos($template->thumbnail, 'http://'); $findposwww = strpos($template->thumbnail, 'www.'); if ($findposhttp === false && $findposwww === false) { jNews_Attachment::deleteAttachment($template->thumbnail, $path); } } } $query = 'DELETE FROM `#__jnews_templates` WHERE `template_id` IN (' . implode(',', $templateIDs) . ')'; $query .= ' AND `premium` != 1 '; $db->setQuery($query); $db->query(); return true; }