diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2022-07-11 09:41:58 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2022-07-11 09:41:58 +0000 |
| commit | 2054b4c0815aa508623165d7fc0b810bafc16cc0 (patch) | |
| tree | aa2af51cce1d1c6b6ff0440ef816dd39b1242b54 /lib/elearning | |
| parent | 8ac6eaf4a1444748ea283bf2dc46e23795357e36 (diff) | |
fix 'Access to undefined property' errors, fixes #1295
Closes #1295
Merge request studip/studip!791
Diffstat (limited to 'lib/elearning')
| -rw-r--r-- | lib/elearning/ConnectedCMS.class.php | 7 | ||||
| -rw-r--r-- | lib/elearning/Ilias3ConnectedCMS.class.php | 11 | ||||
| -rw-r--r-- | lib/elearning/Ilias3ConnectedPermissions.class.php | 4 | ||||
| -rw-r--r-- | lib/elearning/Ilias3ObjectXMLParser.class.php | 141 | ||||
| -rw-r--r-- | lib/elearning/Ilias3Soap.class.php | 3 | ||||
| -rw-r--r-- | lib/elearning/Ilias4ConnectedPermissions.class.php | 2 | ||||
| -rw-r--r-- | lib/elearning/Ilias4ConnectedUser.class.php | 16 | ||||
| -rw-r--r-- | lib/elearning/Ilias4Soap.class.php | 4 | ||||
| -rw-r--r-- | lib/elearning/PmWikiConnectedCMS.class.php | 14 | ||||
| -rw-r--r-- | lib/elearning/PmWikiContentModule.class.php | 4 | ||||
| -rw-r--r-- | lib/elearning/clients/soap_webservice_client.php | 8 | ||||
| -rw-r--r-- | lib/elearning/clients/xml_rpc_webservice_client.php | 5 |
12 files changed, 109 insertions, 110 deletions
diff --git a/lib/elearning/ConnectedCMS.class.php b/lib/elearning/ConnectedCMS.class.php index 0aac526..e29d3c2 100644 --- a/lib/elearning/ConnectedCMS.class.php +++ b/lib/elearning/ConnectedCMS.class.php @@ -52,12 +52,7 @@ class ConnectedCMS public function __construct($cms = "") { $this->cms_type = $cms; - if (Config::get()->getValue("ELEARNING_INTERFACE_{$this->cms}_ACTIVE")) { - $this->is_active = true; - } - else { - $this->is_active = false; - } + $this->is_active = (bool) Config::get()->getValue("ELEARNING_INTERFACE_{$cms}_ACTIVE"); $this->init($cms); } diff --git a/lib/elearning/Ilias3ConnectedCMS.class.php b/lib/elearning/Ilias3ConnectedCMS.class.php index 69f1e52..de8db3f 100644 --- a/lib/elearning/Ilias3ConnectedCMS.class.php +++ b/lib/elearning/Ilias3ConnectedCMS.class.php @@ -20,7 +20,6 @@ use Studip\Button, Studip\LinkButton; class Ilias3ConnectedCMS extends ConnectedCMS { var $client_id; -// var $root_user_id; var $root_user_sid; var $main_category_node_id; var $user_role_template_id; @@ -28,12 +27,10 @@ class Ilias3ConnectedCMS extends ConnectedCMS var $user_style; var $crs_roles; var $global_roles; - - var $db_class_object; - var $db_class_tree; - var $db_class_course; - var $soap_client; + var $encrypt_passwords; + var $is_first_call = true; + /** * constructor * @@ -64,8 +61,6 @@ class Ilias3ConnectedCMS extends ConnectedCMS $this->crs_roles = $ELEARNING_INTERFACE_MODULES[$cms]["crs_roles"]; $this->client_id = $ELEARNING_INTERFACE_MODULES[$cms]["soap_data"]["client"]; $this->global_roles = $ELEARNING_INTERFACE_MODULES[$cms]["global_roles"]; -// $this->root_user_sid = $this->soap_client->login(); - $this->is_first_call = true; } /** diff --git a/lib/elearning/Ilias3ConnectedPermissions.class.php b/lib/elearning/Ilias3ConnectedPermissions.class.php index 17319d7..dcb6615 100644 --- a/lib/elearning/Ilias3ConnectedPermissions.class.php +++ b/lib/elearning/Ilias3ConnectedPermissions.class.php @@ -39,6 +39,7 @@ class Ilias3ConnectedPermissions extends ConnectedPermissions var $USER_OPERATIONS; var $AUTHOR_OPERATIONS; + /** * constructor * @@ -60,7 +61,6 @@ class Ilias3ConnectedPermissions extends ConnectedPermissions } $this->USER_OPERATIONS = [OPERATION_VISIBLE, OPERATION_READ]; // $this->AUTHOR_OPERATIONS = array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_CREATE_LM, OPERATION_CREATE_TEST, OPERATION_CREATE_QUESTIONS, OPERATION_CREATE_FILE); - $this->permissions_changed = false; } /** @@ -141,7 +141,6 @@ class Ilias3ConnectedPermissions extends ConnectedPermissions $connected_cms[$this->cms_type]->soap_client->addMember( $connected_cms[$this->cms_type]->user->getId(), $type, $course_id ); if ($GLOBALS["debug"] == true) echo "addMember"; - $this->permissions_changed = true; } } @@ -162,7 +161,6 @@ class Ilias3ConnectedPermissions extends ConnectedPermissions if ($GLOBALS["debug"] == true) echo "Role $proper_role added."; } - $this->permissions_changed = true; } if (!$this->getContentModulePerms($course_id)) { diff --git a/lib/elearning/Ilias3ObjectXMLParser.class.php b/lib/elearning/Ilias3ObjectXMLParser.class.php index 2dc76b4..172ca2a 100644 --- a/lib/elearning/Ilias3ObjectXMLParser.class.php +++ b/lib/elearning/Ilias3ObjectXMLParser.class.php @@ -38,16 +38,20 @@ class Ilias3ObjectXMLParser extends Ilias3SaxParser { var $object_data = []; + var $curr_obj; + var $reference_count; + var $cdata = ''; /** - * Constructor - * - * @param object $a_content_object must be of type ilObjContentObject - * ilObjTest or ilObjQuestionPool - * @param string $a_xml_file xml data - * @param string $a_subdir subdirectory in import directory - * @access public - */ + * Constructor + * + * @param object $a_content_object must be of type ilObjContentObject + * ilObjTest or ilObjQuestionPool + * @param string $a_xml_file xml data + * @param string $a_subdir subdirectory in import directory + * + * @access public + */ function __construct($a_xml_data = '') { parent::__construct(); @@ -60,33 +64,31 @@ class Ilias3ObjectXMLParser extends Ilias3SaxParser } /** - * set event handlers - * - * @param resource reference to the xml parser - * @access private - */ + * set event handlers + * + * @param resource reference to the xml parser + * + * @access private + */ function setHandlers($a_xml_parser) { - xml_set_object($a_xml_parser,$this); - xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag'); - xml_set_character_data_handler($a_xml_parser,'handlerCharacterData'); + xml_set_object($a_xml_parser, $this); + xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag'); + xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData'); } - - /** - * handler for begin of element - * - * @param resource $a_xml_parser xml parser - * @param string $a_name element name - * @param array $a_attribs element attributes array - */ - function handlerBeginTag($a_xml_parser,$a_name,$a_attribs) + * handler for begin of element + * + * @param resource $a_xml_parser xml parser + * @param string $a_name element name + * @param array $a_attribs element attributes array + */ + function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { - switch($a_name) - { + switch ($a_name) { case 'Objects': $this->curr_obj = -1; break; @@ -95,8 +97,8 @@ class Ilias3ObjectXMLParser extends Ilias3SaxParser ++$this->curr_obj; $this->reference_count = -1; - $this->addProperty__('type',$a_attribs['type']); - $this->addProperty__('obj_id',$a_attribs['obj_id']); + $this->addProperty__('type', $a_attribs['type']); + $this->addProperty__('obj_id', $a_attribs['obj_id']); break; case 'Title': @@ -128,17 +130,15 @@ class Ilias3ObjectXMLParser extends Ilias3SaxParser } - /** - * handler for end of element - * - * @param resource $a_xml_parser xml parser - * @param string $a_name element name - */ - function handlerEndTag($a_xml_parser,$a_name) + * handler for end of element + * + * @param resource $a_xml_parser xml parser + * @param string $a_name element name + */ + function handlerEndTag($a_xml_parser, $a_name) { - switch($a_name) - { + switch ($a_name) { case 'Objects': break; @@ -146,27 +146,27 @@ class Ilias3ObjectXMLParser extends Ilias3SaxParser break; case 'Title': - $this->addProperty__('title',trim($this->cdata)); + $this->addProperty__('title', trim($this->cdata)); break; case 'Description': - $this->addProperty__('description',trim($this->cdata)); + $this->addProperty__('description', trim($this->cdata)); break; case 'Owner': - $this->addProperty__('owner',trim($this->cdata)); + $this->addProperty__('owner', trim($this->cdata)); break; case 'CreateDate': - $this->addProperty__('create_date',trim($this->cdata)); + $this->addProperty__('create_date', trim($this->cdata)); break; case 'LastUpdate': - $this->addProperty__('last_update',trim($this->cdata)); + $this->addProperty__('last_update', trim($this->cdata)); break; case 'ImportId': - $this->addProperty__('import_id',trim($this->cdata)); + $this->addProperty__('import_id', trim($this->cdata)); break; case 'References': @@ -184,17 +184,16 @@ class Ilias3ObjectXMLParser extends Ilias3SaxParser } /** - * handler for character data - * - * @param resource $a_xml_parser xml parser - * @param string $a_data character data - */ - function handlerCharacterData($a_xml_parser,$a_data) + * handler for character data + * + * @param resource $a_xml_parser xml parser + * @param string $a_data character data + */ + function handlerCharacterData($a_xml_parser, $a_data) { - if($a_data != "\n") - { + if ($a_data != "\n") { // Replace multiple tabs with one space - $a_data = preg_replace("/\t+/"," ",$a_data); + $a_data = preg_replace("/\t+/", " ", $a_data); $this->cdata .= $a_data; } @@ -203,27 +202,26 @@ class Ilias3ObjectXMLParser extends Ilias3SaxParser } // PRIVATE - function addProperty__($a_name,$a_value) + function addProperty__($a_name, $a_value) { - $this->object_data[$this->curr_obj][$a_name] = $a_value; - /*/ - if (is_array($this->object_data[$this->curr_obj][$a_name])) - $this->object_data[$this->curr_obj][$a_name][] = $a_value; - elseif ($this->object_data[$this->curr_obj][$a_name] != "") - { - $old_value = $this->object_data[$this->curr_obj][$a_name]; - $this->object_data[$this->curr_obj][$a_name] = array($old_value); - $this->object_data[$this->curr_obj][$a_name][] = $a_value; - } - else - $this->object_data[$this->curr_obj][$a_name] = $a_value; - /**/ + $this->object_data[$this->curr_obj][$a_name] = $a_value; + /*/ + if (is_array($this->object_data[$this->curr_obj][$a_name])) + $this->object_data[$this->curr_obj][$a_name][] = $a_value; + elseif ($this->object_data[$this->curr_obj][$a_name] != "") + { + $old_value = $this->object_data[$this->curr_obj][$a_name]; + $this->object_data[$this->curr_obj][$a_name] = array($old_value); + $this->object_data[$this->curr_obj][$a_name][] = $a_value; + } + else + $this->object_data[$this->curr_obj][$a_name] = $a_value; + /**/ } function addReference__($a_value, $a_accessinfo = "") { - if($a_value) - { + if ($a_value) { $this->object_data[$this->curr_obj]['references'][$this->reference_count]["ref_id"] = $a_value; $this->object_data[$this->curr_obj]['references'][$this->reference_count]["accessInfo"] = $a_accessinfo; } @@ -231,9 +229,8 @@ class Ilias3ObjectXMLParser extends Ilias3SaxParser function addOperation__($a_value) { - if($a_value) + if ($a_value) { $this->object_data[$this->curr_obj]['references'][$this->reference_count]["operations"][] = $a_value; + } } - } -?>
\ No newline at end of file diff --git a/lib/elearning/Ilias3Soap.class.php b/lib/elearning/Ilias3Soap.class.php index 98627de..6a43b9b 100644 --- a/lib/elearning/Ilias3Soap.class.php +++ b/lib/elearning/Ilias3Soap.class.php @@ -22,6 +22,7 @@ class Ilias3Soap extends StudipSoapClient var $user_sid; var $user_type; var $soap_cache; + var $caching_active = false; /** * constructor @@ -39,7 +40,6 @@ class Ilias3Soap extends StudipSoapClient $this->user_type = "admin"; $this->loadCacheData($cms); - $this->caching_active = false; } @@ -1067,4 +1067,3 @@ class Ilias3Soap extends StudipSoapClient return false; } } - diff --git a/lib/elearning/Ilias4ConnectedPermissions.class.php b/lib/elearning/Ilias4ConnectedPermissions.class.php index b44e7a2..af70ba7 100644 --- a/lib/elearning/Ilias4ConnectedPermissions.class.php +++ b/lib/elearning/Ilias4ConnectedPermissions.class.php @@ -98,7 +98,6 @@ class Ilias4ConnectedPermissions extends Ilias3ConnectedPermissions if ($type != "") { $connected_cms[$this->cms_type]->soap_client->addMember( $connected_cms[$this->cms_type]->user->getId(), $type, $course_id ); if ($GLOBALS["debug"] == true) echo "addMember"; - $this->permissions_changed = true; } } @@ -114,7 +113,6 @@ class Ilias4ConnectedPermissions extends Ilias3ConnectedPermissions $connected_cms[$this->cms_type]->soap_client->addUserRoleEntry( $connected_cms[$this->cms_type]->user->getId(), $proper_role); if ($GLOBALS["debug"] == true) echo "Role $proper_role added."; } - $this->permissions_changed = true; } diff --git a/lib/elearning/Ilias4ConnectedUser.class.php b/lib/elearning/Ilias4ConnectedUser.class.php index 0d480d4..be8b88c 100644 --- a/lib/elearning/Ilias4ConnectedUser.class.php +++ b/lib/elearning/Ilias4ConnectedUser.class.php @@ -19,6 +19,8 @@ class Ilias4ConnectedUser extends Ilias3ConnectedUser { var $roles; var $user_sid; + var $auth_plugin; + /** * constructor * @@ -48,11 +50,13 @@ class Ilias4ConnectedUser extends Ilias3ConnectedUser if ($this->getLoginData($this->login)) { //automatische Zuordnung von bestehenden Ilias Accounts //nur wenn ldap Modus benutzt wird und Stud.IP Nutzer passendes ldap plugin hat - if ($connected_cms[$this->cms_type]->USER_AUTO_CREATE == true && - $connected_cms[$this->cms_type]->USER_PREFIX == '' && - $this->auth_plugin && - $this->auth_plugin != "standard" && - $this->auth_plugin == $connected_cms[$this->cms_type]->ldap_enable) { + if ( + $connected_cms[$this->cms_type]->USER_AUTO_CREATE + && !$connected_cms[$this->cms_type]->USER_PREFIX + && $this->auth_plugin + && $this->auth_plugin !== 'standard' + && $this->auth_plugin === $connected_cms[$this->cms_type]->ldap_enable + ) { if (!$this->external_password) { $this->setPassword(md5(uniqid("4dfmjsnll"))); } @@ -161,4 +165,4 @@ class Ilias4ConnectedUser extends Ilias3ConnectedUser } return true; } -}
\ No newline at end of file +} diff --git a/lib/elearning/Ilias4Soap.class.php b/lib/elearning/Ilias4Soap.class.php index d6d2527..7afd738 100644 --- a/lib/elearning/Ilias4Soap.class.php +++ b/lib/elearning/Ilias4Soap.class.php @@ -34,7 +34,7 @@ class Ilias4Soap extends Ilias3Soap function __construct($cms) { parent::__construct($cms); - $this->seperator_string = " / "; + $this->separator_string = " / "; } /** @@ -145,7 +145,7 @@ class Ilias4Soap extends Ilias3Soap } if (is_array($path)) { - return implode($path, $this->seperator_string); + return implode($path, $this->separator_string); } else { return false; } diff --git a/lib/elearning/PmWikiConnectedCMS.class.php b/lib/elearning/PmWikiConnectedCMS.class.php index 5c123be..3cd728e 100644 --- a/lib/elearning/PmWikiConnectedCMS.class.php +++ b/lib/elearning/PmWikiConnectedCMS.class.php @@ -34,6 +34,10 @@ require_once 'clients/webservice_client.php'; class PmWikiConnectedCMS extends ConnectedCMS { + public $client; + public $api_key; + public $field_script; + function __construct($cms) { parent::__construct($cms); @@ -43,7 +47,7 @@ class PmWikiConnectedCMS extends ConnectedCMS $this->api_key = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key']; } - + function init($cms) { parent::init($cms); @@ -62,20 +66,20 @@ class PmWikiConnectedCMS extends ConnectedCMS function searchContentModules($key) { $fields_found = $this->client->call("search_content_modules", $args = [ - $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key'], - $key]); + $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key'], + $key]); $result = []; foreach($fields_found as $field) { - $result[$field['field_id']] = [ 'ref_id' => $field['field_id'], + $result[$field['field_id']] = [ 'ref_id' => $field['field_id'], 'type' => $field['field_type'], 'obj_id' => $field_id, 'create_date' => $field['create_date'], 'last_update' => $field['change_date'], - 'title' => $field['field_title'], + 'title' => $field['field_title'], 'description' => $field['field_description']]; } return $result; diff --git a/lib/elearning/PmWikiContentModule.class.php b/lib/elearning/PmWikiContentModule.class.php index 061dbd3..06533dd 100644 --- a/lib/elearning/PmWikiContentModule.class.php +++ b/lib/elearning/PmWikiContentModule.class.php @@ -28,6 +28,10 @@ class PmWikiContentModule extends ContentModule { + public $link; + public $client; + public $chdate; + public $accepted_users; /** * constructor diff --git a/lib/elearning/clients/soap_webservice_client.php b/lib/elearning/clients/soap_webservice_client.php index 9573f13..9c392a8 100644 --- a/lib/elearning/clients/soap_webservice_client.php +++ b/lib/elearning/clients/soap_webservice_client.php @@ -1,4 +1,4 @@ -<?php +<?php # Lifter002: TODO # Lifter007: TODO # Lifter003: TODO @@ -9,6 +9,8 @@ require_once 'vendor/nusoap/nusoap.php'; class Soap_WebserviceClient extends WebserviceClient { + private $client; + public function __construct($webservice_url) { $this->client = new soap_client($webservice_url); @@ -17,7 +19,7 @@ class Soap_WebserviceClient extends WebserviceClient public function &call($method_name, &$args) { - return $this->client->call($method_name, $args); + $result = $this->client->call($method_name, $args); + return $result; } } - diff --git a/lib/elearning/clients/xml_rpc_webservice_client.php b/lib/elearning/clients/xml_rpc_webservice_client.php index 6060a0e..19568f6 100644 --- a/lib/elearning/clients/xml_rpc_webservice_client.php +++ b/lib/elearning/clients/xml_rpc_webservice_client.php @@ -8,6 +8,8 @@ require_once __DIR__ . '/webservice_client.php'; class XML_RPC_WebserviceClient extends WebserviceClient { + private $client; + public function __construct($webservice_url) { $this->client = new xmlrpc_client($webservice_url); @@ -28,6 +30,7 @@ class XML_RPC_WebserviceClient extends WebserviceClient } $xmlrpc_return = $this->client->send(new xmlrpcmsg($method_name, $xmlrpc_args), 300); - return $xmlrpc_return->value(); + $xmlrpc_result = $xmlrpc_return->value(); + return $xmlrpc_result; } } |
