4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Rembrandt on June 04, 2011, 05:42:40 PM
-
Hi!
The Desire come from here: http://www.4homepages.de/forum/index.php?topic=18088.msg157471#msg157471
If Keywords field empty by Users, you can set auto generated "Keywords" from "Image Name" and/or "Image Description".
The Settings for this, find under "ACP/General/Settings/Image settings".
Optional: With the Modified "rebuild_searchindex.php" (see Attachment) you can register all the "keywords" at once.
Copy the "rebuild_searchindex.php" (see Attachment) in your "admin/plugin" folder
1.) search admin/settings.php:
show_setting_row("image_table_cellpadding");
insert below:
show_setting_row("image_use_image_name", "radio");
show_setting_row("image_use_description", "radio");
2.) search in lang/yourLang/admin.php:
(deutsch)
$setting['image_table_cellpadding'] = "Cellpadding der Bilder Tabelle";
insert below:
$setting['image_use_image_name'] = "Als Schlüsselwort 'Bild Namen' verwenden?";
$setting['image_use_description'] = "Als Schlüsselwort 'Bild Beschreibung' verwenden?";
(english)
$setting['image_use_image_name'] = "Use 'Image Name' as Keyword?";
$setting['image_use_description'] = "Use 'Image Description' as Keyword?";
3.) search in root/member.php:
include(ROOT_PATH.'includes/page_header.php');
insert below:
function clean_description($val) {
$search_array = array("#[-_'`´\^\$\(\)<>\"\|,@\;\?%~\+\.\[\]{}:\/=!§\\\\]+#s");
$replace_array = array(" ");
$val = preg_replace($search_array, $replace_array, $val);
return $val;
}
4.) search in root/member.php 2x:
$image_keywords = un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));
and insert below 2x:
$keywords_name="";
$keywords_description="";
if($config['image_use_image_name'] && empty($image_keywords)){
$keywords_name = $image_name;
}
if($config['image_use_description'] && empty($image_keywords)){
if(!empty($image_description)){
$keywords_description = ",".clean_description($image_description);
}
}
$keywords_name_description = str_replace(" ",",", $keywords_name.$keywords_description);
$image_keywords = $image_keywords.$keywords_name_description;
mfg Andi
-
Nice, Danke!!
-
Danke ! morgen gleich einbauen werd ;)
-
Wie immer TOP
Danke
-
huhu,
läuft halbwegs was ich bis jetzt gecheckt habe aber
mit deiner Version kann ich auch den such index nicht mehr leeren, aber mit der die bei 1.7.10 dabei ist schon :(
gruß
jeff
-
läuft halbwegs was ich bis jetzt gecheckt habe...
ah da bekomme ich richtig lust noch ein par mods einzustellen.. :?
mit deiner Version kann ich auch den such index nicht mehr leeren, aber mit der die bei 1.7.10 dabei ist schon :(
das ist die rebuild aus der V1.7.10, und der suchindex wird auch geleert du kannst ja beide dateien einmal vergleichen dann siehst das an dieser funktion nicht verändert wurde.
mfg Andi
-
hi,
ehm das sollte jetzt nicht negativ klingen von mir fals du es so aufgenommen hast :(
beim ersten durch lauf hat es nämlich nicht gepasst ganz gefunkt, erst als ich nochmal nen durchlauf gemacht hatte, und paar bilder gecheckt habe hat es gepasst ka warum ^^
werd aber auch nicht 10k bilder durchgucken ob es hinhaut ;) da vertrau ich dir mal
ja habs eh gesehen das nicht verändert wurde nur ... woran liegt es, dass wenn ich deine datei verwende und auf leeren klicke, dass nix passiert und wenn ich die original datei raufspiele, es funkt ... ^^ mal typisch computer ^^
mfg
jeff
-
Thanks great mod...
Is it possible to change next symbols in description field "(", ")", "/", " " with one symbol ";" ???
Need a correction in step 2
replace:
$lang_rebuild_use_image_name = "Use 'Image Name' as Keyword?";
$lang_rebuild_use_description = "Use 'Image Description' as Keyword?";
with:
$setting['image_use_image_name'] = "Use 'Image Name' as Keyword?";
$setting['image_use_description'] = "Use 'Image Description' as Keyword?";
-
....
Need a correction in step 2
....
*rofl* you're right, Thank You!
-
OK, no problem...
Is it possible to send Sydney (SYD/YSSY) as Sydney;SYD;YSSY; to the keywords?
-
search in member.php:
include(ROOT_PATH.'includes/page_header.php');
insert below:
function clean_description($val) {
$search_array = array("#[-_'`´\^\$\(\)<>\"\|,@\;\?%~\+\.\[\]{}:\/=!§\\\\]+#s");
$replace_array = array(" ");
$val = preg_replace($search_array, $replace_array, $val);
return $val;
}
search 2x:
$keywords_description = ",".$image_description;
and replace 2x:
$keywords_description = ",".clean_description($image_description);
-
genau das war es :lol:
Big Thanks
-
Work fine. Another little request...
I need to add ";" at the end of image name. For example: image name "Russia" -> send as "Russia;"
-
search:
$keywords_name_description = str_replace(" ",",", $keywords_name.$keywords_description);
replace:
$keywords_name_description = str_replace(" ",",", $keywords_name.";".$keywords_description);
-
Genial, Perfect!! Thank you very very much!
-
Maybe a rather stupid question, but will this work on the latest version (1.7.10)?
-
Maybe a rather stupid question,....
I think all my mods work with V1.7.10 , i hope... :mrgreen:
-
Maybe a rather stupid question,....
I think all my mods work with V1.7.10 , i hope... :mrgreen:
Ok.. good to know. :)
Thanks for the fast reply.
-
Wie sieht es denn aus für das ACP? Geht das da auch?
Ich habe in der images.php nach dem gesucht:
$keywords_name="";
$keywords_description="";
if($config['image_use_image_name'] && empty($image_keywords)){
$keywords_name = $image_name;
}
if($config['image_use_description'] && empty($image_keywords)){
if(!empty($image_description)){
$keywords_description = ",".clean_description($image_description);
}
}
$keywords_name_description = str_replace(" ",",", $keywords_name.$keywords_description);
$image_keywords = $image_keywords.$keywords_name_description;
Und mit deinem Code ersetzt:
$keywords_name="";
$keywords_description="";
if($config['image_use_image_name'] && empty($image_keywords)){
$keywords_name = $image_name;
}
if($config['image_use_description'] && empty($image_keywords)){
if(!empty($image_description)){
$keywords_description = ",".clean_description($image_description);
}
}
$keywords_name_description = str_replace(" ",",", $keywords_name.$keywords_description);
$image_keywords = $image_keywords.$keywords_name_description;
Und unter diesem hier:
if ($action == "") {
$action = "modifyimages";
}
Habe ich das hinzugefügt:
function clean_description($val) {
$search_array = array("#[-_'`´\^\$\(\)<>\"\|,@\;\?%~\+\.\[\]{}:\/=!§\\\\]+#s");
$replace_array = array(" ");
$val = preg_replace($search_array, $replace_array, $val);
return $val;
}
Aber es tut sich da nichts, wobei der Code ja gleich ist!? Aber automatisch wird da nichts generiert.
-
füge den code mal auch nach dem ein:
$image_keywords = un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords_'.$i]));
-
ne leider hilft das auch nicht
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: images.php *
* Copyright: (C) 2002-2011 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.10 *
* *
* 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. *
* *
*************************************************************************/
define('IN_CP', 1);
define('ROOT_PATH', './../');
require('admin_global.php');
include(ROOT_PATH.'includes/search_utils.php');
// Start Upload
include(ROOT_PATH.'includes/upload.php');
$site_upload = new Upload();
if ($action == "") {
$action = "modifyimages";
}
function clean_description($val) {
$search_array = array("#[-_'`´\^\$\(\)<>\"\|,@\;\?%~\+\.\[\]{}:\/=!§\\\\]+#s");
$replace_array = array(" ");
$val = preg_replace($search_array, $replace_array, $val);
return $val;
}
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 " ".$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 " ".$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 (!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 $lang['comments_delete_success']."<br />\n";
}
else {
$error_log[] = "<b>".$lang['comments_delete_success']."</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;
}
show_admin_header();
if ($action == "deleteimage") {
$deleteimages = (isset($HTTP_POST_VARS['deleteimages'])) ? $HTTP_POST_VARS['deleteimages'] : array();
$delfromserver = (isset($HTTP_POST_VARS['delfromserver'])) ? intval($HTTP_POST_VARS['delfromserver']) : 1;
$image_ids = "";
if (!empty($deleteimages)) {
foreach ($deleteimages as $val) {
$image_ids .= (($image_ids != "") ? ", " : "").$val;
}
}
$lang_key = (sizeof($deleteimages) > 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> </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("Error Log:", 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td> </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']) || isset($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['deleteimages'])) {
$image_ids = $HTTP_POST_VARS['deleteimages'];
}
else {
$image_ids[] = 0;
}
show_form_header("images.php", "deleteimage");
foreach ($image_ids as $val) {
show_hidden_input("deleteimages[]", $val);
}
$lang_key = (sizeof($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']);
}
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']));
$image_keywords = un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));
$keywords_name="";
$keywords_description="";
if($config['image_use_image_name'] && empty($image_keywords)){
$keywords_name = $image_name;
}
if($config['image_use_description'] && empty($image_keywords)){
if(!empty($image_description)){
$keywords_description = ",".clean_description($image_description);
}
}
$keywords_name_description = str_replace(" ",",", $keywords_name.$keywords_description);
$image_keywords = $image_keywords.$keywords_name_description;
$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)));
$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']);
$delete_thumb_file = (isset($HTTP_POST_VARS['delete_thumb_file']) && $HTTP_POST_VARS['delete_thumb_file'] == 1) ? 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]) == 1 && 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_name, MEDIA_PATH."/".$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);
$error = 1;
}
else {
unlink(MEDIA_PATH."/".$old_cat_id."/".$old_file_name.".bak");
$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);
}
}
else {
if ($cat_id != $old_cat_id && !empty($old_file_name)) {
$new_name = copy_media($old_file_name, $old_cat_id, $cat_id);
}
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_name, THUMB_PATH."/".$old_cat_id."/".$old_thumb_file_name.".bak");
$new_thumb_name = $site_upload->upload_file("thumb_file", "thumb", $cat_id, get_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)) {
$additional_sql = "";
if (!empty($additional_image_fields)) {
$table_fields = $site_db->get_table_fields(IMAGES_TABLE);
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);
@unlink(MEDIA_PATH."/".$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]);
}
}
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 ($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']) : intval($HTTP_GET_VARS['image_id']);
$sql = "SELECT *, FROM_UNIXTIME(image_date) AS image_date
FROM ".IMAGES_TABLE."
WHERE image_id = $image_id";
$image_row = $site_db->query_firstrow($sql);
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']);
show_table_header($lang['nav_images_edit'].": ".format_text($image_row['image_name'], 2), 2);
$file_src = get_file_path($image_row['image_media_file'], "media", $image_row['cat_id'], 1);
show_image_row($lang['image']."<br /><span class=\"smalltext\">(".$image_row['image_media_file'].")</span>", $file_src, 1);
$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);
if (!empty($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\">(".$image_row['image_thumb_file'].")</span>", $thumb_src, 1, "delete_thumb_file");
}
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);
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);
show_cat_select_row($lang['field_category'], $image_row['cat_id'], 3);
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) : "");
show_date_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_row, IMAGES_TABLE);
show_form_footer($lang['save_changes'], $lang['reset'], 2, "", " onClick='showProgress()'");
}
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]);
$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]);
$image_download_url = trim($HTTP_POST_VARS['image_download_url_'.$i]);
if ($image_name == "") {
$error['image_name_'.$i] = 1;
}
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]) == 1 && trim($HTTP_POST_VARS[$key.'_'.$i]) == "") {
$error[$key.'_'.$i] = 1;
}
}
}
}
if (empty($error)) {
for ($i = 1; $i <= $num_newimages; $i++) {
$log = array();
$uploaderror = 0;
$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]);
//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'].": ".$HTTP_POST_FILES[$file]['name']."</b><br />".$site_upload->get_upload_errors();
$uploaderror = 1;
}
else {
$log[] = "<b>".$lang['file_upload_success'].": ".$new_name."</b>";
}
}
else {
$new_name = $remote_file;
}
//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_id, get_basefile($new_name));
if (!$new_thumb_name) {
$log[] = "<b>".$lang['thumb_upload_error'].": ".$HTTP_POST_FILES[$thumb_file]['name']."</b><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'].": ".$new_thumb_name."</b>";
}
}
else {
$new_thumb_name = $remote_thumb_file;
}
//Save to Database
if (!$uploaderror) {
$image_description = un_htmlspecialchars(trim($HTTP_POST_VARS['image_description_'.$i]));
$image_keywords = un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords_'.$i]));
$keywords_name="";
$keywords_description="";
if($config['image_use_image_name'] && empty($image_keywords)){
$keywords_name = $image_name;
}
if($config['image_use_description'] && empty($image_keywords)){
if(!empty($image_description)){
$keywords_description = ",".clean_description($image_description);
}
}
$keywords_name_description = str_replace(" ",",", $keywords_name.$keywords_description);
$image_keywords = $image_keywords.$keywords_name_description;
$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)));
$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)) {
$table_fields = $site_db->get_table_fields(IMAGES_TABLE);
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]);
}
}
add_searchwords($image_id, $search_words);
$log[] = $lang['image_add_success'].": <b>".format_text(stripslashes($image_name), 2)."</b> (".$new_name.")";
}
else {
$log[] = $lang['image_add_error'].": <b>".format_text(stripslashes($image_name), 2)."</b> (".$new_name.")";
}
}
else {
$log[] = $lang['no_db_entry'];
}
echo "<script language=javascript>\n showProgress();\n hideProgress();\n</script>";
show_table_header($lang['image']." $i", 1);
echo "<tr><td class=\"tablerow\">\n";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td> </td><td>\n";
foreach ($log as $val) {
echo $val."<br />";
}
echo "</td></tr></table>\n";
echo "</td></tr>\n";
show_table_footer();
echo "<br />";
}
}
else {
echo "<script language=javascript>\n showProgress();\n hideProgress();\n</script>";
$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(" ", "num_newimages", $lang['num_addnewimages_desc']);
for ($i = 1; $i <= $num_newimages; $i++) {
show_table_separator($lang['image']." ".$i, 2);
show_upload_row($lang['image'], "file_".$i, "<br /><span class=smalltext>".$lang['allowed_mediatypes_desc'].str_replace(",",", ",$config['allowed_mediatypes'])."</span>");
show_upload_row($lang['thumb'], "thumb_file_".$i, "<br /><span class=smalltext>".$lang['allowed_mediatypes_desc']." jpg, gif, png</span>");
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'], 0, 3, $i);
show_user_select_row($lang['user'], $user_info['user_id'], $i);
show_radio_row($lang['field_free'], "image_active_".$i, 1);
show_radio_row($lang['field_allow_comments'], "image_allow_comments_".$i, 1);
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 ($action == "modifyimages") {
show_form_header("images.php", "findimages", "form");
show_table_header($lang['nav_images_edit'], 2);
show_input_row($lang['field_image_id_contains'], "image_id", "", $textinput_size);
show_input_row($lang['field_image_name_contains'], "image_name", "", $textinput_size);
show_input_row($lang['field_description_contains'], "image_description", "", $textinput_size);
show_input_row($lang['field_keywords_contains'], "image_keywords", "", $textinput_size);
show_cat_select_row($lang['field_category'], 0, 2);
show_input_row($lang['field_image_file_contains'], "image_media_file", "", $textinput_size);
show_input_row($lang['field_thumb_file_contains'], "image_thumb_file", "", $textinput_size);
show_date_input_row($lang['field_date_after'].$lang['date_format'], "dateafter", "", $textinput_size);
show_date_input_row($lang['field_date_before'].$lang['date_format'], "datebefore", "", $textinput_size);
show_input_row($lang['field_downloads_upper'], "downloadsupper", "", $textinput_size);
show_input_row($lang['field_downloads_lower'], "downloadslower", "", $textinput_size);
show_input_row($lang['field_rating_upper'], "ratingupper", "", $textinput_size);
show_input_row($lang['field_rating_lower'], "ratinglower", "", $textinput_size);
show_input_row($lang['field_votes_upper'], "votesupper", "", $textinput_size);
show_input_row($lang['field_votes_lower'], "voteslower", "", $textinput_size);
show_input_row($lang['field_hits_upper'], "hitsupper", "", $textinput_size);
show_input_row($lang['field_hits_lower'], "hitslower", "", $textinput_size);
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">
<option value="i.image_name" selected><?php echo $lang['field_image_name'] ?></option>
<option value="i.image_media_file"><?php echo $lang['field_image_file'] ?></option>
<option value="i.image_thumb_file"><?php echo $lang['field_thumb_file'] ?></option>
<option value="i.cat_id"><?php echo $lang['field_category'] ?></option>
<option value="i.image_date"><?php echo $lang['field_date'] ?></option>
<option value="i.image_downloads"><?php echo $lang['field_downloads'] ?></option>
<option value="i.image_rating"><?php echo $lang['field_rating'] ?></option>
<option value="i.image_votes"><?php echo $lang['field_votes'] ?></option>
<option value="i.image_hits"><?php echo $lang['field_hits'] ?></option>
</select>
<select name="direction">
<option selected value="ASC"><?php echo $lang['asc'] ?></option>
<option value="DESC"><?php echo $lang['desc'] ?></option>
</select>
</p></td></tr>
<?php
show_input_row($lang['results_per_page'], "limitnumber", 50);
show_form_footer($lang['search'], $lang['reset'], 2);
}
if ($action == "findimages") {
$site_sess->set_session_var('back_url', $self_url);
$condition = "1=1";
$image_id = intval($HTTP_POST_VARS['image_id']);
if ($image_id != "") {
$condition .= " AND INSTR(LCASE(i.image_id),'$image_id')>0";
}
$image_name = trim($HTTP_POST_VARS['image_name']);
if ($image_name != "") {
$condition .= " AND INSTR(LCASE(i.image_name),'".strtolower($image_name)."')>0";
}
$image_description = trim($HTTP_POST_VARS['image_description']);
if ($image_description != "") {
$condition .= " AND INSTR(LCASE(i.image_description),'".strtolower($image_description)."')>0";
}
$image_keywords = trim($HTTP_POST_VARS['image_keywords']);
if ($image_keywords != "") {
$condition .= " AND INSTR(LCASE(i.image_keywords),'".strtolower($image_keywords)."')>0";
}
$cat_id = intval(trim($HTTP_POST_VARS['cat_id']));
if ($cat_id != 0 && $cat_id != "") {
$condition .= " AND i.cat_id = '$cat_id'";
}
$image_media_file = trim($HTTP_POST_VARS['image_media_file']);
if ($image_media_file != "") {
$condition .= " AND INSTR(LCASE(i.image_media_file),'".strtolower($image_media_file)."')>0";
}
$image_thumb_file = trim($HTTP_POST_VARS['image_thumb_file']);
if ($image_thumb_file != "") {
$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 = "i.image_name";
}
$limitstart = (isset($HTTP_POST_VARS['limitstart'])) ? trim($HTTP_POST_VARS['limitstart']) : "";
if ($limitstart == "") {
$limitstart = 0;
}
else {
$limitstart--;
}
$limitnumber = trim($HTTP_POST_VARS['limitnumber']);
if ($limitnumber == "") {
$limitnumber = 5000;
}
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 = "ASC";
}
$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";
echo "<td class=\"tableseparator\"><input name=\"allbox\" type=\"checkbox\" onClick=\"CheckAll();\" /></td>\n";
echo "<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<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 = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_date".get_user_table_field(", u.", "user_name")."
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
LIMIT $limitstart, $limitnumber";
$result = $site_db->query($sql);
while ($image_row = $site_db->fetch_array($result)) {
echo "<tr class=\"".get_row_bg()."\">";
echo "<td><input type=\"checkbox\" name=\"deleteimages[]\" value=\"".$image_row['image_id']."\" /></td>";
echo "<td><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank>".format_text($image_row['image_name'], 2)."</a></b> (".$image_row['image_media_file'];
if (!get_file_path($image_row['image_media_file'], "media", $image_row['cat_id'], 1, 0)) {
echo " <b class=\"marktext\">!</b>";
}
echo ")</td>\n";
echo "<td><a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$image_row['cat_id'])."\" target=\"_blank\">".format_text($cat_cache[$image_row['cat_id']]['cat_name'], 2)."</a></td>\n";
$show_user_name = format_text($image_row[$user_table_fields['user_name']], 2);
if ($image_row['user_id'] != GUEST && empty($url_show_profile)) {
$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."</a></td>\n";
echo "<td>".format_date($config['date_format'], $image_row['image_date'])."</td>\n";
echo "<td><p>";
show_text_link($lang['edit'],"images.php?action=editimage&image_id=".$image_row['image_id']);
show_text_link($lang['delete'],"images.php?action=removeimage&image_id=".$image_row['image_id']);
echo "</p></td>\n";
echo "</tr>\n";
}
echo "<tr class=\"tablefooter\">\n<td colspan=\"6\" align=\"left\">\n ";
echo "<input type=\"submit\" value=\" ".$lang['delete']." \" class=\"button\">\n";
echo " \n</td>\n</tr>\n</table>\n</td>\n</tr>\n</table>\n</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";
//if ($limitnumber != 5000 && $limitfinish < $countimages['images']) {
show_hidden_input("action", "findimages");
show_hidden_input("image_id", $image_id);
show_hidden_input("image_name", $image_name, 1);
show_hidden_input("image_description", $image_description, 1);
show_hidden_input("image_keywords", $image_keywords, 1);
show_hidden_input("cat_id", $cat_id);
show_hidden_input("image_media_file", $image_media_file, 1);
show_hidden_input("image_thumb_file", $image_thumb_file, 1);
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", $orderby, 1);
show_hidden_input("direction", $direction, 1);
show_hidden_input("limitstart", $limitstart + $limitnumber + 1);
show_hidden_input("limitnumber", $limitnumber);
if ($limitstart > 1) {
echo "<input type=\"button\" value=\" ".$lang['back']." \" onclick=\"limitstart.value=limitstart.value-limitnumber.value*2;submit();\" class=\"button\">\n";
}
if ($limitnumber != 5000 && $limitfinish < $countimages['images']) {
echo "<input type=\"submit\" value=\" ".$lang['search_next_page']." \" class=\"button\">\n";
}
//echo "<input type=\"button\" value=\" ".$lang['back']." \" onclick=\"history.go(-1)\" class=\"button\">\n";
echo "</form>";
echo "</div>";
}
show_admin_footer();
?>
-
funktioniert wunderbar, mit der einen einschränkung wenn du ein bild hochladest, sieht du die erstellten schlüsselwörter erst wenn du entweder auf die detailseite wechselst
oder wenn du im ACP nach dem du das bild hochgeladen hast, das selbige nochmals aufrufst.
mfg Andi
-
thank you Rembrandt.
i need remove number from keyword and change code to
function clean_description($val) {
$search_array = array("#[-_'`´\^\$\(\)<>\"\|,@\;\?%~\+\.\[\]{}:\/=!§\\\\]+#s123456789");
$replace_array = array(" ");
$val = preg_replace($search_array, $replace_array, $val);
return $val;
}
but not work correctly :(
how to this please help Rembrandt
please see tgis:
http://www.wallward.net/img-ashley_coda7-2815.htm
How to build clean keyword?
-
...i need remove number from keyword and change code to
....
test it:
$search_array = array("#[0-9\-_'`´\/\#/^\$\(\)<>\"\|@*\;\?%~\+\.\[\]{}:\/=!§\\\\]+#s");
-
many thanks , but not work for keyword :cry:
after "rebuild search index" number not remove from keyword, i need clean keyword :roll:
please see keyword field in this page:
link removed
-
Nichts gegen deinen Link, bin ja schon groß, trotzdem solltest Du dir eine Testseite einrichten, mit Jugendfreien Bildern (bzw. ohne die Werbung)
Glaube auch, das Du eine Vorschaltseite brauchst (wegen 18 Jahre etc.)
LG
-
...after "rebuild search index".......
Your questions are always in the wrong threads.....
This is the Thread "Auto generate keywords, if keywords field left empty by users II"
This thread has nothing to do with the "rebuild search index".
-
Klasse MOD, erleichert das Suchen nach Bildern eheblich!
Danke Andi!
Kann man auch weitere Image Fields nehmen, aus denen die keywords gezogen werden sollen?
Schritte 1 und 2 kann man ja einfach um ein weiteres Feld erweitern, Schritt 3 muss man nichts machen denke ich aber in Schritt 4 dann:
Einfach unter
if($config['image_use_image_name'] && empty($image_keywords)){
$keywords_name = $image_name;
}
nochmal das gleiche setzen (nur mit anderem Feld)?
if($config['image_use_image_name'] && empty($image_keywords)){
$keywords_name = $image_anotherfield;
}
Bin mir nicht sicher ob das klappt.
Danke für deine Hilfe!
Grüße,
Patrick
-
Probiere es doch einfach aus, sollte funktionieren mit "$image_anotherfield;" vorausgesetzt diese Variable ist nicht leer.
if($config['image_use_image_name'] && empty($image_keywords)){
$keywords_name = $image_name;
}
if($config['image_use_image_name'] && !empty($image_anotherfield){
$keywords_name = $image_name.",".$image_anotherfield;
}
mfg Andi
-
Puhhh, ist gar net so einfach wie ich dachte.
Hab nicht alles durchgedacht --> man muss die neue Variable doch bestimmt noch iwo in den SQL-Abfragen usw. einfügen...
Das wird schwierig.
-
Puhhh, ist gar net so einfach wie ich dachte.
Hab nicht alles durchgedacht --> man muss die neue Variable doch bestimmt noch iwo in den SQL-Abfragen usw. einfügen...
Das wird schwierig.
Hm, hab mal ne Weile rumprobiert.
Iwie klappts aber nicht so richtig.
An welchen Stellen muss die Variable denn definiert werden?
-
Puhhh, ist gar net so einfach wie ich dachte.
Hab nicht alles durchgedacht --> man muss die neue Variable doch bestimmt noch iwo in den SQL-Abfragen usw. einfügen...
Das wird schwierig.
Hm, hab mal ne Weile rumprobiert.
Iwie klappts aber nicht so richtig.
An welchen Stellen muss die Variable denn definiert werden?
Hab gerade mal noch bisschen rumprobiert:
if($config['image_use_image_name'] && empty($image_keywords)){
$keywords_name = $image_name.",".$image_typ;
}
...und weiter unten noch:
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
Jedoch funzt es immernoch nicht. Das 2. image field ist in der if-Ausgabe angegeben und weiter unten die Variable (image_typ) definiert.
Wo liegt also der Fehler?
Ich freue mich über jede Hilfe!
Grüße,
Patrick
-
Der Hintergrund von mehreren image fields im Keyword-Feld ist übrigens folgender:
Um z.B. nach "BR 1016" zu suchen muss man ein * einfügen, also "BR*1016".
Bei längeren Wörtern kann das sehr ungeschickt werden und sehr user-unfreundlich.
Eventuell gibt es hier noch eine andere Lösung das Problem mit den * zu beheben?
-
Hallo,
bei mir wird in den Keywords das "&" angezeigt .....
meta name="keywords" content="Angezogen, &, Nackt"
Wie bringe ich das weg?
-
Hi!
Liest euch mal diesen Tutorial durch, vielleicht wird dann einiges klarer.
http://www.4homepages.de/forum/index.php?topic=29598.0
mfg Andi
-
Hey,
ich hab bei mir schon die Felder auf "keywords" gesetzt ;)
Das Problem ist, dass wenn man in eines der dafür vorgesehen image fields "BR 1016 272" eingibt, muss man in der Suche "BR*1016*272" eingeben, damit das Bild gefunden wird.
Und sowas einem User beizubringen, ist nicht immer einfach ;)
Hättest du evtl. noch eine Idee, das Problem zu beheben?
Grüße und Danke,
Patrick
EDIT: Ahhh, da liegt die Lösung, einfach auf "fulltext" umstellen.
@ Rembrandt: Bist der beste! Vielen Dank!
-
...muss man in der Suche "BR*1016*272" eingeben, damit das Bild gefunden wird.....
Nein man muß im Eingabefeld die Suchbegriffe in Anführungszeichen setzen, dann klapt es auch mit Keywords.
"BR 1016 272"
mfg Andi
-
...muss man in der Suche "BR*1016*272" eingeben, damit das Bild gefunden wird.....
Nein man muß im Eingabefeld die Suchbegriffe in Anführungszeichen setzen, dann klapt es auch mit Keywords.
"BR 1016 272"
mfg Andi
Wenn man jedoch nur nach "BR 1016" suchen will, muss man doch das * benutzen oder?
-
Nein, such mal auf dieser Seite (http://entwicklung.vienna-pictures.com/) nach: "BR 1016 272"
Einmal mit einmal ohne Anführungszeichen, diese Zeichenfolge ist ganz einfach ein Schlüsselwort.
Du kannst natürlich auch nach Br* suchen dann werden alle Bilder mit "Br" und irgend welche Zeichen hinten nach, in den Schlüsselwörter gefunden.
-
Ok, jetzt tritt leider folgendes Problem auf:
Ich habe unter jedem Thumbnail Links auf die image fields gesetzt, sodass wenn man diese klickt alle Bilder mit diesem Wert angezeigt werden.
Beim image field, dass ich auf "keywords" umgestellt habe funktioniert jetzt leider nicht mehr der folgende Link:
/search.php?search_keywords="TGV 4712"
In der functions.php habe ich die Links folgendermaßen aufgebaut:
"typ_url" => "<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_keywords="".$image_row['image_typ']).""\">".$image_row ['image_typ']."</a>",
Weißt du evtl. wo der Fehler liegt?
Danke und Grüße,
Patrick
-
...
Beim image field, dass ich auf "keywords" umgestellt habe funktioniert jetzt leider nicht mehr der folgende Link:
......
Was funktioniert nicht, der link an sich, oder gibt es kein Ergebnis?
Du kannst auch in der DB nachsehen ob dort das Suchwort überhaupt eingetragen ist. (4images_wordlist)
mfg Andi
-
Es kommt kein Ergebnis wenn man den Link anklickt.
Nop, das Suchwort ist nicht eingetragen obwohl das Bild den Wert im image_field hat.
Komisch, da ich eigentlich nach dem Umstellen des Index Typ den Search Index rebuilded hab.
EDIT: Neue Erkenntnis:
/search.php?search_keywords=BR 4020 208-7
bei diesem Link werden Bilder gefunden, jedoch auch die, welche im image field einen anderen Wert haben, z.B. "BR 1144 221".
Klickt man den Link wäre es aber gut wenn nur Bilder gefunden werden die auch genau diesen Wert im image image field haben.
-
....
bei diesem Link werden Bilder gefunden, jedoch auch die, welche im image field einen anderen Wert haben, z.B. "BR 1144 221".
Klickt man den Link wäre es aber gut wenn nur Bilder gefunden werden die auch genau diesen Wert im image image field haben.
...
Das ist klar weil, "BR" in den anderen Feldern auch vorkommt, du mußt den Suchbegriff in Anführungszeichen setzen (siehe Tutorial).
So zu den "Fehler" erstens schau mal in der DB nach ob in diesen Image Feld der Suchbegriff vom Formular überhaupt eingetragen worden ist, ist er das nicht dann kann die Rebuild Search Index natürlich gar nichts in die "4images_wordlist" eintragen.
Dann die schau mal in der "Rebuild....php", ob die Version die du verwendest überhaut die zusätzlichen Image felder überhaupt unterstützt.
mfg Andi
-
Sodele, hab gerade mal ein Bild hochgeladen (das erste Bild nach Umstellen des Index-Typ).
Jetzt findet er beim Klicken des Links auch nur Bilder mit genau dem image field, es sieht also so aus als käme das Problem von der Umstellung des Index Typ denn nun wurde der Wert erfolgreich in 4images_wordlist eingetragen.
Danke!
-
Wenn ein Bildname sich "Künster - Bildname" nennt und die Keywords auto generiert werden. Wie bekomme ich das "-" aus den Keywords weg? Denn er erstellt die K-Words so "Künstler,-,Bildname" !?
-
Works great there was no problem at all thank you so much :oops:
-
hello works fine thanks you
but i have an error message when i rebuild
if title is "Jeremy's house"
i have
DB Error: Bad SQL Query: UPDATE 4images_images SET image_keywords = 'Jeremy's,house' WHERE image_id = 124
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's,house' WHERE image_id = 124' at line 2
OK
if i put Jeremy s house its ok ... the problem is with " ' "