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/articles/classes/BxArlModule.php

    r13781 r13816  
    466466        )); 
    467467    } 
    468     function actionFeatured($aIds, $bPositive = true) {      
     468    function actionFeatured() { 
     469        $iId = (int)$_POST['id']; 
     470 
     471        return !empty($iId) ? $this->_actFeatured($iId) : false; 
     472    } 
     473    function actionPublish() { 
     474        $iId = (int)$_POST['id']; 
     475 
     476        return !empty($iId) ? $this->_actPublish($iId) : false; 
     477    } 
     478    function actionDelete() { 
     479        $iId = (int)$_POST['id']; 
     480 
     481        return !empty($iId) ? $this->_actDelete($iId) : false; 
     482    } 
     483 
     484    function _actFeatured($aIds, $bPositive = true) {        
    469485        if(!isAdmin())  
    470486            return false; 
    471                  
     487 
     488        if(is_int($aIds) || is_string($aIds)) 
     489            $aIds = array((int)$aIds); 
     490 
    472491        $bResult = $this->_oDb->updateArticles($aIds, array('featured' => ($bPositive ? 1 : 0))); 
    473492        if($bResult) 
     
    482501        return $bResult; 
    483502    } 
    484     function actionDelete($aIds) {       
     503    function _actPublish($aIds, $bPositive = true) { 
     504        if(!isAdmin())  
     505            return false; 
     506 
     507        if(is_int($aIds) || is_string($aIds)) 
     508            $aIds = array((int)$aIds); 
     509 
     510        $bResult = $this->_oDb->updateArticles($aIds, array('status' => ($bPositive ? BX_TD_STATUS_ACTIVE : BX_TD_STATUS_INACTIVE))); 
     511        if($bResult) 
     512            foreach($aIds as $iId) { 
     513                //--- Articles -> Publish/Unpublish for Alerts Engine ---// 
     514                $oAlert = new BxDolAlerts('bx_' . $this->_oConfig->getUri(), ($bPositive ? 'publish' : 'unpublish'), $iId, BxDolTextData::getAuthorId()); 
     515                $oAlert->alert(); 
     516                //--- Articles -> Publish/Unpublish for Alerts Engine ---// 
     517                 
     518                //--- Reparse Global Tags ---// 
     519                $oTags = new BxDolTags(); 
     520                $oTags->reparseObjTags('bx_' . $this->_oConfig->getUri(), $iId); 
     521                //--- Reparse Global Tags ---// 
     522                 
     523                //--- Reparse Global Categories ---//             
     524                $oCategories = new BxDolCategories(); 
     525                $oCategories->reparseObjTags('bx_' . $this->_oConfig->getUri(), $iId); 
     526                //--- Reparse Global Categories ---// 
     527            } 
     528         
     529        return $bResult; 
     530    } 
     531    function _actDelete($aIds) {         
    485532        if(!$this->_isDeleteAllowed(true))  
    486533            return false; 
     
    516563        return $bResult; 
    517564    } 
    518     function actionPublish($aIds, $bPositive = true) { 
    519         if(!isAdmin())  
    520             return false; 
    521          
    522         $bResult = $this->_oDb->updateArticles($aIds, array('status' => ($bPositive ? BX_TD_STATUS_ACTIVE : BX_TD_STATUS_INACTIVE))); 
    523         if($bResult) 
    524             foreach($aIds as $iId) { 
    525                 //--- Articles -> Publish/Unpublish for Alerts Engine ---// 
    526                 $oAlert = new BxDolAlerts('bx_' . $this->_oConfig->getUri(), ($bPositive ? 'publish' : 'unpublish'), $iId, BxDolTextData::getAuthorId()); 
    527                 $oAlert->alert(); 
    528                 //--- Articles -> Publish/Unpublish for Alerts Engine ---// 
    529                  
    530                 //--- Reparse Global Tags ---// 
    531                 $oTags = new BxDolTags(); 
    532                 $oTags->reparseObjTags('bx_' . $this->_oConfig->getUri(), $iId); 
    533                 //--- Reparse Global Tags ---// 
    534                  
    535                 //--- Reparse Global Categories ---//             
    536                 $oCategories = new BxDolCategories(); 
    537                 $oCategories->reparseObjTags('bx_' . $this->_oConfig->getUri(), $iId); 
    538                 //--- Reparse Global Categories ---// 
    539             } 
    540          
    541         return $bResult; 
    542     } 
    543      
    544565    function _isDeleteAllowed($bPerform = false) { 
    545566        if(!isLogged()) 
Note: See TracChangeset for help on using the changeset viewer.