/** * Lookup all plugin slots of a component */ static function lookupPluginSlots($a_type, $a_name) { // global $ilDB; $cached_component = ilCachedComponentData::getInstance(); $recs = $cached_component->lookupPluginSlotByComponent($a_type . "/" . $a_name); //$set = $ilDB->query("SELECT * FROM il_pluginslot WHERE component = ". // $ilDB->quote($a_type."/".$a_name, "text")); $ps = array(); //echo "<br>".$a_type."/".$a_name; //while($rec = $ilDB->fetchAssoc($set)) foreach ($recs as $rec) { $rec["dir"] = "Customizing/global/plugins/" . $a_type . "/" . $a_name . "/" . $rec["name"]; $rec["dir_pres"] = "Customizing/global/plugins/<br />" . $a_type . "/" . $a_name . "/" . $rec["name"]; $rec["lang_prefix"] = ilComponent::lookupId($a_type, $a_name) . "_" . $rec["id"] . "_"; $ps[$rec["id"]] = $rec; } return $ps; }
/** * 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; }
/** * Lookup all plugin slots of a component */ static function lookupPluginSlots($a_type, $a_name) { global $ilDB; $set = $ilDB->query("SELECT * FROM il_pluginslot WHERE component = " . $ilDB->quote($a_type . "/" . $a_name, "text")); $ps = array(); //echo "<br>".$a_type."/".$a_name; while ($rec = $ilDB->fetchAssoc($set)) { $rec["dir"] = "Customizing/global/plugins/" . $a_type . "/" . $a_name . "/" . $rec["name"]; $rec["dir_pres"] = "Customizing/global/plugins/<br />" . $a_type . "/" . $a_name . "/" . $rec["name"]; $rec["lang_prefix"] = ilComponent::lookupId($a_type, $a_name) . "_" . $rec["id"] . "_"; $ps[$rec["id"]] = $rec; } return $ps; }
/** * 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; }
/** * 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; }