source/Application/Model/Rating.php
public function allowRating($sUserId, $sType, $sObjectId)
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if ($iRatingLogsTimeout = $myConfig->getConfigParam('iRatingLogsTimeout')) {
            $sExpDate = date('Y-m-d H:i:s', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() - $iRatingLogsTimeout * 24 * 60 * 60);
            $oDb->execute("delete from oxratings where oxtimestamp < '$sExpDate'");
        }
        $sSelect = "select oxid from oxratings where oxuserid = " . $oDb->quote($sUserId) . " and oxtype=" . $oDb->quote($sType) . " and oxobjectid = " . $oDb->quote($sObjectId);
        if ($oDb->getOne($sSelect)) {
            return false;
        }

        return true;
    }
public function allowRating($sUserId, $sType, $sObjectId)
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if ($iRatingLogsTimeout = $myConfig->getConfigParam('iRatingLogsTimeout')) {
            $sExpDate = date('Y-m-d H:i:s', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() - $iRatingLogsTimeout * 24 * 60 * 60);
            $oDb->execute("delete from oxratings where oxtimestamp < '$sExpDate'");
        }
        $sSelect = "select oxid from oxratings where oxuserid = " . $oDb->quote($sUserId) . " and oxtype=" . $oDb->quote($sType) . " and oxobjectid = " . $oDb->quote($sObjectId);
        if ($oDb->getOne($sSelect)) {
            return false;
        }

        return true;
    }
public function allowRating ( $ sUserId , $ sType , $ sObjectId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ iRatingLogsTimeout = $ myConfig -> getConfigParam ( 'iRatingLogsTimeout' ) ) { $ sExpDate = date ( 'Y-m-d H:i:s' , \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) - $ iRatingLogsTimeout * 24 * 60 * 60 ) ; $ oDb -> execute ( "delete from oxratings where oxtimestamp < '$sExpDate'" ) ; } $ sSelect = "select oxid from oxratings where oxuserid = " . $ oDb -> quote ( $ sUserId ) . " and oxtype=" . $ oDb -> quote ( $ sType ) . " and oxobjectid = " . $ oDb -> quote ( $ sObjectId ) ; if ( $ oDb -> getOne ( $ sSelect ) ) { return false ; } return true ; }
Checks if user can rate product.

@param string $sUserId   user id
@param string $sType     object type
@param string $sObjectId object id

@return bool
Checks if user can rate product .