Navigacija

Vartotojų tinkle

-> Prisijungusių svečių: 23
-> Prisijungusių narių: 0
Prisijungusių narių nėra

-> Registruoti nariai: 25,753
-> Naujausias narys: juideo

Naujausi straipsniai

Paskutiniai nariai

-> losxi02:36:10
-> juideo04:48:57
-> centukas05:30:30
-> ozzWANTED 1 diena
-> Audrius_17 1 diena
-> lonka 2 dienos
-> November 2 dienos
-> vsauce 6 dienos
-> artisbit 1 savaitė
-> botanik 1 savaitė
-> Steve 1 savaitė
-> rokas10 2 savaitės
-> ritas8 2 savaitės
-> Creatium 2 savaitės
-> Niger 2 savaitės
-> Aldona 2 savaitės
-> Ewaldas 2 savaitės
-> Ievutea 2 savaitės
-> avice 2 savaitės
-> oscas 2 savaitės

Informacija:


OS: Unknown
Naršyklė: Nežinoma
IP: 3.81.29.226
Naujienų: 522
Straipsnių: 235
Temų: 52,454
Postų: 522,226
Postų pask. parą: 0
Shout'ų pask. parą: 0
P.S.C. pask. parą: 0
Nuorodų kataloge: 13

Hey.lt lankomumo statistika

Prisijungti

REGISTRUOTIS
Nario vardas

Slaptažodis



Pamiršai slaptažodį?
Paprašyk naujo

Aktyvuoti save

Šaukykla

Jei norite rašyti žinutes, turite prisijungti.

-> lonka
2019/11/11 22:56
Laba vakara. Jieskau zmogaus kuris ismano php ir galetu man idiegti svetaine. Profesionalai tik

-> botanik
2019/11/06 10:02
Labas rytas šypsosi senai matyti

-> nesby
2019/10/16 15:28
Sveiki vyrai

-> niekam111
2019/10/06 17:48
Sveiki, superku Facebook anketas. Jeigu turite ka pasiulyti rasykite el.pastu : niekamtinkamas@gmail.c
om


-> avice
2019/09/26 20:14
Ahhha klaidingai pats parasiai akinanti šypsen pagal `WebDnD` randa tik php-fusion grupe. Reikes uzeit

-> Šaukyklos archyvas ->

Apklausa

Ar esate patenkinti lietuviško vertimo kokybe?

Taip!

Taip, bet yra ką taisyti (parašysiu komentaruose)

Ne

Norėdamas balsuoti turite prisijungti.
-> Archyvas ->
Reklama 400x60
ss_star_rating du undifined indexai
Forumas | Modai, įskiepiai, panelės (PHP-FUSION) | Mods, Panels & Infusions

Autorius: Wyciokazz Peržiūrų: 915      Spausdinti temą
2011-07-26 18:57          1 žinutė iš 1
Spausdinti pranešimą
Undefined index: sum eilutė 83. - $db['sum'] += $vote;
Undefined variable: db eilutė 82. - $db['votes']++;


