Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Nosferatu

Pages: [1] 2 3
1
Hallo meine Lieben,

ich wollte eben paar Beschreibungen bei Bilder Ändern und da ist mir aufgefallen, dass dies bei mir gar nicht - habe sonst immer gleich die ganze Kategorie geändert.

Also folgende zwei Probleme habe ich:

1) Wenn ich beim Bild auf "Edit" klicke
z.B.: http://www.wallpapers-heaven.com/details.php?image_id=59236

wird auf folgende Adresse verlinkt:
http://www.wallpapers-heaven.com/admin/index.php?goto=images.php%3Faction%3Deditimage%26amp%3Bimage_id%3D59236

Diese muss ich dann händisch korriegieren auf:
http://www.wallpapers-heaven.com/admin/images.php?action=editimage&image_id=59236
?goto= funktioniert nämlich nicht

Wo muss ich was ändern, damit die % wieder in normale Zeichen umgewandelt werden?

2) Wenn ich im Editor drinnen bin also bei:
http://www.wallpapers-heaven.com/admin/images.php?action=editimage&image_id=59236

Dann wird mir kein Bild angezeigt, weil dieses auf wie folgt verlingt ist:
http://www.wallpapers-heaven.com/.data/media/475/gw2_2012-08-25_06-46-09-09.jpg

anstatt:
http://www.wallpapers-heaven.com/data/media/475/gw2_2012-08-25_06-46-09-09.jpg

Kann mir bitte jemand helfen?

Vielen lieben Dank!

PS: verwende 1.7.13

LG
Jeff

2
Hallo,

ich habe gerade einen Fehler bei meiner Bildergallerie gefunden, jedoch finde ich einfach nicht raus wo ich was ändern muss :(.

Wenn ich aufs Bild gehe und dann auf edit -> index.php?goto=images.php?action=editimage...

Dann steht oben : NOTE: In case the thumbnail file name does not correspond with the image file name it will be adapted to the image file name.
Dann Edit images: XXXX

Image
und bei dem Link steht dann www.domain.com/picgallerie/.data/media/793/XXXXXX.jpg
ebenfalls rechts kann das Bild nicht angezeigt werden weil die adresse .data anstatt data hat.

Dieser Fehler tritt aber nur hier beim bearbeiten eines einzelnen Bildes auf.

auszug aus meiner images.php
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: images.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7 - 1.7.9                                          *
 *     File Version: 4.15.7                                               *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
/*
Changes since previous version:
 - FIXED: search keywords not being saved at quick edit unless image keywords edited
 - FIXED: yet another issue with keywords when adding images
*/

define('IN_CP'1);
define('ROOT_PATH''./../');
require(
'admin_global.php');
@include_once(
ROOT_PATH 'includes/ims_core.php');

define('MAIN_SCRIPT''images.php');
define('SCRIPT'MAIN_SCRIPT); //backwards compatibility with config file from previous versions
define('KEYWORDS_NEW'version_compare(SCRIPT_VERSION"1.7.8"">="));
$additional_image_fields_settings = array();
$preset = array();
/*
These are default settings. You should NOT change them. Instead, use admin/images_config.php to override any of these default settings.
Doing so you won't need edit this file after each update.
*/

//--- Settings -----------------------


$thumbsize 48//thumbnail size showed at find image page (will be resized by browser)
$imagesize 640//image size showed at edit image page (will be resized by browser)

//quick edit description and keywords field size
$cols 30//textarea width
$rows 4//textarea height
$target true//Open links to edit/delete a single image in a new window? (true or false)

$limitnumber 25//number of images per page by default

//Quick Edit options:
$quickedit_checkboxes 0//1 = show checkboxes; 0 = show multiline dropdown
$quickedit_checkboxes_height 200//when show checkboxes limit height of the column in pixels (0 = disable)
$quickedit_default = array(); //list of image fields that will be selected by default and after search form reset.

//example select image name, description and date by default or when reset search form
/*
$quickedit_default = array(
"image_name",
"image_description",
"image_date",
);
*/
$nextpage_default 1//select "Continue next page after save" by default? (1 = yes, 0 = no)

$savedate 1//select "save date" on copy/move by default? (1 = yes, 0 = no)

$use_media_template 1//use media template at edit image page (useful for non-image files)

$num_newimages_max 10//max number of "add new images"

$exif_enable 1//use exif? if PHP doesn't support read_exif_data() function, this setting will be ignored and exif support will be disabled.

$image_resize_default 1//resize image by default for add new images page (1 = yes, 0 = no)
$thumb_tools_default 2//thumbnail tools by default for add new images page (0 = skip, 1 = resize, 2 = create)

$image_resize_type = -1//image resize type (-1 = use settings, 1 = proportionally, 2 = fixed width, 3 = fixed height)
$image_resize_quality = -1//image quality (-1 = use settings, 0-100 = quality)
$image_resize_width = -1//image resize width (-1 = use settings)
$image_resize_height = -1//image resize height (-1 = use settings)

$thumb_resize_type = -1//thumbnail resize type (-1 = use settings, 1 = proportionally, 2 = fixed width, 3 = fixed height)
$thumb_resize_quality = -1//thumbnail quality (-1 = use settings, 0-100 = quality)
$thumb_resize_dimension = -1//thumbnail resize dimention (-1 = use settings)

$presets_session 0//use sessions to store presets? (1 = yes, 0 = no) If no, use $presets_file
$presets_file ROOT_PATH."data/images_presets.txt"//file where presets will be stored. Must be writable!

//--- End Settings -------------------

//--- Additional Fields Settings -----

/*
$additional_image_fields_settings["example_field_name0"] = array(true, "%s = '%s'"); //show this field in the search form and do exact string match, this should be used for radio type fields
$additional_image_fields_settings["example_field_name1"] = array(true, "%s LIKE '%s'");
$additional_image_fields_settings["example_field_name2"] = array(true, "%s LIKE '%s\%'");
$additional_image_fields_settings["example_field_name3"] = array(true, "%s LIKE '\%%s'");
$additional_image_fields_settings["example_field_name4"] = array(true, "INSTR(LCASE(%s), '%s')"); //show this field in the search form and search using INSTR() mysql function
$additional_image_fields_settings["example_field_name5"] = array(false, ""); //don't show this field in the search form

*/

//--- End Additional Fields Settings--


//--- Language Settings --------------
if (!isset($lang['big_not_found']))
{
if ($config['language_dir'] == "deutsch")
{
$lang['changeowner'] = "Username ersetzen";
$lang['copy'] = "Kopieren";
$lang['move'] = "Verschieben";
$lang['save'] = "Speichern";
$lang['big_not_found'] = "Kein Original in Big Ordner gefunden";
$lang['orig_not_found'] = "Kein Original gefunden";
$lang['copy_file_error_perm'] = "Error Kopieren. (Datei %s zu %s) Bitte uberprufe Deine Ordner Rechte.";
$lang['skipped'] = "Ubersprungen";
$lang['in_cat_id'] = "von Kategorie ID";
$lang['error_del_big'] = "Error geloschte \"Big\" Datei";
$lang['error_del_backup'] = "Error geloschte \"Backup\" Datei";
$lang['src_des_same'] = "Quelle und Ziel sind gleich";
$lang['owner_error'] = "Error User ersetzen";
$lang['no_user_select'] = "Kein User ausgewahlt";
$lang['owner_success'] = "Username erfolgreich gewechselt";
$lang['file_delete_success'] = "Bild-Datei erfolgreich geloscht";
$lang['file_big_delete_success'] = "Bild-Datei in Big Ordner erfolgreich geloscht";
$lang['user_id_contains'] = "User ID enthalt";
$lang['image_active'] = "Aktiviert";
$lang['quick_edit'] = "Bilder Optionen";
$lang['continue_next_page'] = "Weiter auf nachste Seite";
$lang['move_confirm'] = "Verschiebe Datei(en) nach Kategorie <b>%s</b> [ID: %s]?";
$lang['error_log'] = "Ereignis Log:";
$lang['save_log'] = "Save Log:";
$lang['image_update_success'] = "Bilder erfolgreich aktualisiert";
$lang['copy_confirm'] = "Kopiere Datei(en) nach <b>%s</b> [ID: %s]?";
$lang['upload_error'][0] = "Error Bild aktualisierung"//single
$lang['upload_error'][1] = "Error Bilder aktualisierung"//plural
$lang['upload_success'][0] = "Bild erfolgreich aktualisiert"//single
$lang['upload_success'][1] = "Bilder erfolgreich aktualisiert"//plural
$lang['edit_image'][0] = "Editiere Bild";
$lang['edit_image'][1] = "Editiere Bilder";
$lang['cat_image'] = "Kategorie Bild";
$lang['current_image'] = "Aktuelles Bild:";
$lang['copy_success'] = "<b>Bild \"%s\" erfolgreich kopiert</b> (von Kategorie %s nach %s)";
$lang['copy_error_skipped'] = "<b>Bild</b> %s <b>wurde nicht kopiert</b>";
$lang['copy_error_thumb'] = "<b>Error Thumbnail Datei kopieren</b> %s";
$lang['copy_error_media'] = "<b>Error Media Datei kopieren</b> %s";
$lang['copy_error_db'] = "<b>Error Datenbank Update. Bild %s wurde nicht kopiert</b>";
$lang['move_success'] = "<b>Bild \"%s\" erfolgreich verschoben</b> (von Kategorie %s nach %s)";
$lang['move_error'] = "<b>Error Bild verschieben</b> %s (from category: %s to %s)";
$lang['move_error_thumb'] = "<b>Error Thumbnail Datei verschieben</b> %s";
$lang['move_error_media'] = "<b>Error Media Datei verschieben</b> %s";
$lang['move_error_skipped'] = "<b>Bild</b> %s <b>wurde nicht verschoben</b>";
$lang['move_error_db'] = "<b>Error Datenbank Update. Bild %s wurde nicht verschoben</b>";
$lang['no_image'] = "Kein Bild mit dieser ID gefunden";
$lang['save_date'] = "Speichere Original Datum";
$lang['save_date_exp'] = "Bei nicht aktivierter CheckBox wird das heutige Datum eingefugt!";
$lang['ims_file_delete_success'] = "Bild Cache Datei erfolgreich geloscht (<i>%s</i>)";
$lang['ims_file_delete_error'] = "Error loschen Bild Cache Datei (<i>%s</i>)";
$lang['additional_fields'] = "Zusatzliche Bild Felder <span class=\"smalltext\">(muss aktiviert sein durch das Auswahlmenu neben jedem Feld)</span>";
$lang['default'] = "Standard";
$lang['edit_log'] = "Editiere Bilder Log:";
$lang['quick_edit_fields'] = "Schnelle editierbare Felder";
$lang['quick_edit_fields_exp'] = "<span class=\"smalltext\"><i>(Selektiere mehrere Felder, drucke und halte die CTRL Taste, wahle dann die gewunschten Felder.<br />Entferne ein Feld, drucke die CTRL Taste und klicke auf das selektierte Feld.<br />Ist nichts ausgewahlt, ist die Funktion ausgeschaltet.)</i></span>";
$lang['field_cat_id'] = "Kategorie ID";
$lang['field_user_id'] = "User ID";
$lang['field_media_file'] = "Media Datei";
$lang['select_all'] = "Alle auswahlen";
$lang['select_none'] = "Nichts auswahlen";
$lang['comments_delete_success'] = "Kommentar(e) erfolgreich geloscht";
$lang['comments_delete_error'] = "Error Kommentar(e) loschen";
$lang['skip'] = "Uberspringen";
$lang['resize'] = "Verkleinern";
$lang['create_thumb'] = "Erstellen";
$lang['thumb_tools_add'] = "Thumbnail Werkzeug<br /><span class=\"smalltext\"><b>Verkleinern</b> - Hochgeladenes Thumbnail verkleinern<br /><b>Erstellen</b> - Erstelle Thumbnail von Media Datei</span>";
$lang['thumb_tools_edit'] = "Thumbnail Werkzeug<br /><span class=\"smalltext\"><b>Loschen</b> - Losche existierendes Thumbnail<br /><b>Verkleinern</b> - Verkleinere existierendes oder neu hochgeladenes Thumbnail<br /><b>Erstellen</b> - Erstelle Thumbnail von Media Datei</span>";
$lang['image_resize'] = "Verkleinertes Bild";
$lang['image_resize_skipped'] = "Bild verkleinern ubersprungen";
$lang['image_resize_error'] = "Bild Error verkleinern";
$lang['image_resize_success'] = "<b>Bild verkleinert</b> (von %sx%s nach %sx%s)";
$lang['thumb_resize_skipped'] = "Thumbnail verkleinern ubersprungen";
$lang['thumb_resize_error'] = "Thumbnail Error verkleiner";
$lang['thumb_resize_success'] = "Thumbnail verkleinert";
$lang['thumb_create_skipped'] = "Thumbnail erstellen ubersprungen";
$lang['thumb_create_error'] = "Thumbnail Error erstellen";
$lang['thumb_create_success'] = "Thumbnail erstellt";
$lang['log'] = "Log";
$lang['load'] = "Laden";
$lang['msg'] = "Nachricht";
$lang['presets'] = "Einstellungen";
$lang['preset_save'] = "Einstellungen in einer Datei speichern<br /><span class=\"smalltext\">Ist die Checkbox vor dem Speichern aktiviert, werden die Einstellungen immer \"Automatisch geladen\"</span>";
$lang['preset_load_error'] = "Error Einstellungen laden";
$lang['preset_delete_error'] = "Error Einstellungen loschen";
$lang['preset_save_error'] = "Error Einstellungen speichern";
$lang['preset_loaded'] = "Geladen";
$lang['qe_cat_id_error'] = "Kategorie mit ID \"%s\" existiert nicht";
$lang['include_subcats'] = "Inklusive Subkategorien";
}
else
{
$lang['changeowner'] = "Change owner";
$lang['copy'] = "Copy";
$lang['move'] = "Move";
$lang['save'] = "Save";
$lang['big_not_found'] = "No Original size (big) Found";
$lang['orig_not_found'] = "No Original Found";
$lang['copy_file_error_perm'] = "Copy error. (File %s to %s) Please check the directory permissions.";
$lang['copy_success'] = "<b>Image \"%s\" successfully copied</b> (from category %s to %s)";
$lang['copy_error_thumb'] = "<b>Error copying thumbnail file</b> %s";
$lang['copy_error_media'] = "<b>Error copying media file</b> %s";
$lang['copy_error_skipped'] = "<b>Image</b> %s <b>was not coppied</b>";
$lang['copy_error_db'] = "<b>Error updating database. Image %s was not coppied</b>";
$lang['skipped'] = "Skipped";
$lang['in_cat_id'] = "in category ID";
$lang['error_del_big'] = "Error deleting \"big\" file";
$lang['error_del_backup'] = "Error deleting \"backup\" file";
$lang['src_des_same'] = "Source and destination are the same";
$lang['move_success'] = "<b>Image \"%s\" successfully moved</b> (from category %s to %s)";
$lang['move_error'] = "<b>Error moving image</b> %s (from category: %s to %s)";
$lang['move_error_thumb'] = "<b>Error moving thumbnail file</b> %s";
$lang['move_error_media'] = "<b>Error moving media file</b> %s";
$lang['move_error_skipped'] = "<b>Image</b> %s <b>was not moved</b>";
$lang['move_error_db'] = "<b>Error updating database. Image %s was not moved</b>";
$lang['owner_error'] = "Error changing owner";
$lang['no_user_select'] = "No user selected";
$lang['owner_success'] = "Owner successfuly changed";
$lang['file_delete_success'] = "Image file successfully deleted";
$lang['file_big_delete_success'] = "Image file successfully in Big file deleted";
$lang['user_id_contains'] = "User ID contains";
$lang['image_active'] = "Activated";
$lang['quick_edit'] = "Quick edit";
$lang['continue_next_page'] = "Continue next page after save";
$lang['save_date'] = "Save original date";
$lang['save_date_exp'] = "If checked, the images original date will not be changed, otherwise current date will be used";
$lang['move_confirm'] = "Move image files to category <b>%s</b> [ID: %s]?";
$lang['error_log'] = "Error Log:";
$lang['save_log'] = "Save Log:";
$lang['image_update_success'] = "Images successfuly updated";
$lang['copy_confirm'] = "Copy image(s) to category <b>%s</b> [ID: %s]?";
$lang['upload_error'][0] = "Error updating image"//single
$lang['upload_error'][1] = "Error updating images"//plural
$lang['upload_success'][0] = "Image updated successfuly"//single
$lang['upload_success'][1] = "Images updated successfuly"//plural
$lang['edit_image'][0] = "Edit image"//single
$lang['edit_image'][1] = "Edit images"//plural
$lang['cat_image'] = "Category image";
$lang['current_image'] = "Current image:";
$lang['no_image'] = "No image found with this ID";
$lang['additional_fields'] = "Additional image fields <span class=\"smalltext\">(must be enabled by the dropdown menu next to each field)</span>";
$lang['ims_file_delete_success'] = "Image cache file successfully deleted (<i>%s</i>)";
$lang['ims_file_delete_error'] = "Error deleting image cache file (<i>%s</i>)";
$lang['default'] = "Default";
$lang['edit_log'] = "Edit images log";
$lang['quick_edit_fields'] = "Quick Edit Fields";
$lang['quick_edit_fields_exp'] = "<span class=\"smalltext\"><i>(To select multiple fields press and hold CTRL key, then click on needed field.<br />To deselect hold CTRL key and click on selected field.<br />If nothing selected quick edit will be disabled)</i></span>";
$lang['field_cat_id'] = "Category ID";
$lang['field_user_id'] = "User ID";
$lang['field_media_file'] = "Media file";
$lang['select_all'] = "Select all";
$lang['select_none'] = "Select none";
$lang['comments_delete_success'] = "Comment(s) deleted";
$lang['comments_delete_error'] = "Error deleting comment(s)";
$lang['skip'] = "Skip";
$lang['resize'] = "Resize";
$lang['create_thumb'] = "Create";
$lang['thumb_tools_add'] = "Thumbnail tools<br /><span class=\"smalltext\"><b>Resize</b> - resize uploaded thumbnail<br /><b>Create</b> - create thumbnail from image file</span>";
$lang['thumb_tools_edit'] = "Thumbnail tools<br /><span class=\"smalltext\"><b>Delete</b> - delete existing thumbnail<br /><b>Resize</b> - resize existing or new uploaded thumbnail<br /><b>Create</b> - create thumbnail from image file</span>";
$lang['image_resize'] = "Resize image";
$lang['image_resize_skipped'] = "Image resize skipped";
$lang['image_resize_error'] = "Image resize error";
$lang['image_resize_success'] = "<b>Image resized</b> (from %sx%s to %sx%s)";
$lang['thumb_resize_skipped'] = "Thumbnail resize skipped";
$lang['thumb_resize_error'] = "Thumbnail resize error";
$lang['thumb_resize_success'] = "Thumbnail resized";
$lang['thumb_create_skipped'] = "Thumbnail create skipped";
$lang['thumb_create_error'] = "Thumbnail create error";
$lang['thumb_create_success'] = "Thumbnail created";
$lang['log'] = "Log";
$lang['load'] = "Load";
$lang['msg'] = "Message";
$lang['presets'] = "Presets";
$lang['preset_save'] = "Save this form in a preset<br /><span class=\"smalltext\">Use the checkbox to save the preset as \"auto load\"</span>";
$lang['preset_load_error'] = "Error loading preset";
$lang['preset_delete_error'] = "Error deleting preset";
$lang['preset_save_error'] = "Error saving preset";
$lang['preset_loaded'] = "loaded";
$lang['qe_cat_id_error'] = "Category with ID \"%s\" doesn't exist";
$lang['include_subcats'] = "Include subcategories";
}
}
//--- End Language Settings ----------

@include(ROOT_PATH 'admin/images_config.php');

/*set BIGDIR variable with the name of your "big" folder for "big" images (no trailing slashes!)*/
//define("BIGDIR", "");
if (!defined('BIGDIR'))
{
define('BIGDIR'"big"); // http://www.4homepages.de/forum/index.php?topic=3236.0
}
/*set BACKUPDIR variable with the full path to your backup dir (no trailing slashes!)*/
if (!defined('BACKUPDIR'))
{
define('BACKUPDIR'"");
//  define('BACKUPDIR', "/home/4images/backup"); //example full path on unix systems
//  define('BACKUPDIR', "C:/4images/backup"); //example full path on windows systems
}

if (!
defined("EXIF_ENABLE"))
{
$exif_enble = (function_exists("read_exif_data")) ? $exif_enable 0;
define("EXIF_ENABLE"$exif_enable);
}
$header_insert "<style>.tablerow_error {
BACKGROUND-COLOR: #ECDFDF;
}
.tablerow2_error {
BACKGROUND-COLOR: #F9F2F2;
}
.categoryselect {
font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
color: #0f5475;
font-size: 11px;
}
.categoryselect1 {
font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
color: #0f5475;
font-size: 11px;
BACKGROUND-COLOR: #F9F8D2;
}
</style>
<script type=\"text/javascript\">
<!--
function changeStyle(obj, c)
{
obj.className=c;
}
function get_element(f, e)
{
alert(f.e);
}
// -->
</script>
"
;


include(
ROOT_PATH.'includes/search_utils.php');

// Start Upload
include(ROOT_PATH.'includes/upload.php');
$site_upload = new Upload();

include(
ROOT_PATH.'includes/image_utils.php');
$convert_options init_convert_options();

