2013-10-07 1 views
0

최근에 내 사이트 중 하나를 PHP 최신 버전을 실행하는 새 전용 서버로 옮겼습니다. 내 PHP 기반 Knowledgebase 섹션에서 다음과 같은 오류가 발생했습니다 :

엄격한 표준 : API_RATING :: multiDelete() 선언은 API와 호환되어야합니다 :: multiDelete ($ ids = 0) in/home /givebrad/public_html/kb/lib/api/class.rating.php on line 156

파일의 맨 아래에있는 행 156입니다. 아래는 class-rating.php의 코드입니다. 누구든지이 문제를 해결하는 방법을 알아 내도록 나를 도울 수 있습니까?

<?php 
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'class.api.php'); 

class API_RATING extends API 
{ 
    var $rateid = 0; 
    var $questionid = 0; 
    var $ip = ''; 
    var $ratedat = ''; 

    var $fields = array (
     'rateid', 
     'questionid', 
     'ip', 
     'ratedat', 
     'ratingemail', 
     'ratingmessage' 
    ); 

    var $pk = 'rateid'; 

    /** 
    * create 
    * create a new rating in the database 
    * 
    * @return bool was the creation successful ? 
    */ 
    function create() 
    { 
     $_POST['ratedat'] = date('Y-m-d H:i:s'); 
     $_POST['ip'] = $_SERVER['REMOTE_ADDR']; 
     return parent::create(); 
    } 

    /** 
    * multiDelete 
    * Delete multiple rating ids. Update each associated question. 
    * 
    * @return bool was the delete successful? 
    */ 
    function multiDelete($ids) { 

     //Get the question ids 
     $objArray = $this->loadMultiByPK($ids); 

     foreach ($objArray as $rateObj) { 
      $questionObj = new API_QUESTION(); 
      $questionObj->load($rateObj->questionid); 

      $questionObj->negvotes--; 
      $questionObj->score -= SCORE_MODIFIER; 

      $questionObj->updateField("negvotes", $questionObj->negvotes); 
      $questionObj->updateField("score", $questionObj->score); 
     }   

     //Delete from the main table 
     if (!parent::multiDelete($ids)) { 
      return false; 
     } 

     return true; 
    } 

    /** 
    * validate_rateid 
    * 
    * Ensure the rate id is a pos int 
    * 
    * @param string $var 
    * 
    * @return bool 
    */ 
    function validate_rateid($var) 
    { 
     return $this->is_positive_int($var); 
    } 

    /** 
    * validate_questionid 
    * 
    * Ensure the questionid is pos int 
    * 
    * @return bool 
    */ 
    function validate_questionid($var) 
    { 
     return $this->is_positive_int($var); 
    } 

    /** 
    * validate_ip 
    * 
    * Ensure the ip is an ipv4 address 
    * 
    * @param $var the ip to validate 
    * 
    * @return bool 
    */ 
    function validate_ip($var) 
    { 
     return $this->is_ip($var); 
    } 

    /** 
    * validate_ratedat 
    * 
    * Ensure the rated at date is in the standard date format 
    * 
    * @param string $var 
    * 
    * @return bool 
    */ 
    function validate_ratedat($var) 
    { 
     return $this->is_standard_date($var); 
    } 

    /** 
    * validate_email 
    * 
    * Ensure the email address for this rate entry is valid. 
    * 
    * @param string $var 
    * 
    * @return bool 
    */ 
    function validate_ratingemail(&$var) 
    { 
     if ((trim($var) == "") || (trim($var) == GetLang("WhyUnhelpfulEmail"))) { 
      $var = ""; 
      return true; 
     } else { 
      return is_email_address($var); 
     } 
    } 

    /** 
    * validate_ratingmessage 
    * 
    * Ensure there is a message and its not blank. 
    * 
    * @param string $var 
    * 
    * @return bool 
    */ 
    function validate_ratingmessage(&$var) 
    { 
     if (strlen(trim($var)) > 250) { 
      $var = substr(trim($var),0,250); 
      return true; 
     } else { 
      return (trim($var) != ""); 
     } 
    } 
} 

>

+0

, 전에이 물었다 ids = 0)'. 따라서 서명을 다시 일치시킬 수 있도록 메소드에 해당 기본값을 설정하십시오. – CBroe

답변

0

이 기능 : 그것은 PARAMS의 클래스 API의 nums, 기본값 및 형식과 동일한 기능을 발견, 부모 함수의와

function multiDelete($ids) { 

이 같은 글의이어야한다 동일해야한다; 당신의 방법 서명 ($ 아이디)``, 당신은에서 상속하는 API 클래스`($로 정의의 메소드의 매개 변수가있는 반면에 -

나는 알아 내기 위해 많은이 없습니다 Strict Standards: Declaration of ' ' should be compatible with ' '

+0

굉장! 고맙습니다!!! – Rob

관련 문제