86 $this->server_id = $a_server_id;
100 $GLOBALS[
'DIC']->logger()->wsrv()->warning(
'Using deprecated call');
102 return self::getInstanceByServerId(null);
112 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;
133 if (self::$configured === null) {
135 $ilDB = $DIC->database();
137 $query =
"SELECT count(*) count FROM ecs_server";
139 $c =
$ret->fetchObject()->count;
141 self::$configured =
$c > 0;
143 return self::$configured;
152 $this->title = $a_title;
170 $this->auth_type = $a_auth_type;
188 $this->auth_user = $a_user;
206 $this->auth_pass = $a_pass;
236 $this->active = $a_status;
259 $this->server = $a_server;
283 case self::PROTOCOL_HTTP:
287 case self::PROTOCOL_HTTPS:
294 foreach ((array) explode(
'/', $this->
getServer()) as
$key => $part) {
297 $uri .=
':' . $this->
getPort();
302 $uri = substr($uri, 0, -1);
305 $uri .= (
':' . $this->
getPort());
320 $this->protocol = $a_prot;
343 $this->port = $a_port;
367 $this->polling = $a_time;
389 return (
int) ($this->polling % 60);
400 return (
int) ($this->polling / 60);
425 $this->client_cert_path = $a_path;
447 $this->ca_cert_path = $a_ca;
481 $this->key_path = $a_path;
504 $this->key_password = $a_pass;
516 $this->import_id = $a_id;
538 $this->cert_serial_number = $a_cert_serial;
549 return $this->cert_serial_number;
572 $this->global_role = $a_role_id;
584 $this->duration = $a_duration;
595 return $this->duration ? $this->duration : self::DEFAULT_DURATION;
606 return explode(
',', (
string) $this->user_recipients);
617 return $this->user_recipients ? $this->user_recipients :
'';
629 $this->user_recipients = $a_logins;
640 return explode(
',', $this->econtent_recipients);
651 return $this->econtent_recipients ? $this->econtent_recipients :
'';
663 $this->econtent_recipients = $a_logins;
674 return explode(
',', $this->approval_recipients);
686 return $this->approval_recipients ? $this->approval_recipients :
'';
697 $this->approval_recipients = $a_rcp;
715 if ($this->
getAuthType() == self::AUTH_CERTIFICATE) {
717 return self::ERROR_REQUIRED;
721 return self::ERROR_EXTRACT_SERIAL;
724 return self::ERROR_CERT_EXPIRED;
730 return self::ERROR_REQUIRED;
737 return self::ERROR_REQUIRED;
741 return self::ERROR_INVALID_IMPORT_ID;
756 $ilObjDataCache = $DIC[
'ilObjDataCache'];
757 $tree = $DIC[
'tree'];
762 if ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getImportId())) !=
'cat') {
765 if (
$tree->isDeleted($this->getImportId())) {
781 $ilDB = $DIC[
'ilDB'];
783 $this->server_id =
$ilDB->nextId(
'ecs_server');
785 $q =
'INSERT INTO ecs_server (server_id,active,title,protocol,server,port,auth_type,client_cert_path,ca_cert_path,' .
786 'key_path,key_password,cert_serial,polling_time,import_id,global_role,econtent_rcp,user_rcp,approval_rcp,duration,auth_user,auth_pass) ' .
788 $ilDB->quote($this->getServerId(),
'integer') .
', ' .
789 $ilDB->quote((
int) $this->isEnabled(),
'integer') .
', ' .
790 $ilDB->quote($this->getTitle(),
'text') .
', ' .
791 $ilDB->quote((
int) $this->getProtocol(),
'integer') .
', ' .
792 $ilDB->quote($this->getServer(),
'text') .
', ' .
793 $ilDB->quote($this->getPort(),
'integer') .
', ' .
794 $ilDB->quote($this->getAuthType(),
'integer') .
', ' .
795 $ilDB->quote($this->getClientCertPath(),
'text') .
', ' .
796 $ilDB->quote($this->getCACertPath(),
'text') .
', ' .
797 $ilDB->quote($this->getKeyPath(),
'text') .
', ' .
798 $ilDB->quote($this->getKeyPassword(),
'text') .
', ' .
799 $ilDB->quote($this->getCertSerialNumber(),
'text') .
', ' .
800 $ilDB->quote($this->getPollingTime(),
'integer') .
', ' .
801 $ilDB->quote($this->getImportId(),
'integer') .
', ' .
802 $ilDB->quote($this->getGlobalRole(),
'integer') .
', ' .
803 $ilDB->quote($this->getEContentRecipientsAsString(),
'text') .
', ' .
804 $ilDB->quote($this->getUserRecipientsAsString(),
'text') .
', ' .
805 $ilDB->quote($this->getApprovalRecipientsAsString(),
'text') .
', ' .
806 $ilDB->quote($this->getDuration(),
'integer') .
', ' .
807 $ilDB->quote($this->getAuthUser(),
'text') .
', ' .
808 $ilDB->quote($this->getAuthPass(),
'text') .
' ' .
820 $ilDB = $DIC[
'ilDB'];
823 'UPDATE ecs_server SET ' .
824 'server_id = ' .
$ilDB->quote($this->getServerId(),
'integer') .
', ' .
825 'active = ' .
$ilDB->quote((
int) $this->isEnabled(),
'integer') .
', ' .
826 'title = ' .
$ilDB->quote($this->getTitle(),
'text') .
', ' .
827 'protocol = ' .
$ilDB->quote((
int) $this->getProtocol(),
'integer') .
', ' .
828 'server = ' .
$ilDB->quote($this->getServer(),
'text') .
', ' .
829 'port = ' .
$ilDB->quote($this->getPort(),
'integer') .
', ' .
830 'auth_type = ' .
$ilDB->quote($this->getAuthType(),
'integer') .
', ' .
831 'client_cert_path = ' .
$ilDB->quote($this->getClientCertPath(),
'text') .
', ' .
832 'ca_cert_path = ' .
$ilDB->quote($this->getCACertPath(),
'text') .
', ' .
833 'key_path = ' .
$ilDB->quote($this->getKeyPath(),
'text') .
', ' .
834 'key_password = ' .
$ilDB->quote($this->getKeyPassword(),
'text') .
', ' .
835 'cert_serial = ' .
$ilDB->quote($this->getCertSerialNumber(),
'text') .
', ' .
836 'polling_time = ' .
$ilDB->quote($this->getPollingTime(),
'integer') .
', ' .
837 'import_id = ' .
$ilDB->quote($this->getImportId(),
'integer') .
', ' .
838 'global_role = ' .
$ilDB->quote($this->getGlobalRole(),
'integer') .
', ' .
839 'econtent_rcp = ' .
$ilDB->quote($this->getEContentRecipientsAsString(),
'text') .
', ' .
840 'user_rcp = ' .
$ilDB->quote($this->getUserRecipientsAsString(),
'text') .
', ' .
841 'approval_rcp = ' .
$ilDB->quote($this->getApprovalRecipientsAsString(),
'text') .
', ' .
842 'duration = ' .
$ilDB->quote($this->getDuration(),
'integer') .
', ' .
843 'auth_user = ' .
$ilDB->quote($this->getAuthUser(),
'text') .
', ' .
844 'auth_pass = ' .
$ilDB->quote($this->getAuthPass(),
'text') .
', ' .
845 'auth_type = ' .
$ilDB->quote($this->getAuthType(),
'integer') .
' ' .
846 'WHERE server_id = ' .
$ilDB->quote($this->getServerId(),
'integer')
853 public function delete()
857 $ilDB = $DIC[
'ilDB'];
861 include_once
'Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
864 include_once
'Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
867 include_once
'Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
870 include_once
'Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
873 include_once
'Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
876 include_once
'Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
879 include_once
'Services/WebServices/ECS/classes/class.ilECSExport.php';
883 include_once
'Services/WebServices/ECS/classes/class.ilECSImport.php';
887 'DELETE FROM ecs_server ' .
888 'WHERE server_id = ' .
$ilDB->quote($this->getServerId(),
'integer')
891 $this->server_id = null;
902 if ($this->
getAuthType() != self::AUTH_CERTIFICATE) {
906 if (function_exists(
'openssl_x509_parse')
and $cert = openssl_x509_parse(
'file://' . $this->
getClientCertPath())) {
907 if (isset($cert[
'validTo_time_t'])
and $cert[
'validTo_time_t']) {
925 if (function_exists(
'openssl_x509_parse')
and $cert = openssl_x509_parse(
'file://' . $this->
getClientCertPath())) {
926 if (isset($cert[
'serialNumber'])
and $cert[
'serialNumber']) {
928 $GLOBALS[
'DIC']->logger()->wsrv()->debug(
'Searial number is: ' . $cert[
'serialNumber']);
938 foreach ($lines as $line) {
939 if (strpos($line,
'Serial Number:') !==
false) {
941 $serial_line = explode(
':', $line);
942 $serial = (int) trim($serial_line[1]);
963 $ilDB = $DIC[
'ilDB'];
969 $query =
'SELECT * FROM ecs_server ' .
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.
static ecsConfigured()
Checks if an ecs server is configured.
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.
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
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
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
setProtocol($a_prot)
set protocol
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static deleteByServerId($a_server_id)