if (
$action == "")
{
$action "modifyimages";
}
if (isset(
$HTTP_POST_VARS['action2']) && !empty($HTTP_POST_VARS['action2']))
{
$action $HTTP_POST_VARS['action2'];
}
$action fixaction($action); // since we use $lang for some actions we should remove any spaces
$owner $user_info['user_id'];
$types_array_text = array(
"LIKE"        => "%s LIKE '%s'",
"LIKE %...%"  => "%s LIKE '%%%s%%'",
"NOT LIKE"    => "%s NOT LIKE '%s'",
"="           => "%s = '%s'",
"!="          => "%s != '%s'",
"REGEXP"      => "%s REGEXP '%s'",
"NOT REGEXP"  => "%s NOT REGEXP '%s'",
);
$types_array_int = array(
"="           => "%s = '%s'",
"!="          => "%s != '%s'",
">"           => "%s > '%s'",
">="          => "%s >= '%s'",
"<"           => "%s < '%s'",
"<="          => "%s <= '%s'",
);
$types_array_radio = array(
"="           => "%s = '%s'",
);
$types_array_dropdown = array(
"="           => "%s = '%s'",
"!="          => "%s != '%s'",
);
$fields_default = array(
"image_name"            => array($lang['field_image_name'], "text"),
"cat_id"                => array($lang['field_cat_id'], "text", array(1)),
"user_id"               => array($lang['field_user_id'], "text", array(1)),
"image_description"     => array($lang['field_description'], "textarea"),
"image_keywords"        => array($lang['field_keywords'], "textarea"),
"image_date"            => array($lang['field_date'], "date"),
"image_active"          => array($lang['field_free'], "radio", array(1)),
//  "image_media_file"      => array($lang['field_media_file'], "text"),
//  "image_thumb_file"      => array($lang['field_thumb_file'], "text"),
"image_download_url"    => array($lang['field_download_url'], "text"),
"image_allow_comments"  => array($lang['field_allow_comments'], "radio", array(1)),
"image_comments"        => array($lang['field_comment'], "text", array(1)),
"image_downloads"       => array($lang['field_downloads'], "text", array(1)),
"image_votes"           => array($lang['field_votes'], "text", array(1)),
"image_rating"          => array($lang['field_rating'], "text", array(1)),
"image_hits"            => array($lang['field_hits'], "text", array(1)),
);
$quickedit_fields_all $fields_default;
$table_fields $site_db->get_table_fields(IMAGES_TABLE);
$preset_additional_fields = array();
foreach (
$additional_image_fields as $field => $val)
{
if (!isset($table_fields[$field]) || (isset($additional_image_fields_settings[$field][0]) && !$additional_image_fields_settings[$field][0]))
continue;

$quickedit_fields_all[$field] = $val;
$value "";
if ($val[1] == "radio")
{
$value 1;
}
$preset_additional_fields[$field."_type"] = array("int"0);
$preset_additional_fields[$field] = array("trim"$value);
}
//--- Presets ------------------------
// doesn't work (yet)
$preset "default";
if (!
$presets_session || ($presets_session && !$presests $site_sess->get_session_var("acp_images_presets")))
{
$presets = @file_get_contents($presets_file);
}
if (!
$presets = @unserialize($presets))
{
$presets = array();
}
$presets['default'] = array(
"image_id_type"           => array("int", -1),
"image_id"                => array("int"""),
"image_name_type"         => array("int", -1),
"image_name"              => array("trim"""),
"image_description_type"  => array("int", -1),
"image_description"       => array("trim"""),
"image_keywords_type"     => array("int", -1),
"image_keywords"          => array("trim"""),
"cat_id_type"             => array("int", -1),
"cat_id"                  => array("int"0),
"user_id_type"            => array("int", -1),
"user_id"                 => array("int"""),
"user_name_type"          => array("int", -1),
"user_name"               => array("trim"""),
"image_active"            => array("int"1),
"image_media_file_type"   => array("int", -1),
"image_media_file"        => array("trim"""),
"image_thumb_file_type"   => array("int", -1),
"image_thumb_file"        => array("trim"""),
"dateafter"               => array("trim"""),
"datebefore"              => array("trim"""),
"downloadsupper"          => array("int"""),
"downloadslower"          => array("int"""),
"ratingupper"             => array("trim"""),
"ratinglower"             => array("trim"""),
"votesupper"              => array("int"""),
"voteslower"              => array("int"""),
"hitsupper"               => array("int"""),
"hitslower"               => array("int"""),
"orderby"                 => array("trim""i.image_date"),
"direction"               => array("trim""DESC"),
"limitnumber"             => array("int"$limitnumber),
"additional_fields"       => array(""$preset_additional_fields),
"quickedit"               => array(""$quickedit_default),
"subcat"                  => array("bool"1),
);
if (!isset(
$presets['_default_']))
{
$presets['_default_'] = $preset;
}
$preset_new = (isset($HTTP_POST_VARS['preset']) && $HTTP_POST_VARS['preset']) ? trim($HTTP_POST_VARS['preset']) : ((isset($HTTP_GET_VARS['preset']) && $HTTP_GET_VARS['preset']) ? trim($HTTP_GET_VARS['preset']) : false);
if (!
$preset_new || !isset($presets[$preset]))
{
$preset $presets['_default_'];
}
else
{
$preset $preset_new;
}

//--- End Presets -----
$image_resize_type = ($image_resize_type != -1) ? $image_resize_type : (isset($config['auto_image_resize_type']) ? $config['auto_image_resize_type'] : $config['auto_thumbnail_resize_type']);
$image_resize_quality = ($image_resize_quality != -1) ? $image_resize_quality : (isset($config['auto_image_quality']) ? $config['auto_image_quality'] : $config['auto_thumbnail_quality']);
$image_resize_width = ($image_resize_width != -1) ? $image_resize_width $config['max_image_width'];
$image_resize_height = ($image_resize_height != -1) ? $image_resize_height $config['max_image_height'];

$thumb_resize_type = ($thumb_resize_type != -1) ? $thumb_resize_type $config['auto_thumbnail_resize_type'];
$thumb_resize_quality = ($thumb_resize_quality != -1) ? $thumb_resize_quality $config['auto_thumbnail_quality'];
$thumb_resize_dimension = ($thumb_resize_dimension != -1) ? $thumb_resize_dimension $config['auto_thumbnail_dimension'];

function 
preset_save()
{
global $presets$site_sess$msg$presets_session$presets_file;
$data $presets;
unset($data['default']);
$data serialize($data);
if ($presets_session || !@file_put_contents($presets_file$data))
{
$site_sess->set_session_var("acp_images_presets"$data);
}
}
if (!
function_exists("get_exif_insert_link"))
{
function get_exif_insert_link($file$tag$input$add_text 1$before ""$after "")
{
if (!EXIF_ENABLE || !function_exists('exif_read_data') || !$exif_data = @exif_read_data($file'EXIF'))
return;

if (!isset($exif_data[$tag]))
return;

global $lang;
$value "";
switch ($tag)
{
case "DateTimeOriginal":
case "DateTime":
case "DateTimeDigitized";
$value preg_replace("/([0-9]{4}):([0-9]{2}):([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/""\\1-\\2-\\3 \\4:\\5:\\6"$exif_data[$tag]);
break;
default:
$value $exif_data[$tag];
break;
}
if (!empty($value))
{
$txt = (isset($lang['exif_'.$tag])) ? $lang['exif_'.$tag] : "EXIF: ".$tag;

/*
$html .= "<script language=\"javascript\">\n<!--\n";
$html .= "this.document.writeln('".(isset($beforeafter[0]) ? $beforeafter[0] : "")."<input type=\"button\" value=\"$txt\" onClick=\"this.form.elements[\'".$input."\'].value=".(($add_text) ? "this.form.elements[\'".$input."\'].value + " : "")."\'".trim(str_replace('"', '&quot;', str_replace("'", "\'", $value)))."\'\" class=\"button\">&nbsp; $value".(isset($beforeafter[1]) ? $beforeafter[1] : "")."');";
$html .= "\n//-->\n</script>\n";
*/
$html $before;
$html .= "<input type=\"button\" value=\"$txt\" onClick=\"this.form.elements['".$input."'].value=".(($add_text) ? "this.form.elements['".$input."'].value + " "")."'".trim(str_replace('"''&quot;'$value))."'\" class=\"button\">&nbsp; $value";
$html .= $after;
return $html;
}
}
}
function 
_show_num_select_row($title$option$desc ""$max 10)
{
global $site_sess$PHP_SELF$action, $$option;
if ($max < ${$option})
$max = ${$option};

echo "<tr class=\"".get_row_bg()."\">\n<td><p>".$title."</p></td>\n";
echo "<td align=\"right\"><p>".$desc;
$url $PHP_SELF;
$url .= preg_match("/\?/"$url) ? "&amp;" "?";
$url .= "action=".$action;
$url $site_sess->url($url);
echo "<select name=\"num\" onchange=\"window.location=('".$url."&";
echo $option."='+this.options[this.selectedIndex].value)\">\n";
for ($i 1$i <= $max$i++)
{
echo "<option value=\"$i\"";
if ($i == ${$option})
{
echo " selected";
}
echo ">".$i."</option>\n";
}
echo "</select>&nbsp;";
echo "<script type=\"text/javascript\">
function checkEnter(e,v){ //e is event object passed from function invocation
var characterCode //literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4's which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
window.location=('"
.$url."&".$option."='+v);
return false
}
else{
return true
}

}
</script>"
;
echo "<input name=\"num2\" value=\"".${$option}."\" size=\"3\" onkeypress=\"return checkEnter(event, this.value);\"></p></td>\n</tr>\n";
}

if (!
function_exists("safe_htmlspecialchars"))
{
function safe_htmlspecialchars($chars)
{
// Translate all non-unicode entities
$chars preg_replace(
'/&(?!(#[0-9]+|[a-z]+);)/si',
'&amp;',
$chars
);

$chars str_replace(">""&gt;"$chars);
$chars str_replace("<""&lt;"$chars);
$chars str_replace('"'"&quot;"$chars);
return $chars;
}
}
function 
get_type_dropdown($name$select 0$type "text"$field ""$default true$empty true$class ""$js "")
{
global $HTTP_POST_VARS;
if (isset($HTTP_POST_VARS[$name]))
{
$select = (int)$HTTP_POST_VARS[$name];
}
$return "<select name=\"" $name "\" class=\"categoryselect" $class "\" " $js ">\n";
$return .= get_type_dropdown_options($select$type$field$default$empty);
$return .= "</select>\n";
return $return;
}

function 
get_type_dropdown_options($select 0$type "text"$field ""$default true$empty true)
{
global $lang;
switch ($type)
{
case "radio":
$var "radio";
break;

case "dropdown":
$var "dropdown";
break;

default:
$var = (strstr(strtolower($field), "int") === false) ? "text" "int";
break;
}
$var "types_array_" $var;
global $$var;
$var array_keys($$var);
$return "";
$count count($var);
if ($empty)
{
$return .= "<option value=\"0\"" . (!$select " selected" "") . "></option>\n";
}
if ($default)
{
$return .= "<option value=\"-1\"" . ($select == -" selected" "") . ">" $lang['default'] . "</option>\n";
}
for($i 1$i <= $count$i++)
{
$selected = ($select == $i) ? " selected" "";
$return .= "<option value=\"" $i "\"" $selected ">" $var[$i-1] . "</option>\n";
}
return $return;
}

