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]) {
112 return self::$instances[$a_server_id];
114 return self::$instances[$a_server_id] =
new ilECSSetting($a_server_id);
122 return self::DEFAULT_AUTH_MODE;
131 $this->title = $a_title;
149 $this->auth_type = $a_auth_type;
167 $this->auth_user = $a_user;
185 $this->auth_pass = $a_pass;
215 $this->active = $a_status;
238 $this->server = $a_server;
262 case self::PROTOCOL_HTTP:
266 case self::PROTOCOL_HTTPS:
276 $uri .=
':' . $this->
getPort();
281 $uri = substr($uri, 0, -1);
284 $uri .= (
':' . $this->
getPort());
299 $this->protocol = $a_prot;
322 $this->port = $a_port;
346 $this->polling = $a_time;
368 return (
int) ($this->polling % 60);
379 return (
int) ($this->polling / 60);
404 $this->client_cert_path = $a_path;
426 $this->ca_cert_path = $a_ca;
460 $this->key_path = $a_path;
483 $this->key_password = $a_pass;
495 $this->import_id = $a_id;
517 $this->cert_serial_number = $a_cert_serial;
528 return $this->cert_serial_number;
551 $this->global_role = $a_role_id;
563 $this->duration = $a_duration;
574 return $this->duration ? $this->duration : self::DEFAULT_DURATION;
585 return explode(
',', (
string) $this->user_recipients);
596 return $this->user_recipients ? $this->user_recipients :
'';
608 $this->user_recipients = $a_logins;
619 return explode(
',', $this->econtent_recipients);
630 return $this->econtent_recipients ? $this->econtent_recipients :
'';
642 $this->econtent_recipients = $a_logins;
653 return explode(
',', $this->approval_recipients);
665 return $this->approval_recipients ? $this->approval_recipients :
'';
676 $this->approval_recipients = $a_rcp;
694 if ($this->
getAuthType() == self::AUTH_CERTIFICATE) {
696 return self::ERROR_REQUIRED;
700 return self::ERROR_EXTRACT_SERIAL;
703 return self::ERROR_CERT_EXPIRED;
709 return self::ERROR_REQUIRED;
716 return self::ERROR_REQUIRED;
720 return self::ERROR_INVALID_IMPORT_ID;
733 global $ilObjDataCache,$tree;
738 if ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getImportId())) !=
'cat') {
741 if ($tree->isDeleted($this->getImportId())) {
757 $this->server_id = $ilDB->nextId(
'ecs_server');
759 $q =
'INSERT INTO ecs_server (server_id,active,title,protocol,server,port,auth_type,client_cert_path,ca_cert_path,' .
760 'key_path,key_password,cert_serial,polling_time,import_id,global_role,econtent_rcp,user_rcp,approval_rcp,duration,auth_user,auth_pass) ' .
762 $ilDB->quote($this->getServerId(),
'integer') .
', ' .
763 $ilDB->quote((
int) $this->isEnabled(),
'integer') .
', ' .
764 $ilDB->quote($this->getTitle(),
'text') .
', ' .
765 $ilDB->quote((
int) $this->getProtocol(),
'integer') .
', ' .
766 $ilDB->quote($this->getServer(),
'text') .
', ' .
767 $ilDB->quote($this->getPort(),
'integer') .
', ' .
768 $ilDB->quote($this->getAuthType(),
'integer') .
', ' .
769 $ilDB->quote($this->getClientCertPath(),
'text') .
', ' .
770 $ilDB->quote($this->getCACertPath(),
'text') .
', ' .
771 $ilDB->quote($this->getKeyPath(),
'text') .
', ' .
772 $ilDB->quote($this->getKeyPassword(),
'text') .
', ' .
773 $ilDB->quote($this->getCertSerialNumber(),
'text') .
', ' .
774 $ilDB->quote($this->getPollingTime(),
'integer') .
', ' .
775 $ilDB->quote($this->getImportId(),
'integer') .
', ' .
776 $ilDB->quote($this->getGlobalRole(),
'integer') .
', ' .
777 $ilDB->quote($this->getEContentRecipientsAsString(),
'text') .
', ' .
778 $ilDB->quote($this->getUserRecipientsAsString(),
'text') .
', ' .
779 $ilDB->quote($this->getApprovalRecipientsAsString(),
'text') .
', ' .
780 $ilDB->quote($this->getDuration(),
'integer') .
', ' .
781 $ilDB->quote($this->getAuthUser(),
'text') .
', ' .
782 $ilDB->quote($this->getAuthPass(),
'text') .
' ' .
795 'UPDATE ecs_server SET ' .
796 'server_id = ' . $ilDB->quote($this->getServerId(),
'integer') .
', ' .
797 'active = ' . $ilDB->quote((
int) $this->isEnabled(),
'integer') .
', ' .
798 'title = ' . $ilDB->quote($this->getTitle(),
'text') .
', ' .
799 'protocol = ' . $ilDB->quote((
int) $this->getProtocol(),
'integer') .
', ' .
800 'server = ' . $ilDB->quote($this->getServer(),
'text') .
', ' .
801 'port = ' . $ilDB->quote($this->getPort(),
'integer') .
', ' .
802 'auth_type = ' . $ilDB->quote($this->getAuthType(),
'integer') .
', ' .
803 'client_cert_path = ' . $ilDB->quote($this->getClientCertPath(),
'text') .
', ' .
804 'ca_cert_path = ' . $ilDB->quote($this->getCACertPath(),
'text') .
', ' .
805 'key_path = ' . $ilDB->quote($this->getKeyPath(),
'text') .
', ' .
806 'key_password = ' . $ilDB->quote($this->getKeyPassword(),
'text') .
', ' .
807 'cert_serial = ' . $ilDB->quote($this->getCertSerialNumber(),
'text') .
', ' .
808 'polling_time = ' . $ilDB->quote($this->getPollingTime(),
'integer') .
', ' .
809 'import_id = ' . $ilDB->quote($this->getImportId(),
'integer') .
', ' .
810 'global_role = ' . $ilDB->quote($this->getGlobalRole(),
'integer') .
', ' .
811 'econtent_rcp = ' . $ilDB->quote($this->getEContentRecipientsAsString(),
'text') .
', ' .
812 'user_rcp = ' . $ilDB->quote($this->getUserRecipientsAsString(),
'text') .
', ' .
813 'approval_rcp = ' . $ilDB->quote($this->getApprovalRecipientsAsString(),
'text') .
', ' .
814 'duration = ' . $ilDB->quote($this->getDuration(),
'integer') .
', ' .
815 'auth_user = ' . $ilDB->quote($this->getAuthUser(),
'text') .
', ' .
816 'auth_pass = ' . $ilDB->quote($this->getAuthPass(),
'text') .
', ' .
817 'auth_type = ' . $ilDB->quote($this->getAuthType(),
'integer') .
' ' .
818 'WHERE server_id = ' . $ilDB->quote($this->getServerId(),
'integer')
825 public function delete()
831 include_once
'Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
834 include_once
'Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
837 include_once
'Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
840 include_once
'Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
843 include_once
'Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
846 include_once
'Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
849 include_once
'Services/WebServices/ECS/classes/class.ilECSExport.php';
853 include_once
'Services/WebServices/ECS/classes/class.ilECSImport.php';
857 'DELETE FROM ecs_server ' .
858 'WHERE server_id = ' . $ilDB->quote($this->getServerId(),
'integer')
861 $this->server_id = null;
872 if ($this->
getAuthType() != self::AUTH_CERTIFICATE) {
876 if (function_exists(
'openssl_x509_parse') and $cert = openssl_x509_parse(
'file://' . $this->
getClientCertPath())) {
877 if (isset($cert[
'validTo_time_t']) and $cert[
'validTo_time_t']) {
895 if (function_exists(
'openssl_x509_parse') and $cert = openssl_x509_parse(
'file://' . $this->
getClientCertPath())) {
896 if (isset($cert[
'serialNumber']) and $cert[
'serialNumber']) {
898 $GLOBALS[
'DIC']->logger()->wsrv()->debug(
'Searial number is: ' . $cert[
'serialNumber']);
908 foreach ($lines as $line) {
909 if (strpos($line,
'Serial Number:') !==
false) {
911 $serial_line = explode(
':', $line);
912 $serial = (int) trim($serial_line[1]);
937 $query =
'SELECT * FROM ecs_server ' .
938 'WHERE server_id = ' . $ilDB->quote($this->
getServerId(),
'integer');
954 $this->econtent_recipients = $row[
'econtent_rcp'];
955 $this->approval_recipients = $row[
'approval_rcp'];
956 $this->user_recipients = $row[
'user_rcp'];
970 $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
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
__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
foreach($_POST as $key=> $value) $res
static _getInstance()
singleton getInstance
static deleteByServerId($a_server_id)
getUserRecipientsAsString()
Get new user recipients.
getCertSerialNumber()
get cert serial number
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)