case 'saveedit': save_category(1); break; case 'opencat': category_status('open'); break; case 'closecat': category_status('close'); break; case 'new': images_form(0); break; case 'resize': resize_images(); break; case 'edit': edit_image(); break; case 'update': update_image(); break; case 'delete': delete_image(); break; case 'thumbs': update_thumbnails(); break; default: show_images(); break; }
$title = mysqli_real_escape_string($dbc, strip_tags($_POST['title'])); } // validate type if (isset($_POST['type']) && filter_var($_POST['type'], FILTER_VALIDATE_INT, array('min_range' => 1))) { $type_id = $_POST['type']; } else { $errors[] = 'type'; } // validate status if (isset($_POST['status'])) { $status = $_POST['status']; } else { $errors[] = 'status'; } if (empty($errors)) { $result = edit_image($iid, $title, $type_id, $status); if (mysqli_affected_rows($dbc) == 1) { echo "<script type='text/javascript'>\n alert('{$lang['AD_EDIT_IMG_SUCCESS']}');\n window.location = 'list_images.php';\n </script>\n "; } else { echo "<script type='text/javascript'>\n alert('{$lang['AD_EDIT_FAIL']}');\n window.location = 'list_images.php';\n </script>\n "; } } else { $error = $lang['AD_REQUIRED']; } } // END main IF submit condition } else { redirect_to('admin/list_images.php'); } include '../includes/backend/header-admin.php'; ?>
/** * Standard aed_module edit actualiser. * * @param ID_TEXT The entry being edited */ function edit_actualisation($_id) { $id = intval($_id); $cat = post_param('cat'); if (can_submit_to_gallery($cat) === false) { access_denied('SUBMIT_HERE'); } make_member_gallery_if_needed($cat); $this->check_images_allowed($cat); $this->handle_resizing_and_watermarking(); $validated = post_param_integer('validated', 0); $urls = get_url('url', 'file', 'uploads/galleries' . (get_value('use_gallery_subdirs') == '1' ? '/' . $cat : ''), 0, OCP_UPLOAD_IMAGE, true, 'thumb_url', 'file2'); if ($urls[0] == '') { $rows = $GLOBALS['SITE_DB']->query_select('images', array('url', 'thumb_url'), array('id' => $id), '', 1); $urls = $rows[0]; $url = $urls['url']; $thumb_url = $urls['thumb_url']; } else { $url = $urls[0]; $thumb_url = $urls[1]; } if (substr($urls[0], 0, 8) != 'uploads/' && $urls[0] != '' && is_null(http_download_file($urls[0], 0, false)) && !is_null($GLOBALS['HTTP_MESSAGE_B'])) { attach_message($GLOBALS['HTTP_MESSAGE_B'], 'warn'); } $comments = post_param('comments'); $allow_rating = post_param_integer('allow_rating', 0); $allow_comments = post_param_integer('allow_comments', 0); $notes = post_param('notes', ''); $allow_trackbacks = post_param_integer('allow_trackbacks', 0); $title = post_param('title'); $this->donext_type = $cat; if ($validated == 1 && $GLOBALS['SITE_DB']->query_value('images', 'validated', array('id' => $id)) == 0) { $submitter = $GLOBALS['SITE_DB']->query_value('images', 'submitter', array('id' => $id)); if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'galleries') && has_category_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'galleries', $cat)) { syndicate_described_activity($submitter != get_member() ? 'galleries:ACTIVITY_VALIDATE_IMAGE' : 'galleries:ACTIVITY_ADD_IMAGE', $title == '' ? $urls[2] : $title, '', '', '_SEARCH:galleries:image:' . strval($id), '', '', 'galleries', 1, NULL); } } edit_image($id, $title, $cat, $comments, $url, $thumb_url, $validated, $allow_rating, $allow_comments, $allow_trackbacks, $notes, post_param('meta_keywords', ''), post_param('meta_description', '')); if (has_edit_permission('cat_mid', get_member(), get_member_id_from_gallery_name($cat), 'cms_galleries', array('galleries', $cat)) && post_param_integer('rep_image', 0) == 1) { $GLOBALS['SITE_DB']->query_update('galleries', array('rep_image' => $thumb_url), array('name' => $cat), '', 1); } }
} elseif (!empty($is_video)) { $var = 'edit-video'; } elseif (!empty($is_link)) { $var = 'edit-link'; } elseif (!empty($is_quote)) { $var = 'edit-quote'; } elseif (!empty($is_audio)) { $var = 'edit-audio'; } elseif (!empty($is_post)) { $var = 'edit-post'; } if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) { if (empty($url)) { $url = $title; } edit_image($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $image, $revertPost, $publishDraft, $category); } else { if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) { if (empty($url)) { $url = $title; } edit_video($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $video, $revertPost, $publishDraft, $category); } else { if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) { if (empty($url)) { $url = $title; } edit_link($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $link, $revertPost, $publishDraft, $category); } else { if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) { if (empty($url)) {
function testEditGalleries() { edit_image($this->glry_id, '', '', '', 'http://www.google.com', 'images/sample.jpg', 0, 0, 0, 0, '', '', ''); $this->assertTrue('http://www.google.com' == $GLOBALS['SITE_DB']->query_value('images', 'url', array('id' => $this->glry_id))); }