85 $this->server_id = $a_server_id;
99 $GLOBALS[
'ilLog']->write(__METHOD__.
': Using deprecated call.');
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);
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:
276 foreach((array) explode(
'/',$this->
getServer()) as $key => $part)
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;
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;
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;
897 if(function_exists(
'openssl_x509_parse') and $cert = openssl_x509_parse(
'file://'.$this->
getClientCertPath()))
899 if(isset($cert[
'validTo_time_t']) and $cert[
'validTo_time_t'])
919 if(function_exists(
'openssl_x509_parse') and $cert = openssl_x509_parse(
'file://'.$this->
getClientCertPath()))
921 if(isset($cert[
'serialNumber']) and $cert[
'serialNumber'])
924 $ilLog->write(__METHOD__.
': Serial number is '.$cert[
'serialNumber']);
935 foreach($lines as $line)
937 if(strpos($line,
'Serial Number:') !==
false)
940 $serial_line = explode(
':',$line);
941 $serial = (int) trim($serial_line[1]);
971 $query =
'SELECT * FROM ecs_server '.
972 'WHERE server_id = '.$ilDB->quote($this->
getServerId(),
'integer');
989 $this->econtent_recipients = $row[
'econtent_rcp'];
990 $this->approval_recipients = $row[
'approval_rcp'];
991 $this->user_recipients = $row[
'user_rcp'];
1005 $this->server_id = 0;