<?php /* 7 april 2011: created from admin/news/delete.php */ // save some typing below $typef_app_dir = Typeframe::CurrentPage()->applicationUri(); // if not posting, bounce out of here if ('POST' != $_SERVER['REQUEST_METHOD']) { Typeframe::Redirect('Nothing to do.', $typef_app_dir); return; } // create download object from given id $fileid = @$_POST['fileid']; $download = Model_Download_File::Get($fileid); // download must exist to proceed if (!$download->exists()) { Typeframe::Redirect('Invalid download id specified.', $typef_app_dir); return; } // perform the delete $download->delete(); // done Typeframe::Redirect('Download has been deleted.', $typef_app_dir);
<?php $download = Model_Download_File::Get($_REQUEST['fileid']); if (!$download->exists() || $download['siteid'] != Typeframe::CurrentPage()->siteid()) { Typeframe::Redirect('Invalid file specified.', Typeframe::CurrentPage()->applicationUri(), 1); return; } include 'options.inc.php'; $pm->setVariable('download', $download); if ($_SERVER['REQUEST_METHOD'] == 'POST') { include 'update.inc.php'; if ($download->exists()) { Typeframe::Redirect('Download created.', Typeframe::CurrentPage()->applicationUri()); } }