[MOD] Aynı Resimden İki Tane Varmı Kontrol Eden Eklenti v1.0
Aç member.php
Ara
if (!$error) {
// Start Upload
include(ROOT_PATH.'includes/upload.php');
Bu kodu bulunca üstüne alttaki kodu ekleyin
/*
MOD CHECK FOR DUPLICATE IMAGES
START INSERT
*/
##########
# CONFIG #
##########
$check_admin = true; //do check when administrator is uploading? (true/false)
$show_image = true; //show link to the image that was previously uploaded? (true/false)
$show_member = true; //show name and link to profile page of the member who previously uploaded that file? (true/false)
##############
# END CONFIG #
##############
$md5 = "";
unset($HTTP_POST_VARS['image_md5']);
if ($user_info['user_level'] != ADMIN || $check_admin)
{
if (!empty($HTTP_POST_FILES['media_file']['tmp_name']) && $HTTP_POST_FILES['media_file']['tmp_name'] != "none")
{
$md5 = md5_file($HTTP_POST_FILES['media_file']['tmp_name']);
$file = $HTTP_POST_FILES['media_file']['filename'];
}
elseif ($remote_media_file)
{
$md5 = md5($remote_media_file);
$file = $remote_media_file;
}
if ($md5)
{
$sql = "SELECT image_id, image_name, cat_id, user_id
FROM ".IMAGES_TABLE."
WHERE image_md5 = '".$md5."'
LIMIT 1";
if ($row = $site_db->query_firstrow($sql))
{
$row['image_name'] = stripslashes($row['image_name']);
if (function_exists('multilang')) $row['image_name'] = multilang($row['image_name']);
$user_row = get_user_info($row['user_id']);
// $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$file."</b><br />";
$msg .= (($msg != "") ? "<br />" : "").(($user_info['user_level'] > GUEST && $user_info['user_id'] == $user_row['user_id']) ? $lang['image_md5_duplicate_self'] : sprintf(($show_member ? $lang['image_md5_duplicate_more'] : $lang['image_md5_duplicate_simple']), "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$user_row['user_id'])."\">".$user_row['user_name']."</a>"));
if ($show_image && (($user_info['user_level'] > GUEST && $user_info['user_id'] != $user_row['user_id']) || (check_permission("auth_viewcat", $row['cat_id'] && check_permission("auth_viewimage", $row['cat_id'])))))
{
$msg .= ": <a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$row['image_id'])."\">".$row['image_name']."</a>";
}
$error = 1;
}
else
{
$sql = "SELECT image_id, image_name, user_id
FROM ".IMAGES_TEMP_TABLE."
WHERE image_md5 = '".$md5."'
LIMIT 1";
if ($row = $site_db->query_firstrow($sql))
{
$user_row = get_user_info($row['user_id']);
// $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$file."</b><br />";
$msg .= (($msg != "") ? "<br />" : "").(($user_info['user_level'] > GUEST && $user_info['user_id'] == $row['user_id']) ? $lang['image_md5_duplicate_validation_self'] : sprintf(($show_member ? $lang['image_md5_duplicate_validation_more'] : $lang['image_md5_duplicate_validation_simple']), "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$user_row['user_id'])."\">".$user_row['user_name']."</a>"));
$error = 1;
}
}
$HTTP_POST_VARS['image_md5'] = $md5;
}
}
/*
MOD CHECK FOR DUPLICATE IMAGES
END INSERT
*/
Aç lang/<senin dil klasörü>/main.php
bu işaretten önce kodu ekle ?>
$lang['image_md5'] = "Image MD5 hash";
$lang['image_md5_duplicate_self'] = "You have submitted this file before";
$lang['image_md5_duplicate_more'] = "This file has been previously submitted by %s";
$lang['image_md5_duplicate_simple'] = "This file has been previously submitted";
$lang['image_md5_duplicate_validation_self'] = "You have submitted this file before and awaiting validation.";
$lang['image_md5_duplicate_validation_more'] = "This file has been previously submitted by %s and awaiting validation.";
$lang['image_md5_duplicate_validation_simple'] = "This file has been previously submitted and awaiting validation.";
Aç includes/db_field_definitions.php
Bu işaretten önce kodu ekleyin ?> :
$additional_image_fields['image_md5'] = array($lang['image_md5'], "text", 0);
Sonra ekli dosyadaki image_md5_hash.php yi admin/plugins klasörü içine atınız
Sonrasında yine siteyi açıp admin paneline girin plugins menüsü var solda oradan "Image MD5 hash update" ye tıklayın ve gönder diyin.
Sonrasında
Çift resim varmı kontrol etmek için Image ID to start at alanına yazıp gönder diyiniz.