public function deleteCover($id) { $object = new SimpleBlogPost($id, Context::getContext()->language->id); $tmp_location = _PS_TMP_IMG_DIR_ . 'ph_simpleblog_' . $object->id . '.' . $object->cover; if (file_exists($tmp_location)) { @unlink($tmp_location); } $orig_location = _PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $object->id . '.' . $object->cover; $thumb = _PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $object->id . '-thumb.' . $object->cover; $thumbWide = _PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $object->id . '-wide.' . $object->cover; if (file_exists($orig_location)) { @unlink($orig_location); } if (file_exists($thumb)) { @unlink($thumb); } if (file_exists($thumbWide)) { @unlink($thumbWide); } $object->cover = NULL; $object->update(); Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminSimpleBlogPosts') . '&conf=7'); }