/** * Get pages for list. */ function getComponents() { $plugins = array(); include_once "./Services/Component/classes/class.ilModule.php"; $modules = ilModule::getAvailableCoreModules(); foreach ($modules as $m) { $plugin_slots = ilComponent::lookupPluginSlots(IL_COMP_MODULE, $m["subdir"]); foreach ($plugin_slots as $ps) { include_once "./Services/Component/classes/class.ilPluginSlot.php"; $slot = new ilPluginSlot(IL_COMP_MODULE, $m["subdir"], $ps["id"]); foreach ($slot->getPluginsInformation() as $p) { $plugins[] = $this->gatherPluginData(IL_COMP_MODULE, $slot, $m["subdir"], $p); } } } include_once "./Services/Component/classes/class.ilService.php"; $services = ilService::getAvailableCoreServices(); foreach ($services as $s) { $plugin_slots = ilComponent::lookupPluginSlots(IL_COMP_SERVICE, $s["subdir"]); foreach ($plugin_slots as $ps) { $slot = new ilPluginSlot(IL_COMP_SERVICE, $s["subdir"], $ps["id"]); foreach ($slot->getPluginsInformation() as $p) { $plugins[] = $this->gatherPluginData(IL_COMP_SERVICE, $slot, $s["subdir"], $p); } } } $this->setData($plugins); }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilSetting, $objDefinition; // plugin slots $plugin_slots = ilComponent::lookupPluginSlots($this->mode, $a_set["subdir"]); foreach ($plugin_slots as $slot) { $this->tpl->setCurrentBlock("slot"); $this->tpl->setVariable("SLOT_NAME", $slot["name"]); $this->tpl->setVariable("SLOT_ID", $slot["id"]); $this->tpl->setVariable("TXT_DIR", $lng->txt("cmps_dir")); $this->tpl->setVariable("SLOT_DIR", $slot["dir_pres"]); $this->tpl->setVariable("TXT_LANG_PREFIX", $lng->txt("cmps_lang_prefix")); $this->tpl->setVariable("LANG_PREFIX", $slot["lang_prefix"]); $ilCtrl->setParameter($this->parent_obj, "ctype", $this->mode); $ilCtrl->setParameter($this->parent_obj, "cname", $a_set["subdir"]); $ilCtrl->setParameter($this->parent_obj, "slot_id", $slot["id"]); $this->tpl->setVariable("HREF_SHOW_SLOT", $ilCtrl->getLinkTarget($this->parent_obj, "showPluginSlot")); $this->tpl->setVariable("TXT_SHOW_SLOT", $lng->txt("cmps_show_details")); $this->tpl->parseCurrentBlock(); } // repository object types if ($this->mode == IL_COMP_MODULE) { $rep_types = $objDefinition->getRepositoryObjectTypesForComponent(IL_COMP_MODULE, $a_set["subdir"]); foreach ($rep_types as $rt) { // group if ($rt["grp"] != "") { $this->tpl->setCurrentBlock("group"); $this->tpl->setVariable("TXT_GROUP", $lng->txt("cmps_group")); $gi = $objDefinition->getGroup($rt["grp"]); $this->tpl->setVariable("VAL_GROUP", $gi["name"]); $this->tpl->setVariable("VAL_GROUP_ID", $rt["grp"]); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("rep_object"); $this->tpl->setVariable("TXT_REP_OBJECT", $rt["class_name"]); $this->tpl->setVariable("TXT_REP_OBJECT_ID", $rt["id"]); $this->tpl->setVariable("IMG_REP_OBJECT", ilUtil::getImagePath("icon_" . $rt["id"] . ".png")); // add new position $this->tpl->setVariable("TXT_ADD_NEW_POS", $lng->txt("cmps_add_new_rank")); $this->tpl->setVariable("VAR_POS", "obj_pos[" . $rt["id"] . "]"); $pos = $ilSetting->get("obj_add_new_pos_" . $rt["id"]) > 0 ? $ilSetting->get("obj_add_new_pos_" . $rt["id"]) : $rt["default_pos"]; $this->tpl->setVariable("VAL_POS", ilUtil::prepareFormOutput($pos)); // disable creation $this->tpl->setVariable("TXT_DISABLE_CREATION", $lng->txt("cmps_disable_creation")); $this->tpl->setVariable("VAR_DISABLE_CREATION", "obj_dis_creation[" . $rt["id"] . "]"); if ($ilSetting->get("obj_dis_creation_" . $rt["id"])) { $this->tpl->setVariable("CHECKED_DISABLE_CREATION", ' checked="checked" '); } $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("rep_object_td"); if (count($rep_types) == 0) { $this->tpl->setVariable("DUMMY", " "); } $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("TXT_MODULE_NAME", $a_set["subdir"]); }
/** * Get pages for list. */ function getComponents() { $data = array(); include_once "./Services/Component/classes/class.ilService.php"; foreach (ilService::getAvailableCoreServices() as $obj) { foreach (ilComponent::lookupPluginSlots(IL_COMP_SERVICE, $obj["subdir"]) as $slot) { $data[] = array("subdir" => $obj["subdir"], "id" => $slot["id"], "name" => $slot["name"], "dir" => $slot["dir_pres"], "lang" => $slot["lang_prefix"], "ctype" => IL_COMP_SERVICE); } } include_once "./Services/Component/classes/class.ilModule.php"; foreach (ilModule::getAvailableCoreModules() as $obj) { foreach (ilComponent::lookupPluginSlots(IL_COMP_MODULE, $obj["subdir"]) as $slot) { $data[] = array("subdir" => $obj["subdir"], "id" => $slot["id"], "name" => $slot["name"], "dir" => $slot["dir_pres"], "lang" => $slot["lang_prefix"], "ctype" => IL_COMP_MODULE); } } $this->setData($data); }
/** * @return bool */ protected function initViteroPlugin() { /** * @var ilPluginAdmin $ilPluginAdmin */ global $ilPluginAdmin; if (!$ilPluginAdmin->isActive(self::VIT_CTYPE, self::VIT_CNAME, self::VIT_SLOT_ID, self::VIT_PNAME)) { return false; } include_once './Services/Component/classes/class.ilPluginAdmin.php'; $vit = ilPluginAdmin::getPluginObject(self::VIT_CTYPE, self::VIT_CNAME, self::VIT_SLOT_ID, self::VIT_PNAME); if (ilComponent::isVersionGreaterString(self::VIT_MIN_VERSION, $vit->getVersion())) { return false; } $this->vitero = $vit; return true; }
public function initILIAS() { chdir(substr($_SERVER['SCRIPT_FILENAME'], 0, strpos($_SERVER['SCRIPT_FILENAME'], '/Customizing'))); require_once 'include/inc.ilias_version.php'; require_once 'Services/Component/classes/class.ilComponent.php'; if (ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, '4.2.999')) { require_once './Services/Context/classes/class.ilContext.php'; ilContext::init(ilContext::CONTEXT_WEB); require_once './Services/Init/classes/class.ilInitialisation.php'; ilInitialisation::initILIAS(); } else { $_GET['baseClass'] = 'ilStartUpGUI'; require_once './include/inc.get_pear.php'; require_once './include/inc.header.php'; } require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/class.ilCertificatePlugin.php'; require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Certificate/class.srCertificate.php'; require_once "./Services/Tracking/classes/class.ilTrQuery.php"; require_once "./Services/Tracking/classes/class.ilLPStatusFactory.php"; }
/** * Get pages for list. */ function getComponents() { include_once "./Services/Component/classes/class.ilModule.php"; $modules = ilModule::getAvailableCoreModules(); $slots = array(); foreach ($modules as $m) { $plugin_slots = ilComponent::lookupPluginSlots(IL_COMP_MODULE, $m["subdir"]); foreach ($plugin_slots as $ps) { $plugins = array(); include_once "./Services/Component/classes/class.ilPluginSlot.php"; $slot = new ilPluginSlot(IL_COMP_MODULE, $m["subdir"], $ps["id"]); foreach ($slot->getPluginsInformation() as $p) { $plugins[] = $p; } if (count($plugins) > 0) { $slots[] = array("slot_name" => $slot->getSlotName(), "component_type" => IL_COMP_MODULE, "component_name" => $m["subdir"], "slot_id" => $ps["id"], "plugins" => $plugins); } } } include_once "./Services/Component/classes/class.ilService.php"; $services = ilService::getAvailableCoreServices(); foreach ($services as $s) { $plugin_slots = ilComponent::lookupPluginSlots(IL_COMP_SERVICE, $s["subdir"]); foreach ($plugin_slots as $ps) { $plugins = array(); $slot = new ilPluginSlot(IL_COMP_SERVICE, $s["subdir"], $ps["id"]); foreach ($slot->getPluginsInformation() as $p) { $plugins[] = $p; } if (count($plugins) > 0) { $slots[] = array("slot_name" => $slot->getSlotName(), "component_type" => IL_COMP_SERVICE, "component_name" => $s["subdir"], "slot_id" => $ps["id"], "plugins" => $plugins); } } } $this->setData($slots); //include_once("./Services/Component/classes/class.ilService.php"); //$services = ilService::getAvailableCoreServices(); }
static final function isVersionGreaterString($a_ver1, $a_ver2) { $a_arr1 = ilComponent::checkVersionNumber($a_ver1); $a_arr2 = ilComponent::checkVersionNumber($a_ver2); if (is_array($a_arr1) && is_array($a_arr2)) { return ilComponent::isVersionGreater($a_arr1, $a_arr2); } else { return false; } }
/** * Calls base class of current request. The base class is * passed via $_GET["baseClass"] and is the first class in * the call sequence of the request. Do not call this method * within other scripts than ilias.php. */ function callBaseClass() { global $ilDB; $baseClass = strtolower($_GET["baseClass"]); $module_class = ilCachedCtrl::getInstance(); $mc_rec = $module_class->lookupModuleClass($baseClass); // get class information // $mc_set = $ilDB->query("SELECT * FROM module_class WHERE LOWER(class) = ". // $ilDB->quote($baseClass, "text")); // $mc_rec = $ilDB->fetchAssoc($mc_set); $module = $mc_rec["module"]; $class = $mc_rec["class"]; $class_dir = $mc_rec["dir"]; if ($module != "") { $m_set = $ilDB->query("SELECT * FROM il_component WHERE name = " . $ilDB->quote($module, "text")); $m_rec = $ilDB->fetchAssoc($m_set); $this->module_dir = $m_rec["type"] . "/" . $m_rec["name"]; include_once $this->module_dir . "/" . $class_dir . "/class." . $class . ".php"; } else { // $mc_set = $ilDB->query("SELECT * FROM service_class WHERE LOWER(class) = ". // $ilDB->quote($baseClass, "text")); // $mc_rec = $ilDB->fetchAssoc($mc_set); $mc_rec = $module_class->lookupServiceClass($baseClass); $service = $mc_rec["service"]; $class = $mc_rec["class"]; $class_dir = $mc_rec["dir"]; if ($service == "") { include_once "./Services/UICore/exceptions/class.ilCtrlException.php"; throw new ilCtrlException("Could not find entry in modules.xml or services.xml for " . $baseClass . " <br/>" . str_replace("&", "<br />&", htmlentities($_SERVER["REQUEST_URI"]))); } // get service information // $m_set = $ilDB->query("SELECT * FROM il_component WHERE name = ". // $ilDB->quote($service, "text")); // $m_rec = $ilDB->fetchAssoc($m_set); $m_rec = ilComponent::getComponentInfo('Services', $service); $this->service_dir = $m_rec["type"] . "/" . $m_rec["name"]; include_once $this->service_dir . "/" . $class_dir . "/class." . $class . ".php"; } // forward processing to base class $this->getCallStructure(strtolower($baseClass)); $base_class_gui =& new $class(); $this->forwardCommand($base_class_gui); }
/** * Get slot prefix, used for lang vars and db tables. Needs * plugin id appended. */ function getPrefix() { if ($this->prefix == "") { $this->prefix = ilComponent::lookupId($this->getComponentType(), $this->getComponentName()) . "_" . $this->getSlotId(); } return $this->prefix; }
/** * Show information about a plugin slot. */ function showPluginSlotInfo() { global $tpl, $lng, $ilTabs, $ilCtrl; if (!DEVMODE) { $ilCtrl->redirect($this, "listPlugins"); } $ilTabs->clearTargets(); $ilTabs->setBackTarget($lng->txt("cmps_slots"), $ilCtrl->getLinkTarget($this, "listSlots")); include_once "./Services/Component/classes/class.ilComponent.php"; $comp = ilComponent::getComponentObject($_GET["ctype"], $_GET["cname"]); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); // component $ne = new ilNonEditableValueGUI($lng->txt("cmps_component"), "", true); $ne->setValue($comp->getComponentType() . "/" . $comp->getName() . " [" . $comp->getId() . "]"); $form->addItem($ne); // plugin slot $ne = new ilNonEditableValueGUI($lng->txt("cmps_plugin_slot"), "", true); $ne->setValue($comp->getPluginSlotName($_GET["slot_id"]) . " [" . $_GET["slot_id"] . "]"); $form->addItem($ne); // main dir $ne = new ilNonEditableValueGUI($lng->txt("cmps_main_dir"), "", true); $ne->setValue($comp->getPluginSlotDirectory($_GET["slot_id"]) . "/<Plugin_Name>"); $form->addItem($ne); // plugin file $ne = new ilNonEditableValueGUI($lng->txt("cmps_plugin_file"), "", true); $ne->setValue("<" . $lng->txt("cmps_main_dir") . ">" . "/classes/class.il<Plugin_Name>Plugin.php"); $form->addItem($ne); // language files $ne = new ilNonEditableValueGUI($lng->txt("cmps_lang_files"), "", true); $ne->setValue("<" . $lng->txt("cmps_main_dir") . ">" . "/lang/ilias_<Language ID>.lang"); $form->addItem($ne); // db update $ne = new ilNonEditableValueGUI($lng->txt("cmps_db_update"), "", true); $ne->setValue("<" . $lng->txt("cmps_main_dir") . ">" . "/sql/dbupdate.php"); $form->addItem($ne); // lang prefix $ne = new ilNonEditableValueGUI($lng->txt("cmps_plugin_lang_prefixes"), "", true); $ne->setValue($comp->getPluginSlotLanguagePrefix($_GET["slot_id"]) . "<Plugin_ID>_"); $form->addItem($ne); // db prefix $ne = new ilNonEditableValueGUI($lng->txt("cmps_plugin_db_prefixes"), "", true); $ne->setValue($comp->getPluginSlotLanguagePrefix($_GET["slot_id"]) . "<Plugin_ID>_"); $form->addItem($ne); $form->setTitle($lng->txt("cmps_plugin_slot")); // set content and title $tpl->setContent($form->getHTML()); $tpl->setTitle($comp->getComponentType() . "/" . $comp->getName() . ": " . $lng->txt("cmps_plugin_slot") . " \"" . $comp->getPluginSlotName($_GET["slot_id"]) . "\""); $tpl->setDescription(""); }
/** * Get css file location */ public final function getStyleSheetLocation($a_css_file) { $d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName()) . "_" . $this->getSlotId() . "_" . ilPlugin::lookupIdForName($this->getComponentType(), $this->getComponentName(), $this->getSlotId(), $this->getPluginName()); $css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2); if (is_int(strpos($css, "Customizing"))) { return $css; } return $this->getDirectory() . "/templates/" . $a_css_file; }
/** * Constructor: read information on component */ function __construct() { parent::__construct(); }
/** * Show information about a plugin slot. */ function showPluginSlot() { global $tpl, $lng, $ilTabs, $ilCtrl; $ilTabs->clearTargets(); $ilTabs->setBackTarget($lng->txt("cmps_plugins"), $ilCtrl->getLinkTarget($this, "listPlugins")); include_once "./Services/Component/classes/class.ilComponent.php"; $comp = ilComponent::getComponentObject($_GET["ctype"], $_GET["cname"]); // plugins table include_once "./Services/Component/classes/class.ilPluginsTableGUI.php"; $plugins_table = new ilPluginsTableGUI($this, "showPluginSlot", $_GET["ctype"], $_GET["cname"], $_GET["slot_id"]); $tpl->setContent($plugins_table->getHTML()); // set content and title $tpl->setTitle($comp->getComponentType() . "/" . $comp->getName() . ": " . $lng->txt("cmps_plugin_slot") . " \"" . $comp->getPluginSlotName($_GET["slot_id"]) . "\""); $tpl->setDescription(""); }
/** * Get basic data of plugin from plugin.php * * @param string $a_ctype Component Type * @param string $a_cname Component Name * @param string $a_slot_id Slot ID * @param string $a_pname Plugin Name */ private final function getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname) { global $ilDB, $lng; if (!isset($this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname])) { include_once "./Services/Component/classes/class.ilPluginSlot.php"; $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id); $plugin_php_file = "./Customizing/global/plugins/" . $a_ctype . "/" . $a_cname . "/" . $slot_name . "/" . $a_pname . "/plugin.php"; $rec = ilPlugin::getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname); if (is_file($plugin_php_file)) { include_once $plugin_php_file; $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = array("version" => $version, "id" => $id, "ilias_min_version" => $ilias_min_version, "ilias_max_version" => $ilias_max_version, "responsible" => $responsible, "responsible_mail" => $responsible_mail, "learning_progress" => (bool) $learning_progress); } $active = $rec["active"]; $needs_update = false; $activation_possible = !$active; $inactive_reason = ""; // version checks if (ilComponent::isVersionGreaterString($ilias_min_version, ILIAS_VERSION_NUMERIC)) { $active = false; if (is_object($lng)) { $inactive_reason = $lng->txt("cmps_needs_newer_ilias_version"); } else { $inactive_reason = "Plugin needs a newer version of ILIAS."; } $activation_possible = false; } else { if (ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, $ilias_max_version)) { $active = false; if (is_object($lng)) { $inactive_reason = $lng->txt("cmps_needs_newer_plugin_version"); } else { $inactive_reason = "Plugin does not support current version of ILIAS. Newer version of plugin needed."; } $activation_possible = false; } else { if ($rec["last_update_version"] == "") { $active = false; if (is_object($lng)) { $inactive_reason = $lng->txt("cmps_needs_update"); } else { $inactive_reason = "Update needed."; } $needs_update = true; $activation_possible = false; } else { if (ilComponent::isVersionGreaterString($rec["last_update_version"], $version)) { $active = false; if (is_object($lng)) { $inactive_reason = $lng->txt("cmps_needs_upgrade"); } else { $inactive_reason = "Upgrade needed."; } $activation_possible = false; } else { if ($rec["last_update_version"] != $version) { $active = false; if (is_object($lng)) { $inactive_reason = $lng->txt("cmps_needs_update"); } else { $inactive_reason = "Update needed."; } $needs_update = true; $activation_possible = false; } } } } } $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"] = $active; $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["inactive_reason"] = $inactive_reason; $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"] = $needs_update; $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["activation_possible"] = $activation_possible; $this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = true; } }
/** * Check access rights of the requested file * @access public */ public function checkAccess() { global $ilLog, $ilUser, $ilObjDataCache, $objDefinition; // an error already occurred at class initialisation if ($this->errorcode) { return false; } // check for type by subdirectory $pos1 = strpos($this->subpath, "lm_data/lm_") + 11; $pos2 = strpos($this->subpath, "mobs/mm_") + 8; $pos3 = strpos($this->subpath, "usr_images/") + 11; $pos4 = strpos($this->subpath, "sec") + 3; $obj_id = 0; $type = 'none'; // trying to access data within a learning module folder if ($pos1 > 11) { $type = 'lm'; $seperator = strpos($this->subpath, '/', $pos1); $obj_id = substr($this->subpath, $pos1, ($seperator > 0 ? $seperator : strlen($this->subpath)) - $pos1); } else { if ($pos2 > 8) { $type = 'mob'; $seperator = strpos($this->subpath, '/', $pos2); $obj_id = substr($this->subpath, $pos2, ($seperator > 0 ? $seperator : strlen($this->subpath)) - $pos2); } elseif ($pos3 > 11) { $type = 'user_image'; // user images may be: // upload_123pic, upload_123 // usr_123.jpg, usr_123_small.jpg, usr_123_xsmall.jpg, usr_123_xxsmall.jpg $seperator = strpos($this->subpath, '_', $pos3); $obj_id = (int) substr($this->subpath, $seperator + 1); } elseif ($pos4 > 3) { $plugin = false; $seperator = strpos($this->subpath, '/', $pos4); $path = explode("/", substr($this->subpath, $seperator + 1)); $component = array_shift($path); if (substr($component, 0, 2) == "il") { $component = substr($component, 2); $comp_dir = null; if (ilComponent::lookupId(IL_COMP_MODULE, $component)) { $comp_dir = "Modules"; } else { if (ilComponent::lookupId(IL_COMP_SERVICE, $component)) { $comp_dir = "Services"; } else { if ($objDefinition->isPlugin($pl_id = strtolower($component))) { $comp_class = $objDefinition->getClassName($pl_id); $comp_dir = $objDefinition->getLocation($pl_id); $plugin = true; } } } if ($comp_dir) { if ($plugin) { $comp_class = "il" . $comp_class . "WebAccessChecker"; $comp_include = $comp_dir . "/class." . $comp_class . ".php"; } else { $comp_class = "il" . $component . "WebAccessChecker"; $comp_include = $comp_dir . "/" . $component . "/classes/class." . $comp_class . ".php"; } if (file_exists($comp_include)) { include_once $comp_include; if (class_exists($comp_class)) { $comp_inst = new $comp_class(); if ($comp_inst instanceof ilComponentWebAccessChecker) { if ($comp_inst->isValidPath($path)) { $type = "sec"; } } } } } } } } if (!$obj_id && $type != "sec" || $type == 'none') { $this->errorcode = 404; $this->errortext = $this->lng->txt("obj_not_found"); return false; } // #13237 - if imporint is display on login page we have user id 0 if ($type == "mob") { $usages = ilObjMediaObject::lookupUsages($obj_id); foreach ($usages as $usage) { if ($usage['type'] == 'impr:pg') { return $this->checkAccessMobUsage($usage, 1); } } } // get proper user id (could be anonymous) ilInitialisation::authenticate(); // do this here because ip based checking may be set after construction $this->determineUser(); switch ($type) { // SCORM or HTML learning module case 'lm': if ($this->checkAccessObject($obj_id)) { return true; } break; // media object // media object case 'mob': if ($this->checkAccessMob($obj_id)) { return true; } break; // image in user profile // image in user profile case 'user_image': if ($this->checkAccessUserImage($obj_id)) { return true; } break; case 'sec': if ($obj_id = $comp_inst->getRepositoryObjectId()) { return $this->checkAccessObject($obj_id); } else { return $comp_inst->checkAccess($this->check_users); } break; } // none of the checks above gives access $this->errorcode = 403; $this->errortext = $this->lng->txt('msg_no_perm_read'); return false; }
/** * @return bool */ public function isAvailable() { // Only for ILIAS >= 4.4 return ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, '4.4.0'); }