@unlink($image->webimagePath); @unlink($image->thumbPath); $wpdb->query("DELETE FROM {$wpdb->flagpictures} WHERE pid = '{$image->pid}'"); } } // old app if (isset($_GET['account']) && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { $path = $wpdb->get_var("SELECT path FROM {$wpdb->flaggallery} WHERE gid = {$gid}"); $file = ABSPATH . trailingslashit($path) . str_replace(array(' ', ':'), array('_', ''), current_time('mysql')) . '.jpg'; $filename = basename($file); // Open temp file $out = @fopen($file, "wb"); if ($out) { if (@fwrite($out, $GLOBALS['HTTP_RAW_POST_DATA'])) { $alttext = isset($_GET['alttext']) ? esc_sql(flagallery_utf8_urldecode($_GET['alttext'])) : ''; $description = isset($_GET['description']) ? esc_sql(flagallery_utf8_urldecode($_GET['description'])) : ''; $exclude = intval($account->exclude); $location = esc_sql($account->location); $wpdb->query("INSERT INTO {$wpdb->flagpictures} (galleryid, filename, alttext, description, exclude, location) VALUES ('{$gid}', '{$filename}', '{$alttext}', '{$description}', '{$exclude}', '{$location}')"); // and give me the new id $pic_id = (int) $wpdb->insert_id; @(require_once dirname(dirname(__FILE__)) . '/admin/functions.php'); // add the metadata flagAdmin::import_MetaData($pic_id); // action hook for post process after the image is added to the database $image = array('id' => $pic_id, 'filename' => $filename, 'galleryID' => $gid); do_action('flag_added_new_image', $image); $thumb = flagAdmin::create_thumbnail($pic_id); if ($thumb != '1') { fclose($out); die('{"status":"thumb_error: ' . $thumb . '"}');
if ($image) { @unlink($image->imagePath); @unlink($image->thumbPath); $wpdb->query("DELETE FROM {$wpdb->flagpictures} WHERE pid = '{$image->pid}'"); } } if (isset($_GET['account']) && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { $path = $wpdb->get_var("SELECT path FROM {$wpdb->flaggallery} WHERE gid = {$gid}"); $file = ABSPATH . trailingslashit($path) . str_replace(array(' ', ':'), array('_', ''), current_time('mysql')) . '.jpg'; $filename = basename($file); // Open temp file $out = @fopen($file, "wb"); if ($out) { if (@fwrite($out, $GLOBALS['HTTP_RAW_POST_DATA'])) { $alttext = isset($_GET['alttext']) ? $wpdb->escape(flagallery_utf8_urldecode($_GET['alttext'])) : ''; $description = isset($_GET['description']) ? $wpdb->escape(flagallery_utf8_urldecode($_GET['description'])) : ''; $exclude = intval($account->exclude); $location = $wpdb->escape($account->location); $wpdb->query("INSERT INTO `{$wpdb->flagpictures}` (`galleryid`, `filename`, `alttext`, `description`, `exclude`, `location`) VALUES ('{$gid}', '{$filename}', '{$alttext}', '{$description}', '{$exclude}', '{$location}')"); // and give me the new id $pic_id = (int) $wpdb->insert_id; @(require_once dirname(dirname(__FILE__)) . '/admin/functions.php'); // add the metadata flagAdmin::import_MetaData($pic_id); // action hook for post process after the image is added to the database $image = array('id' => $pic_id, 'filename' => $filename, 'galleryID' => $gid); do_action('flag_added_new_image', $image); $thumb = flagAdmin::create_thumbnail($pic_id); if ($thumb == '1') { do_action('flag_thumbnail_created', $picture); } else {