function delete_image($dbc, $image_id) { $file = IMG_UPLOADPATH . get_image_file_by_id($dbc, $image_id); unlink($file); $query = "DELETE FROM images WHERE id = '{$image_id}'"; mysqli_query($dbc, $query) or die('Error querying database.'); foreach (get_all_segments($dbc) as $segment_id) { delete_image_from_segment($dbc, $segment_id, $image_id); } }
$images = get_images_of_segment($dbc, $segment_id); foreach ($images as $image_id) { if (!array_key_exists($image_id, $images_nos)) { $images_nos[$image_id] = $image_no; $image_no++; } } } return $images_nos; } $biblio = array(); if (isset($_GET['id'])) { $id = $_GET['id']; $has_right_to_edit = isset($_GET['view']) ? false : has_right_to_edit($dbc, $_SESSION['id'], $id); if (isset($_GET['delete_image'])) { delete_image_from_segment($dbc, $_GET['segment_id'], $_GET['delete_image']); } if (isset($_GET['deleted_segment_id'])) { delete_segment_from_article($dbc, $id, $_GET['deleted_segment_id']); } if (isset($_GET['insert'])) { insert_segment_into_article($dbc, $id, $_GET['insert'], $_GET['prev']); } if (isset($_GET['copy'])) { copy_and_insert_segment($dbc, $id, $_GET['copy'], $_GET['prev']); } $article_info = get_article_info($dbc, $id); $segments = get_segments($dbc, $id); $images = set_image_no($dbc, $segments); ?> <script type ="text/javascript">