<?php
/*-------------------------------------------------------+
| <span style="border-bottom: 1px dotted black;">PHP</span>-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| <a href='http://www.php-fusion.co.uk/' target='_blank'><span style='color:005C5B'>http://www.php-fusion.co.uk/</span></a>
+--------------------------------------------------------+
| Filename: ss_star_rating_include.php
| Author: SiteMaster style
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at <a href='http://www.gnu.org/licenses/agpl.html.' target='_blank'><span style='color:005C5B'>www.gnu.org/licenses/agpl.html.</span></a> Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/

include "../../maincore.php";
if (!defined("IN_FUSION")) { die("Access Denied"); }
 
sleep(0);
 
// Check, if we need to proccess the FORM submission (or AJAX call that pretends POST method)
if($_SERVER["REQUEST_METHOD"] == 'POST'){
// veriffy user input!
$vote = in_range($_POST['rate'], 1, 5);
 
// update statistic and save to db
$db = save_rating($_POST['rate'], $_POST['rating_item_id'], $_POST['rating_type']);
 
// For AJAX requests we'll return JSON object with current vote statistics
if($_SERVER['HTTP_X_REQUESTED_WITH']) {
header('Cache-Control: no-cache');
echo json_encode($db); // requires: <span style="border-bottom: 1px dotted black;">PHP</span> >= 5.2.0, PECL json >= 1.2.0
// For non-AJAX requests we are going to echo {$post_message} variable in main script
} else {
$avg = round($db['avg']);
 
foreach($options as $id => $val) {
$options[$id]['disabled'] = 'disabled="disabled"';
$options[$id]['checked'] = $id==$avg ? 'checked="checked"' : '';
}
}
}
if(isset($_GET['fake']) && $_GET['fake'] == 1){
// For AJAX requests we'll return JSON object with current vote statistics
if($_SERVER['HTTP_X_REQUESTED_WITH']){
header('Cache-Control: no-cache');
 
echo json_encode(get_votes($_GET['rating_type'], $_GET['rating_item_id'])); // requires: <span style="border-bottom: 1px dotted black;">PHP</span> >= 5.2.0, PECL json >= 1.2.0
}else{
$db = get_votes($_GET['rating_type'], $_GET['rating_item_id']);
$avg = round($db['avg']);
 
foreach($options as $id => $val) {
$options[$id]['disabled'] = 'disabled="disabled"';
$options[$id]['checked'] = $id==$avg ? 'checked="checked"' : '';
}
}
}
 
function in_range($val, $from=0, $to=100) {
return min($to, max($from, (int)$val));
}
 
function get_votes($rating_type, $rating_item_id) {
$votes = dbcount("(rating_item_id)", DB_RATINGS, "rating_item_id='".$rating_item_id."' AND rating_type='".$rating_type."'");
$sum = dbarray(dbquery("SELECT SUM(rating_vote) AS sum FROM ".DB_RATINGS." WHERE rating_item_id='".$rating_item_id."' AND rating_type='".$rating_type."'"));
 
if ($sum != "" && $votes['rating_item_id']){
$db = array('votes' => $votes, 'sum' => $sum['sum'], 'avg' => (round($sum['sum'] / $votes, 2)));
}else{
$db = array('votes' => 0, 'sum' => 0, 'avg' => 0);
}
 
return $db;
}
 
function save_rating($vote, $rating_item_id, $rating_type) {
global $userdata;
 
$db['votes']++;
$db['sum'] += $vote;
$db['avg'] = round($db['sum'] / $db['votes'], 2);
if (iMEMBER) {
if (isset($_POST['rate']) && $_POST['rate'] == 0){
$result = dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_item_id='".$rating_item_id."' AND rating_type='".$rating_type."' AND rating_user='".$userdata['user_id']."'");
}elseif (isset($_POST['rate']) && $_POST['rate'] > 0 && $_POST['rate'] < 6){
$d_rating = dbarray(dbquery("SELECT rating_vote, rating_datestamp FROM ".DB_RATINGS." WHERE rating_item_id='".$rating_item_id."' AND rating_type='".$rating_type."' AND rating_user='".$userdata['user_id']."'"));
if (!isset($d_rating['rating_vote'])){
$result = dbquery("INSERT INTO ".DB_RATINGS." (rating_item_id, rating_type, rating_user, rating_vote, rating_datestamp, rating_ip) VALUES ('".$rating_item_id."', '".$rating_type."', '".$userdata['user_id']."', '".$vote."', '".time()."', '".USER_IP."')");
} else {
$result = dbquery("UPDATE ".DB_RATINGS." SET rating_item_id='".$rating_item_id."', rating_type='".$rating_type."', rating_user='".$userdata['user_id']."', rating_vote='".$vote."', rating_datestamp='".time()."', rating_ip='".USER_IP."' WHERE rating_item_id='".$rating_item_id."' AND rating_type='".$rating_type."' AND rating_user='".$userdata['user_id']."'");
}
}
}
 
$db = get_votes($rating_type, $rating_item_id);
return $db;
}
?>


0 atsakymų
Peršokti į forumą: