• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

webservice/soap/classes/class.ilSoapAdministration.php

Go to the documentation of this file.
00001 <?php
00002   /*
00003    +-----------------------------------------------------------------------------+
00004    | ILIAS open source                                                           |
00005    +-----------------------------------------------------------------------------+
00006    | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007    |                                                                             |
00008    | This program is free software; you can redistribute it and/or               |
00009    | modify it under the terms of the GNU General Public License                 |
00010    | as published by the Free Software Foundation; either version 2              |
00011    | of the License, or (at your option) any later version.                      |
00012    |                                                                             |
00013    | This program is distributed in the hope that it will be useful,             |
00014    | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016    | GNU General Public License for more details.                                |
00017    |                                                                             |
00018    | You should have received a copy of the GNU General Public License           |
00019    | along with this program; if not, write to the Free Software                 |
00020    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021    +-----------------------------------------------------------------------------+
00022   */
00023 
00024 
00035 include_once './webservice/soap/lib/nusoap.php';
00036 include_once ("./classes/class.ilAuthUtils.php");               // to get auth mode constants
00037 
00038 class ilSoapAdministration
00039 {
00040         /*
00041          * object which handles php's authentication
00042          * @var object
00043          */
00044         var $sauth = null;
00045 
00046         /*
00047          * Defines type of error handling (PHP5 || NUSOAP)
00048          * @var object
00049          */
00050         var $error_method = null;
00051 
00052 
00053         function ilSoapAdministration($use_nusoap = true)
00054         {
00055                 define('USER_FOLDER_ID',7);
00056                 define('NUSOAP',1);
00057                 define('PHP5',2);
00058 
00059                 if($use_nusoap)
00060                 {
00061                         $this->error_method = NUSOAP;
00062                 }
00063                 $this->__initAuthenticationObject();
00064 
00065         }
00066 
00067         // PROTECTED
00068         function __checkSession($sid)
00069         {
00070                 list($sid,$client) = $this->__explodeSid($sid);
00071 
00072                 $this->sauth->setClient($client);
00073                 $this->sauth->setSid($sid);
00074 
00075                 if(!$this->sauth->validateSession())
00076                 {
00077                         return false;
00078                 }                       
00079                 return true;
00080         }
00081 
00082 
00083         function __explodeSid($sid)
00084         {
00085                 $exploded = explode('::',$sid);
00086 
00087                 return is_array($exploded) ? $exploded : array('sid' => '','client' => '');
00088         }
00089 
00090 
00091         function __setMessage($a_str)
00092         {
00093                 $this->message = $a_str;
00094         }
00095         function __getMessage()
00096         {
00097                 return $this->message;
00098         }
00099         function __appendMessage($a_str)
00100         {
00101                 $this->message .= isset($this->message) ? ' ' : '';
00102                 $this->message .= $a_str;
00103         }
00104 
00105 
00106         function __initAuthenticationObject($a_auth_mode = AUTH_LOCAL)
00107         {
00108                 switch($a_auth_mode)
00109                 {
00110                         case AUTH_CAS:
00111                                 include_once './webservice/soap/classes/class.ilSoapAuthenticationCAS.php';
00112                                 return $this->sauth = new ilSoapAuthenticationCAS();
00113                         
00114                         default:
00115                                 include_once './webservice/soap/classes/class.ilSoapAuthentication.php';
00116                                 return $this->sauth = new ilSoapAuthentication();
00117                 }
00118         }
00119                 
00120 
00121         function __raiseError($a_message,$a_code)
00122         {
00123                 switch($this->error_method)
00124                 {
00125                         case NUSOAP:
00126 
00127                                 return new soap_fault($a_code,'',$a_message);
00128                 }
00129         }
00130 
00131         
00132 }
00133 ?>

Generated on Fri Dec 13 2013 13:52:16 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1