Ignore:
Timestamp:
May 1, 2007, 3:57:52 PM (17 years ago)
Author:
rub
Message:

Issue 0000684: History [Search] - Add a thumbnail display

o Display choice can be selected
o Display choice is saved on on cookie
o Small improvement picture link (hoverbox on all the link, alt&title on classic mode)
o New cookie functions and use

Enhance computing method of script_basename function.

http://forum.phpwebgallery.net/viewtopic.php?pid=58258#p58258

Merge BSF 1988:1989 into branch-1_7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_rate.inc.php

    r1903 r1992  
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     7// | file          : $Id$
    98// | last update   : $Date$
    109// | last modifier : $Author$
     
    6059    $anonymous_id = implode ('.', $ip_components);
    6160
    62     if (isset($_COOKIE['pwg_anonymous_rater']))
    63     {
    64       if ($anonymous_id != $_COOKIE['pwg_anonymous_rater'])
    65       { // client has changed his IP adress or he's trying to fool us
     61    $save_anonymous_id = pwg_get_cookie_var('anonymous_rater', $anonymous_id);
     62
     63    if ($anonymous_id != $save_anonymous_id)
     64    { // client has changed his IP adress or he's trying to fool us
     65      $query = '
     66SELECT element_id
     67FROM '.RATE_TABLE.'
     68WHERE user_id = '.$user['id'].'
     69  AND anonymous_id = \''.$anonymous_id.'\'
     70;';
     71      $already_there = array_from_query($query, 'element_id');
     72
     73      if (count($already_there) > 0)
     74      {
    6675        $query = '
    67 SELECT element_id
    68   FROM '.RATE_TABLE.'
    69   WHERE user_id = '.$user['id'].'
    70     AND anonymous_id = \''.$anonymous_id.'\'
    71 ;';
    72         $already_there = array_from_query($query, 'element_id');
    73 
    74         if (count($already_there) > 0)
    75         {
    76           $query = '
    7776DELETE
    78   FROM '.RATE_TABLE.'
    79   WHERE user_id = '.$user['id'].'
    80     AND anonymous_id = \''.$_COOKIE['pwg_anonymous_rater'].'\'
    81     AND element_id NOT IN ('.implode(',', $already_there).')
    82 ;';
    83            pwg_query($query);
    84          }
    85 
    86          $query = '
    87 UPDATE
    88   '.RATE_TABLE.'
    89   SET anonymous_id = \'' .$anonymous_id.'\'
    90   WHERE user_id = '.$user['id'].'
    91     AND anonymous_id = \'' . $_COOKIE['pwg_anonymous_rater'].'\'
     77FROM '.RATE_TABLE.'
     78WHERE user_id = '.$user['id'].'
     79  AND anonymous_id = \''.$save_anonymous_id.'\'
     80  AND element_id NOT IN ('.implode(',', $already_there).')
    9281;';
    9382         pwg_query($query);
     83       }
    9484
    95          setcookie(
    96             'pwg_anonymous_rater',
    97             $anonymous_id,
    98             strtotime('+10 years'),
    99             cookie_path()
    100            );
    101       } // end client changed ip
    102     } // end client has cookie
    103     else
    104     {
    105       setcookie(
    106           'pwg_anonymous_rater',
    107           $anonymous_id,
    108           strtotime('+10 years'),
    109           cookie_path()
    110           );
    111     }
     85       $query = '
     86UPDATE
     87'.RATE_TABLE.'
     88SET anonymous_id = \'' .$anonymous_id.'\'
     89WHERE user_id = '.$user['id'].'
     90  AND anonymous_id = \'' . $save_anonymous_id.'\'
     91;';
     92       pwg_query($query);
     93    } // end client changed ip
     94
     95  pwg_get_cookie_var('anonymous_rater', $anonymous_id);
    11296  } // end anonymous user
     97
    11398  $query = '
    11499DELETE
Note: See TracChangeset for help on using the changeset viewer.