original_string: static function exists( $contentID, $languageID , $subscriptionType, $email = null, $enabled = false )
      {
        
          $emailString = '';
          if ( !is_null($email) )
          {
              $emailString = " WHERE email = '$email'";
          }
          $countArray = null;
          $db = eZDB::instance();
          if ( $enabled === false )
          {
              $countArray = $db->arrayQuery( "SELECT count(*) AS count" .
                                         " FROM ezcomment_subscription" .
                                         " WHERE " .
                                         " content_id = $contentID" .
                                         " AND language_id = $languageID" .
                                         " AND subscription_type = '$subscriptionType'" .
                                         " AND subscriber_id IN" . 
                                         "( SELECT id FROM ezcomment_subscriber" .
                                         "$emailString )");
          }
          else
          if ( $enabled === 1 || $enabled === 0 )
          {
            $enabledString = "enabled = $enabled";
            if ( $emailString != '' )
            {
                $enabledString = " AND " . $enabledString;
            }
            else
            {
                $enabledString = " WHERE " . $enabledString;
            }
            $countArray = $db->arrayQuery( "SELECT count(*) AS count" .
                                         " FROM ezcomment_subscription" .
                                         " WHERE" .
                                         " content_id = $contentID" .
                                         " AND language_id = $languageID" .
                                         " AND subscription_type = '$subscriptionType'" .
                                         " AND subscriber_id IN" .
                                         " ( SELECT id FROM ezcomment_subscriber" .
                                         $emailString .
                                         "$enabledString )" );
          }
          else
          {
              return null;
          }
          $totalCount = $countArray[0]['count'];
          if ( $totalCount === '0' )
          {
              return false;
          }
          else
          {
              return true;
          }
      }
code: static function exists( $contentID, $languageID , $subscriptionType, $email = null, $enabled = false )
      {
        
          $emailString = '';
          if ( !is_null($email) )
          {
              $emailString = " WHERE email = '$email'";
          }
          $countArray = null;
          $db = eZDB::instance();
          if ( $enabled === false )
          {
              $countArray = $db->arrayQuery( "SELECT count(*) AS count" .
                                         " FROM ezcomment_subscription" .
                                         " WHERE " .
                                         " content_id = $contentID" .
                                         " AND language_id = $languageID" .
                                         " AND subscription_type = '$subscriptionType'" .
                                         " AND subscriber_id IN" . 
                                         "( SELECT id FROM ezcomment_subscriber" .
                                         "$emailString )");
          }
          else
          if ( $enabled === 1 || $enabled === 0 )
          {
            $enabledString = "enabled = $enabled";
            if ( $emailString != '' )
            {
                $enabledString = " AND " . $enabledString;
            }
            else
            {
                $enabledString = " WHERE " . $enabledString;
            }
            $countArray = $db->arrayQuery( "SELECT count(*) AS count" .
                                         " FROM ezcomment_subscription" .
                                         " WHERE" .
                                         " content_id = $contentID" .
                                         " AND language_id = $languageID" .
                                         " AND subscription_type = '$subscriptionType'" .
                                         " AND subscriber_id IN" .
                                         " ( SELECT id FROM ezcomment_subscriber" .
                                         $emailString .
                                         "$enabledString )" );
          }
          else
          {
              return null;
          }
          $totalCount = $countArray[0]['count'];
          if ( $totalCount === '0' )
          {
              return false;
          }
          else
          {
              return true;
          }
      }
code_tokens: static function exists ( $ contentID , $ languageID , $ subscriptionType , $ email = null , $ enabled = false ) { $ emailString = '' ; if ( ! is_null ( $ email ) ) { $ emailString = " WHERE email = '$email'" ; } $ countArray = null ; $ db = eZDB :: instance ( ) ; if ( $ enabled === false ) { $ countArray = $ db -> arrayQuery ( "SELECT count(*) AS count" . " FROM ezcomment_subscription" . " WHERE " . " content_id = $contentID" . " AND language_id = $languageID" . " AND subscription_type = '$subscriptionType'" . " AND subscriber_id IN" . "( SELECT id FROM ezcomment_subscriber" . "$emailString )" ) ; } else if ( $ enabled === 1 || $ enabled === 0 ) { $ enabledString = "enabled = $enabled" ; if ( $ emailString != '' ) { $ enabledString = " AND " . $ enabledString ; } else { $ enabledString = " WHERE " . $ enabledString ; } $ countArray = $ db -> arrayQuery ( "SELECT count(*) AS count" . " FROM ezcomment_subscription" . " WHERE" . " content_id = $contentID" . " AND language_id = $languageID" . " AND subscription_type = '$subscriptionType'" . " AND subscriber_id IN" . " ( SELECT id FROM ezcomment_subscriber" . $ emailString . "$enabledString )" ) ; } else { return null ; } $ totalCount = $ countArray [ 0 ] [ 'count' ] ; if ( $ totalCount === '0' ) { return false ; } else { return true ; } }
docstring: Check if the subscription exists by a given contentID
  @param string $contentID : the ID of content subscribed
  @param string $languageID : the language ID of content
  @param string $subscriptionType : type of the subscription
  @param string $email : email in table subscriber
  @param integer $enabled : 1/0 - check if the subscriber is enabled.
  Empty/false - not check if the subscriber is enabled
  @return boolean: true if existing, false if not, null if error happens
docstring_tokens: Check if the subscription exists by a given contentID