/**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if ($eventName == 'readFormParameters') {
         if (isset($_POST['usedQuotes']) && is_array($_POST['usedQuotes'])) {
             $this->usedQuotes = $_POST['usedQuotes'];
         }
     } else {
         if ($eventName == 'saved') {
             if (count($this->usedQuotes) > 0) {
                 require_once WCF_DIR . 'lib/data/message/multiQuote/MultiQuoteManager.class.php';
                 foreach ($this->usedQuotes as $quoteID) {
                     MultiQuoteManager::removeQuote($quoteID);
                 }
                 MultiQuoteManager::saveStorage();
             }
         } else {
             if ($eventName == 'assignVariables') {
                 require_once WCF_DIR . 'lib/data/message/multiQuote/MultiQuoteManager.class.php';
                 $quotes = MultiQuoteManager::getStorage();
                 $usedQuotes = array_flip($this->usedQuotes);
                 foreach ($quotes as $quoteID => $quote) {
                     $quote['used'] = isset($usedQuotes[$quoteID]) ? 1 : 0;
                     $quotes[$quoteID] = $quote;
                 }
                 WCF::getTPL()->assign('quotes', $quotes);
                 WCF::getTPL()->append(array('additionalTabs' => '<li id="multiQuoteTab"><a onclick="tabbedPane.openTab(\'multiQuote\');"><span>' . WCF::getLanguage()->get('wcf.multiQuote.title') . '</span></a></li>', 'additionalSubTabs' => WCF::getTPL()->fetch('messageFormMultiQuote')));
             }
         }
     }
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // remove quotes
     MultiQuoteManager::removeQuote($this->quoteID);
     MultiQuoteManager::saveStorage();
     $this->executed();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // remove quotes
     MultiQuoteManager::removeQuotes($this->objectID, $this->objectType);
     MultiQuoteManager::saveStorage();
     $this->executed();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     if (!is_array($this->text) && $this->text == '' || is_array($this->text) && !count($this->text)) {
         $this->text = $this->pm->message;
     }
     if (!is_array($this->text)) {
         $this->text = array($this->text);
     }
     // store quotes
     foreach ($this->text as $key => $string) {
         MultiQuoteManager::storeQuote($this->objectID, 'pm', $string, $this->pm->username, 'index.php?page=PMView&pmID=' . $this->objectID . '#pm' . $this->objectID, $this->pm->parentPmID, strlen($key) == 40 && preg_match('/^[a-f0-9]+$/', $key) ? $key : '');
     }
     MultiQuoteManager::saveStorage();
     $this->executed();
 }
Пример #5
0
 /**
  * Returns the number of quotes of this message.
  * 
  * @return	integer
  */
 public function isQuoted()
 {
     require_once WCF_DIR . 'lib/data/message/multiQuote/MultiQuoteManager.class.php';
     return MultiQuoteManager::getQuoteCount($this->pmID, 'pm');
 }
 /**
  * Loads the quote storage.
  */
 protected static function loadStorage()
 {
     if (self::$quoteStorage === null || self::$quoteCounts === null) {
         self::$quoteStorage = WCF::getSession()->getVar('quoteStorage');
         if (self::$quoteStorage === null) {
             self::$quoteStorage = array();
         }
         self::$quoteCounts = WCF::getSession()->getVar('quoteCounts');
         if (self::$quoteCounts === null) {
             self::$quoteCounts = array();
         }
     }
 }