4define(
"IL_MODE_ALIAS", 1);
 
    5define(
"IL_MODE_OUTPUT", 2);
 
    6define(
"IL_MODE_FULL", 3);
 
    8require_once(
"./Services/MediaObjects/classes/class.ilMediaItem.php");
 
    9include_once 
"./Services/Object/classes/class.ilObject.php";
 
   52        $this->
user = $DIC->user();
 
   53        $this->app_event_handler = 
$DIC[
"ilAppEventHandler"];
 
   54        $this->lng = 
$DIC->language();
 
   55        $this->is_alias = 
false;
 
   56        $this->media_items = array();
 
   57        $this->contains_int_link = 
false;
 
   59        parent::__construct($a_id, 
false);
 
   64        $this->
ilias->raiseError(
"Operation ilObjMedia::setRefId() not allowed.", $this->
ilias->error_obj->FATAL);
 
   74        $this->
ilias->raiseError(
"Operation ilObjMedia::putInTree() not allowed.", $this->
ilias->error_obj->FATAL);
 
   79        $this->
ilias->raiseError(
"Operation ilObjMedia::createReference() not allowed.", $this->
ilias->error_obj->FATAL);
 
   84        parent::setTitle($a_title);
 
   89        return parent::getTitle();
 
  105        include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
  106        if (is_int(strpos($a_id, 
"_"))) {
 
  119    public function delete()
 
  122        $mob_logger->debug(
"ilObjMediaObject: Delete called for media object ID '" . $this->
getId() . 
"'.");
 
  124        if (!($this->
getId() > 0)) {
 
  130        $mob_logger->debug(
"ilObjMediaObject: ... Found " . count($usages) . 
" usages.");
 
  132        if (count($usages) == 0) {
 
  152            $mob_logger->debug(
"ilObjMediaObject: ... deleted.");
 
  154            foreach ($usages as $u) {
 
  155                $mob_logger->debug(
"ilObjMediaObject: ... usage type:" . $u[
"type"] .
 
  157                    ", lang:" . $u[
"lang"] .
 
  158                    ", hist_nr:" . $u[
"hist_nr"] . 
".");
 
  160            $mob_logger->debug(
"ilObjMediaObject: ... not deleted.");
 
  179        parent::setDescription($a_description);
 
  195        include_once 
'Services/MetaData/classes/class.ilMD.php';
 
  197        switch ($a_element) {
 
  202                $md_gen = $md->getGeneral();
 
  204                if (is_object($md_gen)) {
 
  206                    $this->
setTitle($md_gen->getTitle());
 
  208                    foreach ($md_gen->getDescriptionIds() as 
$id) {
 
  209                        $md_des = $md_gen->getDescription(
$id);
 
  228        include_once 
'Services/MetaData/classes/class.ilMDCreator.php';
 
  233        $md_creator->setTitle($this->
getTitle());
 
  234        $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
 
  236        $md_creator->setDescriptionLanguage(
$ilUser->getPref(
'language'));
 
  237        $md_creator->setKeywordLanguage(
$ilUser->getPref(
'language'));
 
  238        $md_creator->setLanguage(
$ilUser->getPref(
'language'));
 
  239        $md_creator->create();
 
  249        include_once(
"Services/MetaData/classes/class.ilMD.php");
 
  250        include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
 
  251        include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
 
  254        $md_gen = $md->getGeneral();
 
  255        $md_gen->setTitle($this->
getTitle());
 
  258        $md_des_ids = $md_gen->getDescriptionIds();
 
  259        if (count($md_des_ids) > 0) {
 
  260            $md_des = $md_gen->getDescription($md_des_ids[0]);
 
  273        include_once(
'Services/MetaData/classes/class.ilMD.php');
 
  286        $this->media_items[] = $a_item;
 
  308        foreach ($this->media_items as $media_item) {
 
  309            if ($media_item->getPurpose() == $a_purpose) {
 
  322        foreach ($this->media_items as 
$key => $media_item) {
 
  323            if ($media_item->getPurpose() == $a_purpose) {
 
  324                unset($this->media_items[
$key]);
 
  330        foreach ($this->media_items as $media_item) {
 
  332            $media_item->setMobId($this->
getId());
 
  333            $media_item->setNr(
$i);
 
  344        $this->media_items = array();
 
  350        for (
$i = 0; 
$i < count($this->media_items); 
$i++) {
 
  351            if ($this->media_items[
$i]->getPurpose() == $a_purpose) {
 
  411        $this->is_alias = $a_is_alias;
 
  421        return $this->origin_id = $a_id;
 
  446        $this->import_id = $a_id;
 
  452    public function create($a_create_meta_data = 
false, $a_save_media_items = 
true)
 
  456        if (!$a_create_meta_data) {
 
  460        if ($a_save_media_items) {
 
  464                $item->setMobId($this->
getId());
 
  465                $item->setNr(
$i + 1);
 
  473        $ilAppEventHandler->raise(
 
  474            'Services/MediaObjects',
 
  476            array(
'object' => $this,
 
  478            'obj_id' => $this->
getId())
 
  486    public function update($a_upload = 
false)
 
  501            if (is_object($item)) {
 
  502                $item->setMobId($this->
getId());
 
  504                if ($item->getLocationType() == 
"Reference") {
 
  505                    $item->extractUrlParameters();
 
  514        $ilAppEventHandler->raise(
 
  515            'Services/MediaObjects',
 
  517            array(
'object' => $this,
 
  519                    'obj_id' => $this->
getId())
 
  538        $parent_obj_ids = array();
 
  541            if ($parent_obj_id &&
 
  542                !in_array($parent_obj_id, $parent_obj_ids)) {
 
  543                $parent_obj_ids[] = $parent_obj_id;
 
  552        include_once 
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
 
  580        return "mobs/mm_" . $a_mob_id;
 
  611        $a_url_encode = 
false,
 
  624        $a_url_encode = 
false,
 
  628        if ($a_purpose == 
"") {
 
  629            $a_purpose = 
"Standard";
 
  632        if (preg_match(
"/https?\:/i", 
$location)) {
 
  644        return $path . 
"/data/" . CLIENT_ID . 
"/mobs/mm_" . $a_mob_id . 
"/" . 
$location;
 
  654        if (!is_dir(
$path)) {
 
  655            $this->
ilias->raiseError(
"Failed to create directory $path.", $this->
ilias->error_obj->FATAL);
 
  676        $a_subdir = str_replace(
"..", 
"", $a_subdir);
 
  678        if ($a_subdir != 
"") {
 
  679            $dir .= 
"/" . $a_subdir;
 
  685            foreach ($entries as $e) {
 
  686                if (is_file($dir . 
"/" . $e[
"entry"]) && $e[
"entry"] != 
"." && $e[
"entry"] != 
"..") {
 
  708                $xml = 
"<MediaObject>";
 
  709                $xml .= 
"<MediaAlias OriginId=\"il__mob_" . $this->
getId() . 
"\"/>";
 
  713                    $xml .= 
"<MediaAliasItem Purpose=\"" . $item->getPurpose() . 
"\">";
 
  716                    $width = ($item->getWidth() != 
"")
 
  717                        ? 
"Width=\"" . $item->getWidth() . 
"\"" 
  719                    $height = ($item->getHeight() != 
"")
 
  720                        ? 
"Height=\"" . $item->getHeight() . 
"\"" 
  722                    $halign = ($item->getHAlign() != 
"")
 
  723                        ? 
"HorizontalAlign=\"" . $item->getHAlign() . 
"\"" 
  725                    $xml .= 
"<Layout $width $height $halign />";
 
  728                    if ($item->getCaption() != 
"") {
 
  729                        $xml .= 
"<Caption Align=\"bottom\">" .
 
  734                    if ($item->getTextRepresentation() != 
"") {
 
  735                        $xml .= 
"<TextRepresentation>" .
 
  736                            $this->
escapeProperty($item->getTextRepresentation()) . 
"</TextRepresentation>";
 
  740                    $parameters = $item->getParameters();
 
  741                    foreach ($parameters as 
$name => $value) {
 
  742                        $xml .= 
"<Parameter Name=\"$name\" Value=\"$value\"/>";
 
  744                    $xml .= $item->getMapAreasXML();
 
  745                    $xml .= 
"</MediaAliasItem>";
 
  754                $xml = 
"<MediaObject Id=\"il__mob_" . $this->
getId() . 
"\">";
 
  760                    $xml .= 
"<MediaItem Purpose=\"" . $item->getPurpose() . 
"\">";
 
  762                    if ($a_sign_locals && $item->getLocationType() == 
"LocalFile") {
 
  763                        require_once 
'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
 
  768                        if ($item->getLocationType() != 
"LocalFile") {  
 
  773                    $xml .= 
"<Location Type=\"" . $item->getLocationType() . 
"\">" .
 
  777                    $xml .= 
"<Format>" . $item->getFormat() . 
"</Format>";
 
  780                    $width = ($item->getWidth() != 
"")
 
  781                        ? 
"Width=\"" . $item->getWidth() . 
"\"" 
  783                    $height = ($item->getHeight() != 
"")
 
  784                        ? 
"Height=\"" . $item->getHeight() . 
"\"" 
  786                    $halign = ($item->getHAlign() != 
"")
 
  787                        ? 
"HorizontalAlign=\"" . $item->getHAlign() . 
"\"" 
  789                    $xml .= 
"<Layout $width $height $halign />";
 
  792                    if ($item->getCaption() != 
"") {
 
  793                        $xml .= 
"<Caption Align=\"bottom\">" .
 
  798                    if ($item->getTextRepresentation() != 
"") {
 
  799                        $xml .= 
"<TextRepresentation>" .
 
  800                            $this->
escapeProperty($item->getTextRepresentation()) . 
"</TextRepresentation>";
 
  810                    $parameters = $item->getParameters();
 
  811                    foreach ($parameters as 
$name => $value) {
 
  812                        $xml .= 
"<Parameter Name=\"$name\" Value=\"$value\"/>";
 
  814                    $xml .= $item->getMapAreasXML();
 
  817                    if ($item->getPurpose() == 
"Standard") {
 
  819                        foreach ($srts as $srt) {
 
  822                            if (
$ilUser->getLanguage() != $meta_lang &&
 
  823                                $ilUser->getLanguage() == $srt[
"language"]) {
 
  824                                $def = 
' Default="true" ';
 
  826                            $xml .= 
"<Subtitle File=\"" . $srt[
"full_path"] .
 
  827                                "\" Language=\"" . $srt[
"language"] . 
"\" " . 
$def . 
"/>";
 
  830                    $xml .= 
"</MediaItem>";
 
  838                $xml = 
"<MediaObject>";
 
  841                include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
 
  843                $md2xml->setExportMode(
true);
 
  844                $md2xml->startExport();
 
  845                $xml .= $md2xml->getXML();
 
  852                    $xml .= 
"<MediaItem Purpose=\"" . $item->getPurpose() . 
"\">";
 
  855                    $xml .= 
"<Location Type=\"" . $item->getLocationType() . 
"\">" .
 
  856                        $this->
handleAmps($item->getLocation()) . 
"</Location>";
 
  859                    $xml .= 
"<Format>" . $item->getFormat() . 
"</Format>";
 
  862                    $width = ($item->getWidth() != 
"")
 
  863                        ? 
"Width=\"" . $item->getWidth() . 
"\"" 
  865                    $height = ($item->getHeight() != 
"")
 
  866                        ? 
"Height=\"" . $item->getHeight() . 
"\"" 
  868                    $halign = ($item->getHAlign() != 
"")
 
  869                        ? 
"HorizontalAlign=\"" . $item->getHAlign() . 
"\"" 
  871                    $xml .= 
"<Layout $width $height $halign />";
 
  874                    if ($item->getCaption() != 
"") {
 
  875                        $xml .= 
"<Caption Align=\"bottom\">" .
 
  876                            str_replace(
"&", 
"&", $item->getCaption()) . 
"</Caption>";
 
  880                    if ($item->getTextRepresentation() != 
"") {
 
  881                        $xml .= 
"<TextRepresentation>" .
 
  882                            str_replace(
"&", 
"&", $item->getTextRepresentation()) . 
"</TextRepresentation>";
 
  886                    $parameters = $item->getParameters();
 
  887                    foreach ($parameters as 
$name => $value) {
 
  888                        $xml .= 
"<Parameter Name=\"$name\" Value=\"$value\"/>";
 
  890                    $xml .= $item->getMapAreasXML(
true, $a_inst);
 
  891                    $xml .= 
"</MediaItem>";
 
  895        $xml .= 
"</MediaObject>";
 
  907        return htmlspecialchars($a_value);
 
  916        $a_str = str_replace(
"&", 
"&", $a_str);
 
  917        $a_str = str_replace(
"&", 
"&", $a_str);
 
  939        $subdir = 
"il_" . IL_INST_ID . 
"_mob_" . $this->
getId();
 
  943        ilUtil::rCopy($mobdir, $a_target_dir . 
"/objects/" . $subdir);
 
  949        $subdir = 
"il_" . IL_INST_ID . 
"_mob_" . $this->
getId();
 
  950        $a_target_dir = $a_target_dir . 
"/objects/" . $subdir;
 
  952        $tpl = 
new ilTemplate(
"tpl.fullscreen.html", 
true, 
true, 
"Modules/LearningModule");
 
  953        $tpl->setCurrentBlock(
"ilMedia");
 
  961        require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  963        require_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
  968        $xml .= $pg_obj->getMediaAliasElement($this->
getId());
 
  975        $xsl = file_get_contents(
"./Services/COPage/xsl/page.xsl");
 
  976        $args = array( 
'/_xml' => 
$xml, 
'/_xsl' => $xsl );
 
  983        $params = array(
'mode' => 
"fullscreen", 
'enlarge_path' => $enlarge_path,
 
  984            'link_params' => 
"ref_id=" . 
$_GET[
"ref_id"],
'fullscreen_link' => 
"",
 
  985            'ref_id' => 
$_GET[
"ref_id"], 
'webspace_path' => $wb_path);
 
  986        $output = xslt_process($xh, 
"arg:/_xml", 
"arg:/_xsl", 
null, $args, 
$params);
 
  991        include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
 
  992        $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET", 
"../../css/style.css");
 
  993        $tpl->setVariable(
"LOCATION_STYLESHEET", 
"../../css/system.css");
 
  997        $output = preg_replace(
"/mobs\/mm_(\d+)\/([^\"]+)/i", 
"$2", 
$output);
 
  998        $output = preg_replace(
"/\.\/Services\/MediaObjects\/flash_mp3_player/i", 
"../../players", 
$output);
 
 1000        $output = preg_replace(
"/file=..\/..\/..\//i", 
"file=../objects/" . $subdir . 
"/", 
$output);
 
 1002        fwrite(fopen($a_target_dir . 
'/fullscreen.html', 
'w'), 
$output);
 
 1007        if ($a_tag == 
"Identifier" && $a_param == 
"Entry") {
 
 1027        $this->contains_int_link = $a_contains_link;
 
 1049        if ($a_usage_hist_nr !== 
false) {
 
 1050            $and_hist = 
" AND usage_hist_nr = " . 
$ilDB->quote($a_usage_hist_nr, 
"integer");
 
 1054        $set = 
$ilDB->query(
"SELECT id FROM mob_usage" .
 
 1055            " WHERE usage_type = " . 
$ilDB->quote(
$a_type, 
"text") .
 
 1056            " AND usage_id = " . 
$ilDB->quote($a_id, 
"integer") .
 
 1057            " AND usage_lang = " . 
$ilDB->quote($a_lang, 
"text") .
 
 1059        while (
$row = 
$ilDB->fetchAssoc($set)) {
 
 1060            $mob_ids[] = 
$row[
"id"];
 
 1063        $q = 
"DELETE FROM mob_usage WHERE usage_type = " .
 
 1065            " AND usage_id= " . 
$ilDB->quote($a_id, 
"integer") .
 
 1066            " AND usage_lang = " . 
$ilDB->quote($a_lang, 
"text") .
 
 1068        $ilDB->manipulate($q);
 
 1070        foreach ($mob_ids as $mob_id) {
 
 1085        if ($a_lang != 
"") {
 
 1086            $lstr = 
" AND usage_lang = " . 
$ilDB->quote($a_lang, 
"text");
 
 1089        if ($a_usage_hist_nr !== 
false) {
 
 1090            $hist_str = 
" AND usage_hist_nr = " . 
$ilDB->quote($a_usage_hist_nr, 
"integer");
 
 1093        $q = 
"SELECT * FROM mob_usage WHERE " .
 
 1094            "usage_type = " . 
$ilDB->quote(
$a_type, 
"text") . 
" AND " .
 
 1095            "usage_id = " . 
$ilDB->quote($a_id, 
"integer") .
 
 1098        $mob_set = 
$ilDB->query($q);
 
 1099        while ($mob_rec = 
$ilDB->fetchAssoc($mob_set)) {
 
 1101                $mobs[$mob_rec[
"id"]] = $mob_rec[
"id"];
 
 1120                "id" => array(
"integer", (
int) $a_mob_id),
 
 1121                "usage_type" => array(
"text", 
$a_type),
 
 1122                "usage_id" => array(
"integer", $a_id),
 
 1123                "usage_lang" => array(
"text", $a_lang),
 
 1124                "usage_hist_nr" => array(
"integer", (
int) $a_usage_hist_nr)
 
 1141        $q = 
"DELETE FROM mob_usage WHERE " .
 
 1142            " id = " . 
$ilDB->quote((
int) $a_mob_id, 
"integer") . 
" AND " .
 
 1143            " usage_type = " . 
$ilDB->quote(
$a_type, 
"text") . 
" AND " .
 
 1144            " usage_id = " . 
$ilDB->quote((
int) $a_id, 
"integer") . 
" AND " .
 
 1145            " usage_lang = " . 
$ilDB->quote($a_lang, 
"text") . 
" AND " .
 
 1146            " usage_hist_nr = " . 
$ilDB->quote((
int) $a_usage_hist_nr, 
"integer");
 
 1147        $ilDB->manipulate($q);
 
 1172        if ($a_include_history) {
 
 1173            $hist_str = 
", usage_hist_nr";
 
 1177        $q = 
"SELECT DISTINCT usage_type, usage_id, usage_lang" . $hist_str . 
" FROM mob_usage WHERE id = " .
 
 1178            $ilDB->quote($a_id, 
"integer");
 
 1180        if (!$a_include_history) {
 
 1181            $q .= 
" AND usage_hist_nr = " . 
$ilDB->quote(0, 
"integer");
 
 1184        $us_set = 
$ilDB->query($q);
 
 1186        while ($us_rec = 
$ilDB->fetchAssoc($us_set)) {
 
 1188            if (is_int(strpos($us_rec[
"usage_type"], 
":"))) {
 
 1189                $us_arr = explode(
":", $us_rec[
"usage_type"]);
 
 1197                include_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
 1204                $ret[] = array(
"type" => $us_rec[
"usage_type"],
 
 1205                    "id" => $us_rec[
"usage_id"],
 
 1206                    "lang" => $us_rec[
"usage_lang"],
 
 1207                    "hist_nr" => $us_rec[
"usage_hist_nr"]);
 
 1212        $q = 
"SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = " .
 
 1213            $ilDB->quote($a_id, 
"integer") . 
" AND mep_item.type = " . 
$ilDB->quote(
"mob", 
"text");
 
 1214        $us_set = 
$ilDB->query($q);
 
 1215        while ($us_rec = 
$ilDB->fetchAssoc($us_set)) {
 
 1216            $ret[] = array(
"type" => 
"mep",
 
 1217                "id" => $us_rec[
"mep_id"]);
 
 1221        include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 1223        foreach ($news_usages as $nu) {
 
 1229        $q = 
"SELECT DISTINCT mob_id FROM media_item it, map_area area " .
 
 1230            " WHERE area.item_id = it.id " .
 
 1231            " AND area.link_type = " . 
$ilDB->quote(
"int", 
"text") . 
" " .
 
 1232            " AND area.target = " . 
$ilDB->quote(
"il__mob_" . $a_id, 
"text");
 
 1233        $us_set = 
$ilDB->query($q);
 
 1234        while ($us_rec = 
$ilDB->fetchAssoc($us_set)) {
 
 1235            $ret[] = array(
"type" => 
"map",
 
 1236                "id" => $us_rec[
"mob_id"]);
 
 1242            $ret[] = array(
"type" => 
"clip",
 
 1256        if (is_int(strpos($a_usage[
"type"], 
":"))) {
 
 1257            $us_arr = explode(
":", $a_usage[
"type"]);
 
 1259            $cont_type = $us_arr[0];
 
 1261            $type = $a_usage[
"type"];
 
 1264        $id = $a_usage[
"id"];
 
 1271                switch ($cont_type) {
 
 1274                        include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
 1276                        if ($qinfo[
"original_id"] > 0) {
 
 1277                            include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
 1280                            $obj_id = $qinfo[
"obj_fi"];         
 
 1286                        include_once(
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
 
 1289                            $parent_id = $quest->getObjId();
 
 1292                            if ($quest->getOriginalId() &&
 
 1298                                $obj_id = $parent_id;
 
 1307                        $returned_pk = $a_usage[
'id'];
 
 1309                        include_once 
'Modules/Exercise/classes/class.ilExSubmission.php';
 
 1315                        $post_pk = $a_usage[
'id'];
 
 1316                        include_once 
'Modules/Forum/classes/class.ilForumPost.php';
 
 1317                        include_once 
'Modules/Forum/classes/class.ilForum.php';
 
 1319                        $frm_pk = $oPost->getForumId();
 
 1325                        $draft_id = $a_usage[
'id'];
 
 1326                        include_once 
'Modules/Forum/classes/class.ilForumPostDraft.php';
 
 1327                        include_once 
'Modules/Forum/classes/class.ilForum.php';
 
 1330                        $frm_pk = $oDraft->getForumId();
 
 1334                        $history_id = $a_usage[
'id'];
 
 1335                        include_once 
'Modules/Forum/classes/class.ilForumDraftsHistory.php';
 
 1336                        include_once 
'Modules/Forum/classes/class.ilForumPostDraft.php';
 
 1337                        include_once 
'Modules/Forum/classes/class.ilForum.php';
 
 1341                        $frm_pk = $oDraft->getForumId();
 
 1347                        $obj_id = $a_usage[
'id'];
 
 1365                switch ($cont_type) {
 
 1368                        include_once(
'./Services/COPage/classes/class.ilPageObject.php');
 
 1375                        include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
 1377                        if ($qinfo[
"original_id"] > 0) {
 
 1378                            include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
 1381                            $obj_id = $qinfo[
"obj_fi"];         
 
 1384                            include_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
 
 1386                            if ($pinfo && $pinfo[
"parent_type"] == 
"lm") {
 
 1387                                include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
 1391                            if ($pinfo && $pinfo[
"parent_type"] == 
"sahs") {
 
 1392                                include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
 
 1400                        include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
 1406                        include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
 
 1407                        include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
 
 1414                        include_once 
'Modules/Wiki/classes/class.ilWikiPage.php';
 
 1421                        include_once(
'./Services/COPage/classes/class.ilPageObject.php');
 
 1427                        include_once 
"Modules/Portfolio/classes/class.ilPortfolioPage.php";
 
 1433                        include_once 
"Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
 
 1439                        include_once(
'./Services/COPage/classes/class.ilPageObject.php');
 
 1468                include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 1483    public static function _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop = 
false)
 
 1485        $file_path = pathinfo($a_file);
 
 1486        $location = substr($file_path[
"basename"], 0, strlen($file_path[
"basename"]) -
 
 1487            strlen($file_path[
"extension"]) - 1) . 
"_" .
 
 1489            $a_height . 
"." . $file_path[
"extension"];
 
 1490        $target_file = $file_path[
"dirname"] . 
"/" .
 
 1512        include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
 
 1525        $a_constrain_proportions,
 
 1539        if ($a_format == 
"audio/mpeg") {
 
 1545            include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
 
 1553        if ($a_use_original) {
 
 1560                $info = 
$lng->txt(
"cont_could_not_determine_resource_size");
 
 1563            $w = (int) $a_user_width;
 
 1564            $h = (int) $a_user_height;
 
 1580                        $width = (int) (
$size[0] / 
$r);
 
 1581                        $height = (int) (
$size[1] / 
$r);
 
 1589        if ($width == 0 && $a_user_width === 
"") {
 
 1592        if ($height == 0 && $a_user_height === 
"") {
 
 1596        return array(
"width" => $width, 
"height" => $height, 
"info" => 
$info);
 
 1605        return array(
"image/x-ms-bmp", 
"image/gif", 
"image/jpeg", 
"image/x-portable-bitmap",
 
 1606            "image/png", 
"image/psd", 
"image/tiff", 
"application/pdf");
 
 1622        $lpath = pathinfo($a_loc);
 
 1623        if ($lpath[
"extension"] == 
"mp3" && $a_format == 
"audio/mpeg") {
 
 1626        if ($lpath[
"extension"] == 
"flv") {
 
 1629        if (in_array($a_format, array(
"video/mp4", 
"video/webm"))) {
 
 1642        $media_object->setTitle(
$name);
 
 1643        $media_object->setDescription(
"");
 
 1644        $media_object->create();
 
 1647        $media_object->createDirectory();
 
 1651        $media_object->addMediaItem($media_item);
 
 1652        $media_item->setPurpose(
"Standard");
 
 1654        $file = $mob_dir . 
"/" . 
$name;
 
 1656            ilUtil::moveUploadedFile($tmp_name, 
$name, $file);
 
 1658            copy($tmp_name, $file);
 
 1664        $media_item->setFormat(
$format);
 
 1666        $media_item->setLocationType(
"LocalFile");
 
 1667        $media_object->setTitle(
$name);
 
 1668        $media_object->setDescription(
$format);
 
 1671            include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
 
 1673            $media_item->setWidth(
$size[0]);
 
 1674            $media_item->setHeight(
$size[1]);
 
 1676        $media_item->setHAlign(
"Left");
 
 1679        include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
 
 1682        $media_object->update();
 
 1684        return $media_object;
 
 1692        $a_subdir = str_replace(
"..", 
"", $a_subdir);
 
 1694        if ($a_subdir != 
"") {
 
 1695            $dir .= 
"/" . $a_subdir;
 
 1698        if ($a_mode == 
"rename") {
 
 1699            rename($tmp_name, $dir . 
"/" . $a_name);
 
 1701            ilUtil::moveUploadedFile($tmp_name, $a_name, $dir . 
"/" . $a_name, 
true, $a_mode);
 
 1704        include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
 
 1714    public function uploadSrtFile($a_tmp_name, $a_language, $a_mode = 
"move_uploaded")
 
 1716        if (is_file($a_tmp_name) && $a_language != 
"") {
 
 1730        if (!is_dir($srt_dir)) {
 
 1736        $srt_files = array();
 
 1737        foreach ($items as 
$i) {
 
 1738            if (!in_array(
$i[
"entry"], array(
".", 
"..")) && 
$i[
"type"] == 
"file") {
 
 1739                $name = explode(
".", 
$i[
"entry"]);
 
 1740                if (
$name[1] == 
"srt" && substr(
$name[0], 0, 9) == 
"subtitle_") {
 
 1741                    $srt_files[] = array(
"file" => 
$i[
"entry"],
 
 1742                        "full_path" => 
"srt/" . 
$i[
"entry"], 
"language" => substr(
$name[0], 9, 2));
 
 1763            $m_dir . 
"/" . $a_file,
 
 1764            $t_dir . 
"/" . $a_thumbname,
 
 1779        return $t_dir . 
"/" . $a_thumbname;
 
 1788        $file = str_replace(
"..", 
"", $a_file);
 
 1790        if (is_file($file)) {
 
 1803        if (!is_array($a_ignore)) {
 
 1804            $a_ignore = array();
 
 1810        foreach ($med_items as $med_item) {
 
 1812            foreach ($int_links as $k => $int_link) {
 
 1813                if ($int_link[
"Type"] == 
"MediaObject") {
 
 1814                    include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 1817                        if (!in_array($l_id, $linked) &&
 
 1818                            !in_array($l_id, $a_ignore)) {
 
 1834        return array_filter(self::getAllowedFileTypes(), 
function ($v) {
 
 1835            return !in_array($v, self::getForbiddenFileTypes());
 
 1847        if (trim($mset->get(
"black_list_file_types")) == 
"") {
 
 1852                return strtolower(trim($v));
 
 1854            explode(
",", $mset->get(
"black_list_file_types"))
 
 1866        if (trim($mset->get(
"restricted_file_types")) == 
"") {
 
 1871                return strtolower(trim($v));
 
 1873            explode(
",", $mset->get(
"restricted_file_types"))
 
 1885        if (in_array(
$a_type, self::getForbiddenFileTypes())) {
 
 1888        if (count(self::getAllowedFileTypes()) == 0 || in_array(
$a_type, self::getAllowedFileTypes())) {
 
 1901        $new_obj->setTitle($this->
getTitle());
 
 1906            $new_obj->addMediaItem($val);
 
 1909        $new_obj->create(
false, 
true);
 
 1912        $new_obj->createDirectory();
 
 1924        include_once(
"Services/MetaData/classes/class.ilMD.php");
 
 1925        $md = 
new ilMD(0, $this->
getId(), 
"mob");
 
 1926        $new_md = $md->cloneMD(0, $new_obj->getId(), 
"mob");
 
 1944        $pi = pathinfo($a_prevpic[
"name"]);
 
 1945        $ext = $pi[
"extension"];
 
 1946        if (in_array($ext, array(
"jpg", 
"jpeg", 
"png"))) {
 
 1961        if ($item->getLocationType() == 
"LocalFile" &&
 
 1962            is_int(strpos($item->getFormat(), 
"image/"))) {
 
 1964            $file = $dir . 
"/" .
 
 1965                $item->getLocation();
 
 1966            if (is_file($file)) {
 
 1985        $ppics = array(
"mob_vpreview.jpg",
 
 1986            "mob_vpreview.jpeg",
 
 1987            "mob_vpreview.png");
 
 1988        foreach ($ppics as $p) {
 
 1989            if (is_file($dir . 
"/" . $p)) {
 
 1990                if ($a_filename_only) {
 
 1993                    return $dir . 
"/" . $p;
 
 2010        $rchars = array(
"`", 
"=", 
"$", 
"{", 
"}", 
"'", 
";", 
" ", 
"(", 
")");
 
 2011        $a_name = str_replace($rchars, 
"_", $a_name);
 
 2012        $a_name = str_replace(
"__", 
"_", $a_name);
 
 2040        include_once(
"./Services/MediaObjects/exceptions/class.ilMediaObjectsException.php");
 
 2041        if (!is_file($a_file[
"tmp_name"])) {
 
 2048        ilUtil::moveUploadedFile($a_file[
"tmp_name"], 
"multi_srt.zip", $dir . 
"/" . 
"multi_srt.zip");
 
 2067        include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
 
 2074            if (
$i[
"type"] == 
"file" && !in_array($k, array(
".", 
".."))) {
 
 2075                if (pathinfo($k, PATHINFO_EXTENSION) == 
"srt") {
 
 2077                    if (substr($k, strlen($k) - 7, 1) == 
"_") {
 
 2078                        $lang = substr($k, strlen($k) - 6, 2);
 
 2079                        if (!in_array(
$lang, $lang_codes)) {
 
 2083                    $items[] = array(
"filename" => $k, 
"lang" => 
$lang);
 
 2098        if (!self::isTypeAllowed(
"html")) {
 
An exception for terminatinating execution or to throw for unit testing.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _lookupSurveyObjId($a_question_id)
static _getQuestionInfo($question_id)
Returns question information from the database.
static handleUpdatedSourceObject($a_src_obj_type, $a_src_obj_id, $a_src_filesize, $a_owner_obj_ids=null, $a_is_prtf=false)
Find and update/create all related entries for source object.
static lookupExerciseIdForReturnedId($a_returned_id)
Get exercise from submission id (used in ilObjMediaObject)
Class ilForumDraftHistory.
static newInstanceByDraftId($draft_id)
static _lookupObjIdForForumId($a_for_id)
static _lookupTermId($a_def_id)
Looks up term id for a definition id.
static _lookGlossaryID($term_id)
get glossary id form term id
static _extractObjIdOfTarget($a_target)
Extract object id out of target.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static getLogger($a_component_id)
Get component logger.
static _getPossibleLanguageCodes()
static _getIntLinks($a_item_id)
get all internal links of a media items map areas
const APPLICATION__OCTET_STREAM
static lookupMimeType($path_to_file, $fallback=self::APPLICATION__OCTET_STREAM, $a_external=null)
static _lookupContextObjId($a_news_id)
Context Object ID.
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
static _lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
static _getUsersForClipboadObject($a_type, $a_id)
get all users, that have a certain object within their clipboard
Class ilObject Basic functions for all objects.
getType()
get object type @access public
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _writeTitle($a_obj_id, $a_title)
write title to db (static)
static _lookupType($a_id, $a_reference=false)
lookup object type
static _writeDescription($a_obj_id, $a_desc)
write description to db (static)
static _getPageForQuestionId($a_q_id, $a_parent_type="")
Get page for question id.
static lookupParentId($a_id, $a_type)
Lookup parent id.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static getFlashVideoPlayerDirectory()
Get flash video player directory.
static findPortfolioForPage($a_page_id)
Get portfolio id of page id.
static _lookupSLMID($a_id)
Lookup Scorm Learning Module ID for node id.
special template class to simplify handling of ITX/PEAR
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
static escapeShellArg($a_arg)
static getWebspaceDir($mode="filesystem")
get webspace directory
static execConvert($args)
execute convert command
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
static rRenameSuffix($a_dir, $a_old_suffix, $a_new_suffix)
Renames all files with certain suffix and gives them a new suffix.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static getHtmlPath($relative_path)
get url of path
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
static secureUrl($url)
Prepare secure href attribute.
static createDirectory($a_dir, $a_mod=0755)
create directory
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
static signFile($path_to_file)
static lookupObjIdByPage($a_page_id)
returns the wiki/object id to a given page id
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
update($pash, $contents, Config $config)
redirection script todo: (a better solution should control the processing via a xml file)