function 
get_type_condition($select 0$type "text"$field ""$default true$empty true$array = array(""))
{
if ($select == -1) return false//use default

if ($default$select--;

if ($empty$select--;

switch ($type)
{
case "radio":
$var "radio";
break;

case "dropdown":
$var "dropdown";
break;

default:
$var = (strstr(strtolower($field), "int") === false) ? "text" "int";
break;
}
$var "types_array_" $var;
global $$var;
$key array_keys($$var);
$var array_values($$var);
if (!isset($var[$select]) || ($key[$select] == "REGEXP" && !$array[1]))
return false;

return vsprintf($var[$select], $array);
}

function 
show_input_row_type($title$name$value ""$size ""$type null$default true$empty true)
{
if ($type !== null)
{
$d = ($empty) ? : (($default) ? -$type[0]);
$class = ($type[0] == $d) ? "" 1;
$js "onChange=\"changeStyle(this,'categoryselect1');if(this.value!=" $d "){changeStyle(this,'categoryselect1');}else{changeStyle(this,'categoryselect');}\"";
$title "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"rowtitle\"><td width=\"100%\">".$title."</td>";
$title .= "<td>" get_type_dropdown($name "_type"$type[0], ""$type[1], $default$empty$class$js) . "</td></table>";
}
echo "<div>";
show_input_row($title$name$value$size);
echo "</div>";
}

function 
show_cat_select_row_type($title$cat_id$admin 0$i 0$type null$default true$empty true$subcat null)
{
if ($type !== null)
{
$d = ($empty) ? : (($default) ? -$type);
$class = ($type == $d) ? "" 1;
$js "onChange=\"if(this.value!=" $d "){changeStyle(this, 'categoryselect1');}else{changeStyle(this, 'categoryselect')}\"";
$title "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"rowtitle\"><td width=\"100%\">".$title."</td>";
$title .= "<td>" get_type_dropdown("cat_id_type"$type"dropdown"""$default$empty$class$js) . "</td></table>";
}
ob_start();
show_cat_select_row($title$cat_id$admin$i);
$dropdown ob_get_contents();
ob_end_clean();
if ($subcat !== null)
{
global $lang;
$radio ' <label for="subcat"><input type="checkbox" name="subcat" id="subcat"' . ($subcat ' checked=checked' '') . ($cat_id '' ' disabled') . '> ' $lang['include_subcats'] . '</label>';
$dropdown str_replace("</td>\n</tr>"$radio "\n</td>\n</tr>"$dropdown);
$select 'name="cat_id" onchange="this.form.subcat.disabled = (this.value == 0);"';
$dropdown str_replace('name="cat_id"'$select$dropdown);
}
echo $dropdown;
}

function 
show_user_dropdown_row_type($name$val$value 0$type null$default true$empty true)
{
if ($type !== null)
{
$d = ($empty) ? : (($default) ? -$type);
$class = ($type == $d) ? "" 1;
$js "onChange=\"if(this.value!=" $d "){changeStyle(this, 'categoryselect1');}else{changeStyle(this, 'categoryselect')}\"";
$val[0] = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"rowtitle\"><td width=\"100%\">".$val[0]."</td>";
$val[0] .= "<td>" get_type_dropdown($name "_type"$type"dropdown"""$default$empty$class$js) . "</td></table>";
}
if (function_exists("show_user_dropdown_row"))
show_user_dropdown_row($name$val$value);
}

function 
show_radio_row_type($title$name$value 1$type null$default true$empty true)
{
if ($type !== null)
{
$d = ($empty) ? : (($default) ? -$type);
$class = ($type == $d) ? "" 1;
$js "onChange=\"if(this.value!=" $d "){changeStyle(this, 'categoryselect1');}else{changeStyle(this, 'categoryselect')}\"";
$title "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"rowtitle\"><td width=\"100%\">".$title."</td>";
$title .= "<td>" get_type_dropdown($name "_type"$type"radio"""$default$empty$class$js) . "</td></table>";
}
show_radio_row($title$name$value);
}

if (!
function_exists("redirect"))
{
function redirect($url)
{
global $script_url$site_sess;
if (strpos($url'://') === false)
{
$url $script_url.'/'.$url;
}
$location = @preg_match('/Microsoft|WebSTAR|Xitami/'getenv('SERVER_SOFTWARE')) ? 'Refresh: 0; URL=' 'Location: ';
if (is_object($site_sess))
{
$url $site_sess->url($url"&");
}
header($location.$url);
exit;
}
}
function 
get_resize2($file$dim$height false$file_info false)
{
if ($file_info === false)
{
$file_info = @getimagesize($file);
}
if (!$file_info)
return array(00, array(), 0);;

$width $file_info[0];
$height $file_info[1];
if ($width && $height)
{
if ($width $dim || $height $dim)
{
@$ratio $width $height;
if ($ratio 1)
{
$new_width $dim;
$new_height round(($dim/$width) * $height);
}
else
{
$new_width round(($dim/$height) * $width);
$new_height $dim;
}
}
else
{
$new_width $width;
$new_height $height;
}
}
else
{
$new_width $dim;
$new_height $dim;
}
return array($new_width$new_height$file_info1);
}

function 
delete_images($image_ids$delfromserver 1)
{
global $site_db$lang;
if (empty($image_ids))
{
echo $lang['no_search_results'];
return false;
}
$error_log = array();
echo "<br />";
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file, l.lightbox_image_ids
FROM "
.IMAGES_TABLE." i
LEFT JOIN "
.LIGHTBOXES_TABLE." l ON (l.user_id = i.user_id)
WHERE i.image_id IN (
$image_ids)";
$image_result $site_db->query($sql);
while ($image_row $site_db->fetch_array($image_result))
{
if ($image_row['user_id'] != GUEST)
{
$lightbox_array explode(" ",$image_row['lightbox_image_ids']);
foreach ($lightbox_array as $key => $val)
{
if ($val == $image_row['image_id'])
{
unset($lightbox_array[$key]);
}
}
$lightbox_image_ids trim(implode(" "$lightbox_array));
$sql "UPDATE ".LIGHTBOXES_TABLE."
SET lightbox_image_ids = '"
.$lightbox_image_ids."'
WHERE user_id = "
.$image_row['user_id'];
$site_db->query($sql);
}

$sql "DELETE FROM ".IMAGES_TABLE."
WHERE image_id = "
.$image_row['image_id'];
if ($site_db->query($sql))
{
echo "<b>".$lang['image_delete_success']."</b> ".format_text($image_row['image_name'], 2)." [ID: ".$image_row['image_id']."]<br />\n";
}
else
{
$error_log[] = "<b>".$lang['image_delete_error']."</b> ".format_text($image_row['image_name'], 2)." [ID: ".$image_row['image_id']."]<br />";
}

if ($delfromserver)
{
if (!is_remote($image_row['image_media_file']) && !is_local_file($image_row['image_media_file']))
{
if (@unlink(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file']))
{
echo "&nbsp;&nbsp;".$lang['file_delete_success']." (".$image_row['image_media_file'].")<br />\n";
}
else
{
$error_log[] = "<b>".$lang['file_delete_error']." (".$image_row['image_media_file'].")<br />";
}
}
if (!empty($image_row['image_thumb_file']) && !is_remote($image_row['image_thumb_file']) && !is_local_file($image_row['image_thumb_file']))
{
if (@unlink(THUMB_PATH."/".$image_row['cat_id']."/".$image_row['image_thumb_file']))
{
echo "&nbsp;&nbsp;".$lang['thumb_delete_success']." (".$image_row['image_thumb_file'].")<br />\n";
}
else
{
$error_log[] = "<b>".$lang['thumb_delete_error']." (".$image_row['image_thumb_file'].")<br />\n";
}
}
if (BIGDIR)
{
if (@unlink(MEDIA_PATH."/".$image_row['cat_id']."/".BIGDIR."/".$image_row['image_media_file']))
{
echo "&nbsp;&nbsp;".$lang['file_big_delete_success']." (".BIGDIR."/".$image_row['image_media_file'].")<br />\n";
}
else
{
echo "&nbsp;&nbsp;".$lang['big_not_found']." <br />\n";
}
}
if (BACKUPDIR)
{
if (@unlink(BACKUPDIR."/".$image_row['cat_id']."/".$image_row['image_media_file']))
{
echo "&nbsp;&nbsp;".$lang['file_delete_success']." (".BACKUPDIR."/".$image_row['image_media_file'].")<br />\n";
}
else
{
echo "&nbsp;&nbsp;".$lang['orig_not_found']." <br />\n";
}
}
}
if (defined("IMS_DIR"))
{
$list IMS_getFileList($image_row);
foreach($list as $file)
{
if (@unlink($file))
{
echo "&nbsp;&nbsp;".sprintf($lang['ims_file_delete_success'], $file)."<br />\n";
}
else
{
echo "&nbsp;&nbsp;".sprintf($lang['ims_file_delete_error'], $file)."<br />\n";
}
}
}

if (!empty($user_table_fields['user_comments']))
{
$sql "SELECT user_id
FROM "
.COMMENTS_TABLE."
WHERE image_id = "
.$image_row['image_id']." AND user_id <> ".GUEST;
$result $site_db->query($sql);

while ($row $site_db->fetch_array($result))
{
$sql "UPDATE ".USERS_TABLE."
SET "
.get_user_table_field("""user_comments")." = ".get_user_table_field("""user_comments")." - 1
WHERE "
.get_user_table_field("""user_id")." = ".$row['user_id'];
$site_db->query($sql);
}
}

$sql "DELETE FROM ".COMMENTS_TABLE."
WHERE image_id = "
.$image_row['image_id'];
if ($site_db->query($sql))
{
echo "&nbsp;&nbsp;".$lang['comments_delete_success']."<br />\n";
}
else
{
$error_log[] = "<b>".$lang['comments_delete_error']."</b> ".format_text($image_row['image_name'], 2).", [ID: ".$image_row['image_id']."]<br />\n";
}
echo "<br />\n";
}
remove_searchwords($image_ids);
return $error_log;
}

function 
do_copy($image_media_file$image_thumb_file ""$from_cat 0$to_cat 0$media 1)
{
global $config$error_log$lang;
if ($media)
{
if (is_remote($image_media_file))
return $image_media_file;

$ok 0;
$new_file $image_media_file;
$image_src = ($from_cat != -1) ? MEDIA_PATH.(($from_cat != 0) ? "/".$from_cat "") : MEDIA_TEMP_PATH;
$image_dest = ($to_cat != -1) ? MEDIA_PATH.(($to_cat != 0) ? "/".$to_cat "") : MEDIA_TEMP_PATH;
$image_src_file $image_src."/".$image_media_file;
if (BIGDIR && file_exists((($from_cat != -1) ? MEDIA_PATH.(($from_cat != 0) ? "/".$from_cat "") : MEDIA_TEMP_PATH)."/".BIGDIR."/".$image_media_file))
{
$image_src_big = (($from_cat != -1) ? MEDIA_PATH.(($from_cat != 0) ? "/".$from_cat "") : MEDIA_TEMP_PATH)."/".BIGDIR;
$image_dest_big = (($to_cat != -1) ? MEDIA_PATH.(($to_cat != 0) ? "/".$to_cat "") : MEDIA_TEMP_PATH)."/".BIGDIR;
$image_src_file_big $image_src_big."/".$image_media_file;
}
else
{
$image_src_big "";
$image_dest_big "";
$image_src_file_big "";
}
if (BACKUPDIR && file_exists(BACKUPDIR."/".(($from_cat != && $from_cat != -1) ? $from_cat "")))
{
$image_src_backup BACKUPDIR."/".(($from_cat != && $from_cat != -1) ? $from_cat "");
$image_dest_backup BACKUPDIR."/".(($to_cat != && $to_cat != -1) ? $to_cat "");
$image_src_file_backup $image_src_backup."/".$image_media_file;
}
else
{
$image_src_backup "";
$image_dest_backup "";
$image_src_file_backup "";
}
if (file_exists($image_src."/".$image_media_file))
{
$file_extension get_file_extension($image_media_file);
$file_name get_file_name($image_media_file);
$n 2;
$copy "";
while (file_exists($image_dest."/".$file_name.$copy.".".$file_extension))
{
$copy "_".$n;
$n++;
}
$new_file $file_name.$copy.".".$file_extension;
$ok copy($image_src_file$image_dest."/".$new_file);
if (BIGDIR)
{
@copy($image_src_file_big$image_dest_big."/".$new_file);
}
if (BACKUPDIR)
{
@copy($image_src_file_backup$image_dest_backup."/".$new_file);
}
}
if (file_exists($image_src_file_big))
{
if (!@is_dir($image_dest_big))
{
$oldumask umask(0);
$result = @mkdir($image_dest_big);
umask($oldumask);
if (!@is_dir($image_dest_big) || !$result)
{
@mkdir($image_dest_bigCHMOD_DIRS);
}
}
if (!file_exists($image_dest_big."/".$new_file))
{
if (!copy($image_src_file_big$image_dest_big."/".$new_file))
{
$error_log[] = sprintf($lang['copy_file_error_perm'], $image_src_file_big$image_dest_big."/".$new_file);
}
}
}
if (file_exists($image_src_file_backup))
{
if (!@is_dir($image_dest_backup))
{
$oldumask umask(0);
$result = @mkdir($image_dest_backup);
umask($oldumask);
if (!@is_dir($image_dest_backup) || !$result)
{
@mkdir($image_dest_backupCHMOD_DIRS);
}
}
if (!file_exists($image_dest_backup."/".$new_file))
{
if (!copy($image_src_file_backup$image_dest_backup."/".$new_file))
{
$error_log[] = sprintf($lang['copy_file_error_perm'], $image_src_file_backup$image_dest_backup."/".$new_file);
}
}
}
if ($ok)
{
@chmod($image_dest."/".$new_fileCHMOD_FILES);
@chmod($image_dest_big."/".$new_fileCHMOD_FILES);
@chmod($image_dest_backup."/".$new_fileCHMOD_FILES);
return $new_file;
}
else
{
return false;
}
}
else
{
if (is_remote($image_thumb_file))
{
return $image_thumb_file;
}

$thumb_src = ($from_cat != -1) ? THUMB_PATH.(($from_cat != 0) ? "/".$from_cat "") : THUMB_TEMP_PATH;
$thumb_dest = ($to_cat != -1) ? THUMB_PATH.(($to_cat != 0) ? "/".$to_cat "") : THUMB_TEMP_PATH;

if ($image_thumb_file != "" && file_exists($thumb_src."/".$image_thumb_file))
{
$thumb_extension get_file_extension($image_thumb_file);

$thumb_name get_file_name($image_thumb_file);
$n 2;
$copy "";
while (file_exists($thumb_dest."/".$thumb_name.$copy.".".$thumb_extension))
{
$copy "_".$n;
$n++;
}
$new_thumb $thumb_name.$copy.".".$thumb_extension;
if (copy($thumb_src."/".$image_thumb_file$thumb_dest."/".$new_thumb))
{
@chmod($thumb_dest."/".$new_thumbCHMOD_FILES);
$image_thumb_file $new_thumb;
}
}
return $image_thumb_file;
}
}

function 
copy_images($image_ids$cat_id$date$move 0)
{
global $site_db$lang$site_sess$cat_cache;
if (empty($image_ids))
{
echo $lang['no_search_results'];
return false;
}
if (!$cat_id)
{
echo $lang['no_category'];
return false;
}
$copymove $move "move" "copy";
$error_log = array();
echo "<br />";
$sql "SELECT *
FROM "
.IMAGES_TABLE."
WHERE image_id IN (
$image_ids)";
$image_result $site_db->query($sql);
while ($image_row $site_db->fetch_array($image_result))
{
$ok false;
$msg "";
$ok_media "";
$ok_thumb "";
$image_cat_id $image_row['cat_id'];
$image_id $image_row['image_id'];
if ($cat_id != $image_cat_id)
{
$ok_media do_copy($image_row['image_media_file'], ""$image_cat_id$cat_id);
if ($ok_media && $image_row['image_thumb_file'] !== "")
{
$ok_thumb do_copy($image_row['image_media_file'], $image_row['image_thumb_file'], $image_cat_id$cat_id0);
}
if (!$ok_media)
{
$error_log[] = sprintf($lang[$copymove.'_error_media'], "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" target=_blank>".$image_row['image_name']."</a>",  format_text($cat_cache[$image_cat_id]['cat_name'], 2)." [ID:".$image_cat_id."]"format_text($cat_cache[$cat_id]['cat_name'], 2)." [ID:".$cat_id."]")."<br />";
}
elseif ($ok_thumb === false)
{
$error_log[] = sprintf($lang[$copymove.'_error_thumb'], $image_row['image_name']). "<br />";
}
$new_media_name $ok_media;
$new_thumb_name $ok_thumb;
if ($ok_media && $ok_thumb !== false)
{
if ($move)
{
$date_sql = ($date) ? "" ", image_date = ".time();
$filenames = (($new_media_name) ? ", image_media_file = '".$new_media_name."'" "").(($new_thumb_name) ? ", image_thumb_file = '".$new_thumb_name."'" "");
$sql "UPDATE ".IMAGES_TABLE." SET cat_id = ".$cat_id.$filenames.$date_sql." WHERE image_id = ".$image_id;
}
else
{
$image_row['cat_id'] = $cat_id;
unset($image_row['image_id']);
$keys = array();
$vals = array();
foreach ($image_row as $key => $val)
{
if (!intval($key) && $key && $val)
{
if ($key == "image_date" && !$date)
{
$val time();
}
if ($key == "image_media_file" && $new_media_name)
{
$val addslashes($new_media_name);
}
if ($key == "image_thumb_file" && $new_thumb_name)
{
$val addslashes($new_thumb_name);
}
$keys[] = $key;
$vals[] = "'".addslashes($val)."'";
}
}
$sql "INSERT INTO ".IMAGES_TABLE."
("
.implode(", "$keys).")
VALUES
("
.implode(", "$vals).")";
}
if ($site_db->query($sql))
{
if (!$move)
{
$image_id $site_db->get_insert_id();
}
if ($move && isset($cat_cache[$image_row['cat_id']]['cat_image']) && $cat_cache[$image_row['cat_id']]['cat_image'] == $image_row['image_id'])
{
$sql "UPDATE " CATEGORIES_TABLE " SET cat_image = '' WHERE cat_id = " $image_row['cat_id'];
$site_db->query($sql);
}
$msg sprintf($lang[$copymove.'_success'], "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" target=_blank>".$image_row['image_name']."</a>",  format_text($cat_cache[$image_cat_id]['cat_name'], 2)." [ID:".$image_cat_id."]"format_text($cat_cache[$cat_id]['cat_name'], 2)." [ID:".$cat_id."]")."<br />\n";
$ok 1;
}
else
{
$error_log[] = sprintf($lang[$copymove.'_error_db'], "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" target=_blank>".$image_row['image_name']."</a>"format_text($cat_cache[$image_cat_id]['cat_name'], 2)." [ID:".$image_cat_id."]"format_text($cat_cache[$cat_id]['cat_name'], 2)." [ID:".$cat_id."]")."<br />";
}
}
else
{
$error_log[] = sprintf($lang[$copymove.'_error_skipped'], "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" target=_blank>".$image_row['image_name']."</a>",  format_text($cat_cache[$image_cat_id]['cat_name'], 2)." [ID:".$image_cat_id."]"format_text($cat_cache[$cat_id]['cat_name'], 2)." [ID:".$cat_id."]")."<br />";
}
}
else
{
$msg "<b>".$lang['skipped']."</b> ".$image_row['image_name']." (".$lang['src_des_same'].")<br />\n";
}
if ($move && $cat_id != $image_cat_id && $ok)
{
if (!is_remote($image_row['image_media_file']) && !is_local_file($image_row['image_media_file']))
{
if (@unlink(MEDIA_PATH."/".$image_cat_id."/".$image_row['image_media_file']))
{
$ok_media 1;
}
else
{
$error_log[] = "<b>".$lang['file_delete_error']."</b> (".$image_row['image_media_file']." ".$lang['in_cat_id'].": ".$image_cat_id.")<br />";
}
}
if ($ok_media && !empty($image_row['image_thumb_file']) && !is_remote($image_row['image_thumb_file']) && !is_local_file($image_row['image_thumb_file']))
{
if (@unlink(THUMB_PATH."/".$image_cat_id."/".$image_row['image_thumb_file']))
{
$ok_thumb 1;
}
else
{
$error_log[] = "<b>".$lang['thumb_delete_error']." (".$image_row['image_thumb_file']." ".$lang['in_cat_id'].": ".$image_cat_id.")<br />\n";
}
}
if (BIGDIR && file_exists(MEDIA_PATH."/".$image_cat_id."/".BIGDIR."/".$image_row['image_media_file']))
{
if (!@unlink(MEDIA_PATH."/".$image_cat_id."/".BIGDIR."/".$image_row['image_media_file']))
{
$error_log[] = "<b>".$lang['error_del_big']."</b> (".BIGDIR."/".$image_row['image_media_file']." ".$lang['in_cat_id'].": ".$image_cat_id.")<br />";
}
}
if (BACKUPDIR && file_exists(BACKUPDIR."/".$image_cat_id."/".$image_row['image_media_file']))
{
if (!unlink(BACKUPDIR."/".$image_cat_id."/".$image_row['image_media_file']))
{
$error_log[] = "<b>".$lang['error_del_backup']."</b> (".BACKUPDIR."/".$image_row['image_media_file']." ".$lang['in_cat_id'].": ".$image_cat_id.")<br />";
}
}
}

echo $msg."<br />\n";
}
return $error_log;
}

function 
fixaction($txt)
{
//  return preg_replace("#[ ,._\-\[\]{}]#", "", $txt);
return trim($txt);
}

function 
get_thumbnail($image_row)
{
global $config;
if (!check_media_type($image_row['image_media_file']))
{
$return ICON_PATH."/404.gif";
}
else
{
if (!get_file_path($image_row['image_thumb_file'], "thumb"$image_row['cat_id'], 00))
{
$return ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}
else
{
$return get_file_path($image_row['image_thumb_file'], "thumb"$image_row['cat_id'], 01);
}
}
return $return;
}


if (
$action == "reset" || $action == fixaction($lang['reset']))
{
$presets['_default_'] = "default";
preset_save();
redirect(ROOT_PATH "admin/images.php");
}



show_admin_header($header_insert);


if (
$action == "deleteimage")
{
$selectimages = (isset($HTTP_POST_VARS['selectimages'])) ? $HTTP_POST_VARS['selectimages'] : array();
$delfromserver = (isset($HTTP_POST_VARS['delfromserver'])) ? intval($HTTP_POST_VARS['delfromserver']) : 1;
$image_ids "";
if (!empty($selectimages))
{
foreach ($selectimages as $val)
{
$image_ids .= (($image_ids != "") ? ", " "").$val;
}
}
$lang_key = (count($selectimages) > 1) ? 'images' 'image';
show_table_header($lang['delete'].": ".$lang[$lang_key], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
$error_log delete_images($image_ids$delfromserver);
echo "</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
if (!empty($error_log))
{
show_table_header($lang['error_log'], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
echo "<b>".$lang['error_log_desc']."</b>\n<ul>\n";
foreach ($error_log as $val)
{
printf("<li>%s</li>\n"$val);
}
echo "</ul>\n</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}
echo "<p>";
show_text_link($lang['back_overview'], "images.php?action=modifyimages");
}



if (
$action == "removeimage")
{
$image_ids = array();
if ((isset($HTTP_GET_VARS['image_id']) && intval($HTTP_GET_VARS['image_id'])) || (isset($HTTP_POST_VARS['image_id']) && intval($HTTP_POST_VARS['image_id'])))
{
$image_id = (isset($HTTP_GET_VARS['image_id'])) ? intval($HTTP_GET_VARS['image_id']) : intval($HTTP_POST_VARS['image_id']);
$image_ids[] = $image_id;
}
elseif (isset($HTTP_POST_VARS['selectimages']))
{
$image_ids $HTTP_POST_VARS['selectimages'];
}
else
{
$image_ids[] = 0;
}

if ($image_ids[0] != 0)
{
show_form_header("images.php""deleteimage");
foreach ($image_ids as $val)
{
show_hidden_input("selectimages[]"$val);
}
$lang_key = (count($image_ids) > 1) ? 'images' 'image';
show_table_header($lang['delete'].": ".$lang[$lang_key], 2);
show_description_row($lang['delete_image_confirm']);
show_radio_row($lang['delete_image_files_confirm'], "delfromserver"1);
show_form_footer($lang['yes'], ""2$lang['no']);
}
else
{
$error_log[] = $lang['no_search_results'];
$action "findimages";
}
}



if (
$action == "changeowner" || $action == fixaction($lang['changeowner']))
{
$image_ids = array();
if (isset($HTTP_POST_VARS['selectimages']) && $HTTP_POST_VARS['selectimages'])
{
$image_ids $HTTP_POST_VARS['selectimages'];
}
if ((isset($HTTP_GET_VARS['owner']) && intval($HTTP_GET_VARS['owner'])) || (isset($HTTP_POST_VARS['owner']) && intval($HTTP_POST_VARS['owner'])))
{
$owner = (isset($HTTP_GET_VARS['owner'])) ? intval($HTTP_GET_VARS['owner']) : intval($HTTP_POST_VARS['owner']);
}
if (!empty($image_ids) && is_array($image_ids))
{
if ($owner)
{
$sql "UPDATE ".IMAGES_TABLE."
SET user_id = "
.$owner."
WHERE image_id IN ("
.implode(",",$image_ids).")";
if ($site_db->query($sql))
{
echo "<b>".$lang['owner_success']."</b><br /><br />\n";
}
else
{
$error_log[] = $lang['owner_error'];
}
}
else
{
$error_log[] = $lang['no_user_select'];
}
}
else
{
$error_log[] = $lang['no_search_results'];
}
$action "findimages";
}



if (
$action == "saveedit")
{
$selectimages = (isset($HTTP_POST_VARS['selectimages'])) ? $HTTP_POST_VARS['selectimages'] : array();
$image_allow_comments = (isset($HTTP_POST_VARS['image_allow_comments']) && $HTTP_POST_VARS['image_allow_comments']) ? $HTTP_POST_VARS['image_allow_comments'] : 0;
$image_description un_htmlspecialchars(trim($HTTP_POST_VARS['image_description']));
$image_date = (trim($HTTP_POST_VARS['image_date']) != "") ? "UNIX_TIMESTAMP('".trim($HTTP_POST_VARS['image_date'])."')" 0;
$image_active intval($HTTP_POST_VARS['image_active']);
if (KEYWORDS_NEW)
{
$image_keywords un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));
$image_keywords preg_replace("/[\n\r]/is"","$image_keywords);
$image_keywords_arr explode(','$image_keywords);
array_walk($image_keywords_arr'trim_value');
$image_keywords implode(','array_unique(array_filter($image_keywords_arr)));
}
else
{
$image_keywords un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));
$image_keywords preg_replace("/[\n\r]/is"" "$image_keywords);
$image_keywords str_replace(","," ",$image_keywords);
$image_keywords preg_replace("/( ){2,}/"" "$image_keywords);
}
$HTTP_POST_VARS['image_keywords'] = $image_keywords;

$image_ids implode(",",$selectimages);
echo "<script language=javascript>\n showProgress();\n hideProgress();\n</script>";
show_table_header($lang['edit_log'], 2);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
$date = ($image_date) ? ", image_date = ".$image_date "";
$sql "UPDATE ".IMAGES_TABLE."
SET image_description = '
$image_description', image_keywords = '$image_keywords', image_allow_comments = $image_allow_comments, image_active = $image_active.$date
WHERE image_id IN (
$image_ids)";
$result $site_db->query($sql);
if ($result)
{
remove_searchwords($image_ids);
foreach($selectimages as $image_id)
{
$search_words = array();
foreach ($search_match_fields as $image_column => $match_column)
{
if (isset($HTTP_POST_VARS[$image_column]))
{
$search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column]);
if (KEYWORDS_NEW && $image_column == 'image_keywords')
{
$search_words[$image_column] = explode(','$search_words[$image_column]);
}
}
}
add_searchwords($image_id$search_words);
}
echo "<b>".$lang['upload_success'][(count($selectimages) > 1) ? 0]."</b>\n</td></tr></table>\n";
echo "</td></tr>\n";
echo "</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}
else
{
echo "</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
show_table_header($lang['error_log'], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
echo "<b>".$lang['upload_error'][(count($selectimages) > 1) ? 0]."</b>\n</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}
$HTTP_POST_VARS = array();
$action "modifyimages";
//  echo "<p>";
//  show_text_link($lang['back_overview'], "images.php?action=modifyimages");
}



if (
$action == "edit" || $action == fixaction($lang['edit']))
{
$image_ids = array();
if ((isset($HTTP_GET_VARS['image_id']) && intval($HTTP_GET_VARS['image_id'])) || (isset($HTTP_POST_VARS['image_id']) && intval($HTTP_POST_VARS['image_id'])))
{
$image_id = (isset($HTTP_GET_VARS['image_id'])) ? intval($HTTP_GET_VARS['image_id']) : intval($HTTP_POST_VARS['image_id']);
$image_ids[] = $image_id;
}
elseif (isset($HTTP_POST_VARS['selectimages']))
{
$image_ids $HTTP_POST_VARS['selectimages'];
}
else
{
$image_ids[] = 0;
}
if (count($image_ids) > 1)
{
if ($image_ids[0] != 0)
{
show_form_header("images.php""saveedit");
foreach ($image_ids as $val)
{
show_hidden_input("selectimages[]"$val);
}
$sql "SELECT image_id, cat_id, image_name, image_keywords, image_description, image_allow_comments, image_active, FROM_UNIXTIME(image_date) AS image_date, image_media_file, image_thumb_file
FROM "
.IMAGES_TABLE."
WHERE image_id IN ("
.implode(","$image_ids).")";
$result $site_db->query($sql);
$list "<div style=\"display: block;\">";
$i 0;
$keywords "";
$keywords_sep KEYWORDS_NEW "," " ";
while ($row $site_db->fetch_array($result))
{
$image_row[$row['image_id']] = $row;
$file_src get_thumbnail($row);
$height $thumbsize;
$width $thumbsize;
$file_size get_resize2($file_src$thumbsize);
$width $file_size[0];
$height $file_size[1];

$list .= "<div style=\"float: left;" . (($i) ? " margin: 2px 2px 2px 5px;" "") . "\">";
$list .= "<div><a href=\""$site_sess->url(ROOT_PATH "details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" target=\"_blank\">";
$list .= "<img src=\"".$file_src."\" width=\"" $width "\" height=\"" $height "\" border=\"1\" alt=\"\"></div><div>";
$list .= $row['image_name'];
$list .= " [ID: ".$row['image_id']."]</a></div></div>";
$i++;
if ($row['image_keywords'])
{
$keywords .= $keywords_sep trim($row['image_keywords']);
}
}
$list .= "</div>";
$keywords trim($keywords$keywords_sep);
$keywords implode($keywords_separray_unique(explode($keywords_septrim($keywords))));
$HTTP_POST_VARS = array();
show_table_header($lang['edit_image'][(count($image_ids) > 1) ? 0], 2);
show_custom_row($lang['edit_image'][(count($image_ids) > 1) ? 0] . ":"trim($list", "));
$file_src get_file_path($image_row[$image_ids[0]]['image_media_file'], "media"$image_row[$image_ids[0]]['cat_id'], 1);
$title $lang['field_description_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src"caption""image_description") : "");
show_textarea_row($title"image_description"$image_row[$image_ids[0]]['image_description'], $textarea_size);

$title $lang['field_keywords_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src"keyword""image_keywords") : "");
show_textarea_row($title"image_keywords"$keywords$textarea_size);
$title $lang['field_date'].$lang['date_desc'].$lang['date_format'];
if (function_exists("show_date_input_row"))
show_date_input_row($title"image_date"$image_row[$image_ids[0]]['image_date'], $textinput_size);
else
show_input_row($title"image_date"$image_row[$image_ids[0]]['image_date'], $textinput_size);

show_radio_row($lang['field_free'], "image_active"$image_row[$image_ids[0]]['image_active']);
show_radio_row($lang['field_allow_comments'], "image_allow_comments"$image_row[$image_ids[0]]['image_allow_comments']);
show_form_footer($lang['save_changes'], $lang['reset'], 2""" onClick='showProgress()'");
}
else
{
$error_log[] = $lang['no_search_results'];
$action "findimages";
}
}
else
{
$HTTP_POST_VARS['image_id'] = $image_ids[0];
$action "editimage";
}
}



if (
$action == "docopy")
{
$selectimages = (isset($HTTP_POST_VARS['selectimages'])) ? $HTTP_POST_VARS['selectimages'] : array();
$cat_id = (isset($HTTP_POST_VARS['new_cat_id'])) ? $HTTP_POST_VARS['new_cat_id'] : 0;
$date = (isset($HTTP_POST_VARS['date']) && intval($HTTP_POST_VARS['date'])) ? 0;
$image_ids "";
if (!empty($selectimages))
{
foreach ($selectimages as $val)
{
$image_ids .= (($image_ids != "") ? ", " "").$val;
}
}
$lang_key = (count($selectimages) > 1) ? 'images' 'image';
show_table_header($lang['copy']." ".$lang[$lang_key], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
$error_log copy_images($image_ids$cat_id$date);
echo "</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
if (!empty($error_log))
{
show_table_header($lang['error_log'], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
echo "<b>".$lang['error_log_desc']."</b>\n<ul>\n";
foreach ($error_log as $val)
{
printf("<li>%s</li>\n"$val);
}
echo "</ul>\n</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}
echo "<p>";
show_text_link($lang['back_overview'], "images.php?action=modifyimages");
}



if (
$action == "copy" || $action == fixaction($lang['copy']))
{
$image_ids = array();
if (isset($HTTP_POST_VARS['selectimages']))
{
$image_ids $HTTP_POST_VARS['selectimages'];
}
else
{
$image_ids[] = 0;
}
$cat_id = (isset($HTTP_POST_VARS['new_cat_id'])) ? $HTTP_POST_VARS['new_cat_id'] : 0;
$date = (isset($HTTP_POST_VARS['date']) && intval($HTTP_POST_VARS['date'])) ? 0;
if ($image_ids[0] != && $cat_id)
{
show_form_header("images.php""docopy");
foreach ($image_ids as $val)
{
show_hidden_input("selectimages[]"$val);
}
show_hidden_input("new_cat_id"$cat_id);
show_hidden_input("date"$date);
$lang_key = (count($image_ids) > 1) ? 'images' 'image';
show_table_header($lang['copy']." ".$lang[$lang_key], 2);
show_description_row(sprintf($lang['copy_confirm'], format_text($cat_cache[$cat_id]['cat_name'], 2), $cat_id));
show_form_footer($lang['yes'], ""2$lang['no']);
}
else
{
if ($image_ids[0] == 0)
{
$error_log[] = $lang['no_search_results'];
}
if (!$cat_id)
{
$error_log[] = $lang['no_category'];
}
$action "findimages";
}
}



if (
$action == "domove")
{
$selectimages = (isset($HTTP_POST_VARS['selectimages'])) ? $HTTP_POST_VARS['selectimages'] : array();
$cat_id = (isset($HTTP_POST_VARS['new_cat_id'])) ? $HTTP_POST_VARS['new_cat_id'] : 0;
$date = (isset($HTTP_POST_VARS['date']) && intval($HTTP_POST_VARS['date'])) ? 0;
$image_ids "";
if (!empty($selectimages))
{
foreach ($selectimages as $val)
{
$image_ids .= (($image_ids != "") ? ", " "").$val;
}
}
$lang_key = (count($selectimages) > 1) ? 'images' 'image';
show_table_header($lang['move'].": ".$lang[$lang_key], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
$error_log copy_images($image_ids$cat_id$date1);
echo "</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
if (!empty($error_log))
{
show_table_header($lang['error_log'], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
echo "<b>".$lang['error_log_desc']."</b>\n<ul>\n";
foreach ($error_log as $val)
{
printf("<li>%s</li>\n"$val);
}
echo "</ul>\n</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}
echo "<p>";
show_text_link($lang['back_overview'], "images.php?action=modifyimages");
}



if (
$action == "move" || $action == fixaction($lang['move']))
{
$image_ids = array();
if (isset($HTTP_POST_VARS['selectimages']))
{
$image_ids $HTTP_POST_VARS['selectimages'];
}
else {
$image_ids[] = 0;
}
$cat_id = (isset($HTTP_POST_VARS['new_cat_id'])) ? $HTTP_POST_VARS['new_cat_id'] : 0;
$date = (isset($HTTP_POST_VARS['date']) && intval($HTTP_POST_VARS['date'])) ? 0;
if ($image_ids[0] != && $cat_id && isset($cat_cache[$cat_id]))
{
show_form_header("images.php""domove");
foreach ($image_ids as $val)
{
show_hidden_input("selectimages[]"$val);
}
show_hidden_input("date"$date);
show_hidden_input("new_cat_id"$cat_id);
$lang_key = (count($image_ids) > 1) ? 'images' 'image';
show_table_header($lang['move'].": ".$lang[$lang_key], 2);
show_description_row(sprintf($lang['move_confirm'], format_text($cat_cache[$cat_id]['cat_name'], 2), $cat_id));
show_form_footer($lang['yes'], ""2$lang['no']);
}else{
if ($image_ids[0] == 0)
{
$error_log[] = $lang['no_search_results'];
}
if (!$cat_id)
{
$error_log[] = $lang['no_category'];
}
$action "findimages";
}
}



if (
$action == "updateimage")
{
$error_msg "";
$error = array();

$image_id = (isset($HTTP_POST_VARS['image_id'])) ? intval($HTTP_POST_VARS['image_id']) : intval($HTTP_GET_VARS['image_id']);
$image_name un_htmlspecialchars(trim($HTTP_POST_VARS['image_name']));
$image_description un_htmlspecialchars(trim($HTTP_POST_VARS['image_description']));

if (KEYWORDS_NEW)
{
$image_keywords un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));
$image_keywords preg_replace("/[\n\r]/is"","$image_keywords);
$image_keywords_arr explode(','$image_keywords);
array_walk($image_keywords_arr'trim_value');
$image_keywords implode(','array_unique(array_filter($image_keywords_arr)));
}
else
{
$image_keywords un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));
$image_keywords preg_replace("/[\n\r]/is"" "$image_keywords);
$image_keywords str_replace(","," ",$image_keywords);
$image_keywords preg_replace("/( ){2,}/"" "$image_keywords);
}
$HTTP_POST_VARS['image_keywords'] = $image_keywords;
$cat_id intval($HTTP_POST_VARS['cat_id']);
$old_cat_id intval($HTTP_POST_VARS['old_cat_id']);

$user_id = (intval($HTTP_POST_VARS['user_id']) != 0) ? intval($HTTP_POST_VARS['user_id']) : $user_info['user_id'];

$image_date = (trim($HTTP_POST_VARS['image_date']) != "") ? "UNIX_TIMESTAMP('".trim($HTTP_POST_VARS['image_date'])."')" time();
$image_active intval($HTTP_POST_VARS['image_active']);
$image_allow_comments intval($HTTP_POST_VARS['image_allow_comments']);
$image_downloads = (trim($HTTP_POST_VARS['image_downloads']) != "") ? intval($HTTP_POST_VARS['image_downloads']) : 0;
$image_votes = (trim($HTTP_POST_VARS['image_votes']) != "") ? intval($HTTP_POST_VARS['image_votes']) : 0;
$image_rating = (trim($HTTP_POST_VARS['image_rating']) != "") ? sprintf("%.2f"trim($HTTP_POST_VARS['image_rating'])) : "0.00";
$image_hits = (trim($HTTP_POST_VARS['image_hits']) != "") ? intval(trim($HTTP_POST_VARS['image_hits'])) : 0;

$remote_file trim($HTTP_POST_VARS['remote_file']);
$remote_thumb_file trim($HTTP_POST_VARS['remote_thumb_file']);

$old_file_name trim($HTTP_POST_VARS['old_file_name']);
$old_thumb_file_name trim($HTTP_POST_VARS['old_thumb_file_name']);

$image_download_url trim($HTTP_POST_VARS['image_download_url']);

$image_resize = (isset($HTTP_POST_VARS['image_resize'])) ? intval($HTTP_POST_VARS['image_resize']) : 0;
$thumb_tools = (isset($HTTP_POST_VARS['thumb_tools'])) ? intval($HTTP_POST_VARS['thumb_tools']) : 0;
if ($thumb_tools == -1)
{
$HTTP_POST_VARS['delete_thumb_file'] = 1;
$thumb_tools 0;
}
$delete_thumb_file = (isset($HTTP_POST_VARS['delete_thumb_file']) && $HTTP_POST_VARS['delete_thumb_file'] == 1) ? 0;

if ($image_name == "")
{
$error['image_name'] = 1;
}
if ($cat_id == 0)
{
$error['cat_id'] = 1;
}
if ($image_download_url != "" && !is_remote($image_download_url) && !is_local_file($image_download_url))
{
$error['image_download_url'] = 1;
}

if ((empty($HTTP_POST_FILES['file']['tmp_name']) || $HTTP_POST_FILES['file']['tmp_name'] == "none") && $remote_file != "" && !check_remote_media($remote_file) && !check_local_media($remote_file))
{
$error['remote_file'] = 1;
}
if ((empty($HTTP_POST_FILES['thumb_file']['tmp_name']) || $HTTP_POST_FILES['thumb_file']['tmp_name'] == "none") && $remote_thumb_file != "" && !check_remote_thumb($remote_thumb_file) && !check_local_thumb($remote_thumb_file))
{
$error['remote_thumb_file'] = 1;
}

if (!empty($additional_image_fields))
{
foreach ($additional_image_fields as $key => $val)
{
if (isset($HTTP_POST_VARS[$key]) && intval($val[2]) == && trim($HTTP_POST_VARS[$key]) == "")
{
$error[$key] = 1;
}
}
}

if (!empty($HTTP_POST_FILES['file']['tmp_name']) && $HTTP_POST_FILES['file']['tmp_name'] != "none" && !$error)
{
unset($HTTP_POST_VARS['remote_file']);
@rename(MEDIA_PATH."/".$old_cat_id."/".$old_file_nameMEDIA_PATH."/".$old_cat_id."/".$old_file_name.".bak");
if (BIGDIR)
{
@rename(MEDIA_PATH."/".$old_cat_id."/".BIGDIR."/".$old_file_nameMEDIA_PATH."/".$old_cat_id."/".BIGDIR."/".$old_file_name.".bak");
}
if (BACKUPDIR)
{
@rename(BACKUPDIR."/".$old_cat_id."/".$old_file_nameBACKUPDIR."/".$old_cat_id."/".$old_file_name.".bak");
}
$new_name $site_upload->upload_file("file""media"$cat_id);
if (!$new_name)
{
$error_msg .= $lang['file_upload_error'].": <b>".$HTTP_POST_FILES['file']['name']."</b><br />".$site_upload->get_upload_errors();
@rename(MEDIA_PATH."/".$old_cat_id."/".$old_file_name.".bak"MEDIA_PATH."/".$old_cat_id."/".$old_file_name);
if (BIGDIR)
{
@rename(MEDIA_PATH."/".$old_cat_id."/".BIGDIR."/".$old_file_name.".bak"MEDIA_PATH."/".$old_cat_id."/".BIGDIR."/".$old_file_name);
}
if (BACKUPDIR)
{
@rename(BACKUPDIR."/".$old_cat_id."/".$old_file_name.".bak"BACKUPDIR."/".$old_cat_id."/".$old_file_name);
}
$error[''] = 1;
}
else
{
@unlink(MEDIA_PATH."/".$old_cat_id."/".$old_file_name.".bak");
@unlink(MEDIA_PATH."/".$old_cat_id."/".BIGDIR."/".$old_file_name.".bak");
@unlink(BACKUPDIR."/".$old_cat_id."/".$old_file_name.".bak");
if (defined("IMS_DIR"))
{
$list IMS_getFileList($image_id);
foreach($list as $file)
{
@unlink($file);
}
}
$log[] = $lang['file_upload_success'].": <b>$new_name</b>";
}
}
elseif ((empty($HTTP_POST_FILES['file']['tmp_name']) || $HTTP_POST_FILES['file']['tmp_name'] == "none") && $remote_file != "" && (check_remote_media($remote_file) || check_local_media($remote_file)))
{
$new_name $remote_file;
if (file_exists(MEDIA_PATH."/".$old_cat_id."/".$old_file_name) && is_file(MEDIA_PATH."/".$old_cat_id."/".$old_file_name))
{
unlink(MEDIA_PATH."/".$old_cat_id."/".$old_file_name);
@unlink(MEDIA_PATH."/".$old_cat_id."/".BIGDIR."/".$old_file_name);
@unlink(BACKUPDIR."/".$old_cat_id."/".$old_file_name);
if (defined("IMS_DIR"))
{
$list IMS_getFileList($image_id);
foreach($list as $file)
{
@unlink($file);
}
}
}
}
else
{
if ($cat_id != $old_cat_id && !empty($old_file_name))
{
if ($new_name do_copy($old_file_name""$old_cat_id$cat_id1))
{
if (!is_remote($old_file_name) && !is_local_file($old_file_name))
{
if (!@unlink(MEDIA_PATH."/".$old_cat_id."/".$old_file_name))
{
$error_msg .= "<b>".$lang['file_delete_error']."</b> (".$old_file_name." ".$lang['in_cat_id'].": ".$old_cat_id.")<br />";
$error[''] = 1;
}
else
{
if (BIGDIR && file_exists(MEDIA_PATH."/".$old_cat_id."/".BIGDIR."/".$old_file_name))
{
if (!@unlink(MEDIA_PATH."/".$old_cat_id."/".BIGDIR."/".$old_file_name))
{
$error_msg .= "<b>".$lang['error_del_big']."</b> (".BIGDIR."/".$old_file_name." ".$lang['in_cat_id'].": ".$old_cat_id.")<br />";
$error[''] = 1;
}
}
if (BACKUPDIR && file_exists(BACKUPDIR."/".$old_cat_id."/".$old_file_name))
{
if (!@unlink(BACKUPDIR."/".$old_cat_id."/".$old_file_name))
{
$error_msg .= "<b>".$lang['error_del_backup']."</b> (".BACKUPDIR."/".$old_file_name." ".$lang['in_cat_id'].": ".$old_cat_id.")<br />";
$error[''] = 1;
}
}
}
}
}
else
{
$error[''] = 1;
}

}
else
{
$new_name $old_file_name;
}
}

if ($delete_thumb_file == 1)
{
if (!empty($old_thumb_file_name) && file_exists(THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name))
{
unlink(THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name);
}
$new_thumb_name "";
unset($HTTP_POST_VARS['remote_thumb_file']);
}
elseif (!empty($HTTP_POST_FILES['thumb_file']['tmp_name']) && $HTTP_POST_FILES['thumb_file']['tmp_name'] != "none" && !$error)
{
unset($HTTP_POST_VARS['remote_thumb_file']);
@rename(THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_nameTHUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name.".bak");
$new_thumb_name $site_upload->upload_file("thumb_file""thumb"$cat_idget_basefile($new_name));
if (!$new_thumb_name)
{
$error_msg .= $lang['thumb_upload_error'].": <b>".$HTTP_POST_FILES['thumb_file']['name']."</b><br />".$site_upload->get_upload_errors();
@rename(THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name.".bak"THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name);
@unlink(MEDIA_PATH."/".$old_cat_id."/".$new_name);
$error[''] = 1;
}
else
{
$log[] = $lang['thumb_upload_success'].": <b>$new_thumb_name</b>";
}
}
elseif ((empty($HTTP_POST_FILES['thumb_file']['tmp_name']) || $HTTP_POST_FILES['thumb_file']['tmp_name'] == "none") && $remote_thumb_file != "" && (check_remote_thumb($remote_thumb_file) || check_local_thumb($remote_thumb_file)))
{
$new_thumb_name $remote_thumb_file;
if (file_exists(THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name) && is_file(THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name))
{
unlink(THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name);
}
}
else
{
if ($cat_id != $old_cat_id && !empty($old_thumb_file_name))
{
$new_thumb_name copy_thumbnail($new_name$old_thumb_file_name$old_cat_id$cat_id);
}
else
{
$new_thumb_name $old_thumb_file_name;
}
}
if (empty($error) && !$convert_options['convert_error'])
{
if ($image_resize)
{
@set_time_limit(90);
$file MEDIA_PATH."/".$cat_id."/".$new_name;
if (!$image_info getimagesize($file))
{
$log[] = $lang['image_resize_error'];
}
else
{

if ($image_info[2] && $image_info[2] < 4)
{
if ($image_info[0] > $image_resize_width || $image_info[1] > $image_resize_height)
{
if (resize_image($file$image_resize_quality$image_resize_width$image_resize_type$image_resize_height))
{
$image_info2 getimagesize($file);
$log[] = sprintf($lang['image_resize_success'], $image_info[0], $image_info[1], $image_info2[0], $image_info2[1]);
}
else
{
$log[] = $lang['image_resize_error'];
}
}
else
{
$log[] = $lang['image_resize_skipped'];
}
}
else
{
$log[] = $lang['image_resize_skipped'];
}
}
}
if (!$delete_thumb_file && $thumb_tools)
{
$type = ($thumb_tools == 1) ? "resize" "create";
if (($new_thumb_name === "" || $thumb_tools == 2) && file_exists(MEDIA_PATH."/".$cat_id."/".$new_name))
{
if (file_exists(THUMB_PATH."/".$cat_id."/".$new_name))
{
unlink(THUMB_PATH."/".$cat_id."/".$new_name);
}

if (copy(MEDIA_PATH."/".$cat_id."/".$new_nameTHUMB_PATH."/".$cat_id."/".$new_name))
{
chmod(THUMB_PATH."/".$cat_id."/".$new_nameCHMOD_FILES);
$new_thumb_name $new_name;
$type "create";
}

}
if ($new_thumb_name !== "")
{
@set_time_limit(90);
$file THUMB_PATH."/".$cat_id."/".$new_thumb_name;
if (!$image_info getimagesize($file))
{
$log[] = $lang['thumb_'.$type.'_error'];
}
else
{
if ($image_info[2] && $image_info[2] < 4)
{
if ($image_info[0] > $thumb_resize_dimension || $image_info[1] > $thumb_resize_dimension)
{
@unlink($file.".bak");
if (resize_image($file$thumb_resize_quality$thumb_resize_dimension$thumb_resize_type))
{
$image_info2 getimagesize($file);
$log[] = $lang['thumb_'.$type.'_success'];
}
else
{
$log[] = $lang['thumb_'.$type.'_error'];
}
}
else
{
$log[] = $lang['thumb_'.$type.'_skipped'];
}
}
else
{
$log[] = $lang['thumb_'.$type.'_skipped'];
}
}
}
}
$image_resize 0;
$thumb_tools 0;
}
if (empty($error))
{
$additional_sql "";
if (!empty($additional_image_fields))
{
foreach ($additional_image_fields as $key => $val)
{
if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key]))
{
$additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
}
}
}

$sql "UPDATE ".IMAGES_TABLE."
SET cat_id = 
$cat_id, user_id = $user_id, image_name = '$image_name', image_description = '$image_description', image_keywords = '$image_keywords', image_date = $image_date, image_active = $image_active, image_media_file = '$new_name', image_thumb_file = '$new_thumb_name', image_download_url = '$image_download_url', image_allow_comments = $image_allow_comments, image_downloads = $image_downloads, image_votes = $image_votes, image_rating = '$image_rating', image_hits = $image_hits".$additional_sql."
WHERE image_id = 
$image_id";
$result $site_db->query($sql);

if (isset($HTTP_POST_VARS['cat_image']))
{
if ($old_cat_id == $cat_id)
{
$sql "UPDATE ".CATEGORIES_TABLE."
SET cat_image = "
.((intval($HTTP_POST_VARS['cat_image'])) ? intval($HTTP_POST_VARS['cat_image']) : ((isset($HTTP_POST_VARS['cat_image_old']) && $HTTP_POST_VARS['cat_image_old'] != $image_id) ? $HTTP_POST_VARS['cat_image_old'] : 0))."
WHERE cat_id = 
$cat_id";
$result $site_db->query($sql);
}
else
{
unset($HTTP_POST_VARS['cat_image']);
}
if ($old_cat_id != $cat_id && isset($cat_cache[$old_cat_id]['cat_image']) && $cat_cache[$old_cat_id]['cat_image'] == $image_id)
{
$sql "UPDATE " CATEGORIES_TABLE "
SET cat_image = ''
WHERE cat_id = " 
$old_cat_id;
$site_db->query($sql);
}

}
@unlink(MEDIA_PATH."/".$old_cat_id."/".$old_file_name.".bak");
@unlink(MEDIA_PATH."/".$old_cat_id."/".BIGDIR."/".$old_file_name.".bak");
@unlink(BACKUPDIR."/".$old_cat_id."/".$old_file_name.".bak");
@unlink(THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name.".bak");
update_comment_count($image_id);

if ($result)
{
$search_words = array();
foreach ($search_match_fields as $image_column => $match_column)
{
if (isset($HTTP_POST_VARS[$image_column]))
{
$search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column]);
if (KEYWORDS_NEW && $image_column == 'image_keywords')
{
$search_words[$image_column] = explode(','$search_words[$image_column]);
}

}
}
remove_searchwords($image_id);
add_searchwords($image_id$search_words);
$msg .= $lang['image_edit_success'];
}
else
{
$msg .= $lang['image_edit_error'];
}
}
else
{
$msg .= sprintf("<span class=\"marktext\">%s</span>"$lang['lostfield_error']);
$msg .= $error_msg;
}
echo "<script language=javascript>\n showProgress();\n hideProgress();\n</script>";
$action "editimage";
if (!empty($log))
{
show_table_header($lang['log'], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
foreach ($log as $val)
{
echo $val."<br />";
}
echo "</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}
}



if (
$action == "save" || $action == fixaction($lang['save']))
{
$image_ids = array();
$image_name = array();
$image_description = array();
$image_keywords = array();
if (isset($HTTP_POST_VARS['selectimages']))
{
$image_ids $HTTP_POST_VARS['selectimages'];
}
else
{
$image_ids[] = 0;
}
$editkeywords 0;
$image_info = array();
if (isset($HTTP_POST_VARS['qe_cat_id']))
{
$sql "SELECT cat_id, image_id, image_media_file, image_thumb_file
FROM " 
IMAGES_TABLE "
WHERE image_id IN (" 
implode(","$image_ids) . ")";
$result $site_db->query($sql);
$image_info = array();
while($image_row $site_db->fetch_array($result))
{
$image_info[$image_row['image_id']] = $image_row;
}
}
foreach ($image_ids as $key => $val)
{
$set = array();
foreach($quickedit_fields_all as $field => $data)
{
if (!isset($HTTP_POST_VARS["qe_".$field][$key]) || (isset($HTTP_POST_VARS['qe_orig_'.$field][$key]) && trim($HTTP_POST_VARS['qe_orig_'.$field][$key]) == trim($HTTP_POST_VARS['qe_'.$field][$key])))
continue;

$value trim($HTTP_POST_VARS["qe_".$field][$key]);
if (isset($data[2]) && is_array($data[2]) && $data[2][0] == 1)
$value = (int)$value;

$editkeywords 0;
if ($field == "image_keywords")
{
if (KEYWORDS_NEW)
{
$value un_htmlspecialchars(trim($value));
$value preg_replace("/[\n\r]/is"","$value);
$value_arr explode(','$value);
array_walk($value_arr'trim_value');
$value implode(','array_unique(array_filter($value_arr)));
}
else
{
$value preg_replace("/[\n\r]/is"" "$value);
$value str_replace(","," ",$value);
$value preg_replace("/( ){2,}/"" "$value);
}
$HTTP_POST_VARS["qe_image_keywords"][$key] = $value;
$value "'".$value."'";
$editkeywords 1;
}
elseif ($field == "image_date")
{
$value "UNIX_TIMESTAMP('".$value."')";
}
elseif ($field == "cat_id")
{
if (!isset($cat_cache[$value]))
{
$error_log[] = "<b>".sprintf($lang['qe_cat_id_error'], $value)."<b>";
continue;
}
if (!empty($image_info[$val]['image_media_file']) && file_exists(MEDIA_PATH."/".$image_info[$val]['cat_id']."/".$image_info[$val]['image_media_file']) && is_file(MEDIA_PATH."/".$image_info[$val]['cat_id']."/".$image_info[$val]['image_media_file']))
{
if (!is_remote($image_info[$val]['image_media_file']) && !is_local_file($image_info[$val]['image_media_file']))
{
if ($new_name do_copy($image_info[$val]['image_media_file'], ""$image_info[$val]['cat_id'], $value1))
{
if (!@unlink(MEDIA_PATH."/".$image_info[$val]['cat_id']."/".$image_info[$val]['image_media_file']))
{
$error_log[] = "<b>".$lang['file_delete_error']."</b> (".MEDIA_PATH."/".$image_info[$val]['cat_id']."/".$image_info[$val]['image_media_file'].")";
$error[''] = 1;
}
else
{
if (BIGDIR && file_exists(MEDIA_PATH."/".$image_info[$val]['cat_id']."/".BIGDIR."/".$image_info[$val]['image_media_file']))
{
if (!@unlink(MEDIA_PATH."/".$image_info[$val]['cat_id']."/".BIGDIR."/".$image_info[$val]['image_media_file']))
{
$error_log[] = "<b>".$lang['error_del_big']."</b> (".MEDIA_PATH."/".$image_info[$val]['cat_id']."/".BIGDIR."/".$image_info[$val]['image_media_file'].")";
$error[''] = 1;
}
}
if (BACKUPDIR && file_exists(BACKUPDIR."/".$image_info[$val]['cat_id']."/".$image_info[$val]['image_media_file']))
{
if (!@unlink(BACKUPDIR."/".$image_info[$val]['cat_id']."/".$image_info[$val]['image_media_file']))
{
$error_log[] = "<b>".$lang['error_del_backup']."</b> (".BACKUPDIR."/".$image_info[$val]['cat_id']."/".$image_info[$val]['image_media_file'].")";
$error[''] = 1;
}
}
}
}
else
{
$error[''] = 1;
}
}
}
else
{
$new_name $image_info[$val]['image_media_file'];
}
if (!empty($image_info[$val]['image_thumb_file']) && file_exists(THUMB_PATH."/".$image_info[$val]['cat_id']."/".$image_info[$val]['image_thumb_file']) && is_file(THUMB_PATH."/".$image_info[$val]['cat_id']."/".$image_info[$val]['image_thumb_file']))
{
$new_thumb_name copy_thumbnail($new_name$image_info[$val]['image_thumb_file'], $image_info[$val]['cat_id'], $value);
}
else
{
$new_thumb_name $image_info[$val]['image_thumb_file'];
}
$set[] = "image_media_file = '".addslashes($new_name)."'";
$set[] = "image_thumb_file = '".addslashes($new_thumb_name)."'";
}
else
{
$value "'".$value."'";
}
$set[] = $field " = " $value;
}
if (!empty($set))
{
$sql "UPDATE ".IMAGES_TABLE."
SET "
.implode(", "$set)."
WHERE image_id = 
$val";
$result $site_db->query($sql);
}
$search_words = array();
foreach ($search_match_fields as $image_column => $match_column)
{
if (isset($HTTP_POST_VARS["qe_".$image_column][$key]))
{
$search_words[$image_column] = stripslashes($HTTP_POST_VARS["qe_".$image_column][$key]);
if (KEYWORDS_NEW && $image_column == 'image_keywords')
{
$search_words[$image_column] = explode(','$search_words[$image_column]);
}
}
}
remove_searchwords($val);
add_searchwords($val$search_words);
}
$msg $lang['image_update_success'];
$action "findimages";
echo "<script language=javascript>\n showProgress();\n hideProgress();\n</script>";
show_table_header($lang['save_log']);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
echo "<b>".$lang['image_update_success']."</b>\n</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}



if (
$action == "editimage")
{
if ($msg != "")
{
printf("<b>%s</b>\n"$msg);
}
printf("<p>%s</p>\n"$lang['upload_note']);

$image_id = (isset($HTTP_POST_VARS['image_id'])) ? intval($HTTP_POST_VARS['image_id']) : (isset($HTTP_GET_VARS['image_id']) ? intval($HTTP_GET_VARS['image_id']) : 0);
$cat_image array_keys($cat_cache);
if (isset($cat_cache[$cat_image[0]]['cat_image']))
{
$sql "SELECT i.*, FROM_UNIXTIME(i.image_date) AS image_date, c.cat_image, b.image_name as cat_image_name, b.image_media_file as cat_image_media_file, b.image_thumb_file as cat_image_thumb_file
FROM "
.IMAGES_TABLE." i
LEFT JOIN "
.CATEGORIES_TABLE." c ON (c.cat_id = i.cat_id)
LEFT JOIN "
.IMAGES_TABLE." b ON (b.image_id = c.cat_image)
WHERE i.image_id = 
$image_id";
}
else
{
$sql "SELECT *, FROM_UNIXTIME(image_date) AS image_date
FROM "
.IMAGES_TABLE."
WHERE image_id = 
$image_id";
}
if ($image_id && $image_row $site_db->query_firstrow($sql))
{
$site_sess->set_session_var('back_url'ROOT_PATH."admin/images.php?action=editimage&".URL_IMAGE_ID."=".$image_id);
show_form_header("images.php""updateimage""form"1);
show_hidden_input("image_id"$image_id);
show_hidden_input("old_file_name"$image_row['image_media_file']);
show_hidden_input("old_thumb_file_name"$image_row['image_thumb_file']);
show_hidden_input("old_cat_id"$image_row['cat_id']); 
$name $lang['nav_images_edit'].": ";
$name .= "<a href=\"" $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" target=\"_blank\"><span class=\"tableheader\">";
$name .= format_text($image_row['image_name'], 2) . "</span></a>";
$name .= "<span class=\"tableheader\" style=\"font-weight: normal;\"> [ID: ".$image_row['image_id']."]</span>";
$name .= " &nbsp;<a href=\"".$site_sess->url(ROOT_PATH."admin/images.php?action=removeimage&".URL_IMAGE_ID."=".$image_id)."\"".($target " target=\"_blank\"" "")."><span class=\"tableheader\" style=\"font-weight: normal;\">[".$lang['delete']."]</span></a>";
show_table_header($name2);
$file_src get_file_path($image_row['image_media_file'], "media"$image_row['cat_id'], 1);
$height $imagesize;
$width $imagesize;
$file_size get_resize2($file_src$imagesize);
$width $file_size[0];
$height $file_size[1];
echo "<tr class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">";
$file_path get_file_path($image_row['image_media_file'], "media"$image_row['cat_id'], 00);
$file_path = ($file_path) ? $file_path : (($image_row['cat_id']) ? MEDIA_PATH."/".$image_row['cat_id'] : MEDIA_TEMP_PATH)."/".$image_row['image_media_file'];
echo $lang['image']."<br /><span class=\"smalltext\">(<a href=\"".$file_path."\" target=\"_blank\">".$image_row['image_media_file']."</a>)<br />".$file_size[2][0]."x".$file_size[2][1]."</span>"."</p>";
echo "</td>\n";
echo "<td>";
echo "<a href=\"" $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=\"_blank\">";
$user_info['ims_user_dim'] = $imagesize;
if ($use_media_template)
{
include_once(ROOT_PATH."includes/page_header.php");
echo str_replace("width=\"".$file_size[2][0]."\"""width=\"".$file_size[0]."\""str_replace("height=\"".$file_size[2][1]."\"""height=\"".$file_size[1]."\""get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode11)));
}
else
{
if (defined("IMS_DIR"))
{
$_file_src $site_sess->url(ROOT_PATH "multisizes.php?" URL_IMAGE_ID "=" $image_row['image_id'] . "&" IMS_URL_SIZE_TEMP "=" $imagesize);
}
else
{
$_file_src $file_src;
}
echo "<img src=\"".$_file_src."\" width=\"" $width "\" height=\"" $height "\" border=\"1\" alt=\"\">";
}
echo "</td>\n</tr>\n";

$value = (is_remote($image_row['image_media_file']) || is_local_file($image_row['image_media_file'])) ? $image_row['image_media_file'] : "";
show_upload_row($lang['image_file'], "file""<br /><span class=\"smalltext\">".$lang['allowed_mediatypes_desc'].str_replace(",",", ",$config['allowed_mediatypes'])."</span>"$value);
$image_resize 0;
$thumb_tools 0;
if (!$convert_options['convert_error'])
{
echo "<tr class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">";
echo $lang['image_resize'];
echo "</p>";
echo "</td>\n";
echo "<td>";
echo "<input type=\"radio\" name=\"image_resize\" value=\"1\"";
if ($image_resize)
{
echo " checked=\"checked\"";
}
echo "> ".$lang['yes']."&nbsp;&nbsp;&nbsp;\n";
echo "<input type=\"radio\" name=\"image_resize\" value=\"0\"";
if (!$image_resize)
{
echo " checked=\"checked\"";
}
echo "> ".$lang['no']." ";
echo "</td>";
echo "</tr>";
}
if (!empty($image_row['image_thumb_file']))
{
$file_path get_file_path($image_row['image_thumb_file'], "thumb"$image_row['cat_id'], 00);
$file_path = ($file_path) ? $file_path : (($image_row['cat_id']) ? THUMB_PATH."/".$image_row['cat_id'] : THUMB_TEMP_PATH)."/".$image_row['image_thumb_file'];
$thumb_src get_file_path($image_row['image_thumb_file'], "thumb"$image_row['cat_id'], 1);
show_image_row($lang['thumb']."<br /><span class=\"smalltext\">(<a href=\"".$file_path."\" target=\"_blank\">".$image_row['image_thumb_file']."</a>)</span>"$thumb_src1);
}
else
{
$file_type get_file_extension($image_row['image_media_file']);
show_image_row($lang['thumb']."<br /><span class=smalltext>(".$lang['no_thumb_found'].")</span>"ICON_PATH."/".$file_type.".gif"1);
}
$value = (is_remote($image_row['image_thumb_file']) || is_local_file($image_row['image_thumb_file'])) ? $image_row['image_thumb_file'] : "";
show_upload_row($lang['thumb_file'], "thumb_file""<br /><span class=\"smalltext\">".$lang['allowed_mediatypes_desc']." jpg, gif, png</span>"$value);
if (!$convert_options['convert_error'])
{
echo "<tr class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">";
echo $lang['thumb_tools_edit']."</p>";
echo "</td>\n";
echo "<td valign=\"middle\">";
echo "<select name=\"thumb_tools\">";
echo "<option value=\"0\" selected></option>";
echo "<option value=\"-1\"".($thumb_tools == -" selected" "").">".$lang['delete']."</option>";
echo "<option value=\"1\"".($thumb_tools == " selected" "").">".$lang['resize']."</option>";
echo "<option value=\"2\"".($thumb_tools == " selected" "").">".$lang['create_thumb']."</option>";
echo "</select>";
echo "</td>";
echo "</tr>";
}

show_input_row($lang['field_download_url'].$lang['download_url_desc'], "image_download_url"$image_row['image_download_url'], $textinput_size);

$title $lang['field_image_name'].((isset($file_src)) ? get_iptc_insert_link($file_src"object_name""image_name"0) : "");
show_input_row($title"image_name"$image_row['image_name'], $textinput_size);

$title $lang['field_description_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src"caption""image_description") : "");
show_textarea_row($title"image_description"$image_row['image_description'], $textarea_size);

$title $lang['field_keywords_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src"keyword""image_keywords") : "");
show_textarea_row($title"image_keywords"$image_row['image_keywords'], $textarea_size);

//    ob_start();
show_cat_select_row($lang['field_category'], $image_row['cat_id'], 3);
//    $dropdown = ob_get_contents();
//    ob_end_clean();
//    $dropdown = str_replace("name=\"cat_id\"", "name=\"cat_id\" onChange=\"document.getElementById('cat_image').style.display=(this.value != ".$image_row['cat_id'].")?'none':'block';\"", $dropdown);
//    echo $dropdown;
show_user_select_row($lang['user'], $image_row['user_id']);

$title $lang['field_date'].$lang['date_desc'].$lang['date_format'].((isset($file_src)) ? get_iptc_insert_link($file_src"date_created""image_date"0) : "");
if (EXIF_ENABLE && isset($file_src))
{
$title .= get_exif_insert_link($file_src"DateTimeOriginal""image_date"0"<br />");
$title .= get_exif_insert_link($file_src"DateTimeDigitized""image_date"0"<br />");
$title .= get_exif_insert_link($file_src"DateTime""image_date"0"<br />");
}
if (function_exists("show_date_input_row"))
show_date_input_row($title"image_date"$image_row['image_date'], $textinput_size);
else
show_input_row($title"image_date"$image_row['image_date'], $textinput_size);

show_radio_row($lang['field_free'], "image_active"$image_row['image_active']);
show_radio_row($lang['field_allow_comments'], "image_allow_comments"$image_row['image_allow_comments']);
show_input_row($lang['field_downloads'], "image_downloads"$image_row['image_downloads'], 10);
show_input_row($lang['field_votes'], "image_votes"$image_row['image_votes'], 10);
show_input_row($lang['field_rating'], "image_rating"$image_row['image_rating'], 10);
show_input_row($lang['field_hits'], "image_hits"$image_row['image_hits'], 10);
show_additional_fields("image"$image_rowIMAGES_TABLE);
if (isset($image_row['cat_image']))
{
$value = ($image_row['cat_image'] && $image_row['image_id'] == $image_row['cat_image']) ? 0;
if (isset($HTTP_POST_VARS['cat_image']))
{
$value $HTTP_POST_VARS['cat_image'];
}
echo "<tr class=\"".get_row_bg()."\" id=\"cat_image\">\n";
echo "<td><p class=\"rowtitle\">".$lang['cat_image'];
if ($image_row['cat_image'])
{
if (!get_file_path($image_row['cat_image_thumb_file'], "thumb"$image_row['cat_id'], 00))
{
$cat_image ICON_PATH."/".get_file_extension($image_row['cat_image_media_file']).".gif";
}
else
{
$cat_image get_file_path($image_row['cat_image_thumb_file'], "thumb"$image_row['cat_id'], 01);
}
$wh get_resize2($cat_image50);
echo "<br /><span class=\"smalltext\">".$lang['current_image']."<br /><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['cat_image'])."\" target=\"_blank\"><img src=\"".$cat_image."\" width=\"".$wh[0]."\" height=\"".$wh[1]."\" align=\"middle\"></a>&nbsp;<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['cat_image'])."\" target=\"_blank\">".$image_row['cat_image_name']."</a></span>";
}
echo "</p></td>\n<td><p>";
echo "<input type=\"radio\" name=\"cat_image\" value=\"".$image_row['image_id']."\"";
if ($value)
{
echo " checked=\"checked\"";
}
echo "> ".$lang['yes']."&nbsp;&nbsp;&nbsp;\n";
echo "<input type=\"radio\" name=\"cat_image\" value=\"0\"";
if (!$value)
{
echo " checked=\"checked\"";
}
echo "> ".$lang['no']." ";
echo "</p></td>\n</tr>";
show_hidden_input("cat_image_old"$image_row['cat_image']);
}
show_form_footer($lang['save_changes'], $lang['reset'], 2""" onClick='showProgress()'");
}
else
{
$action "modifyimages";
$error_log[] = $lang['no_image'];
}
}



if (
$action == "saveimages")
{
$date time();
$ip getenv("REMOTE_ADDR");
$error_msg "";
$num_newimages $HTTP_POST_VARS['num_newimages'];

$error = array();
for ($i 1$i <= $num_newimages$i++)
{
$image_name un_htmlspecialchars(trim($HTTP_POST_VARS['image_name_'.$i]));
$cat_id intval($HTTP_POST_VARS['cat_id_'.$i]);
$remote_file trim($HTTP_POST_VARS['remote_file_'.$i]);
$remote_thumb_file trim($HTTP_POST_VARS['remote_thumb_file_'.$i]);
$image_download_url trim($HTTP_POST_VARS['image_download_url_'.$i]);

if ($cat_id == 0)
{
$error['cat_id_'.$i] = 1;
}
if (((empty($HTTP_POST_FILES['file_'.$i]['tmp_name']) || $HTTP_POST_FILES['file_'.$i]['tmp_name'] == "none") && $remote_file == "") || ($remote_file != "" && !check_remote_media($remote_file) && !check_local_media($remote_file)))
{
$error['file_'.$i] = 1;
}
if ($remote_thumb_file != "" && !check_remote_thumb($remote_thumb_file) && !check_local_thumb($remote_thumb_file))
{
$error['remote_thumb_file_'.$i] = 1;
}
if ($image_download_url != "" && !is_remote($image_download_url) && !is_local_file($image_download_url))
{
$error['image_download_url_'.$i] = 1;
}

if (!empty($additional_image_fields))
{
foreach ($additional_image_fields as $key => $val)
{
if (isset($HTTP_POST_VARS[$key.'_'.$i]) && intval($val[2]) == && trim($HTTP_POST_VARS[$key.'_'.$i]) == "")
{
$error[$key.'_'.$i] = 1;
}
}
}
}

if (empty($error))
{
for ($i 1$i <= $num_newimages$i++)
{
$log = array();
$uploaderror 0;
$thumb "";
$image_name un_htmlspecialchars(trim($HTTP_POST_VARS['image_name_'.$i]));
$cat_id intval($HTTP_POST_VARS['cat_id_'.$i]);
$user_id = (intval($HTTP_POST_VARS['user_id_'.$i]) != 0) ? intval($HTTP_POST_VARS['user_id_'.$i]) : $user_info['user_id'];
$remote_file trim($HTTP_POST_VARS['remote_file_'.$i]);
$remote_thumb_file trim($HTTP_POST_VARS['remote_thumb_file_'.$i]);

//Upload Image
$file "file_".$i;
$remote_file trim($HTTP_POST_VARS['remote_file_'.$i]);
if (!empty($HTTP_POST_FILES[$file]['tmp_name']) && $HTTP_POST_FILES[$file]['tmp_name'] != "none")
{
$new_name $site_upload->upload_file($file"media"$cat_id);
if (!$new_name)
{
$log[] = "<b>".$lang['file_upload_error'].":</b> ".$HTTP_POST_FILES[$file]['name']."<br />".$site_upload->get_upload_errors();
$uploaderror 1;
}
else
{
$log[] = "<b>".$lang['file_upload_success'].":</b> ".$new_name;
}
$name $HTTP_POST_FILES[$file]['name'];
}
else
{
$new_name $name $remote_file;
}
$name str_replace(" ""_"$name);
$name str_replace("%20""_"$name);
$name get_file_name(trim(basename($name)));

if ($image_name === "")
{
$image_name $name;
}
if ($image_name === "")
{
$error['image_name_'.$i] = 1;
continue;
}

//Upload Thumbnail if exists
$thumb_file "thumb_file_".$i;
$remote_thumb_file trim($HTTP_POST_VARS['remote_thumb_file_'.$i]);
$new_thumb_name "";
if (!empty($HTTP_POST_FILES[$thumb_file]['tmp_name']) && $HTTP_POST_FILES[$thumb_file]['tmp_name'] != "none" && !$uploaderror)
{
$new_thumb_name $site_upload->upload_file($thumb_file"thumb"$cat_idget_basefile($new_name));
if (!$new_thumb_name)
{
$log[] = "<b>".$lang['thumb_upload_error'].":</b> ".$HTTP_POST_FILES[$thumb_file]['name']."<br />".$site_upload->get_upload_errors();
@unlink(MEDIA_PATH."/".$cat_id."/".$new_name);
$log[] = $lang['error_image_deleted'];
$uploaderror 1;
}
else
{
$log[] = "<b>".$lang['thumb_upload_success'].":</b> ".$new_thumb_name;
}
}
else
{
$new_thumb_name $remote_thumb_file;
}

if (empty($uploaderror) && !$convert_options['convert_error'])
{
$image_resize = (isset($HTTP_POST_VARS['image_resize_'.$i])) ? intval($HTTP_POST_VARS['image_resize_'.$i]) : 0;
$thumb_tools = (isset($HTTP_POST_VARS['thumb_tools_'.$i])) ? intval($HTTP_POST_VARS['thumb_tools_'.$i]) : 0;
if ($image_resize)
{
@set_time_limit(90);
$file MEDIA_PATH."/".$cat_id."/".$new_name;
if (!$image_info getimagesize($file))
{
$log[] = "<b>".$lang['image_resize_error']."</b>";
}
else
{

if ($image_info[2] && $image_info[2] < 4)
{
if ($image_info[0] > $image_resize_width || $image_info[1] > $image_resize_height)
{
if (resize_image($file$image_resize_quality$image_resize_width$image_resize_type$image_resize_height))
{
$image_info2 getimagesize($file);
$log[] = sprintf($lang['image_resize_success'], $image_info[0], $image_info[1], $image_info2[0], $image_info2[1]);
}
else
{
$log[] = "<b>".$lang['image_resize_error']."</b>";
}
}
else
{
$log[] = "<b>".$lang['image_resize_skipped']."</b>";
}
}
else
{
$log[] = "<b>".$lang['image_resize_skipped']."</b>";
}
}
}
if ($thumb_tools)
{
$type = ($thumb_tools == 1) ? "resize" "create";
if (($new_thumb_name === "" || $thumb_tools == 2) && file_exists(MEDIA_PATH."/".$cat_id."/".$new_name))
{
if (file_exists(THUMB_PATH."/".$cat_id."/".$new_name))
{
unlink(THUMB_PATH."/".$cat_id."/".$new_name);
}

if (copy(MEDIA_PATH."/".$cat_id."/".$new_nameTHUMB_PATH."/".$cat_id."/".$new_name))
{
chmod(THUMB_PATH."/".$cat_id."/".$new_nameCHMOD_FILES);
$new_thumb_name $new_name;
$type "create";
}

}
if ($new_thumb_name !== "")
{
@set_time_limit(90);
$file THUMB_PATH."/".$cat_id."/".$new_thumb_name;
if (!$image_info getimagesize($file))
{
$log[] = "<b>".$lang['thumb_'.$type.'_error']."</b>";
}
else
{
if ($image_info[2] && $image_info[2] < 4)
{
if ($image_info[0] > $thumb_resize_dimension || $image_info[1] > $thumb_resize_dimension)
{
@unlink($file.".bak");
if (resize_image($file$thumb_resize_quality$thumb_resize_dimension$thumb_resize_type))
{
$image_info2 getimagesize($file);
$log[] = "<b>".$lang['thumb_'.$type.'_success']."</b>";
}
else
{
$log[] = "<b>".$lang['thumb_'.$type.'_error']."</b>";
}
}
else
{
$log[] = "<b>".$lang['thumb_'.$type.'_skipped']."</b>";
}
}
else
{
$log[] = "<b>".$lang['thumb_'.$type.'_skipped']."</b>";
}
}
}
}
}
//Save to Database
if (!$uploaderror)
{
$image_description un_htmlspecialchars(trim($HTTP_POST_VARS['image_description_'.$i]));
if (KEYWORDS_NEW)
{
$image_keywords un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords_'.$i]));
$image_keywords preg_replace("/[\n\r]/is"","$image_keywords);
$image_keywords_arr explode(','$image_keywords);
array_walk($image_keywords_arr'trim_value');
$image_keywords implode(','array_unique(array_filter($image_keywords_arr)));
}
else
{
$image_keywords un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords_'.$i]));
$image_keywords preg_replace("/[\n\r]/is"" "$image_keywords);
$image_keywords str_replace(","," ",$image_keywords);
$image_keywords preg_replace("/( ){2,}/"" "$image_keywords);
}
$HTTP_POST_VARS['image_keywords_'.$i] = $image_keywords;
$image_active trim($HTTP_POST_VARS['image_active_'.$i]);
$image_allow_comments trim($HTTP_POST_VARS['image_allow_comments_'.$i]);

$image_download_url trim($HTTP_POST_VARS['image_download_url_'.$i]);

$additional_field_sql "";
$additional_value_sql "";
if (!empty($additional_image_fields))
{
foreach ($additional_image_fields as $key => $val)
{
if (isset($HTTP_POST_VARS[$key.'_'.$i]) && isset($table_fields[$key]))
{
$additional_field_sql .= ", $key";
$additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key.'_'.$i]))."'";
}
}
}
$current_time time();
$sql "INSERT INTO ".IMAGES_TABLE."
(cat_id, user_id, image_name, image_description, image_keywords, image_date, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments"
.$additional_field_sql.")
VALUES
(
$cat_id$user_id, '$image_name', '$image_description', '$image_keywords', $current_time$image_active, '$new_name', '$new_thumb_name', '$image_download_url', $image_allow_comments".$additional_value_sql.")";
$result $site_db->query($sql);
$image_id $site_db->get_insert_id();

if ($result)
{
$search_words = array();
foreach ($search_match_fields as $image_column => $match_column)
{
if (isset($HTTP_POST_VARS[$image_column.'_'.$i]))
{
$search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column.'_'.$i]);
if (KEYWORDS_NEW && $image_column == 'image_keywords')
{
$search_words[$image_column] = explode(','$search_words[$image_column]);
}
}
}
add_searchwords($image_id$search_words);
$name "";
if ($new_thumb_name)
{
$thumb_src ROOT_PATH.THUMB_DIR."/".$cat_id."/".$new_thumb_name;
$width $thumbsize;
$height $thumbsize;
$thumb_size get_resize2($thumb_src$thumbsize);
$width $thumb_size[0];
$height $thumb_size[1];

$thumb "<img src=\"".((is_remote($new_thumb_name)) ? $new_thumb_name $thumb_src)."\" width=\"".$width."\" height=\"".$height."\" border=\"1\" alt=\"\" hspace=\"5\" vspace=\"3\" align=\"left\" />";
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" target=_blank>" $thumb "</a>";
}
$name .= "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" target=_blank>" format_text(stripslashes($image_name), 2) . "</a>";
$log[] = "<b>".$lang['image_add_success'].":</b> ".$name." (".$new_name.") &nbsp;<a href=\"".$site_sess->url(ROOT_PATH."admin/images.php?action=editimage&".URL_IMAGE_ID."=".$image_id)."\"".($target " target=\"_blank\"" "").">[".$lang['edit']."]</a>";
}
else
{
$log[] = "<b>".$lang['image_add_error'].":</b> ".format_text(stripslashes($image_name), 2)." (".$new_name.")";
}
}
else
{
$log[] = $lang['no_db_entry'];
}
show_table_header($lang['image'].$i"1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\"><tr><td>\n";
echo $thumb;
foreach ($log as $val)
{
echo $val."<br />";
}
echo "</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
//      echo "<br />";
}
}
echo "<script language=javascript>\n showProgress();\n hideProgress();\n</script>";
if (!empty($error))
{
$msg sprintf("<span class=\"marktext\">%s</span>"$lang['lostfield_error']);
}
$action "addimages";
}



if (
$action == "addimages")
{
if (isset($HTTP_GET_VARS['num_newimages']) || isset($HTTP_POST_VARS['num_newimages']))
{
$num_newimages = (isset($HTTP_GET_VARS['num_newimages'])) ? intval($HTTP_GET_VARS['num_newimages']) : intval($HTTP_POST_VARS['num_newimages']);
}
else
{
$num_newimages 1;
}

if ($msg != "")
{
printf("<b>%s</b>\n"$msg);
}

printf("<p>%s</p>\n"$lang['upload_note']);

show_form_header("images.php""saveimages""form"1);
show_table_header($lang['nav_images_add'], 2);
_show_num_select_row("&nbsp;""num_newimages"$lang['num_addnewimages_desc'], $num_newimages_max);

for ($i 1$i <= $num_newimages$i++)
{
show_table_separator($lang['image']." ".$i2);
show_upload_row($lang['image'], "file_".$i"<br /><span class=smalltext>".$lang['allowed_mediatypes_desc'].str_replace(",",", ",$config['allowed_mediatypes'])."</span>");
$image_resize = (isset($image_resize)) ? $image_resize $image_resize_default;
$thumb_tools = (isset($thumb_tools)) ? $thumb_tools $thumb_tools_default;
if (!$convert_options['convert_error'])
{
echo "<tr class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">";
echo $lang['image_resize'];
echo "</p>";
echo "</td>\n";
echo "<td>";
echo "<input type=\"radio\" name=\"image_resize_".$i."\" value=\"1\"";
if ($image_resize)
{
echo " checked=\"checked\"";
}
echo "> ".$lang['yes']."&nbsp;&nbsp;&nbsp;\n";
echo "<input type=\"radio\" name=\"image_resize_".$i."\" value=\"0\"";
if (!$image_resize)
{
echo " checked=\"checked\"";
}
echo "> ".$lang['no']." ";
echo "</td>";
echo "</tr>";
}
show_upload_row($lang['thumb'], "thumb_file_".$i"<br /><span class=smalltext>".$lang['allowed_mediatypes_desc']." jpg, gif, png</span>");
if (!$convert_options['convert_error'])
{
echo "<tr class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">";
echo $lang['thumb_tools_add']."</p>";
echo "</td>\n";
echo "<td valign=\"middle\">";
echo "<select name=\"thumb_tools_".$i."\">";
echo "<option value=\"0\" selected></option>";
echo "<option value=\"1\"".($thumb_tools == " selected" "").">".$lang['resize']."</option>";
echo "<option value=\"2\"".($thumb_tools == " selected" "").">".$lang['create_thumb']."</option>";
echo "</select>";
echo "</td>";
echo "</tr>";
}
show_input_row($lang['field_download_url'].$lang['download_url_desc'], "image_download_url_".$i""$textinput_size);
show_input_row($lang['field_image_name'], "image_name_".$i""$textinput_size);
show_textarea_row($lang['field_description_ext'],"image_description_".$i""$textarea_size);
show_textarea_row($lang['field_keywords_ext'], "image_keywords_".$i""$textarea_size);
show_cat_select_row($lang['field_category'], 03$i);
show_user_select_row($lang['user'], $user_info['user_id'], $i);
show_radio_row($lang['field_free'], "image_active_".$i1);
show_radio_row($lang['field_allow_comments'], "image_allow_comments_".$i1);
show_additional_fields("image", array(), IMAGES_TABLE$i);
}
show_hidden_input("num_newimages"$num_newimages);
show_form_footer($lang['add'], $lang['reset'], 2""" onClick='showProgress()'");
}
if (isset(
$HTTP_GET_VARS['presetload'])|| isset($HTTP_POST_VARS['presetload']))
{
if (isset($HTTP_POST_VARS['preset']) && $HTTP_POST_VARS['preset'])
{
$preset trim($HTTP_POST_VARS['preset']);
}
elseif (isset($HTTP_GET_VARS['preset']) && $HTTP_GET_VARS['preset'])
{
$preset trim($HTTP_GET_VARS['preset']);
}
else
{
$msg .= $lang['preset_load_error'];
}

if (!isset($presets[$preset]))
{
$preset $presets['_default_'];
}
else
{
foreach($presets['default'] as $key => $val)
{
if (!isset($presets[$preset][$key]))
{
$presets[$preset][$key] = $val;
}
}
}
$HTTP_POST_VARS = array();
$action "modifyimages";
}
elseif (isset(
$HTTP_GET_VARS['presetdelete']) || isset($HTTP_POST_VARS['presetdelete']))
{
if (isset($HTTP_POST_VARS['preset']) && $HTTP_POST_VARS['preset'])
{
$preset_name trim($HTTP_POST_VARS['preset']);
}
elseif (isset($HTTP_GET_VARS['preset']) && $HTTP_GET_VARS['preset'])
{
$preset_name trim($HTTP_GET_VARS['preset']);
}
else
{
$msg .= $lang['preset_delete_error'];
}
if ($preset_name == "default" || !isset($presets[$preset_name]))
{
$msg .= $lang['preset_delete_error'];
}
else
{
unset($presets[$preset_name]);
if ($preset_name == $presets['_default_'])
{
$presets['_default_'] = "default";
}
$preset $presets['_default_'];
preset_save();
}
$HTTP_POST_VARS = array();
$action "modifyimages";
}
elseif (isset(
$HTTP_POST_VARS['presetsave']))
{
$preset_name "";
$action "modifyimages";
if (isset($HTTP_POST_VARS['presetnew']) && $HTTP_POST_VARS['presetnew'])
{
$preset_name trim($HTTP_POST_VARS['presetnew']);
}

if ($preset_name == "default")
{
$preset_name "";
}
if ($preset_name)
{
unset($presets[$preset_name]);
foreach($presets['default'] as $key => $val)
{
if ($key == "quickedit")
{
$presets[$preset_name][$key] = array("", (isset($HTTP_POST_VARS[$key]) ? $HTTP_POST_VARS[$key] : array()));
continue;
}
if ($val[0])
{
$presets[$preset_name][$key] = array($val[0], $HTTP_POST_VARS[$key]);
switch($val[0])
{
case "int":
if (trim($presets[$preset_name][$key][1]) !== "")
$presets[$preset_name][$key][1] = (int)trim($presets[$preset_name][$key][1]);
break;

case "trim":
$presets[$preset_name][$key][1] = trim($presets[$preset_name][$key][1]);
break;
case "bool":
$presets[$preset_name][$key][1] = trim($presets[$preset_name][$key][1]) ? 0;
break;
default:
break;
}
continue;
}
$array = array();
foreach($val[1] as $key2 => $val2)
{
if (is_array($val2))
{
$array[$key2] = array($val2[0], @$HTTP_POST_VARS[$key2]);
}
else
{
$array[$key2] = @$HTTP_POST_VARS[$key2];
}
}
$presets[$preset_name][$key] = array(""$array);
}
$preset $preset_name;
$presets['_default_'] = (isset($HTTP_POST_VARS['presetdefault']) && intval($HTTP_POST_VARS['presetdefault'])) ? $preset : ($presets['_default_'] == $preset "default" $presets['_default_']);
if ($action == "modifyimages")
{
$HTTP_POST_VARS = array();
}
preset_save();
}
else
{
$msg .= $lang['preset_save_error'];

}
}


if (
$action == "modifyimages")
{
if (!empty($error_log))
{
show_table_header($lang['error_log'], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
echo "<b>".$lang['error_log_desc']."</b>\n<ul>\n";
foreach ($error_log as $val)
{
printf("<li>%s</li>\n"$val);
}
echo "</ul>\n</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}
if (!empty($msg))
{
show_table_header($lang['msg'], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
echo "<b>".$msg."</b>\n</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}
$last_image_id_type $presets[$preset]['image_id_type'][1];
$last_image_name_type $presets[$preset]['image_name_type'][1];
$last_image_description_type $presets[$preset]['image_description_type'][1];
$last_image_keywords_type $presets[$preset]['image_keywords_type'][1];
$last_user_id_type $presets[$preset]['user_id_type'][1];
$last_user_name_type $presets[$preset]['user_name_type'][1];
$last_image_media_file_type $presets[$preset]['image_media_file_type'][1];
$last_image_thumb_file_type $presets[$preset]['image_thumb_file_type'][1];
$last_cat_id_type $presets[$preset]['cat_id_type'][1];
$last_cat_id $presets[$preset]['cat_id'][1];
$last_image_active $presets[$preset]['image_active'][1];
$last_orderby $presets[$preset]['orderby'][1];
$last_direction $presets[$preset]['direction'][1];
$last_limitnumber $presets[$preset]['limitnumber'][1];
$last_quickedit $presets[$preset]['quickedit'][1];
show_form_header("images.php""findimages""form");
show_table_header($lang['nav_images_edit'], 2);
show_input_row_type($lang['field_image_id_contains'], "image_id"$presets[$preset]['image_id'][1], $textinput_size, array($last_image_id_type"int"), 10);
show_input_row_type($lang['field_image_name_contains'], "image_name"$presets[$preset]['image_name'][1], $textinput_size, array($last_image_name_type""), 10);
show_input_row_type($lang['field_description_contains'], "image_description"$presets[$preset]['image_description'][1], $textinput_size, array($last_image_description_type""), 10);
show_input_row_type($lang['field_keywords_contains'], "image_keywords"$presets[$preset]['image_keywords'][1], $textinput_size, array($last_image_keywords_type""), 10);
show_cat_select_row_type($lang['field_category'], $last_cat_id20$last_cat_id_type10$presets[$preset]['subcat'][1]);
show_input_row_type($lang['user_id_contains'], "user_id"$presets[$preset]['user_id'][1], $textinput_size, array($last_user_id_type"int"), 10);
show_input_row_type($lang['field_username_contains'], "user_name"$presets[$preset]['user_name'][1], $textinput_size, array($last_user_name_type""), 10);
show_radio_row($lang['image_active'], "image_active"$last_image_active);
show_input_row_type($lang['field_image_file_contains'], "image_media_file"$presets[$preset]['image_media_file'][1], $textinput_size, array($last_image_media_file_type""), 10);
show_input_row_type($lang['field_thumb_file_contains'], "image_thumb_file"$presets[$preset]['image_thumb_file'][1], $textinput_size, array($last_image_thumb_file_type""), 10);
if (function_exists("show_date_input_row"))
show_date_input_row($lang['field_date_after'].$lang['date_format'], "dateafter"$presets[$preset]['dateafter'][1], $textinput_size);
else
show_input_row($lang['field_date_after'].$lang['date_format'], "dateafter"$presets[$preset]['dateafter'][1], $textinput_size);

if (function_exists("show_date_input_row"))
show_date_input_row($lang['field_date_before'].$lang['date_format'], "datebefore"$presets[$preset]['datebefore'][1], $textinput_size);
else
show_input_row($lang['field_date_before'].$lang['date_format'], "datebefore"$presets[$preset]['datebefore'][1], $textinput_size);

show_input_row($lang['field_downloads_upper'], "downloadsupper"$presets[$preset]['downloadsupper'][1], $textinput_size);
show_input_row($lang['field_downloads_lower'], "downloadslower"$presets[$preset]['downloadslower'][1], $textinput_size);
show_input_row($lang['field_rating_upper'], "ratingupper"$presets[$preset]['ratingupper'][1], $textinput_size);
show_input_row($lang['field_rating_lower'], "ratinglower"$presets[$preset]['ratinglower'][1], $textinput_size);
show_input_row($lang['field_votes_upper'], "votesupper"$presets[$preset]['votesupper'][1], $textinput_size);
show_input_row($lang['field_votes_lower'], "voteslower"$presets[$preset]['voteslower'][1], $textinput_size);
show_input_row($lang['field_hits_upper'], "hitsupper"$presets[$preset]['hitsupper'][1], $textinput_size);
show_input_row($lang['field_hits_lower'], "hitslower"$presets[$preset]['hitslower'][1], $textinput_size);
if (!empty($additional_image_fields))
{
show_table_separator($lang['additional_fields'], 2);
}
foreach ($additional_image_fields as $key => $val)
{
if (!isset($table_fields[$key]) || (isset($additional_image_fields_settings[$key][0]) && !$additional_image_fields_settings[$key][0]))
continue;

$type = (isset($presets[$preset]['additional_fields'][1][$key."_type"][1])) ? (int)$presets[$preset]['additional_fields'][1][$key."_type"][1] : 0;
$value "";
switch($val[1])
{
case "radio":
$value = (isset($presets[$preset]['additional_fields'][1][$key][1])) ? $presets[$preset]['additional_fields'][1][$key][1] : "";

$value = ($value === "") ? $value;
show_radio_row_type($val[0], $key$value$type01);
break;

case "dropdown":
$value = (isset($presets[$preset]['additional_fields'][1][$key][1])) ? $presets[$preset]['additional_fields'][1][$key][1] : "";

show_user_dropdown_row_type($key$val$value, array($type"dropdown"), 01);
break;

case "text":
case "textarea":
default:
$value "";
$value = (isset($presets[$preset]['additional_fields'][1][$key][1])) ? $presets[$preset]['additional_fields'][1][$key][1] : "";
show_input_row_type($val[0], $key$value$textinput_size, array($type"text"), 11);
break;
// end switch
$fields[$key] = $value;
$fields[$key "_type"] = $type;
}

show_table_separator($lang['sort_options'], 2);
?>

<tr class="<?php echo get_row_bg(); ?>"><td><p><b><?php echo $lang['order_by'?></b></p></td><td><p>
<select name="orderby">
<?php
$sort_array = array(
"i.image_name"        => $lang['field_image_name'],
"i.image_name"        => $lang['field_image_name'],
"i.image_media_file"  => $lang['field_image_file'],
"i.image_thumb_file"  => $lang['field_thumb_file'],
"i.cat_id"            => $lang['field_category'],
"i.image_date"        => $lang['field_date'],
"i.image_downloads"   => $lang['field_downloads'],
"i.image_rating"      => $lang['field_rating'],
"i.image_votes"       => $lang['field_votes'],
"i.image_hits"        => $lang['field_hits'],
);
foreach($sort_array as $key => $val)
{
echo '<option value="'.$key.'"'.($key == $last_orderby " selected" :"").'>'.$val.'</option>';
}
?>

</select>
<select name="direction">
<option value="ASC"<?=($last_direction == "ASC" ? " selected" : "")?>><?php echo $lang['asc'?></option>
<option value="DESC"<?=($last_direction == "DESC" ? " selected" : "")?>><?php echo $lang['desc'?></option>
</select>
</p></td></tr>
<?php
show_input_row($lang['results_per_page'], "limitnumber"$last_limitnumber);
if ($quickedit_checkboxes)
{
show_table_separator($lang['quick_edit']."</td><td><input name=\"allbox\" type=\"checkbox\" onClick=\"CheckAll();\" style=\"margin: 0; height: 12px;\" />"1);
}
else
{
show_table_separator($lang['quick_edit'], 2);
}

$i 0;
if (!is_array($last_quickedit))
$last_quickedit explode("|"$last_quickedit);

echo "<tr class=\"".get_row_bg()."\">\n";
echo "<td><p class=\"rowtitle\">".$lang['quick_edit_fields'];
if (!$quickedit_checkboxes)
{
echo "<br />".$lang['quick_edit_fields_exp'];
}
echo "</p></td>\n";
echo "<td><div".($quickedit_checkboxes && $quickedit_checkboxes_height " style=\"height:".$quickedit_checkboxes_height."px;overflow:auto;\"" "").">";
if (!$quickedit_checkboxes)
{
echo "<table><tr><td>";
echo "<select name=\"quickedit[]\" multiple size=\"10\" width=\"20\" />\n";
//    echo "<option value=\"\"></option>\n";
}
$i 0;
foreach ($quickedit_fields_all as $field => $val)
{
if ($quickedit_checkboxes)
{
$select = (in_array($field$last_quickedit)) ? " checked" "";
echo "<label for=\"quickedit[$i]\"><input type=\"checkbox\" name=\"quickedit[]\" id=\"quickedit[$i]\" value=\"".$field."\" ".$select.">".$val[0]."</label><br />\n";
}
else
{
$select = (in_array($field$last_quickedit) || (isset($HTTP_POST_VARS['quickedit']) && in_array($field$HTTP_POST_VARS['quickedit']))) ? " selected" "";
echo "<option value=\"".$field."\" ".$select.">".$val[0]."</option>\n";
}
$i++;
}
if (!$quickedit_checkboxes)
{
echo "</select>";
echo "</td><td valign=\"top\">";
echo "<a href=\"#\" onClick=\"for(i=0;i<this.parentNode.parentNode.getElementsByTagName('select')[0].options.length;i++)this.parentNode.parentNode.getElementsByTagName('select')[0].options[i].selected=true;return false;\">".$lang['select_all']."</a><br />";
echo "<a href=\"#\" onClick=\"for(i=0;i<this.parentNode.parentNode.getElementsByTagName('select')[0].options.length;i++)this.parentNode.parentNode.getElementsByTagName('select')[0].options[i].selected=false;return false;\">".$lang['select_none']."</a><br />";
echo "</td></tr></table>";
}
echo "</div></td>\n</tr>";
show_table_separator($lang['presets']." <span style=\"font-weight: normal;\">(".$lang['preset_loaded'].": <b>".(($preset == "default") ? $lang['default'] : $preset)."</b>)</span>"2);
echo "<tr class=\"".get_row_bg()."\">\n";
echo "<td><p class=\"rowtitle\">";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"rowtitle\"><td width=\"100%\">".$lang['preset_save']."</td>";
echo "<td><input type=\"checkbox\" name=\"presetdefault\" value=\"1\"".(($preset == $presets['_default_']) ? " checked" "")." /></td></table>";
echo "</p></td>\n";
echo "<td>";
echo "<input name=\"presetnew\" value=\"".($preset == "default" "" str_replace("\"""&quot;"$preset))."\" />";
echo "&nbsp;<input type=\"submit\" name=\"presetsave\" value=\" ".$lang['save']." \" onClick=\"return (this.form.presetnew.value&&this.form.presetnew.value!='default') ? true : false;\"class=\"button\" />\n";
$options "";
foreach($presets as $key => $val)
{
if ($key == "default" || $key == "_default_")
continue;
$key str_replace(array("\"""<"">"), array("&quot;""&lt;""&gt;"), $key);
$options .= "<option value=\"".$key."\"".(($key == $preset) ? " selected" "").">".$key."</option>";
}
if ($options)
{
echo "&nbsp;<select name=\"preset\" onChange=\"if(this.value!='default')this.form.presetnew.value=this.value;this.form.presetdefault.checked=(this.value=='".str_replace(array("\"""'"), array("&quot;""\'"), $presets['_default_'])."');\">";
//    echo "<option value=\"\"".(($preset == "default" || $preset == "_default_") ? "" : " selected")."></option>";
echo "<option value=\"default\"".(($preset == "default" || $preset == "_default_") ? "" " selected").">".$lang['default']."</option>";
//    echo "<option value=\"default\">".$lang['default']."</option>";
echo $options;
echo "</select>";
echo "&nbsp;<input type=\"submit\" name=\"presetload\" value=\" ".$lang['load']." \" onClick=\"return (this.form.preset.value) ? true : false;\"class=\"button\" />\n";
echo "&nbsp;<input type=\"submit\" name=\"presetdelete\" value=\" ".$lang['delete']." \" onClick=\"return (this.form.preset.value&&this.form.preset.value!='default') ? true : false;\"class=\"button\" />\n";
}
echo "</td>";
echo "</tr>";
/*
if ($savesearchform)
{
*/
echo "<tr class=\"tablefooter\">\n<td colspan=\"2\" align=\"center\">\n&nbsp;";
echo "<input type=\"submit\" value=\"  ".$lang['search']."  \" class=\"button\">\n";
echo "<input type=\"submit\" name=\"action2\" value=\"  ".$lang['reset']."  \" class=\"button\">\n";
echo "&nbsp;\n</td>\n</tr>\n</table>\n</td>\n</tr>\n</table>\n</form>\n";
/*
}
else
{
show_form_footer($lang['search'], $lang['reset'], 2);
}
*/
}



if (
$action == "findimages")
{
if (!empty($error_log))
{
show_table_header($lang['error_log'], 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
echo "<b>".$lang['error_log_desc']."</b>\n<ul>\n";
foreach ($error_log as $val)
{
printf("<li>%s</li>\n"$val);
}
echo "</ul>\n</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
}
$condition "1=1";

$image_id intval($HTTP_POST_VARS['image_id']);
$image_id_type =  (isset($HTTP_POST_VARS["image_id_type"]) && (int)$HTTP_POST_VARS["image_id_type"]) ? (int)$HTTP_POST_VARS["image_id_type"] : 0;
if ($image_id != "" || $image_id_type != -1)
{
$cond "";
if ($image_id_type)
{
if ($cond get_type_condition($image_id_type"text""int"10, array("i.image_id"$image_id)))
{
$cond " AND " $cond;
}
}
if ($cond)
{
$condition .= $cond;
}
else
{
$condition .= " AND INSTR(i.image_id,'$image_id')>0";
}
}
$image_name trim($HTTP_POST_VARS['image_name']);
$image_name_type =  (isset($HTTP_POST_VARS["image_name_type"]) && (int)$HTTP_POST_VARS["image_name_type"]) ? (int)$HTTP_POST_VARS["image_name_type"] : 0;
if ($image_name != "" || $image_name_type != -1)
{
$cond "";
if ($image_name_type)
{
if ($cond get_type_condition($image_name_type"text""text"10, array("i.image_name"strtolower($image_name))))
{
$cond " AND " $cond;
}
}
if ($cond)
{
$condition .= $cond;
}
else
{
$condition .= " AND INSTR(LCASE(i.image_name),'".strtolower($image_name)."')>0";
}
}
$user_name trim($HTTP_POST_VARS['user_name']);
$user_name_type = (isset($HTTP_POST_VARS["user_name_type"]) && (int)$HTTP_POST_VARS["user_name_type"]) ? (int)$HTTP_POST_VARS["user_name_type"] : 0;
if ($user_name != "" || $user_name_type != -1)
{
$cond "";
if ($user_name_type)
{
if ($cond get_type_condition($user_name_type"text""text"10, array("u.user_name"strtolower($user_name))))
{
$cond " AND " $cond;
}
}
if ($cond)
{
$condition .= $cond;
}
else
{
$condition .= " AND INSTR(LCASE(u.user_name),'".strtolower($user_name)."')>0";
}
}
$user_id intval($HTTP_POST_VARS['user_id']);
$user_id_type = (isset($HTTP_POST_VARS["user_id_type"]) && (int)$HTTP_POST_VARS["user_id_type"]) ? (int)$HTTP_POST_VARS["user_id_type"] : 0;
if ($user_id != "" || $user_id_type != -1)
{
$cond "";
if ($user_id_type)
{
if ($cond get_type_condition($user_id_type"text""int"10, array("i.user_id"$user_id)))
{
$cond " AND " $cond;
}
}
if ($cond)
{
$condition .= $cond;
}
else
{
$condition .= " AND INSTR(i.user_id,'$user_id')>0";
}
}
$image_description trim($HTTP_POST_VARS['image_description']);
$image_description_type = (isset($HTTP_POST_VARS["image_description_type"]) && (int)$HTTP_POST_VARS["image_description_type"]) ? (int)$HTTP_POST_VARS["image_description_type"] : 0;
if ($image_description != "" || $image_description_type != -1)
{
$cond "";
if ($image_description_type)
{
if ($cond get_type_condition($image_description_type"text""text"10, array("i.image_description"strtolower($image_description))))
{
$cond " AND " $cond;
}
}
if ($cond)
{
$condition .= $cond;
}
else
{
$condition .= " AND INSTR(LCASE(i.image_description),'".strtolower($image_description)."')>0";
}
}
$image_keywords trim($HTTP_POST_VARS['image_keywords']);
$image_keywords_type =  (isset($HTTP_POST_VARS["image_keywords_type"]) && (int)$HTTP_POST_VARS["image_keywords_type"]) ? (int)$HTTP_POST_VARS["image_keywords_type"] : 0;
if ($image_keywords != "" || $image_keywords_type != -1)
{
$cond "";
if ($image_keywords_type)
{
if ($cond get_type_condition($image_keywords_type"text""text"10, array("i.image_keywords"strtolower($image_keywords))))
{
$cond " AND " $cond;
}
}
if ($cond)
{
$condition .= $cond;
}
else
{
$condition .= " AND INSTR(LCASE(i.image_keywords),'".strtolower($image_keywords)."')>0";
}
}
$cat_id intval(trim($HTTP_POST_VARS['cat_id']));
$cat_id_type =  (isset($HTTP_POST_VARS["cat_id_type"]) && (int)$HTTP_POST_VARS["cat_id_type"]) ? (int)$HTTP_POST_VARS["cat_id_type"] : 0;
$subcat = isset($HTTP_POST_VARS['subcat']);
if ($cat_id != && $cat_id != "" || $cat_id_type != -1)
{
$cond "";
if ($cat_id_type)
{
if ($cond get_type_condition($cat_id_type"text""dropdown"10, array("i.cat_id"$cat_id)))
{
$cond " AND " $cond;
}
}
if ($cond)
{
$condition .= $cond;
}
else
{
if ($subcat)
{
$subcat_ids = array();
get_subcat_ids($cat_id$cat_id$cat_parent_cache);
if (@$subcat_ids[$cat_id])
{
$subcats "," implode(","$subcat_ids[$cat_id]);
}
}
$condition .= " AND i.cat_id IN($cat_id$subcats)";
}
}
$image_media_file trim($HTTP_POST_VARS['image_media_file']);
$image_media_file_type =  (isset($HTTP_POST_VARS["image_media_file_type"]) && (int)$HTTP_POST_VARS["image_media_file_type"]) ? (int)$HTTP_POST_VARS["image_media_file_type"] : 0;
if ($image_media_file != "" || $image_media_file_type != -1)
{
$cond "";
if ($image_media_file_type)
{
if ($cond get_type_condition($image_media_file_type"text""text"10, array("i.image_media_file"strtolower($image_media_file))))
{
$cond " AND " $cond;
}
}
if ($cond)
{
$condition .= $cond;
}
else
{
$condition .= " AND INSTR(LCASE(i.image_media_file),'".strtolower($image_media_file)."')>0";
}
}
$image_thumb_file trim($HTTP_POST_VARS['image_thumb_file']);
$image_thumb_file_type =  (isset($HTTP_POST_VARS["image_thumb_file_type"]) && (int)$HTTP_POST_VARS["image_thumb_file_type"]) ? (int)$HTTP_POST_VARS["image_thumb_file_type"] : 0;
if ($image_thumb_file != "" || $image_thumb_file_type != -1)
{
$cond "";
if ($image_thumb_file_type)
{
if ($cond get_type_condition($image_thumb_file_type"text""text"10, array("i.image_thumb_file"strtolower($image_thumb_file))))
{
$cond " AND " $cond;
}
}
if ($cond)
{
$condition .= $cond;
}
else
{
$condition .= " AND INSTR(LCASE(i.image_thumb_file),'".strtolower($image_thumb_file)."')>0";
}
}
$dateafter trim($HTTP_POST_VARS['dateafter']);
if ($dateafter != "")
{
$condition .= " AND i.image_date > UNIX_TIMESTAMP('$dateafter')";
}
$datebefore trim($HTTP_POST_VARS['datebefore']);
if ($datebefore != "")
{
$condition .= " AND i.image_date < UNIX_TIMESTAMP('$datebefore')";
}
$downloadslower trim($HTTP_POST_VARS['downloadslower']);
if ($downloadslower != "")
{
$condition .= " AND i.image_downloads < '$downloadslower'";
}
$downloadsupper trim($HTTP_POST_VARS['downloadsupper']);
if ($downloadsupper != "")
{
$condition .= " AND i.image_downloads > '$downloadsupper'";
}
$ratinglower trim($HTTP_POST_VARS['ratinglower']);
if ($ratinglower != "")
{
$condition .= " AND i.image_rating < '$ratinglower'";
}
$ratingupper trim($HTTP_POST_VARS['ratingupper']);
if ($ratingupper != "")
{
$condition .= " AND i.image_rating > '$ratingupper'";
}
$voteslower trim($HTTP_POST_VARS['voteslower']);
if ($voteslower != "")
{
$condition .= " AND i.image_votes < '$voteslower'";
}
$votesupper trim($HTTP_POST_VARS['votesupper']);
if ($votesupper != "")
{
$condition .= " AND i.image_votes > '$votesupper'";
}
$hitslower trim($HTTP_POST_VARS['hitslower']);
if ($hitslower != "")
{
$condition .= " AND i.image_hits < '$hitslower'";
}
$hitsupper trim($HTTP_POST_VARS['hitsupper']);
if ($hitsupper != "")
{
$condition .= " AND i.image_hits > '$hitsupper'";
}
$orderby trim($HTTP_POST_VARS['orderby']);
if ($orderby == "")
{
$orderby $presets['default']['orderby'];
}

$limitstart = (isset($HTTP_POST_VARS['limitstart'])) ? intval(trim($HTTP_POST_VARS['limitstart'])) : 0;
if (!$limitstart)
{
$limitstart 0;
}

$limitnumber = (isset($HTTP_POST_VARS['limitnumber'])) ? trim($HTTP_POST_VARS['limitnumber']) : 1;
if (!$limitnumber)
{
$limitnumber 1;
}

if (isset($HTTP_GET_VARS['direction']) || isset($HTTP_POST_VARS['direction']))
{
$direction = (isset($HTTP_GET_VARS['direction'])) ? trim($HTTP_GET_VARS['direction']) : trim($HTTP_POST_VARS['direction']);
}
else
{
$direction $presets['default']['direction'];
}
$image_active = (isset($HTTP_POST_VARS['image_active']) && $HTTP_POST_VARS['image_active']) ? 0;
$condition .= " AND i.image_active = ".$image_active;
$new_cat_id = isset($HTTP_POST_VARS['new_cat_id']) ? intval(trim($HTTP_POST_VARS['new_cat_id'])) : 0;
$quickedit = isset($HTTP_POST_VARS['quickedit']) ? $HTTP_POST_VARS['quickedit'] : array();
if (!is_array($quickedit))
$quickedit = array();

if (isset($quickedit[0]) && empty($quickedit[0]))
{
array_shift($quickedit);
}
$nextpage = isset($HTTP_POST_VARS['nextpage']) ? intval(trim($HTTP_POST_VARS['nextpage'])) : 2;
$date = isset($HTTP_POST_VARS['date']) ? intval(trim($HTTP_POST_VARS['date'])) : $savedate;
$nextpageabort = isset($HTTP_POST_VARS['nextpageabort']) ? intval(trim($HTTP_POST_VARS['nextpageabort'])) : 0;
$owner = (isset($HTTP_POST_VARS['owner'])) ?  intval($HTTP_POST_VARS['owner']) : $owner;

$fields = array();
foreach ($additional_image_fields as $key => $val)
{
if (!isset($table_fields[$key]))
continue;

switch($val[1])
{
case "radio":
$data = (isset($HTTP_POST_VARS[$key])) ? (int)trim($HTTP_POST_VARS[$key]) : 0;
break;
case "dropdown":
$data = (isset($HTTP_POST_VARS[$key])) ? trim($HTTP_POST_VARS[$key]) : "";
break;
case "text":
case "textarea":
default:
$data = (isset($HTTP_POST_VARS[$key])) ? trim($HTTP_POST_VARS[$key]) : "";
break;
// end switch
$selected = (isset($HTTP_POST_VARS[$key "_type"]) && (int)$HTTP_POST_VARS[$key "_type"]) ? (int)$HTTP_POST_VARS[$key "_type"] : 0;
if ($selected)
{
if (!isset($additional_image_fields_settings[$key][0])
|| (isset($additional_image_fields_settings[$key][0])
&& $additional_image_fields_settings[$key][0]))
{
if (isset($additional_image_fields_settings[$key][1])
&& $additional_image_fields_settings[$key][1] !== "")
{
$condition .= " AND " sprintf($additional_image_fields_settings[$key][1], "i." $key$data);
}
else
{
if ($result get_type_condition($selected$val$table_fields[$key], 01, array("i." $key$data)))
{
$condition .= " AND " $result;
}
else
{
$condition .= " AND INSTR(LCASE(i." $key ."),'".strtolower($data)."')>0";
}
}
}
}
$fields[$key "_type"] = $selected;
$fields[$key] = $data;
}
if ($nextpage && $nextpage != && !$nextpageabort)
{
$limitstart $limitstart $limitnumber;
}
$sql "SELECT COUNT(*) AS images
FROM "
.IMAGES_TABLE." i
LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
WHERE 
$condition";
$countimages $site_db->query_firstrow($sql);
$limitfinish $limitstart $limitnumber;

$start 0;
if ($countimages['images'] > 0)
{
$start $limitstart 1;
}

echo $lang['found']." <b>".$countimages['images']."</b>. ".$lang['showing']." <b>$start</b>-";
if ($limitfinish $countimages['images'] == 0)
{
echo "<b>".$limitfinish."</b>.";
}
else
{
echo "<b>".$countimages['images']."</b>.";
}
echo "<br />".$lang['no_image_found'];

show_form_header("images.php""removeimage""form");
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";
if ($countimages['images'] > 0)
{
echo "<tr class=\"tableseparator\">\n";
if (empty($quickedit))
{
echo "<td class=\"tableseparator\"><input name=\"allbox\" type=\"checkbox\" onClick=\"CheckAll();\" /></td>\n";
}
echo "<td class=\"tableseparator\">&nbsp;</td><td class=\"tableseparator\">".$lang['field_image_name']."</td>\n";
if (!empty($quickedit))
{
foreach ($quickedit as $field)
{
if ($field != "image_name" && $field != "image_date" && ($field != "user_id" || !function_exists("get_user_id_by_name")))
echo "<td class=\"tableseparator\">".$quickedit_fields_all[$field][0]."</td>\n";
}
}
echo "<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
$sql_fields = ($quickedit) ? ", i.".implode(", i."$quickedit) : "";
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file, i.image_date, i.image_description, i.image_keywords".get_user_table_field(", u.""user_name").$sql_fields."
FROM "
.IMAGES_TABLE." i
LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
WHERE 
$condition
ORDER BY 
$orderby $direction, i.image_id $direction
LIMIT "
.$limitstart.", $limitnumber";
$result $site_db->query($sql);
$i 0;
while ($image_row $site_db->fetch_array($result))
{
$mark "";
if (!get_file_path($image_row['image_media_file'], "media"$image_row['cat_id'], 10))
{
$mark "_error";
}
echo "<tr class=\"".get_row_bg().$mark."\">";
if (!empty($quickedit))
{
echo "<input type=\"hidden\" name=\"selectimages[$i]\" value=\"".$image_row['image_id']."\" />";
}
else
{
echo "<td><input type=\"checkbox\" name=\"selectimages[]\" value=\"".$image_row['image_id']."\" /></td>";
}
$thumb_src get_thumbnail($image_row);
$width $thumbsize;
$height $thumbsize;
$thumb_size get_resize2($thumb_src$thumbsize);
$width $thumb_size[0];
$height $thumb_size[1];

echo "<td align=\"center\"><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank><img src=\"".((empty($image_row['image_thumb_file'])) ? ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif" : ((is_remote($image_row['image_thumb_file'])) ? $image_row['image_thumb_file'] : $thumb_src))."\" width=\"".$width."\" height=\"".$height."\" border=\"1\" alt=\"\" /></a></td><td>";
if (in_array("image_name"$quickedit))
{
echo "<input type=\"hidden\" name=\"qe_orig_image_name[$i]\" value=\"".str_replace("\"""&quot;"stripslashes($image_row['image_name']))."\" />";
echo "<input name=\"qe_image_name[$i]\" value=\"".str_replace("\"""&quot;"stripslashes($image_row['image_name']))."\" />";
}
else
{
echo "<b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank>".$image_row['image_name']."</a></b> ";
}
echo " [ID: ".$image_row['image_id']."]<br />(<i>".$image_row['image_media_file']."</i>";

if ($mark)
{
echo " <b class=\"marktext\">!</b>";
}
echo ")</td>\n";
if (!empty($quickedit))
{
foreach ($quickedit as $field)
{
if ($field == "image_name" || $field == "image_date" || ($field == "user_id" && function_exists("get_user_id_by_name")))
continue;

echo "<td>";
switch ($quickedit_fields_all[$field][1])
{
case "dropdown":
if (function_exists("get_dropdown_options"))
{
echo "<input type=\"hidden\" name=\"qe_orig_".$field."[$i]\" value=\"".safe_htmlspecialchars($image_row[$field])."\" />";
echo get_dropdown_options("qe_".$field."[$i]"$quickedit_fields_all[$field][3], $image_row[$field], $quickedit_fields_all[$field][4], $quickedit_fields_all[$field][5], $quickedit_fields_all[$field][7], 1"""select"$quickedit_fields_all[$field][6]);
break;
}
else
{
$quickedit_fields_all[$field][1] = "text";
}

case "text":
echo "<input type=\"hidden\" name=\"qe_orig_".$field."[$i]\" value=\"".safe_htmlspecialchars($image_row[$field])."\" />";
echo "<input name=\"qe_".$field."[$i]\" value=\"".safe_htmlspecialchars($image_row[$field])."\">";
break;

case "textarea":
echo "<input type=\"hidden\" name=\"qe_orig_".$field."[$i]\" value=\"".safe_htmlspecialchars($image_row[$field])."\" />";
echo "<textarea cols=\"$cols\" rows=\"$rows\" name=\"qe_".$field."[$i]\">".safe_htmlspecialchars($image_row[$field])."</textarea>";
break;

case "radio":
echo "<input type=\"hidden\" name=\"qe_orig_".$field."[$i]\" value=\"".safe_htmlspecialchars($image_row[$field])."\" />";
echo "<label for=\"y_".$field."$i\"><input type=\"radio\" name=\"qe_".$field."[$i]\" id=\"y_".$field."$i\" value=\"1\"";
if ($image_row[$field] == 1)
{
echo " checked=\"checked\"";
}
echo ">".$lang['yes']."</label>";
echo "<label for=\"n_".$field."$i\"><input type=\"radio\" name=\"qe_".$field."[$i]\" id=\"n_".$field."$i\" value=\"0\"";
if ($image_row[$field] != 1)
{
echo " checked=\"checked\"";
}
echo ">".$lang['no']."</label>&nbsp;";
break;
default:
echo safe_htmlspecialchars($image_row[$field]);
break;
}
echo "</td>\n";
}
}
echo "<td><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$image_row['cat_id'])."\" target=\"_blank\">".safe_htmlspecialchars($cat_cache[$image_row['cat_id']]['cat_name'])."</a></b> [ID: ".$image_row['cat_id']."]</td>\n";
$show_user_name format_text($image_row[$user_table_fields['user_name']], 2);
if (function_exists("get_user_id_by_name") && in_array("user_id"$quickedit))
{
unset($HTTP_POST_VARS["qe_user_id"][$i]);
echo "<input type=\"hidden\" name=\"qe_orig_user_id[$i]\" value=\"".safe_htmlspecialchars($image_row['user_id'])."\" />";
ob_start();
show_user_select_row(""$image_row['user_id'], $i0"qe_user_id"100);
$show_user_name ob_get_contents();
ob_end_clean();
}
elseif ($image_row['user_id'] != GUEST)
{
$show_user_name "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$image_row['user_id'])."\" target=\"_blank\">$show_user_name</a>";
}
echo "<td>".$show_user_name."</td>\n";
echo "<td>";
if (in_array("image_date"$quickedit))
{
$value format_date("Y-m-d H:i:s"$image_row['image_date']);
echo "<input type=\"hidden\" name=\"qe_orig_image_date[$i]\" value=\"".safe_htmlspecialchars($image_row['image_date'])."\" />";
echo "<input name=\"qe_image_date[$i]\" id=\"image_date[$i]\" value=\"".$value."\" />";
if (function_exists("get_calendar_js"))
echo get_calendar_js("image_date[$i]"$value);

echo "<br />yyyy-mm-dd hh:mm:ss";
if (EXIF_ENABLE && $file_src get_file_path($image_row['image_media_file'], "media"$image_row['cat_id'], 1))
{
echo get_exif_insert_link($file_src"DateTimeOriginal""qe_image_date[$i]"0"<br />");
echo get_exif_insert_link($file_src"DateTimeDigitized""image_date"0"<br />");
echo get_exif_insert_link($file_src"DateTime""image_date"0"<br />");
}
}
else
{
echo format_date($config['date_format'] . " " $config['time_format'], $image_row['image_date']);
}
echo "</td>\n";
echo "<td><p>";
$site_sess->set_session_var('back_url'ROOT_PATH."admin/images.php?action=modifyimages");
show_text_link($lang['edit'],"images.php?action=editimage&".URL_IMAGE_ID."=".$image_row['image_id'], $target);
show_text_link($lang['delete'],"images.php?action=removeimage&".URL_IMAGE_ID."=".$image_row['image_id'], $target);
echo "</p></td>\n";
echo "</tr>\n";
$i++;
}

show_hidden_input("image_id_type"$image_id_type);
show_hidden_input("image_name_type"$image_name_type);
show_hidden_input("image_description_type"$image_description_type);
show_hidden_input("image_keywords_type"$image_keywords_type);
show_hidden_input("user_id_type"$user_id_type);
show_hidden_input("user_name_type"$user_name_type);
show_hidden_input("image_media_file_type"$image_media_file_type);
show_hidden_input("image_thumb_file_type"$image_thumb_file_type);
show_hidden_input("cat_id_type"$cat_id_type);

show_hidden_input("image_id"$image_id);
show_hidden_input("image_name"$image_name1);
show_hidden_input("user_id"$user_id);
show_hidden_input("user_name"$user_name1);
show_hidden_input("image_active"$image_active1);
show_hidden_input("image_description"$image_description1);
show_hidden_input("image_keywords"$image_keywords1);
show_hidden_input("cat_id"$cat_id);
show_hidden_input("subcat"$subcat);
show_hidden_input("image_media_file"$image_media_file1);
show_hidden_input("image_thumb_file"$image_thumb_file1);
show_hidden_input("dateafter"$dateafter);
show_hidden_input("datebefore"$datebefore);
show_hidden_input("downloadsupper"$downloadsupper);
show_hidden_input("downloadslower"$downloadslower);
show_hidden_input("ratingupper"$ratingupper);
show_hidden_input("ratinglower"$ratinglower);
show_hidden_input("votesupper"$votesupper);
show_hidden_input("voteslower"$voteslower);
show_hidden_input("hitsupper"$hitsupper);
show_hidden_input("hitslower"$hitslower);

show_hidden_input("orderby"$orderby1);
show_hidden_input("direction"$direction1);
show_hidden_input("limitstart"$limitstart);
show_hidden_input("limitnumber"$limitnumber);
show_hidden_input("preset"safe_htmlspecialchars($preset));
foreach($quickedit as $val)
{
show_hidden_input("quickedit[]"$val);
}
show_hidden_input("date"0); //checkboxes value not sent at all if its unchecked.
show_hidden_input("nextpage"0); //checkboxes value not sent at all if its unchecked.
foreach ($fields as $key => $val)
{
show_hidden_input($key$val1);
}
echo "<tr class=\"tablefooter\">\n<td colspan=\"10\" align=\"left\" class=\"tableseparator\">\n&nbsp;";
if (!empty($quickedit))
{
echo "<input type=\"submit\" value=\"  ".$lang['save']."  \" class=\"button\" name=\"action2\">&nbsp;\n";
if ($limitnumber != 5000 && $limitfinish $countimages['images'])
{
echo "<label for=\"nextpage\"><input type=\"checkbox\" value=\"1\" class=\"button\" id=\"nextpage\" name=\"nextpage\"".((($nextpage && $nextpage != 2) || ($nextpage == && $nextpage_default)) ? " checked" "").">&nbsp;" $lang['continue_next_page'] . "</label>\n";
}
}
else
{
echo "<input type=\"submit\" value=\"  ".$lang['edit']."  \" class=\"button\" name=\"action2\">\n";
echo "<input type=\"submit\" value=\"  ".$lang['delete']."  \" class=\"button\">\n";
$category "\n<select name=\"new_cat_id\" class=\"categoryselect\">\n";
$category .= "<option value=\"0\">".$lang['select_category']."</option>\n";
$category .= "<option value=\"0\">-------------------------------</option>\n";
$drop_down_cat_cache = array();
$drop_down_cat_cache $cat_parent_cache;
$category .= get_category_dropdown_bits($new_cat_id);
$category .= "</select>\n";
echo "<hr />";

echo $category;

echo "<label for=\"date\" title=\"".$lang['save_date_exp']."\"><input type=\"checkbox\" name=\"date\" value=\"1\" id=\"date\" ".(($date) ? " checked" "")."/>&nbsp;" $lang['save_date'] . "</label>";
echo "&nbsp;&nbsp;<input type=\"submit\" value=\"  ".$lang['move']."  \" class=\"button\" name=\"action2\">\n";
echo "<input type=\"submit\" value=\"  ".$lang['copy']."  \" class=\"button\" name=\"action2\">\n";
echo "<hr />";
if (function_exists("get_user_id_by_name"))
{
//        unset($HTTP_POST_VARS["owner"]);
show_user_select_row(""$owner""30"owner"000);
}
else
{
if (empty($user_select_row_cache))
{
$sql "SELECT ".get_user_table_field("""user_id").get_user_table_field(", ""user_name")."
FROM "
.USERS_TABLE."
WHERE "
.get_user_table_field("""user_id")." <> ".GUEST."
ORDER BY "
.get_user_table_field("""user_name")." ASC";
$result $site_db->query($sql);
$user_select_row_cache = array();
while ($row $site_db->fetch_array($result))
{
$user_select_row_cache[$row[$user_table_fields['user_id']]] = $row[$user_table_fields['user_name']];
}
}
//      echo "&nbsp;|&nbsp;&nbsp;";
echo "<select name=\"owner\" class=\"categoryselect\">\n";
echo "<option value=\"".GUEST."\">".$lang['userlevel_guest']."</option>\n";
echo "<option value=\"".GUEST."\">-------------------------------</option>\n";
foreach ($user_select_row_cache as $key => $val)
{
echo "<option value=\"".$key."\"";
if (($owner && $key == $owner) || (!$owner && $key == $user_info['user_id']))
{
echo " selected=\"selected\"";
}
echo ">".$val."</option>\n";
}
echo "</select>\n";
}
echo "&nbsp;<input type=\"submit\" value=\"".$lang['changeowner']."\" class=\"button\" name=\"action2\">\n";
}
echo "&nbsp;\n</td>\n";
echo "</tr>\n</table>\n</td>\n</tr>\n</table>\n";

echo "</form>\n";
}
else
{
show_description_row($lang['no_search_results'], 6);
show_form_footer("""");
}

echo "<div align=\"right\">";
echo "<form action=\"".$site_sess->url("images.php")."\" name=\"form2\" method=\"post\">\n";

show_hidden_input("image_id_type"$image_id_type);
show_hidden_input("image_name_type"$image_name_type);
show_hidden_input("image_description_type"$image_description_type);
show_hidden_input("image_keywords_type"$image_keywords_type);
show_hidden_input("user_id_type"$user_id_type);
show_hidden_input("user_name_type"$user_name_type);
show_hidden_input("image_media_file_type"$image_media_file_type);
show_hidden_input("image_thumb_file_type"$image_thumb_file_type);
show_hidden_input("cat_id_type"$cat_id_type);

show_hidden_input("action""findimages");
show_hidden_input("image_id", ($image_id !== $image_id ""));
show_hidden_input("image_name"$image_name1);
show_hidden_input("user_id", ($user_id !== $user_id ""));
show_hidden_input("user_name"$user_name1);
show_hidden_input("image_active"$image_active1);
show_hidden_input("image_description"$image_description1);
show_hidden_input("image_keywords"$image_keywords1);
show_hidden_input("cat_id"$cat_id);
show_hidden_input("subcat"$subcat);
show_hidden_input("image_media_file"$image_media_file1);
show_hidden_input("image_thumb_file"$image_thumb_file1);
show_hidden_input("dateafter"$dateafter);
show_hidden_input("datebefore"$datebefore);
show_hidden_input("downloadsupper"$downloadsupper);
show_hidden_input("downloadslower"$downloadslower);
show_hidden_input("ratingupper"$ratingupper);
show_hidden_input("ratinglower"$ratinglower);
show_hidden_input("votesupper"$votesupper);
show_hidden_input("voteslower"$voteslower);
show_hidden_input("hitsupper"$hitsupper);
show_hidden_input("hitslower"$hitslower);

show_hidden_input("orderby"$orderby1);
show_hidden_input("direction"$direction1);
show_hidden_input("limitstart"$limitstart $limitnumber);
show_hidden_input("limitnumber"$limitnumber);
show_hidden_input("owner"$owner);
show_hidden_input("preset"safe_htmlspecialchars($preset));
foreach($quickedit as $val)
{
show_hidden_input("quickedit[]"$val1);
}
show_hidden_input("nextpage"$nextpage);
show_hidden_input("nextpageabort"1);
show_hidden_input("date"$date); //checkboxes value not sent at all if its unchecked.
foreach ($fields as $key => $val)
{
show_hidden_input($key$val1);
}

if ($limitnumber != 5000 && $limitfinish $countimages['images'])
{
echo "<input type=\"submit\" value=\"  ".$lang['search_next_page']."  \" class=\"button\">\n";
}
echo "<input type=\"submit\" value=\"  ".$lang['back']."  \" onclick=\"".(($limitstart) ? "limitstart.value = '".($limitstart $limitnumber)."'" "action.value = ''")."\" class=\"button\">\n";
echo "</form>";
echo "</div>";
}

show_admin_footer();
?>


Jemand eine Ahnung wie ich den . weg bekomme?
LG
Jeff

3
Discussion & Troubleshooting / anderer header / domain
« on: June 12, 2012, 06:49:26 PM »
Hallo,

ist es möglich, dass ich je nach domain etwas anderes im header bereich anzeigen lassen kann?

Ich verwende einen JS Code von nem affili programm.... der wird aber immer je nach domain angezeigt ... was total kake ist...

verwende:
http://wallpapers.pj-firepower.com
http://picgallery.pj-firepower.com
http://www.wallpapers-heaven.com
http://www.pj-firepower.com/picgallery/

und wenn ich jetzt von allen 4 den affili JS Code einfüge ... wird der Header riesen groß....

lg
jeff

4
Chit Chat / Affiliate
« on: June 12, 2012, 05:48:29 PM »
Hallo,

welche Affiliate würdet ihr vorschlagen, bzw. welche Programme darinnen.

Google Adsense hat mich entgültig gekillt.... weil ihnen hinten und vorne was nicht passt... dabei habe ich jetzt alles so dolle angepasst.... das bei gewissen kategorien keine google werbung erscheint ....
Nichtmal auf meiner Main Page lassen Sie mich mal mehr werbung anzeigen.... weil das bei denen immer die gesamte Domain betrifft ....

Daher suche ich gute alternativen ...

Jemand ne idee ?

5
Discussion & Troubleshooting / New Image - Kategorie ausschließen
« on: May 30, 2012, 08:04:13 PM »
Hallo,

auf der Startpage werden mir ja die Neuen Bilder angezeigt.

Wie kann ich jetzt bestimmte Kategorien ausschließen ?

MFG
Jeff

6
Hallo,

habe leider nichts gefunden, immer nur wie ich automatisch für alle keywords vom Bildnamen erzeuge...

Suche jedoch einen Mod wo ich sagen kann;

Kategorie: XY

Erzeuge Keywords: Landschaft, Vögel, Österreich, 2012

und diese Keywords sollen dann bei alle Bilder in der Kategorie eingetragen werden.

Toll wäre auch, wenn dies für Beschreibung auch geht.
Alternativ wo ich halt sagen kann, nehme Keywords von Kategorie XY und trage sie in Beschreibung ein, oder Erzeuge Keywords und verwende sie gleich als beschreibung

gibts es hier sowas ?
Hab gesucht finde leider nichts :(

MFG
Nosferatu

7
Hallo,

dies könnte auch an die umstellung auf PHP5.4.0 zu tun habe... zumindest kann ichs mir nicht anders erklären...

Ich habe früher immer über "Neue Bilder checken" meine ganzen Bilder hinzugefügt, wenn ich sie mit FTP raufgeladen habe.

Früher konnte ich ohne probleme 1000 Bilder checken und aktivieren aufeinmal...

Jetzt gehen nur noch 30.... und das ist ziemlich öde....

sobald ich 50 oder 100 einstelle... werden mir diese angezeigt, aber sobald ich auf hinzufügen klicke steht "keine Bilder hinzugefügt"....

Jemand ne ahnung wie man das lösen kann ?

-----------------------------

Weiters Problem habe ich, dass ich ab und zu bilder mit FTP raufladen, die ich auch ganz normal mit http abfragen kann..

aber bei "neue Bilder checken" wird dann nur ein kleines fehler kästchen angezeigt.

Wenn ich dann dieses  1 Bild hinzufügen will... bekomm ich ne weiße seite.. und nichts passiert ...
zuerst dachte ich es liegt bei manchen bilder weil sie 2 MB groß sind....

Doch das ist egal... letzt hatten ich 100 Bilder 10 davon gingen nicht .... un die waren unterschiedlich groß von 100kb bis 6 MB...

Jemand ne ahnung ?


Bitte bitte hilfe!

Danke!

MFG
Nosferatu

8
Hallo,
ich mein Hoster lässt nur noch PHP 5.3.0 oder 5.4.0 zu, bzw will er die alten im Sommer abschalten.
Daher habe ich gleich den Server auf 5.4.0 umgestellt.

Jetzt habe ich aber ein Problem:

Wenn ich online Templates bearbeiten will, ging das immer super.
Jetzt lade ich also das Packet und geh dann auf bbcode.html und sage Template bearbeiten.

Dies klappt...

gehe ich z.B.: auf footer.html und sage Template bearbeite.. wird nur eine leere seite geladen.

Warum gehen manche und manche nicht ?

An den rechten kann auch nichts sein hab im FTP geschaut.
Somit müsste es etwas mit der umstellung auf PHP 5.4.0 zu haben oder nicht ?

Es kann ja nicht sein, dass ich eine datei lesen und bearbeiten und andere wieder nicht angezeigt werden ...

bitte hilfe!

MFG
Nosferatu

9
Chit Chat / Google+
« on: July 15, 2011, 07:36:07 PM »
Hallo,

wer ist von euch dabei ?
Ich würde euch gerne adden bzw. added mich ;)

https://plus.google.com/101626577406833098387/posts

mfg
jeff

10
Discussion & Troubleshooting / Kategorie Bild
« on: July 15, 2011, 07:34:29 PM »
Hallo,

ich hab bei mir jetzt testen mal kategorie bilder eingefügt ... jedoch hab ich ein problem ...

Bei der hauptanzeige sieht es ganz gut aus
http://wallpapers.pj-firepower.com/categories.php?cat_id=22

aber wenn man dann auf die Kategorie klickt wird irgendwie alles automatisch vergrößert Oo..... weiß jemand warum ? bzw. was ich da ändern muss ?
Danke!

mfg
jeff

11
Programming / #1040 - Too many connections
« on: July 01, 2011, 05:50:30 PM »
Hallo,

ich habe von einer stunde zur anderen plötzlich diesen fehler "#1040 - Too many connections" wenn ich auf phpmyadmin zugreife....

und wordpress, 4images, phpbb, piwik, email scripte sagen mir keine verbindung zur datenbank.

jemand ne ahnung was das ist, finde nicht wirklich was, außer das eventuell nicht alle mysql verbindungen geschlossen sind.... nur ich habe nichts gemacht, es kann ja nicht sein, das innerhalb ne stunde sowas passiert .... ohne das ich irgendwas gemacht habe Oo.....

komischerweise kann ich übern hoster auch nicht mehr die Datenbanken online anzeigen lassen.....

leigt das am hoster oder irgendwo an mir Oo

?

mfg
jeff

12
Chit Chat / seltsame google suche, spamer ?
« on: June 29, 2011, 06:17:36 PM »
Hallo,

ich hab bei mir das statistik tool "PIWIK" installiert... und mir fallt sehr oft auf das leute über google folgendes suchen " "bestätigungs-code"inurl:details.php?image_id "

weiß jemand was es damit auf sich hat...

sucht da nen hacker/spamer nach sicherheitslücken oder was ?

mfg
jeff

13
EDIT: ICH VERWENDE NUN DEN MOD VON REMBRANDT !

- With this multi-upload you can upload more than one hundred images simultaneously.
 - Large Images are automatically scaled.
 - Automatically upload in temp folder or direct,for each Categorie.
 - When uploading Image Preview.
 - Write Description and Keywords for all Images.
 - Select Category for each image.

http://www.4homepages.de/forum/index.php?topic=30855.0


Hi,

einige von euch wollen ja ein richtiges multi-upload für seine registrierten user.
Ihr solltet euch einfach den Baukasten von http://codecanyon.net/item/ajax-multi-upload/112532  für 7 $ besorgen.

Im test bereich könnt ihr gerne mal die funktion testen, jedoch sieht ihr die bilder leider nicht, die müsste ich im Admin bereich erst hinzufügen und Thumbnails erstellen wie bei upload über FTP, aber es ist schon ganz praktisch und funkt 100% !
Usern würde ich personlich sowieso nicht erlauben, einfach wild drauflos bilder raufzuladen, aber vieleicht findet sich ja jemand der einen richtigen mod draus machen könnte, mit direkt upload usw *zu Rembrandt schiel*... das ist mir hierbei etwas zu kompliziert.

edit: habs jetzt am design angepasst ;) hab ja den link vergessen ^^
http://www.pj-firepower.com/picgallerie/member_multi_upload.php?action=multi_upload&cat_id=432
edit: nun inklusive multiupload von Andi : http://www.4homepages.de/forum/index.php?topic=28843.0


Diese funktionen wären möglich:

path - The path to the folder you would like to save the files to. End's with '/'
auto - true - files will be uploaded on select, false - files will be uploaded after click on upload button
multi - true - multiple file uploads, false - one file upload
maxSize - The maximum upload file size in bytes
buttonCaption - Upload button caption. Specify just if you use auto="false"
afterUpload - Message that appears after upload or link - link to file appears after upload
fileExt - List of allowed file extensions, eg. fileExt="jpg,png,gif"
fileDesc - The text that will appear at the bottom of the browse dialog box, eg. fileDesc="Images (jpg, png, gif)"
button - Path to custom upload button
bwidth - Custom upload button width in pixels
bheight - Custom upload button height in pixels
queueId - The id of the custom upload queue

mfg
jeff

14
Hallo,

ist es irgendwie möglich zu sagen wenn FireFox mach width = 100% wenn IE mach 500px ??

ich habe nämlich ein Problem beim anzeigen von den Bildern ...

jpg.html

<!-- Template file for JPG Files -->
<!--<
img src="{media_src}" border="1" alt="{image_name}"{limit_var}="{new_limit}" /><br /> -->
<
table border="0" align="center" cellpadding="0" cellspacing="0">
  <
tr>
    <
td>
        <
table border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
            <
tr>
                <
td align="center" valign="middle">
                 <
a href="{media_src}" class="highslide" onclick="return hs.expand(this, {captionId: 'caption1'})"
         <
img src="{media_src}" alt="{image_name}"  width="60%" /></a>
           </
td>
            </
tr>
        </
table>
    </
td>
  </
tr>
</
table>


Wenn ich es so habe funkt es im FireFox ohne probleme...
Im IE wird die ganze seite gesprengt und man braucht fast 2 bildschirme.... egal wieviel % ich eingebe die größe bleibt immer gleich ...
Wenn ich aber 300 pixel mache... dann funkt es im IE ohne probleme....

mfg
jeff

Pages: [1] 2 3