Modified Files:
fd_vote_functions.php
Log Message:
Fixed different PHP Notice errors on fd+ engine
Index: fd_vote_functions.php
===================================================================
RCS file: /cvsroot/flatnuke/flatnuke/download/include/phpfunctions/fd_vote_functions.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** fd_vote_functions.php 31 Oct 2011 15:02:18 -0000 1.16
--- fd_vote_functions.php 4 Mar 2012 14:23:17 -0000 1.17
***************
*** 1,3 ****
! <?php
if (eregi("fd_vote_functions.php",$_SERVER['PHP_SELF'])) {
Header("Location: ../../../index.php");
--- 1,3 ----
! <?php
if (eregi("fd_vote_functions.php",$_SERVER['PHP_SELF'])) {
Header("Location: ../../../index.php");
***************
*** 13,17 ****
if (!is_dir(_FN_VAR_DIR."/fdplus"))
fn_mkdir(_FN_VAR_DIR."/fdplus/",0777);
!
fnwrite($fdiplogfile," ","w",array());
--- 13,17 ----
if (!is_dir(_FN_VAR_DIR."/fdplus"))
fn_mkdir(_FN_VAR_DIR."/fdplus/",0777);
!
fnwrite($fdiplogfile," ","w",array());
***************
*** 28,38 ****
function fd_add_vote(){
global $filename;
!
// echo $filename."<br>";
// echo $_POST['fdfilename'];
// echo $_POST['fdvote'];
!
if (!check_path($filename,"sections/","false")) return;
!
if (!fd_user_can_vote($filename)) return;
//vote
--- 28,38 ----
function fd_add_vote(){
global $filename;
!
// echo $filename."<br>";
// echo $_POST['fdfilename'];
// echo $_POST['fdvote'];
!
if (!check_path($filename,"sections/","false")) return;
!
if (!fd_user_can_vote($filename)) return;
//vote
***************
*** 47,54 ****
return;
}
!
if ($fdvote>5) return;
if ($fdvote<0) return;
!
//file
if (isset($_POST['fdfilename'])){
--- 47,54 ----
return;
}
!
if ($fdvote>5) return;
if ($fdvote<0) return;
!
//file
if (isset($_POST['fdfilename'])){
***************
*** 66,81 ****
$mod = "";
$mod = eregi_replace("sections/","",basename($fdfilename));
!
$tempdesc = array();
$tempdesc = load_description($fdfilename);
!
$tempdesc['totalvote'] = $tempdesc['totalvote']+1;
$tempdesc['totalscore'] = $tempdesc['totalscore']+$fdvote;
!
//se non � gestito da fd+ ritorno
if (!file_exists($fdfilename.".description")) return;
!
save_description($fdfilename,$tempdesc);
!
$logdata = array();
$ip = getparam("REMOTE_ADDR", PAR_SERVER, SAN_FLAT);
--- 66,81 ----
$mod = "";
$mod = eregi_replace("sections/","",basename($fdfilename));
!
$tempdesc = array();
$tempdesc = load_description($fdfilename);
!
$tempdesc['totalvote'] = $tempdesc['totalvote']+1;
$tempdesc['totalscore'] = $tempdesc['totalscore']+$fdvote;
!
//se non � gestito da fd+ ritorno
if (!file_exists($fdfilename.".description")) return;
!
save_description($fdfilename,$tempdesc);
!
$logdata = array();
$ip = getparam("REMOTE_ADDR", PAR_SERVER, SAN_FLAT);
***************
*** 84,90 ****
$logdata['time'] = time();
$logdata['path'] = $fdfilename;
!
add_ip_log_data($logdata);
!
}//fine function fd_add_vote
--- 84,90 ----
$logdata['time'] = time();
$logdata['path'] = $fdfilename;
!
add_ip_log_data($logdata);
!
}//fine function fd_add_vote
***************
*** 195,199 ****
}
else return;
!
$datastring .= "\n\t<entry>
<md5ip>$md5ip</md5ip>
--- 195,199 ----
}
else return;
!
$datastring .= "\n\t<entry>
<md5ip>$md5ip</md5ip>
***************
*** 202,212 ****
</entry>";
}
!
!
}
$datastring .= "\n</votelog>";
if (eregi("\<\?",$datastring) or eregi("\?\>",$datastring)) continue;
!
fnwrite($fdiplogfile, "<?xml version='1.0' encoding='ISO-8859-1'?>\n".$datastring,"w",array("nonull"));
}
--- 202,212 ----
</entry>";
}
!
!
}
$datastring .= "\n</votelog>";
if (eregi("\<\?",$datastring) or eregi("\?\>",$datastring)) continue;
!
fnwrite($fdiplogfile, "<?xml version='1.0' encoding='ISO-8859-1'?>\n".$datastring,"w",array("nonull"));
}
***************
*** 214,221 ****
/**
* Carica i dati relativi ai voti.
! *
! * Questa funzione carica i dati presenti nel file che tiene traccia dei voti espressi
* sui file gestiti da fd+.
! *
* @return una array con i dati salvati
* @author Aldo Boccacci
--- 214,221 ----
/**
* Carica i dati relativi ai voti.
! *
! * Questa funzione carica i dati presenti nel file che tiene traccia dei voti espressi
* sui file gestiti da fd+.
! *
* @return una array con i dati salvati
* @author Aldo Boccacci
***************
*** 225,232 ****
global $fdiplogfile;
if ($fdiplogfile=="") $fdiplogfile = _FN_VAR_DIR."/fdplus/fdipvotelog.php";
!
// if (!check_path($fdiplogfile,"","true")) fd_die("IP log file is not valid! fd_vote_functions: ".__LINE__);
!
! if (file_exists($fdiplogile))
$xml = simplexml_load_file($fdiplogfile);
else $xml = FALSE;
--- 225,232 ----
global $fdiplogfile;
if ($fdiplogfile=="") $fdiplogfile = _FN_VAR_DIR."/fdplus/fdipvotelog.php";
!
// if (!check_path($fdiplogfile,"","true")) fd_die("IP log file is not valid! fd_vote_functions: ".__LINE__);
!
! if (file_exists($fdiplogfile))
$xml = simplexml_load_file($fdiplogfile);
else $xml = FALSE;
***************
*** 237,243 ****
return load_ip_log_data_old();
}
-
- $counter=0;
$item= array();
foreach ($xml->entry as $item){
--- 237,243 ----
return load_ip_log_data_old();
}
+ $counter=0;
+ $data= array();
$item= array();
foreach ($xml->entry as $item){
***************
*** 250,254 ****
$time = utf8_decode((string)$item->time);
if (!ctype_digit($time)) continue;
!
$data[$counter]['md5ip']= $md5ip;
$data[$counter]['time'] = $time;
--- 250,254 ----
$time = utf8_decode((string)$item->time);
if (!ctype_digit($time)) continue;
!
$data[$counter]['md5ip']= $md5ip;
$data[$counter]['time'] = $time;
***************
*** 256,260 ****
$counter++;
}
!
return $data;
}
--- 256,260 ----
$counter++;
}
!
return $data;
}
***************
*** 264,271 ****
* Questa � la vecchia funzione che viene mantenuta perch� viene chiamata
* nel caso che simplexml_load_file fallisca il suo compito.
! *
! * Questa funzione carica i dati presenti nel file che tiene traccia dei voti espressi
* sui file gestiti da fd+.
! *
* @return una array con i dati salvati
* @author Aldo Boccacci
--- 264,271 ----
* Questa � la vecchia funzione che viene mantenuta perch� viene chiamata
* nel caso che simplexml_load_file fallisca il suo compito.
! *
! * Questa funzione carica i dati presenti nel file che tiene traccia dei voti espressi
* sui file gestiti da fd+.
! *
* @return una array con i dati salvati
* @author Aldo Boccacci
***************
*** 275,290 ****
global $fdiplogfile;
if ($fdiplogfile=="") $fdiplogfile = "misc/fdplus/fdipvotelog.php";
!
// if (!check_path($fdiplogfile,"","true")) fd_die("IP log file is not valid! fd_vote_functions: ".__LINE__);
!
$datastring = "";
$datastring = get_file($fdiplogfile);
$datastring = get_xml_element("votelog",$datastring);
!
$item_array = array();
$item_array = get_xml_array("entry",$datastring);
!
$data = array();
!
if (count($item_array)>0){
$item= array();
--- 275,290 ----
global $fdiplogfile;
if ($fdiplogfile=="") $fdiplogfile = "misc/fdplus/fdipvotelog.php";
!
// if (!check_path($fdiplogfile,"","true")) fd_die("IP log file is not valid! fd_vote_functions: ".__LINE__);
!
$datastring = "";
$datastring = get_file($fdiplogfile);
$datastring = get_xml_element("votelog",$datastring);
!
$item_array = array();
$item_array = get_xml_array("entry",$datastring);
!
$data = array();
!
if (count($item_array)>0){
$item= array();
***************
*** 299,311 ****
$time = trim(get_xml_element("time",$item));
if (!ctype_digit($time)) continue;
!
$data[$counter]['md5ip']= $md5ip;
$data[$counter]['time'] = $time;
$data[$counter]['path'] = $path;
!
$counter++;
}
}
!
return $data;
}
--- 299,311 ----
$time = trim(get_xml_element("time",$item));
if (!ctype_digit($time)) continue;
!
$data[$counter]['md5ip']= $md5ip;
$data[$counter]['time'] = $time;
$data[$counter]['path'] = $path;
!
$counter++;
}
}
!
return $data;
}
***************
*** 313,317 ****
/**
* Aggiunge un nuovo elemento al file con i dati dei voti dati ai file di fd+.
! *
* @param array $itemdata l'array con i dati del nuovo elemento
* @author Aldo Boccacci
--- 313,317 ----
/**
* Aggiunge un nuovo elemento al file con i dati dei voti dati ai file di fd+.
! *
* @param array $itemdata l'array con i dati del nuovo elemento
* @author Aldo Boccacci
***************
*** 319,330 ****
*/
function add_ip_log_data($itemdata){
!
if (!is_array($itemdata)) {
fdlogf("\$itemdata is not an array! FDVOTE: ".__LINE__);
return;
}
!
$old_data = load_ip_log_data();
!
if (check_var($itemdata['md5ip'],"alnum")){
$md5ip = $itemdata['md5ip'];
--- 319,330 ----
*/
function add_ip_log_data($itemdata){
!
if (!is_array($itemdata)) {
fdlogf("\$itemdata is not an array! FDVOTE: ".__LINE__);
return;
}
!
$old_data = load_ip_log_data();
!
if (check_var($itemdata['md5ip'],"alnum")){
$md5ip = $itemdata['md5ip'];
***************
*** 339,347 ****
}
else return;
!
$old_data[$path]['md5ip'] = $md5ip;
$old_data[$path]['time'] = $time;
$old_data[$path]['path'] = $path;
!
save_ip_log_data($old_data);
}
--- 339,347 ----
}
else return;
!
$old_data[$path]['md5ip'] = $md5ip;
$old_data[$path]['time'] = $time;
$old_data[$path]['path'] = $path;
!
save_ip_log_data($old_data);
}
***************
*** 349,354 ****
/**
* Funzione che mostra il voto nella scheda del file e permette di votare il file.
! *
! * @param string $filename il file
* @param $votedesc l'array contenente la descrizione del file
* @author Aldo Boccacci
--- 349,354 ----
/**
* Funzione che mostra il voto nella scheda del file e permette di votare il file.
! *
! * @param string $filename il file
* @param $votedesc l'array contenente la descrizione del file
* @author Aldo Boccacci
***************
*** 361,365 ****
$fdiplogfile = _FN_VAR_DIR."/fdplus/fdipvotelog.php";
global $sitename;
! if (!file_exists($fdiplogfile))
fnwrite($fdiplogfile," ","w",array());
--- 361,365 ----
$fdiplogfile = _FN_VAR_DIR."/fdplus/fdipvotelog.php";
global $sitename;
! if (!file_exists($fdiplogfile))
fnwrite($fdiplogfile," ","w",array());
***************
*** 459,463 ****
</form>
! <?php
}//fine controllo usercan vote
else {
--- 459,463 ----
</form>
! <?php
}//fine controllo usercan vote
else {
***************
*** 471,475 ****
<li class="star_5"> </li>
</ul>
! <?php
--- 471,475 ----
<li class="star_5"> </li>
</ul>
! <?php
***************
*** 487,491 ****
<li class="star_5"> </li>
</ul>
! <?php
}
--- 487,491 ----
<li class="star_5"> </li>
</ul>
! <?php
}