/** * Update media. * @return {int} ID of the media object. */ function updateMedia() { if (!isset($_POST['media-name']) || $_POST['media-name'] == '') { header('Location: ../admin.php?error=missing_data_for_media'); exit; } $media = new ae_MediaModel(); $media->load($_POST['edit-id']); $media->setMediaPath('../../media/'); $media->setName($_POST['media-name']); if (!$media->save()) { return FALSE; } return $media->getId(); }
$model = new ae_CategoryModel(); } else { if (isset($_GET['cofilter']) && ae_Validate::id($_GET['cofilter'])) { $area = 'cofilter'; $mainArea = 'settings'; $model = new ae_CommentfilterModel(); } else { if (isset($_GET['comment']) && ae_Validate::id($_GET['comment'])) { $area = 'comment'; $model = new ae_CommentModel(); } else { if (isset($_GET['media']) && ae_Validate::id($_GET['media'])) { $area = 'media'; $mainArea = 'media'; $model = new ae_MediaModel(); $model->setMediaPath('../../media/'); } else { if (isset($_GET['page']) && ae_Validate::id($_GET['page'])) { $area = 'page'; $model = new ae_PageModel(); } else { if (isset($_GET['post']) && ae_Validate::id($_GET['post'])) { $area = 'post'; $model = new ae_PostModel(); } else { if (isset($_GET['user']) && ae_Validate::id($_GET['user'])) { $area = 'user'; $model = new ae_UserModel(); } else { header('Location: ../admin.php?error=unknown_area_or_invalid_id'); exit;
public function testSetMediaPath() { $m = new ae_MediaModel(); $m->setMediaPath('../some-directory/media/'); $this->assertEquals($m->getMediaPath(), '../some-directory/media/'); }