4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on May 24, 2003, 06:10:27 PM
-
Many people asked me post the code that will disable "rate form" after visitor voted. (no more error message "Sorry, u have voted ones recently") u can try it youself here (http://gallery.vano.org/7570)
what it does:
1. could be anable/disable to show what was your vote for each picture. (it will show your vote number in the dropdown, but it will be disabled and u wont be able vote again for that image)
2. could be anabled/disabled ability vote for one image by different members who share one computer. (right now, if u and your brother use the same computer, and u visit 4images sites with different login names, after vote either of u, cookies set that nobody else can vote for the same image from same computer)
3. rate form generates automaticaly based on MAX_RATING set in /includes/constants.php
Open /includes/page_header.php
Find://-----------------------------------------------------
//--- 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'];
}
}
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
Replace with://-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
//----- Settings ------------
//change to $rate_suffix = ""; if u dont want remmber votes for different users on same computer
$rate_suffix = "_".$user_info['user_id'];
//--- End Settings ----------
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated_array = isset($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix]) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix])) : array();
if ($rating && $rating <= MAX_RATING && $id) {
if (!isset($session_info['rated_imgs'.$rate_suffix])) {
$session_info['rated_imgs'.$rate_suffix] = $site_sess->get_session_var("rated_imgs".$rate_suffix);
}
$split_list_array = array();
if (!empty($session_info['rated_imgs'.$rate_suffix])) {
$split_list_array = explode(" ", $session_info['rated_imgs'.$rate_suffix]);
}
$split_list = array();
foreach ($split_list_array as $key) {
$key = explode(",", $key);
$split_list[] = $key[0];
}
$cookie_rated = array();
foreach ($cookie_rated_array as $key) {
$key = explode(",", $key);
$cookie_rated[] = $key[0];
}
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
$session_info['rated_imgs'.$rate_suffix] .= " ".$id.",".$rating;
$session_info['rated_imgs'.$rate_suffix] = trim($session_info['rated_imgs'.$rate_suffix]);
$site_sess->set_session_var("rated_imgs".$rate_suffix, $session_info['rated_imgs'.$rate_suffix]);
$cookie_rated_array[] = $id.",".$rating;
$cookie_expire = time() + 60 * 60 * 24 * 4;
setcookie($cookie_name.'rated'.$rate_suffix, serialize($cookie_rated_array), $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'];
}
}
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
Open /includes/functions.php
Find: $site_template->register_vars("rate", $lang['rate']);
$rate_form = $site_template->parse_template("rate_form");
}
$site_template->register_vars("rate_form", $rate_form);
return true;
}
Replace with: $rate_form = rate_form($image_row['image_id'], $rate_suffix, $rating);
}
$site_template->register_vars("rate_form", $rate_form);
return true;
}
function rate_form($id, $rate_suffix = "", $rating = ""){
global $site_template, $session_info, $lang, $site_sess, $HTTP_COOKIE_VARS, $rate_suffix;
//----- Settings ------------
//change to $rate_show = 0; if u dont want to show what was your vote for an image
$rate_show = 1;
//--- End Settings ----------
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated_array = isset($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix]) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix])) : array();
$split_list_array = array();
if (!empty($session_info['rated_imgs'.$rate_suffix])) {
$split_list_array = explode(" ", $session_info['rated_imgs'.$rate_suffix]);
}
$cookie_rated = array();
foreach ($cookie_rated_array as $key) {
$split = explode(",", $key);
$cookie_rated[] = $split[0];
if ($id == $split[0]) {
$rating = $split[1];
}
}
$split_list = array();
foreach ($split_list_array as $key) {
$split = explode(",", $key);
$split_list[] = $split[0];
if ($id == $split[0]) {
$rating = $split[1];
}
}
$no_rateform = (in_array($id, $split_list) || in_array($id, $cookie_rated)) ? "disabled" : 0;
$rate_options = "<option value=\"\">--</option>\n";
for ($i = MAX_RATING; $i; $i--){
$rate_options .= "<option value=\"".$i."\"".(($i == $rating && $rate_show) ? "selected" : "").">".$i."</option>\n";
}
$site_template->register_vars(array(
"rate" => ($no_rateform && !(check_permission("auth_vote", $image_row['cat_id']) && $no_rateform)) ? "rated" : $lang['rate'],
"rate_options" => $rate_options,
"rate_button" => ($no_rateform) ? $no_rateform : ""
));
$rate_form = $site_template->parse_template("rate_form");
return $rate_form;
}
*In each changed parts u'll find //----- Settings ---------
Open /templates/<yourtemplate>/rate_form.html
replace the code with this:<table border="0" cellspacing="0" cellpadding="1">
<form method="post" action="{self}">
<tr>
<td class="head1">
<table border="0" cellspacing="0" cellpadding="3" class="row1">
<tr>
<td valign="bottom">
<select name="rating" class="select" {rate_button}>
{rate_options}
</select>
</td>
<td>
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" />
<input type="submit" value="{rate}" class="button" name="submit" {rate_button} />
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
-
Works well :wink:
Only one thing, not all people speak english. :?
Rated -> Calificación
/includes/functions.php
"rate" => ($no_rateform && !(check_permission("auth_vote", $image_row['cat_id']) && $no_rateform)) ? "Calificación" : $lang['rate'],
-
Only one thing, not all people speak english. :?
Rated -> Calificación
/includes/functions.php
"rate" => ($no_rateform && !(check_permission("auth_vote", $image_row['cat_id']) && $no_rateform)) ? "Calificación" : $lang['rate'],
yes, u are right, I just wasnt feel like I want add multilanguage support here...;)
u can replace "Calificación" with $lang['rated'] and then add
$lang['rated'] = "Calificación"; in your /lang/<yourlanguage>/main.php
-
Uch, I tought, that to modify it will be easyer, but look at my rate_form.html
I just want to hide the form after vote...
<form action="{self}" method="post" name="RateMe" id="RateMe">
<table cellspacing="0" cellpadding="1" border="0" style="border-color:#999999; border-style:solid; border-width:1px; ">
<tr>
<td> <table cellspacing="0" cellpadding="3" border="0">
<tr>
<td width="0" valign="middle"><strong>Ávertink:</strong></td>
<td width="1" valign="middle"><input onClick="document.RateMe.submit()" type="radio" value="1" name="rating" /></td>
<td width="1" valign="middle">1</td>
<td width="1" valign="middle"><input onClick="document.RateMe.submit()" type="radio" value="2" name="rating" /></td>
<td width="1" valign="middle">2</td>
<td width="1" valign="middle"><input onClick="document.RateMe.submit()" type="radio" value="3" name="rating" /></td>
<td width="1" valign="middle">3</td>
<td width="1" valign="middle"><input onClick="document.RateMe.submit()" type="radio" value="4" name="rating" /></td>
<td width="1" valign="middle">4</td>
<td width="1" valign="middle"><input onClick="document.RateMe.submit()" type="radio" value="5" name="rating" /></td>
<td width="1" valign="middle">5</td>
<td rowspan="2"> <input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" /> </td>
</tr>
</table></td>
</tr>
</table>
</form>
-
either install "{ifno ..} {endifno ..}" mod and use {ifno rate_button} and {endifno rate_button} around your form, or in includes/functions.php find:
"rate_options" => $rate_options,
insert below: "show_rate_form" => ($no_rateform) ? 0 : 1,
then in your rate_form.html use {if show_rate_form} and {endif show_rate_form} tags ;)
-
great! :) thanks again... ;)
-
I've told u its easier modify already existing mod then start from scratch ;)
-
V@no - this seems to "expire" after cookies are deleted - seems like there was another "disable rating after vote" thing I used before that just posted a message "Sorry, but you've already voted..."
here's my code from page_header.php:/* //-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
if ($user_info['user_level'] != GUEST) {
$voted_array = array();
if (!empty($user_info['user_voted'])) {
$voted_array = explode(" ", $user_info['user_voted']);
}
$list_rated = array();
foreach ($voted_array as $key) {
$split = explode(",", $key);
$list_rated[] = $split[0];
if ($id == $split[0]) {
$rating = $split[1];
}
}
$rated = in_array($id, $list_rated);
}else{
$rated = FALSE;
}
$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) && !$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'];
}
} */
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
//----- Settings ------------
//change to $rate_suffix = ""; if u dont want remmber votes for different users on same computer
$rate_suffix = "_".$user_info['user_id'];
//--- End Settings ----------
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated_array = isset($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix]) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix])) : array();
if ($rating && $rating <= MAX_RATING && $id) {
if (!isset($session_info['rated_imgs'.$rate_suffix])) {
$session_info['rated_imgs'.$rate_suffix] = $site_sess->get_session_var("rated_imgs".$rate_suffix);
}
$split_list_array = array();
if (!empty($session_info['rated_imgs'.$rate_suffix])) {
$split_list_array = explode(" ", $session_info['rated_imgs'.$rate_suffix]);
}
$split_list = array();
foreach ($split_list_array as $key) {
$key = explode(",", $key);
$split_list[] = $key[0];
}
$cookie_rated = array();
foreach ($cookie_rated_array as $key) {
$key = explode(",", $key);
$cookie_rated[] = $key[0];
}
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
$session_info['rated_imgs'.$rate_suffix] .= " ".$id.",".$rating;
$session_info['rated_imgs'.$rate_suffix] = trim($session_info['rated_imgs'.$rate_suffix]);
$site_sess->set_session_var("rated_imgs".$rate_suffix, $session_info['rated_imgs'.$rate_suffix]);
$cookie_rated_array[] = $id.",".$rating;
$cookie_expire = time() + 60 * 60 * 24 * 4;
setcookie($cookie_name.'rated'.$rate_suffix, serialize($cookie_rated_array), $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'];
}
}
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
I simply commented out what was already there and added this new code - - but users can still vote again the next day - - is this one based on cookies?
thx -
-
are u saing that if u delete the cookies, u can again vote? - well, yes, what do u expect ;)
-
if u delete the cookies, u can again vote
but the earlier one stored in the DB, so if a user votes, he can't vote again, ever. not sure what was different between these two MODS.... :?
-
these are completly different mods ;)
-
:lol: but, as usual, I want to combine 2 MODS :!:
I like the idea of the rating box showing a user's last rating, but the cookie never expiring so they can't vote again 8)
(nothing's ever good enough for me, as my mom often told me.... :| )
-
and i want one like is on V@no site :twisted:
-
@veno: remember my problem? :roll:
This is how my rate_form.html looks like:
<table border="0" cellspacing="0" cellpadding="3" class="row1">
<tr>
<td> <input type="radio" name="rating" value="0">
0 - {lang_rate_zero}<br>
<input type="radio" name="rating" value="1.0">
1 - {lang_rate_one}<br>
<input type="radio" name="rating" value="2.0">
2 - {lang_rate_two}<br>
<input type="radio" name="rating" value="3.0">
3 - {lang_rate_three}<br>
<input type="radio" name="rating" value="4.0">
4 - {lang_rate_four}<br>
<input type="radio" name="rating" value="5.0">
5 - {lang_rate_five}
</td>
</tr>
</table>
Can anyone help me solve this problem?
-
this is the first time you post in this thread, so we don´t now your Problem... (o:
-
Hello, V@no!
How I can do it your code for my template 'rate-form.html'?
Preview my vote:
(http://plmag.com/pix/img.jpg)
I have this code:
<!-- start rate_form.html -->
<table border="0" align="left" cellpadding="1" cellspacing="0">
<tr>
<form method="post" action="{self}">
<td>
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" />
<input type="hidden" name="rating" value="1" />
<input src="{template_url}/images/1.gif" type="image" name="Mangelhaft" value="Mangelhaft" alt="Mangelhaft" title="1"/>
</td></form><form method="post" action="{self}">
<td>
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" />
<input type="hidden" name="rating" value="2" />
<input src="{template_url}/images/2.gif" type="image" name="Ausreichend" value="Ausreichend" alt="Ausreichend" title="2"/>
</td></form><form method="post" action="{self}">
<td>
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" />
<input type="hidden" name="rating" value="3" />
<input src="{template_url}/images/3.gif" type="image" name="Befriedigend" value="Befriedigend" alt="Befriedigend" title="3"/>
</td></form><form method="post" action="{self}">
<td>
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" />
<input type="hidden" name="rating" value="4" />
<input src="{template_url}/images/4.gif" type="image" name="Gut" value="Gut" alt="Gut" title="4"/>
</td></form><form method="post" action="{self}">
<td>
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" />
<input type="hidden" name="rating" value="5" />
<input src="{template_url}/images/5.gif" type="image" name="Sehr gut" value="Sehr gut" alt="Sehr gut" title="5"/>
</td></form></tr>
</td>
</table>
<!-- end rate_form.html -->
-
mmm...did u try add {rate_button} inside your "image" button?
-
Yes!
-
this is the first time you post in this thread, so we don´t now your Problem... (o:
I posted this problem before forum was hecked ;)
-
Hi V@no, hi mawenzi
I have implemented the following MOD:
Votes saved in DB / Version A
http://www.4homepages.de/forum/index.php?topic=6123.0
Now I have installed this MOD.
Now, the vote is stored in the DB, but after deleting Cookies, it is possible to vote again (although the vote is stored in the DB).
Is it possible, that a user can vote only once and disabled the dropdown after voting?
Thanks for helping me!
TIMT
-
Anyone else who can give me an answer?
Thanks!
-
@TIMT
http://www.4homepages.de/forum/index.php?topic=5853.msg35441#msg35441
-
http://www.4homepages.de/forum/index.php?topic=6123.msg60531#msg60531
-
I wanted to show the download button after rating, like with an info:
please rate this image to get the download link (before rating)
Thank you for rating this image, your donwload link: (after rating)
how can i do this ;)
-
Thanks for this great Mod! :P
I use the phpbb Mod and if i logout, and login i can vote again.
Seems like the cookie is not really stored.
The phpBB Mod dont use the 4image_ Cookie.
:?: How can i store the Cookie that i rated at my 4images - phpBB Gallery?
How do i set the rate in the phpBB Cookie?
Thank you
-
i think last version has this already built in, but it does not gray out the vote after the first vote..
-
V@no
i installed the mod now when i access for search.php this give me many errors on functions.php
?
do you know wath is this, page_header?
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined offset: 1 in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 492
Notice: Undefined variable: image_row in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 509
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: image_row in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 509
-
V@no
i installed the mod now when i access for search.php this give me many errors on functions.php
?
do you know wath is this, page_header?
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined offset: 1 in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 492
Notice: Undefined variable: image_row in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 509
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: image_row in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 509
when i go to:
search.php?search_new_images=1
errors:
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined offset: 1 in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 492
Notice: Undefined variable: image_row in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 509
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: image_row in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 509
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: image_row in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 509
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
functions.php 451-516
if (!empty($additional_image_fields)) {
$additional_field_array = array();
foreach ($additional_image_fields as $key => $val) {
$additional_field_array[$key] = (!empty($image_row[$key])) ? format_text($image_row[$key], 1) : REPLACE_EMPTY;
$additional_field_array['lang_'.$key] = $val[0];
}
if (!empty($additional_field_array)) {
$site_template->register_vars($additional_field_array);
}
}
$rate_form = "";
if (check_permission("auth_vote", $image_row['cat_id'])) {
$rate_form = rate_form($image_row['image_id'], $rate_suffix, $rating);
}
$site_template->register_vars("rate_form", $rate_form);
return true;
}
function rate_form($id, $rate_suffix = "", $rating = ""){
global $site_template, $session_info, $lang, $site_sess, $HTTP_COOKIE_VARS, $rate_suffix;
//----- Settings ------------
//change to $rate_show = 0; if u dont want to show what was your vote for an image
$rate_show = 1;
//--- End Settings ----------
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated_array = isset($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix]) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix])) : array();
$split_list_array = array();
if (!empty($session_info['rated_imgs'.$rate_suffix])) {
$split_list_array = explode(" ", $session_info['rated_imgs'.$rate_suffix]);
}
$cookie_rated = array();
foreach ($cookie_rated_array as $key) {
$split = explode(",", $key);
$cookie_rated[] = $split[0];
if ($id == $split[0]) {
$rating = $split[1];
}
}
$split_list = array();
foreach ($split_list_array as $key) {
$split = explode(",", $key);
$split_list[] = $split[0];
if ($id == $split[0]) {
$rating = $split[1];
}
}
$no_rateform = (in_array($id, $split_list) || in_array($id, $cookie_rated)) ? "disabled" : 0;
$rate_options = "<option value=\"\">--</option>\n";
for ($i = MAX_RATING; $i; $i--){
$rate_options .= "<option value=\"".$i."\"".(($i == $rating && $rate_show) ? "selected" : "").">".$i."</option>\n";
}
$site_template->register_vars(array(
"rate" => ($no_rateform && !(check_permission("auth_vote", $image_row['cat_id']) && $no_rateform)) ? "rated" : $lang['rate'],
"rate_options" => $rate_options,
"rate_button" => ($no_rateform) ? $no_rateform : ""
));
$rate_form = $site_template->parse_template("rate_form");
return $rate_form;
}
-
$rate_form = "";
$image_row = "";
$rating = "";
$rate_suffix = "";
if (check_permission("auth_vote", $image_row['cat_id'])) { -------------------------------------------this is 466
$rate_form = rate_form($image_row['image_id'], $rate_suffix, $rating);
}
$site_template->register_vars("rate_form", $rate_form);
return true;
}
i insert this variables but a error stills:
Notice: Uninitialized string offset: 0 in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 466
V@no
i installed the mod now when i access for search.php this give me many errors on functions.php
?
do you know wath is this, page_header?
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined offset: 1 in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 492
Notice: Undefined variable: image_row in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 509
Notice: Undefined variable: rate_suffix in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: rating in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 464
Notice: Undefined variable: image_row in /home/nfnorte/public_html/galerianfn/includes/functions.php on line 509
-
Hi,
I got the same error as fgabriel does when I call "New images" link (http://www.xx.com/search.php?search_new_images=1).
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
This "functions.php" line 445/446 :
if (check_permission("auth_vote", $image_row['cat_id'])) {
$rate_form = rate_form($image_row['image_id'], $rate_suffix, $rating);
Anybody helps please? thanks
-
Hi,
I got the same error as fgabriel does when I call "New images" link (http://www.xx.com/search.php?search_new_images=1).
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
This "functions.php" line 445/446 :
if (check_permission("auth_vote", $image_row['cat_id'])) {
$rate_form = rate_form($image_row['image_id'], $rate_suffix, $rating);
Anybody helps please? thanks
im not alone,
i think nobody wants to help orb42 :(
-
For this mod, I really don't understand the way the code was insered in "functions.php".
The code insertion proposed is an aberation because it introduces in a function some variables that are not previously defined in the page.
I would like to know what's thinking about the mod's author..
-
I've same problem =(
Notice: Undefined variable: rate_suffix in /www/01/xxx/xxx/xxx/functions.php on line 449
Notice: Undefined variable: rating in /www/01/xxx/xxx/xxx/functions.php on line 449
-
Open includes/functions.php
Find:
if (check_permission("auth_vote", $image_row['cat_id'])) {
Insert Above:
$rate_suffix = "";
$rating = "";
Find Next:
$site_template->register_vars(array(
"rate" => ($no_rateform && !(check_permission("auth_vote", $image_row['cat_id']) && $no_rateform)) ? "rated" : $lang['rate'],
"rate_options" => $rate_options,
"rate_button" => ($no_rateform) ? $no_rateform : ""
));
Insert Above
$image_row = 0;
everything will be OK :D
-
my page_header.php looks like this because of other mods.
I would like to have greyed out after user votes and do not want to remmeber the users computer just the username. can this be done using both mods?
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
if ($user_info['user_level'] != GUEST) {
$sql = "SELECT user_id, image_id, vote
FROM ".VOTED_TABLE."
WHERE image_id = ".$id." AND user_id = ".$user_info['user_id'];
$rated = $site_db->query_firstrow($sql);
$rating = ($rated['vote']) ? $rated['vote'] : $rating;
}else{
$rated = FALSE;
}
$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) && !$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'];
}
}
-
Sorry, I'm not sure what exactly is your question about...
-
Sorry, I'm not sure what exactly is your question about...
never mind, I changed my mind and installing the star mod. sorry
-
Hi,
is there an easy way to check before the tag {rate_form} is displayed to check
the user has allready voted before he tries to vote again?
Out of the box he can try it again and the {msg} tag is filled with the you have
allready voted message.
Why the check is not made before a revote try?
Something like: {ifnot user_voted}{rate_form}{endifnot user_voted}
Greetz X23
-
Your question is not clear. The point of this mod is to disable the rate button after the user's vote...
-
Your question is not clear. The point of this mod is to disable the rate button after the user's vote...
Hi,
you're right but im searching for the right change that makes it possible that the rate_form is
only displayed if the user not allready voted for that image, for example (i wish) with a tag like
{ifnot user_voted}...
Should i start a new thread?
Greetz X23
-
I see now.
Use {ifno rate_button} ..
-
Great! Work! I liked it!
Demo: http://www.all-live.ru/