0) { $query = 'SELECT rate FROM '.RATE_TABLE.' WHERE element_id = '.$page['image_id'] . ' AND user_id = '.$user['id'] ; if ($user['is_the_guest']) { $ip_components = explode('.', $_SERVER['REMOTE_ADDR']); if ( count($ip_components)>3 ) { array_pop($ip_components); } $anonymous_id = implode ('.', $ip_components); $query .= ' AND anonymous_id = \''.$anonymous_id . '\''; } $result = pwg_query($query); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); $sentence = $lang['already_rated']; $sentence.= ' ('.$row['rate'].'). '; $sentence.= $lang['update_rate']; } else { $sentence = $lang['never_rated'].'. '.$lang['Rate']; } } else { $sentence = $lang['never_rated'].'. '.$lang['Rate']; } $template->assign_block_vars( 'rate', array( 'CONTENT' => $value, 'SENTENCE' => $sentence ) ); $template->assign_block_vars('info_rate', array('CONTENT' => $value)); $template->assign_vars( array( 'INFO_RATE' => $value ) ); foreach ($rate_items as $num => $mark) { $template->assign_block_vars( 'rate.rate_option', array( 'OPTION' => $mark, 'URL' => $url_self.'&action=rate&rate='.$mark, 'SEPARATOR' => ($num > 0 ? '|' : ''), ) ); } } } ?>