85 $this->server_id = $a_server_id;
99 $GLOBALS[
'DIC']->logger()->wsrv()->warning(
'Using deprecated call');
101 return self::getInstanceByServerId(null);
111 if(self::$instances[$a_server_id])
113 return self::$instances[$a_server_id];
115 return self::$instances[$a_server_id] =
new ilECSSetting($a_server_id);
123 return self::DEFAULT_AUTH_MODE;
132 $this->title = $a_title;
150 $this->auth_type = $a_auth_type;
168 $this->auth_user = $a_user;
186 $this->auth_pass = $a_pass;
216 $this->active = $a_status;
239 $this->server = $a_server;
264 case self::PROTOCOL_HTTP:
268 case self::PROTOCOL_HTTPS:
281 $uri .=
':'.$this->getPort();
286 $uri = substr($uri,0,-1);
291 $uri .= (
':'.$this->getPort());
306 $this->protocol = $a_prot;
329 $this->port = $a_port;
353 $this->polling = $a_time;
375 return (
int) ($this->polling % 60);
386 return (
int) ($this->polling / 60);
411 $this->client_cert_path = $a_path;
433 $this->ca_cert_path = $a_ca;
467 $this->key_path = $a_path;
490 $this->key_password = $a_pass;
502 $this->import_id = $a_id;
524 $this->cert_serial_number = $a_cert_serial;
535 return $this->cert_serial_number;
558 $this->global_role = $a_role_id;
570 $this->duration = $a_duration;
581 return $this->duration ? $this->duration : self::DEFAULT_DURATION;
592 return explode(
',',(
string) $this->user_recipients);
603 return $this->user_recipients ? $this->user_recipients :
'';
615 $this->user_recipients = $a_logins;
626 return explode(
',',$this->econtent_recipients);
637 return $this->econtent_recipients ? $this->econtent_recipients :
'';
649 $this->econtent_recipients = $a_logins;
660 return explode(
',',$this->approval_recipients);
672 return $this->approval_recipients ? $this->approval_recipients :
'';
683 $this->approval_recipients = $a_rcp;
706 return self::ERROR_REQUIRED;
711 return self::ERROR_EXTRACT_SERIAL;
715 return self::ERROR_CERT_EXPIRED;
723 return self::ERROR_REQUIRED;
731 return self::ERROR_REQUIRED;
736 return self::ERROR_INVALID_IMPORT_ID;
749 global $ilObjDataCache,$tree;
755 if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getImportId())) !=
'cat')
759 if($tree->isDeleted($this->getImportId()))
776 $this->server_id = $ilDB->nextId(
'ecs_server');
777 $ilDB->manipulate($q =
'INSERT INTO ecs_server (server_id,active,title,protocol,server,port,auth_type,client_cert_path,ca_cert_path,'.
778 'key_path,key_password,cert_serial,polling_time,import_id,global_role,econtent_rcp,user_rcp,approval_rcp,duration,auth_user,auth_pass) '.
780 $ilDB->quote($this->getServerId(),
'integer').
', '.
781 $ilDB->quote((
int) $this->isEnabled(),
'integer').
', '.
782 $ilDB->quote($this->getTitle(),
'text').
', '.
783 $ilDB->quote((
int) $this->getProtocol(),
'integer').
', '.
784 $ilDB->quote($this->getServer(),
'text').
', '.
785 $ilDB->quote($this->getPort(),
'integer').
', '.
786 $ilDB->quote($this->getAuthType(),
'integer').
', '.
787 $ilDB->quote($this->getClientCertPath(),
'text').
', '.
788 $ilDB->quote($this->getCACertPath(),
'text').
', '.
789 $ilDB->quote($this->getKeyPath(),
'text').
', '.
790 $ilDB->quote($this->getKeyPassword(),
'text').
', '.
791 $ilDB->quote($this->getCertSerialNumber(),
'text').
', '.
792 $ilDB->quote($this->getPollingTime(),
'integer').
', '.
793 $ilDB->quote($this->getImportId(),
'integer').
', '.
794 $ilDB->quote($this->getGlobalRole(),
'integer').
', '.
795 $ilDB->quote($this->getEContentRecipientsAsString(),
'text').
', '.
796 $ilDB->quote($this->getUserRecipientsAsString(),
'text').
', '.
797 $ilDB->quote($this->getApprovalRecipientsAsString(),
'text').
', '.
798 $ilDB->quote($this->getDuration(),
'integer').
', '.
799 $ilDB->quote($this->getAuthUser(),
'text').
', '.
800 $ilDB->quote($this->getAuthPass(),
'text').
' '.
812 $ilDB->manipulate(
'UPDATE ecs_server SET '.
813 'server_id = '.$ilDB->quote($this->getServerId(),
'integer').
', '.
814 'active = '.$ilDB->quote((
int) $this->isEnabled(),
'integer').
', '.
815 'title = '.$ilDB->quote($this->getTitle(),
'text').
', '.
816 'protocol = '.$ilDB->quote((
int) $this->getProtocol(),
'integer').
', '.
817 'server = '.$ilDB->quote($this->getServer(),
'text').
', '.
818 'port = '.$ilDB->quote($this->getPort(),
'integer').
', '.
819 'auth_type = '.$ilDB->quote($this->getAuthType(),
'integer').
', '.
820 'client_cert_path = '.$ilDB->quote($this->getClientCertPath(),
'text').
', '.
821 'ca_cert_path = '.$ilDB->quote($this->getCACertPath(),
'text').
', '.
822 'key_path = '.$ilDB->quote($this->getKeyPath(),
'text').
', '.
823 'key_password = '.$ilDB->quote($this->getKeyPassword(),
'text').
', '.
824 'cert_serial = '.$ilDB->quote($this->getCertSerialNumber(),
'text').
', '.
825 'polling_time = '.$ilDB->quote($this->getPollingTime(),
'integer').
', '.
826 'import_id = '.$ilDB->quote($this->getImportId(),
'integer').
', '.
827 'global_role = '.$ilDB->quote($this->getGlobalRole(),
'integer').
', '.
828 'econtent_rcp = '.$ilDB->quote($this->getEContentRecipientsAsString(),
'text').
', '.
829 'user_rcp = '.$ilDB->quote($this->getUserRecipientsAsString(),
'text').
', '.
830 'approval_rcp = '.$ilDB->quote($this->getApprovalRecipientsAsString(),
'text').
', '.
831 'duration = '.$ilDB->quote($this->getDuration(),
'integer').
', '.
832 'auth_user = '.$ilDB->quote($this->getAuthUser(),
'text').
', '.
833 'auth_pass = '.$ilDB->quote($this->getAuthPass(),
'text').
', '.
834 'auth_type = '.$ilDB->quote($this->getAuthType(),
'integer').
' '.
835 'WHERE server_id = '.$ilDB->quote($this->getServerId(),
'integer')
842 public function delete()
848 include_once
'Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
851 include_once
'Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
854 include_once
'Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
857 include_once
'Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
860 include_once
'Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
863 include_once
'Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
866 include_once
'Services/WebServices/ECS/classes/class.ilECSExport.php';
870 include_once
'Services/WebServices/ECS/classes/class.ilECSImport.php';
874 'DELETE FROM ecs_server '.
875 'WHERE server_id = '.$ilDB->quote($this->getServerId(),
'integer')
878 $this->server_id = NULL;
894 if(function_exists(
'openssl_x509_parse')
and $cert = openssl_x509_parse(
'file://'.$this->
getClientCertPath()))
896 if(isset($cert[
'validTo_time_t'])
and $cert[
'validTo_time_t'])
916 if(function_exists(
'openssl_x509_parse')
and $cert = openssl_x509_parse(
'file://'.$this->
getClientCertPath()))
918 if(isset($cert[
'serialNumber'])
and $cert[
'serialNumber'])
921 $GLOBALS[
'DIC']->logger()->wsrv()->debug(
'Searial number is: '. $cert[
'serialNumber']);
932 foreach($lines as $line)
934 if(strpos($line,
'Serial Number:') !==
false)
937 $serial_line = explode(
':',$line);
938 $serial = (int) trim($serial_line[1]);
968 $query =
'SELECT * FROM ecs_server '.
969 'WHERE server_id = '.$ilDB->quote($this->
getServerId(),
'integer');
986 $this->econtent_recipients = $row[
'econtent_rcp'];
987 $this->approval_recipients = $row[
'approval_rcp'];
988 $this->user_recipients = $row[
'user_rcp'];
1002 $this->server_id = 0;
static deleteByServerId($a_server_id)
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
getKeyPassword()
get key password
const ERROR_INVALID_IMPORT_ID
getCACertPath()
get ca cert path
setAuthUser($a_user)
Set apache auth user.
setKeyPassword($a_pass)
set key password
setGlobalRole($a_role_id)
set default global role
setKeyPath($a_path)
set key path
getServerId()
Get current server id.
getAuthType()
Get auth type.
getServerURI()
get complete server uri
getEContentRecipientsAsString()
get EContent recipients as string
setAuthPass($a_pass)
Set Apache auth password.
setTitle($a_title)
Set title.
getApprovalRecipientsAsString()
get approval recipients as string
__clone()
Overwritten clone method Reset all connection settings.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
setApprovalRecipients($a_rcp)
set approval recipients
setUserRecipients($a_logins)
set user recipients
getPollingTime()
get polling time
getClientCertPath()
get certificate path
getAuthPass()
Get auth password.
getImportId()
get import id
getEContentRecipients()
get Econtent recipients
fetchCertificateExpiration()
Fetch validity (expired date)
setAuthType($a_auth_type)
Set auth type.
getProtocol()
get protocol
setPollingTimeMS($a_min, $a_sec)
Set polling time.
validate()
Validate settings.
static resetServerId($a_server_id)
setDuration($a_duration)
set Duration
static _getInstance()
singleton getInstance
static deleteByServerId($a_server_id)
getUserRecipientsAsString()
Get new user recipients.
getCertSerialNumber()
get cert serial number
static formatDate(ilDateTime $date)
Format a date public.
getAuthUser()
Get apache auth user.
setImportId($a_id)
set import id Object of category, that store new remote courses
static deleteByServerId($a_server_id)
checkImportId()
check import id
Reload workbook from saved file
setProtocol($a_prot)
set protocol
Create styles array
The data for the language used.
setEContentRecipients($a_logins)
set EContent recipients
getGlobalRole()
get global role
const ERROR_EXTRACT_SERIAL
getDuration()
get duration
static deleteByServerId($a_server_id)
static lookupAuthMode()
Lookup auth mode.
setPollingTime($a_time)
set polling time
setClientCertPath($a_path)
set
fetchSerialID()
Fetch serial ID from cert.
__construct($a_server_id=0)
Singleton contructor.
setCACertPath($a_ca)
set ca cert path
static deleteByServerId($a_server_id)
getApprovalRecipients()
get approval recipients
setCertSerialNumber($a_cert_serial)
set cert serial number
getPollingTimeMinutes()
get polling time minutes
setServer($a_server)
set server
getPollingTimeSeconds()
get polling time seconds (<60)
setEnabledStatus($a_status)
en/disable ecs functionality
getUserRecipients()
Get new user recipients.
static deleteByServerId($a_server_id)