function do_removeSubscriptions()
 {
     $foldersubscriptions = KTUtil::arrayGet($_REQUEST, 'foldersubscriptions');
     $documentsubscriptions = KTUtil::arrayGet($_REQUEST, 'documentsubscriptions');
     if (empty($foldersubscriptions) && empty($documentsubscriptions)) {
         $this->errorRedirectToMain(_kt('No subscriptions were chosen'));
     }
     $iSuccesses = 0;
     $iFailures = 0;
     if (!empty($foldersubscriptions)) {
         foreach ($foldersubscriptions as $iSubscriptionId) {
             $oSubscription = Subscription::get($iSubscriptionId, SubscriptionEvent::subTypes('Folder'));
             if ($oSubscription) {
                 $oSubscription->delete();
                 $iSuccesses++;
             } else {
                 $iFailures++;
             }
         }
     }
     if (!empty($documentsubscriptions)) {
         foreach ($documentsubscriptions as $iSubscriptionId) {
             $oSubscription = Subscription::get($iSubscriptionId, SubscriptionEvent::subTypes('Document'));
             if ($oSubscription) {
                 $oSubscription->delete();
                 $iSuccesses++;
             } else {
                 $iFailures++;
             }
         }
     }
     $sMessage = _kt("Subscriptions removed") . ": ";
     if ($iFailures) {
         $sMessage .= sprintf(_kt('%d successful, %d failures'), $iSuccesses, $iFailures);
     } else {
         $sMessage .= sprintf('%d', $iSuccesses);
     }
     $this->successRedirectToMain($sMessage);
     exit(0);
 }
 /**
  * Subscribes the user to the document
  *
  * @author KnowledgeTree Team
  * @access public
  * @return boolean|object $result SUCCESS Boolean result of operation | FAILURE - a pear error object
  */
 public function subscribe()
 {
     if ($this->isSubscribed()) {
         return TRUE;
     }
     $subscriptionType = SubscriptionEvent::subTypes('Document');
     $user = $this->ktapi->get_user();
     $document = $this->document;
     $subscription = new Subscription($user->getId(), $document->getId(), $subscriptionType);
     $result = $subscription->create();
     if (PEAR::isError($result)) {
         return $result->getMessage();
     }
     if ($result) {
         return $result;
     }
     return $_SESSION['errorMessage'];
 }