$cover_width = intval($_REQUEST["cover_width"]);
     $cover_height = intval($_REQUEST["cover_height"]);
     foreach ($settings_array as $val => $innerKey) {
         $wpdb->query($wpdb->prepare("UPDATE " . gallery_bank_settings() . " SET setting_value = %s WHERE setting_key = %s", (string) current($innerKey), key($innerKey)));
     }
     ////////////CODE FOR CREATING THUMBNAILS///////////
     $album_pics = $wpdb->get_results("SELECT * FROM " . gallery_bank_pics() . " order by sorting_order asc");
     $album_covers = $wpdb->get_results("SELECT * FROM " . gallery_bank_pics() . " where album_cover = 1 order by sorting_order asc");
     for ($flag = 0; $flag < count($album_pics); $flag++) {
         if ($album_pics[$flag]->video != 1) {
             process_image_upload($album_pics[$flag]->thumbnail_url, $thumb_width, $thumb_height);
         }
     }
     for ($flag1 = 0; $flag1 < count($album_covers); $flag1++) {
         if ($album_covers[$flag1]->thumbnail_url != "") {
             process_album_upload($album_covers[$flag1]->thumbnail_url, $cover_width, $cover_height);
         }
     }
     die;
 } else {
     if ($_REQUEST["param"] == "restore_settings") {
         $sql = "TRUNCATE TABLE " . gallery_bank_settings();
         $wpdb->query($sql);
         include GALLERY_BK_PLUGIN_DIR . "/lib/include_settings.php";
         die;
     } else {
         if ($_REQUEST["param"] == "update_licensing_settings") {
             $api_key = esc_attr($_REQUEST["ux_api_key"]);
             $order_id = esc_attr($_REQUEST["ux_order_id"]);
             $wpdb->query($wpdb->prepare("UPDATE " . gallery_bank_licensing() . " SET api_key = %s, order_id = %s ", $api_key, $order_id));
             update_option("gallery-bank-activation", $api_key);
예제 #2
0
 if ($_REQUEST["param"] == "update_album") {
     $albumId = intval($_REQUEST["albumid"]);
     $ux_edit_album_name1 = htmlspecialchars(esc_attr($_REQUEST["edit_album_name"]));
     $ux_edit_album_name = $ux_edit_album_name1 == "" ? "Untitled Album" : $ux_edit_album_name1;
     $ux_edit_description = html_entity_decode(esc_attr($_REQUEST["uxEditDescription"]));
     $wpdb->query($wpdb->prepare("UPDATE " . gallery_bank_albums() . " SET album_name = %s, description = %s WHERE album_id = %d", $ux_edit_album_name, $ux_edit_description, $albumId));
     die;
 } else {
     if ($_REQUEST["param"] == "update_pic") {
         $album_data = json_decode(stripcslashes($_REQUEST["album_data"]), true);
         foreach ($album_data as $element) {
             $field = explode("|", $element);
             if ($field[0] == "image") {
                 if ($field[3] == "checked") {
                     $wpdb->query($wpdb->prepare("UPDATE " . gallery_bank_pics() . " SET title = %s, description = %s, url = %s, date = CURDATE(), tags = %s, album_cover = %d WHERE pic_id = %d", $field[4], $field[5], $field[7], $field[6], 1, $field[1]));
                     process_album_upload($field[2], $field[8], $field[9]);
                 } else {
                     $wpdb->query($wpdb->prepare("UPDATE " . gallery_bank_pics() . " SET title = %s, description = %s, url = %s, date = CURDATE(), tags = %s, album_cover = %d WHERE pic_id = %d", $field[4], $field[5], $field[7], $field[6], 0, $field[1]));
                 }
             } else {
                 $wpdb->query($wpdb->prepare("UPDATE " . gallery_bank_pics() . " SET title = %s, description = %s, date = CURDATE(), tags = %s, album_cover = %d WHERE pic_id = %d", $field[4], $field[5], $field[6], 0, $field[1]));
             }
         }
         die;
     } else {
         if ($_REQUEST["param"] == "delete_pic") {
             $delete_array = html_entity_decode($_REQUEST["delete_array"]);
             $albumId = intval($_REQUEST["albumid"]);
             $wpdb->query("DELETE FROM " . gallery_bank_pics() . " WHERE pic_id in ({$delete_array})");
             die;
         } else {
예제 #3
0
                    $src = str_replace(site_url("/"), "", $file_path);
                    $destination = GALLERY_MAIN_UPLOAD_DIR . $file_name;
                    if (PHP_VERSION > 5) {
                        copy(ABSPATH . $src, $destination);
                    } else {
                        $content = file_get_contents(ABSPATH . $src);
                        $fp = fopen($destination, "w");
                        fwrite($fp, $content);
                        fclose($fp);
                    }
                    if (file_exists($destination)) {
                        process_image_upload($file_name, 160, 120);
                    }
                    $wpdb->query($wpdb->prepare("INSERT INTO " . gallery_bank_pics() . "(pic_id, album_id, title, description, thumbnail_url,\n                    sorting_order, date, url, video, tags, pic_name, album_cover) VALUES(%d, %d, %s, %s, %s, %d, %s,\n                    %s, %d, %s, %s, %d)", $album_pics[$flag]->pic_id, $album_pics[$flag]->album_id, $album_pics[$flag]->title, $album_pics[$flag]->description, $file_name, $album_pics[$flag]->sorting_order, $album_pics[$flag]->date, $album_pics[$flag]->url, $album_pics[$flag]->video, isset($album_pics[$flag]->tags) ? $album_pics[$flag]->tags : "", $file_name, $album_id == $album_pics[$flag]->album_id ? 0 : 1));
                    if ($album_id != $album_pics[$flag]->album_id) {
                        process_album_upload($file_name, 160, 120);
                    }
                    $album_id = $album_pics[$flag]->album_id;
                }
            }
        }
    }
    if (count($wpdb->get_var("SHOW TABLES LIKE '" . gallery_bank_settings() . "'")) == 0) {
        create_table_album_settings();
    } else {
        $sql = "DROP TABLE " . gallery_bank_settings();
        $wpdb->query($sql);
        create_table_album_settings();
    }
    update_option("gallery-bank-pro-edition", "3.1");
} else {