Author Topic: Autor can't rating  (Read 10167 times)

0 Members and 1 Guest are viewing this topic.

Offline Ferus

  • Newbie
  • *
  • Posts: 16
    • View Profile
Autor can't rating
« on: February 08, 2007, 01:42:03 PM »
Ok, i have problem. On my galery i would to do some modification of rating. I woluld to get mod for rating beacuse the authors of photos CAN vote on his/her photo. Can i disable it and where?

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Autor can't rating
« Reply #1 on: February 09, 2007, 08:08:21 PM »
open /includes/page_header.php
search:
Code: [Select]
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
  $rating = intval($HTTP_POST_VARS['rating']);
  $cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
  $cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
  if ($rating && $rating <= MAX_RATING && $id) {
    if (!isset($session_info['rated_imgs'])) {
      $session_info['rated_imgs'] = $site_sess->get_session_var("rated_imgs");
    }
    $split_list = array();
    if (!empty($session_info['rated_imgs'])) {
      $split_list = explode(" ", $session_info['rated_imgs']);
    }
    if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
      $session_info['rated_imgs'] .= " ".$id;
      $session_info['rated_imgs'] = trim($session_info['rated_imgs']);
      $site_sess->set_session_var("rated_imgs", $session_info['rated_imgs']);
      $cookie_rated[] = $id;
      $cookie_expire = time() + 60 * 60 * 24 * 4;
      setcookie($cookie_name.'rated', serialize($cookie_rated), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
      update_image_rating($id, $rating);
      $msg = $lang['voting_success'];
    }
    else {
      $msg = $lang['already_voted'];
    }
  }
  else {
    $msg = $lang['voting_error'];
  }
}

replace with:
Code: [Select]
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
global $site_db;
$sql = "SELECT user_id
          FROM ".IMAGES_TABLE."
          WHERE image_id = $id";
$rating_row = $site_db->query_firstrow($sql);
//error_log("UserID:".$user_info['user_id']."\n ImageID:".$id."\n ImageOwnerID:".$rating_row['user_id']."\n", 3, "/srv/www/htdocs/web12/html/fw-shop-4images/cache/_error.log");
if ($rating && $rating <= MAX_RATING && $id ) {
if ($user_info['user_id'] != $rating_row['user_id']) {
if (!isset($session_info['rated_imgs'])) {
$session_info['rated_imgs'] = $site_sess->get_session_var("rated_imgs");
}
$split_list = array();
if (!empty($session_info['rated_imgs'])) {
$split_list = explode(" ", $session_info['rated_imgs']);
}
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
$session_info['rated_imgs'] .= " ".$id;
$session_info['rated_imgs'] = trim($session_info['rated_imgs']);
$site_sess->set_session_var("rated_imgs", $session_info['rated_imgs']);
$cookie_rated[] = $id;
$cookie_expire = time() + 60 * 60 * 24 * 4;
setcookie($cookie_name.'rated', serialize($cookie_rated), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
update_image_rating($id, $rating);
$msg = $lang['voting_success'];
}
else {
$msg = $lang['already_voted'];
}
}
else {
$msg = $lang['voting_owner_error'];
}
}
else {
$msg = $lang['voting_error'];
}
}

open /lang/XXXX/main.php

add:
$lang['voting_owner_error'] = "Image owner are not allowed to rate there own Images";

Hope this will work... (o:

Good speed!
« Last Edit: February 17, 2007, 12:59:32 PM by Acidgod »

Offline Ferus

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Autor can't rating
« Reply #2 on: February 15, 2007, 07:15:58 PM »
Ok, this is it. But now the users can't rate all of images of all users. :| Can help?

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Autor can't rating
« Reply #3 on: February 17, 2007, 01:00:06 PM »
I have update my first Post...

Offline Ferus

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Autor can't rating
« Reply #4 on: February 17, 2007, 03:25:23 PM »
Working perfectly. Thanks you very much!

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Autor can't rating
« Reply #5 on: February 17, 2007, 04:04:41 PM »
@mawenzi
Vielleicht magst Du diesen Thread verschieben? (o:

Offline Ferus

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Autor can't rating
« Reply #6 on: March 04, 2007, 08:08:32 AM »
I have a small problem now. Users on my gallery now CAN rate on ONE photo many times. Can help?

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Autor can't rating
« Reply #7 on: March 04, 2007, 12:57:47 PM »
Give me a Test Account, will test it on your Site...

Offline Ferus

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Autor can't rating
« Reply #8 on: April 05, 2007, 08:25:57 AM »
acidgod, i've test and test but my users can rating all time of photos and his/her photo.... But on my PC is code is working x/ that can modyfi this with mod Rating Button Disabled After Vote ?

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Autor can't rating
« Reply #9 on: April 06, 2007, 03:43:11 AM »
Give me a Test Account, will test it on your Site...

 :roll:

Offline Ferus

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Autor can't rating
« Reply #10 on: April 06, 2007, 07:50:55 AM »
You have this account fot long time :)

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Autor can't rating
« Reply #11 on: April 06, 2007, 11:34:31 AM »
hey you only send me the mail with the code, but no user or pw...

Offline Ferus

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Autor can't rating
« Reply #12 on: April 19, 2007, 07:10:55 PM »
Hm... i all have the same problem. But i find when it happens. When i log on I rate a photos and log out. When i log out next time, i can rate this photo again.
That also you modification Acidgod nothing works with some of my users. Plz help one more time.