public function __construct() { $this->pageContentModel = \Models\PageContent::instance(); $this->contentListModel = \Models\ContentListElement::instance(); $this->contentListEltModel = \Models\ContentListElement::instance(); $this->contentGroupEltModel = \Models\ContentGroupElement::instance(); $this->imageModel = \Models\Image::instance(); $this->textModel = \Models\Texte::instance(); $this->f3 = \Base::instance(); $this->contentGroupModel = \Models\ContentGroup::instance(); $this->pageModel = $pageModel = \Models\Page::instance(); }
public function delete($f3) { header('Cache-Control: no-cache, must-revalidate'); header('Content-type: application/json'); $lang = $f3->get('PARAMS.lang'); $id = $f3->get('PARAMS.id'); $image = \Models\Image::instance()->get($id, $lang); if ($image) { $newPath = dirname($f3->get('SERVER.SCRIPT_FILENAME')) . '/' . $f3->get('IMAGES_PATH') . 'deleted/' . $image['id'] . '_' . basename($image['file']); $oldPath = dirname($f3->get('SERVER.SCRIPT_FILENAME')) . $image['file']; rename($oldPath, $newPath); echo json_encode(\Models\Image::instance()->delete($id)); } }