function photos_delete_group($group_id) { $group_id = intval($group_id); $sql = "SELECT album_id FROM %spa_groups WHERE group_id=%d"; $rows_groups = queryDB($sql, array(TABLE_PREFIX, $group_id)); foreach ($rows_groups as $row) { $pa = new PhotoAlbum($row['album_id']); $pa->deleteAlbum(); } $sql = "DELETE FROM %spa_groups WHERE group_id=%d"; $result = queryDB($sql, array(TABLE_PREFIX, $group_id)); }
function photos_delete_group($group_id) { global $db; $group_id = intval($group_id); $sql = "SELECT album_id FROM ".TABLE_PREFIX."pa_groups WHERE group_id=$group_id"; $result = mysql_query($sql, $db); while ($row = mysql_fetch_assoc($result)) { $pa = new PhotoAlbum($row['album_id']); $pa->deleteAlbum(); } $sql = "DELETE FROM ".TABLE_PREFIX."pa_groups WHERE group_id=$group_id"; $result = mysql_query($sql, $db); }
//validates if this is me/have the privilege to delete. $id = intval($_REQUEST['id']); $pa = new PhotoAlbum($id); $info = $pa->getAlbumInfo(); if (!$pa->checkAlbumPriv($_SESSION['member_id'])) { $msg->addError('ACCESS_DENIED'); header('Location: index.php'); exit; } if ($_POST['submit_no']) { $msg->addFeedback('CANCELLED'); Header('Location: index.php'); exit; } if ($_POST['submit_yes']) { //delete $pa->deleteAlbum(); $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); if ($info['type_id'] == AT_PA_TYPE_COURSE_ALBUM) { Header('Location: course_albums.php'); exit; } else { Header('Location: index.php'); exit; } } require AT_INCLUDE_PATH . 'header.inc.php'; $hidden_vars['id'] = $id; $msg->addConfirm(array('PA_DELETE_ALBUM', AT_print($info['name'], 'photo_albums.name')), $hidden_vars); $msg->printConfirm(); require AT_INCLUDE_PATH . 'footer.inc.php';