HomeHelpTrac

Ignore:
Timestamp:
03/22/10 03:38:14 (2 years ago)
Author:
Anton Lesnikov
Message:

Ticket #1927

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/boonex/feedback/classes/BxFdbModule.php

    r13778 r13816  
    353353        )); 
    354354    } 
    355     function actionDelete($aIds) { 
    356         if(is_int($aIds) || is_string($aIds)) { 
    357             $aFeedback = $this->_oDb->getFeedback(array('sample_type' => 'id', 'id' => (int)$aIds)); 
    358             if(!$this->_isDeleteAllowed($aFeedback['author_id'], true))  
    359                 return false; 
    360  
    361             $aIds = array((int)$aIds); 
    362         } 
    363         else if(!$this->_isDeleteAllowed())  
    364             return false; 
    365                  
    366         $bResult = $this->_oDb->deleteFeedback($aIds); 
    367         if($bResult) 
    368             foreach($aIds as $iId) { 
    369                 //--- Feedback -> Delete for Alerts Engine ---// 
    370                 bx_import('BxDolAlerts'); 
    371                 $oAlert = new BxDolAlerts('bx_' . $this->_oConfig->getUri(), 'delete', $iId, BxDolTextData::getAuthorId()); 
    372                 $oAlert->alert(); 
    373                 //--- Feedback -> Delete for Alerts Engine ---// 
    374                  
    375                 //--- Reparse Global Tags ---// 
    376                 bx_import('BxDolTags'); 
    377                 $oTags = new BxDolTags(); 
    378                 $oTags->reparseObjTags('bx_feedback', $iId); 
    379                 //--- Reparse Global Tags ---// 
    380             } 
    381  
    382         return $bResult; 
    383     } 
    384     function actionApprove($aIds, $bPositive = true) { 
     355    function actionApprove() { 
     356        $iId = (int)$_POST['id']; 
     357 
     358        return !empty($iId) ? $this->_actApprove($iId) : false; 
     359    } 
     360    function actionDelete() { 
     361        $iId = (int)$_POST['id']; 
     362 
     363        return !empty($iId) ? $this->_actDelete($iId) : false; 
     364    } 
     365     
     366    function _actApprove($aIds, $bPositive = true) { 
    385367        if(!isAdmin())  
    386368            return false; 
    387          
     369 
     370        if(is_int($aIds) || is_string($aIds)) 
     371            $aIds = array((int)$aIds); 
     372 
    388373        $bResult = $this->_oDb->updateFeedback($aIds, array('status' => ($bPositive ? BX_FDB_STATUS_ACTIVE : BX_FDB_STATUS_REJECTED))); 
    389374        if($bResult) 
     
    404389        return $bResult; 
    405390    } 
    406  
     391    function _actDelete($aIds) { 
     392        if(is_int($aIds) || is_string($aIds)) { 
     393            $aFeedback = $this->_oDb->getFeedback(array('sample_type' => 'id', 'id' => (int)$aIds)); 
     394            if(!$this->_isDeleteAllowed($aFeedback['author_id'], true))  
     395                return false; 
     396 
     397            $aIds = array((int)$aIds); 
     398        } 
     399        else if(!$this->_isDeleteAllowed(0, true))  
     400            return false; 
     401 
     402        $bResult = $this->_oDb->deleteFeedback($aIds); 
     403        if($bResult) 
     404            foreach($aIds as $iId) { 
     405                //--- Feedback -> Delete for Alerts Engine ---// 
     406                bx_import('BxDolAlerts'); 
     407                $oAlert = new BxDolAlerts('bx_' . $this->_oConfig->getUri(), 'delete', $iId, BxDolTextData::getAuthorId()); 
     408                $oAlert->alert(); 
     409                //--- Feedback -> Delete for Alerts Engine ---// 
     410                 
     411                //--- Reparse Global Tags ---// 
     412                bx_import('BxDolTags'); 
     413                $oTags = new BxDolTags(); 
     414                $oTags->reparseObjTags('bx_feedback', $iId); 
     415                //--- Reparse Global Tags ---// 
     416            } 
     417 
     418        return $bResult; 
     419    } 
    407420    function _isDeleteAllowed($iAuthorId = 0, $bPerform = false) { 
    408421        if(!isLogged()) 
Note: See TracChangeset for help on using the changeset viewer.