public static function recordVote($objPicture, $objUser, $strIP, $intVote) { /* TODO: Uncomment this. */ // if(clsVote::canVote($objPicture, $objUser, $strIP)) // throw new Exception('exception_internalerror'); if (!is_numeric($intVote)) { throw new Exception('exception_internalerror'); } if ($intVote < 0 || $intVote > MAX_VOTE) { throw new Exception('exception_internalerror'); } $objVote = new clsVote(); $objVote->set('picture_id', $objPicture->get('id')); $objVote->set('user_id', $objUser ? $objUser->get('id') : 0); $objVote->set('ip', $strIP); $objVote->set('vote', $intVote); $objVote->save(); }