コード例 #1
0
 /**
  * activateOrDelete
  */
 protected function activateOrDelete()
 {
     $dbChange = false;
     $objComments = \CommentsModel::findByActivation_token(\Input::get('activation_token'));
     if ($objComments === NULL) {
         die(utf8_decode($GLOBALS['TL_LANG']['MOD']['member_rating']['invalidToken']));
     }
     // delete or publish comment via url, received from a notification email
     if (\Input::get('del') == 'true') {
         $dbChange = true;
         $this->log('DELETE FROM tl_comments WHERE id=' . $objComments->id, __METHOD__, TL_GENERAL);
         $objComments->delete();
         $msg = $GLOBALS['TL_LANG']['MOD']['member_rating']['itemHasBeenActivated'];
         if (($objNextPage = \PageModel::findPublishedById($this->emailNotifyPage_DeleteComment)) !== NULL) {
             $this->redirect($this->generateFrontendUrl($objNextPage->row()));
         }
     } elseif (\Input::get('publish') == 'true') {
         $dbChange = true;
         $objComments->published = 1;
         $objComments->activation_token = '';
         $objComments->save();
         $this->log('A new version of tl_comments ID ' . $objComments->id . ' has been created', __METHOD__, TL_GENERAL);
         $msg = $GLOBALS['TL_LANG']['MOD']['member_rating']['itemHasBeenActivated'];
         if (($objNextPage = \PageModel::findPublishedById($this->emailNotifyPage_ActivateComment)) !== NULL) {
             $this->redirect($this->generateFrontendUrl($objNextPage->row()));
         }
     } else {
         //
     }
     if ($dbChange === true) {
         die($msg);
     }
     exit;
 }