Merge pull request #3516 from jitendrapurohit/CRM-14869
[civicrm-core.git] / CRM / Utils / SoapServer.php
index a0c39fedf7d019b7d94e98d9b3f1fd7d28b60cb6..7d2901405223477db4f12b31aa1440acd92a1146 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -37,7 +37,7 @@
  * This class handles all SOAP client requests.
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -58,7 +58,7 @@ class CRM_Utils_SoapServer {
    * Class constructor.  This caches the real user framework class locally,
    * so we can use it for authentication and validation.
    *
-   * @param  string $uf       The userframework class
+   * @internal param string $uf The userframework class
    */
   public function __construct() {
     // any external program which call SoapServer is responsible for
@@ -85,9 +85,10 @@ class CRM_Utils_SoapServer {
   /**
    * Verify a SOAP key
    *
-   * @param string $key   The soap key generated by authenticate()
+   * @param string $key The soap key generated by authenticate()
    *
-   * @return none
+   * @throws SoapFault
+   * @return void
    * @access public
    */
   public function verify($key) {
@@ -115,9 +116,12 @@ class CRM_Utils_SoapServer {
   /**
    * Authentication wrapper to the UF Class
    *
-   * @param string $name      Login name
-   * @param string $pass      Password
+   * @param string $name Login name
+   * @param string $pass Password
    *
+   * @param bool $loadCMSBootstrap
+   *
+   * @throws SoapFault
    * @return string           The SOAP Client key
    * @access public
    * @static
@@ -125,11 +129,12 @@ class CRM_Utils_SoapServer {
   public function authenticate($name, $pass, $loadCMSBootstrap = FALSE) {
     require_once (str_replace('_', DIRECTORY_SEPARATOR, $this->ufClass) . '.php');
 
-    if ($this->ufClass == 'CRM_Utils_System_Joomla' || $this->ufClass == 'CRM_Utils_System_WordPress'){
-      $loadCMSBootstrap = TRUE;
+    if ($this->ufClass == 'CRM_Utils_System_Joomla'){
+      $loadCMSBootstrap = true;
     }
-        
-    eval('$result =& ' . $this->ufClass . '::authenticate($name, $pass, $loadCMSBootstrap );');
+
+    $className = $this->ufClass;
+    $result =& $className::authenticate($name, $pass, $loadCMSBootstrap );
 
     if (empty($result)) {
       throw new SoapFault('Client', 'Invalid login');
@@ -156,6 +161,15 @@ class CRM_Utils_SoapServer {
     return civicrm_api('Mailing', 'event_bounce', $params);
   }
 
+  /**
+   * @param $key
+   * @param $job
+   * @param $queue
+   * @param $hash
+   *
+   * @return array|int
+   * @throws SoapFault
+   */
   public function mailer_event_unsubscribe($key, $job, $queue, $hash) {
     $this->verify($key);
     $params = array(
@@ -169,6 +183,15 @@ class CRM_Utils_SoapServer {
     return civicrm_api('MailingGroup', 'event_unsubscribe', $params);
   }
 
+  /**
+   * @param $key
+   * @param $job
+   * @param $queue
+   * @param $hash
+   *
+   * @return array|int
+   * @throws SoapFault
+   */
   public function mailer_event_domain_unsubscribe($key, $job, $queue, $hash) {
     $this->verify($key);
     $params = array(
@@ -182,6 +205,15 @@ class CRM_Utils_SoapServer {
     return civicrm_api('MailingGroup', 'event_domain_unsubscribe', $params);
   }
 
+  /**
+   * @param $key
+   * @param $job
+   * @param $queue
+   * @param $hash
+   *
+   * @return array|int
+   * @throws SoapFault
+   */
   public function mailer_event_resubscribe($key, $job, $queue, $hash) {
     $this->verify($key);
     $params = array(
@@ -195,6 +227,15 @@ class CRM_Utils_SoapServer {
     return civicrm_api('MailingGroup', 'event_resubscribe', $params);
   }
 
+  /**
+   * @param $key
+   * @param $email
+   * @param $domain
+   * @param $group
+   *
+   * @return array|int
+   * @throws SoapFault
+   */
   public function mailer_event_subscribe($key, $email, $domain, $group) {
     $this->verify($key);
     $params = array(
@@ -205,6 +246,15 @@ class CRM_Utils_SoapServer {
     return civicrm_api('MailingGroup', 'event_subscribe', $params);
   }
 
+  /**
+   * @param $key
+   * @param $contact
+   * @param $subscribe
+   * @param $hash
+   *
+   * @return array|int
+   * @throws SoapFault
+   */
   public function mailer_event_confirm($key, $contact, $subscribe, $hash) {
     $this->verify($key);
     $params = array(
@@ -218,6 +268,19 @@ class CRM_Utils_SoapServer {
     return civicrm_api('Mailing', 'event_confirm', $params);
   }
 
+  /**
+   * @param $key
+   * @param $job
+   * @param $queue
+   * @param $hash
+   * @param $bodyTxt
+   * @param $rt
+   * @param null $bodyHTML
+   * @param null $fullEmail
+   *
+   * @return array|int
+   * @throws SoapFault
+   */
   public function mailer_event_reply($key, $job, $queue, $hash, $bodyTxt, $rt, $bodyHTML = NULL, $fullEmail = NULL) {
     $this->verify($key);
     $params = array(
@@ -234,6 +297,16 @@ class CRM_Utils_SoapServer {
     return civicrm_api('Mailing', 'event_reply', $params);
   }
 
+  /**
+   * @param $key
+   * @param $job
+   * @param $queue
+   * @param $hash
+   * @param $email
+   *
+   * @return array|int
+   * @throws SoapFault
+   */
   public function mailer_event_forward($key, $job, $queue, $hash, $email) {
     $this->verify($key);
     $params = array(
@@ -246,6 +319,13 @@ class CRM_Utils_SoapServer {
     return civicrm_api('Mailing', 'event_forward', $params);
   }
 
+  /**
+   * @param $key
+   * @param $params
+   *
+   * @return array|int
+   * @throws SoapFault
+   */
   public function get_contact($key, $params) {
     $this->verify($key);
     $params['version'] = 3;