/** * @group IL_Init */ public function testBasicSessionBehaviour() { global $ilUser; include_once "./Services/Authentication/classes/class.ilSession.php"; $result = ""; ilSession::_writeData("123456", "Testdata"); if (ilSession::_exists("123456")) { $result .= "exists-"; } if (ilSession::_getData("123456") == "Testdata") { $result .= "write-get-"; } $duplicate = ilSession::_duplicate("123456"); if (ilSession::_getData($duplicate) == "Testdata") { $result .= "duplicate-"; } ilSession::_destroy("123456"); if (!ilSession::_exists("123456")) { $result .= "destroy-"; } ilSession::_destroyExpiredSessions(); if (ilSession::_exists($duplicate)) { $result .= "destroyExp-"; } ilSession::_destroyByUserId($ilUser->getId()); if (!ilSession::_exists($duplicate)) { $result .= "destroyByUser-"; } $this->assertEquals("exists-write-get-duplicate-destroy-destroyExp-destroyByUser-", $result); }
/** * */ protected function storeRequest() { /** * @var $http ilHTTPS */ global $https; if (!ilSession::get('orig_request_target')) { //#16324 don't use the complete REQUEST_URI $url = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], "/") + 1); ilSession::set('orig_request_target', $url); } }
/** * Get chapters * * @param * @return */ function getChapters() { $hc = ilSession::get("help_chap"); $lm_tree = $this->parent_obj->object->getTree(); if ($hc > 0 && $lm_tree->isInTree($hc)) { //$node = $lm_tree->getNodeData($hc); //$chaps = $lm_tree->getSubTree($node); $chaps = $lm_tree->getFilteredSubTree($hc, array("pg")); unset($chaps[0]); } else { $chaps = ilStructureObject::getChapterList($this->parent_obj->object->getId()); } $this->setData($chaps); }
/** * */ protected function storeRequest() { /** * @var $http ilHTTPS */ global $https; if (!ilSession::get('orig_request_target')) { $target_protocol = 'http'; if ($https->isDetected()) { $target_protocol .= 's'; } $host = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']; $request_url = $_SERVER['REQUEST_URI'][0] == '/' ? $_SERVER['REQUEST_URI'] : '/' . $_SERVER['REQUEST_URI']; $url = $target_protocol . '://' . $host . $request_url; ilSession::set('orig_request_target', $url); } }
/** * display content of page */ function showPage() { global $tree, $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs; // jquery and jquery ui are always provided for components include_once "./Services/jQuery/classes/class.iljQueryUtil.php"; iljQueryUtil::initjQuery(); iljQueryUtil::initjQueryUI(); // $this->initSelfAssessmentRendering(); include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php"; ilObjMediaObjectGUI::includePresentationJS($GLOBALS["tpl"]); $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js"); // needed for overlays in iim include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php"; ilOverlayGUI::initJavascript(); include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php"; ilPlayerUtil::initMediaElementJs($GLOBALS["tpl"]); // init template //if($this->outputToTemplate()) //{ if ($this->getOutputMode() == "edit") { //echo ":".$this->getTemplateTargetVar().":"; $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage"); //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage"); // to do: status dependent class $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page"); // user comment if ($this->isEnabledChangeComments()) { $tpl->setCurrentBlock("change_comment"); $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment")); $tpl->parseCurrentBlock(); } $tpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormActionByClass("ilpageeditorgui", "", "", true)); // determine media, html and javascript mode $sel_media_mode = $ilUser->getPref("ilPageEditor_MediaMode") == "disable" ? "disable" : "enable"; $sel_html_mode = $ilUser->getPref("ilPageEditor_HTMLMode") == "disable" ? "disable" : "enable"; $sel_js_mode = "disable"; //if($ilSetting->get("enable_js_edit", 1)) //{ $sel_js_mode = ilPageEditorGUI::_doJSEditing() ? "enable" : "disable"; //} // show prepending html $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml()); $tpl->setVariable("TXT_CONFIRM_DELETE", $lng->txt("cont_confirm_delete")); // presentation view if ($this->getViewPageLink() != "") { $ilTabs->addNonTabbedLink("pres_view", $this->lng->txt("cont_presentation_view"), $this->getViewPageLink(), $this->getViewPageTarget()); } // show actions drop down $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode); // get js files for JS enabled editing if ($sel_js_mode == "enable") { $this->insertHelp($tpl); include_once "./Services/YUI/classes/class.ilYuiUtil.php"; ilYuiUtil::initDragDrop(); ilYuiUtil::initConnection(); ilYuiUtil::initPanel(false); $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js"); $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js"); include_once './Services/Style/classes/class.ilObjStyleSheet.php'; $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();\n\t\t\t\t\t\tpreloader.src = './templates/default/images/loader.svg';\n\t\t\t\t\t\tilCOPage.setContentCss('" . ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css" . "')"); //$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js"); $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_1_5/tinymce.js"); $tpl->touchBlock("init_dragging"); $cfg = $this->getPageConfig(); $tpl->setVariable("IL_TINY_MENU", self::getTinyMenu($this->getPageObject()->getParentType(), $cfg->getEnableInternalLinks(), $cfg->getEnableWikiLinks(), $cfg->getEnableKeywords(), $this->getStyleId(), true, true, $cfg->getEnableAnchors())); // add int link parts include_once "./Services/Link/classes/class.ilInternalLinkGUI.php"; $tpl->setCurrentBlock("int_link_prep"); $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML($ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"), "", false, true, false))); $tpl->parseCurrentBlock(); include_once "./Services/YUI/classes/class.ilYuiUtil.php"; ilYuiUtil::initConnection(); $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js"); } // multiple actions $cnt_pcs = $this->getPageObject()->countPageContents(); if ($cnt_pcs > 1 || $this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0) { $tpl->setCurrentBlock("multi_actions"); if ($sel_js_mode == "enable") { $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"'); $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"'); $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"'); $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"'); $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"'); $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all")); $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"'); } $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable")); $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic")); $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected")); $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy")); $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut")); $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg")); $tpl->parseCurrentBlock(); } } else { // presentation or preview here $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage"); if ($this->getEnabledPageFocus()) { $tpl->touchBlock("page_focus"); } include_once "./Services/User/classes/class.ilUserUtil.php"; // presentation if ($this->isPageContainerToBeRendered()) { $tpl->touchBlock("page_container_1"); $tpl->touchBlock("page_container_2"); $tpl->touchBlock("page_container_3"); } // history $c_old_nr = $this->getPageObject()->old_nr; if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1) { $hist_info = $this->getPageObject()->getHistoryInfo($c_old_nr); if (!$this->getCompareMode()) { $ilCtrl->setParameter($this, "history_mode", "1"); // previous revision if (is_array($hist_info["previous"])) { $tpl->setCurrentBlock("previous_rev"); $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev")); $ilCtrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]); $tpl->setVariable("HREF_PREV", $ilCtrl->getLinkTarget($this, "preview")); $tpl->parseCurrentBlock(); } else { $tpl->setCurrentBlock("previous_rev_disabled"); $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev")); $tpl->parseCurrentBlock(); } // next revision if ($c_old_nr > 0) { $tpl->setCurrentBlock("next_rev"); $tpl->setVariable("TXT_NEXT_REV", $lng->txt("cont_next_rev")); $ilCtrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]); $tpl->setVariable("HREF_NEXT", $ilCtrl->getLinkTarget($this, "preview")); $tpl->parseCurrentBlock(); // latest revision $tpl->setCurrentBlock("latest_rev"); $tpl->setVariable("TXT_LATEST_REV", $lng->txt("cont_latest_rev")); $ilCtrl->setParameter($this, "old_nr", ""); $tpl->setVariable("HREF_LATEST", $ilCtrl->getLinkTarget($this, "preview")); $tpl->parseCurrentBlock(); } $ilCtrl->setParameter($this, "history_mode", ""); // rollback if ($c_old_nr > 0 && $ilUser->getId() != ANONYMOUS_USER_ID) { $tpl->setCurrentBlock("rollback"); $ilCtrl->setParameter($this, "old_nr", $c_old_nr); $tpl->setVariable("HREF_ROLLBACK", $ilCtrl->getLinkTarget($this, "rollbackConfirmation")); $ilCtrl->setParameter($this, "old_nr", ""); $tpl->setVariable("TXT_ROLLBACK", $lng->txt("cont_rollback")); $tpl->parseCurrentBlock(); } } $tpl->setCurrentBlock("hist_nav"); $tpl->setVariable("TXT_REVISION", $lng->txt("cont_revision")); $tpl->setVariable("VAL_REVISION_DATE", ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME))); $tpl->setVariable("VAL_REV_USER", ilUserUtil::getNamePresentation($hist_info["current"]["user_id"])); $tpl->parseCurrentBlock(); } } if ($this->getOutputMode() != IL_PAGE_PRESENTATION && $this->getOutputMode() != IL_PAGE_OFFLINE && $this->getOutputMode() != IL_PAGE_PREVIEW && $this->getOutputMode() != IL_PAGE_PRINT) { $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui")); } // output media object edit list (of media links) if ($this->getOutputMode() == "edit") { $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType() . ":pg", $this->obj->getId(), $this->obj->getLanguage()); $mob_links = array(); foreach ($links as $link) { if ($link["type"] == "mob") { if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") { $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]"; } } } // linked media objects if (count($mob_links) > 0) { $tpl->setCurrentBlock("med_link"); $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs")); $tpl->setVariable("SEL_MED_LINKS", ilUtil::formSelect(0, "mob_id", $mob_links, false, true)); $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob")); $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard")); //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool")); $tpl->parseCurrentBlock(); } // content snippets used include_once "./Services/COPage/classes/class.ilPCContentInclude.php"; $snippets = ilPCContentInclude::collectContentIncludes($this->getPageObject(), $this->getPageObject()->getDomDoc()); if (count($snippets) > 0) { foreach ($snippets as $s) { include_once "./Modules/MediaPool/classes/class.ilMediaPoolPage.php"; $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]); } $tpl->setCurrentBlock("med_link"); $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used")); $tpl->setVariable("SEL_SNIPPETS", ilUtil::formSelect(0, "ci_id", $sn_arr, false, true)); $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info")); $tpl->parseCurrentBlock(); } // scheduled activation? if (!$this->getPageObject()->getActive() && $this->getPageObject()->getActivationStart() != "" && $this->getPageConfig()->getEnableScheduledActivation()) { $tpl->setCurrentBlock("activation_txt"); $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $lng->txt("cont_scheduled_activation")); $tpl->setVariable("SA_FROM", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationStart(), IL_CAL_DATETIME))); $tpl->setVariable("SA_TO", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationEnd(), IL_CAL_DATETIME))); $tpl->parseCurrentBlock(); } } if ($_GET["reloadTree"] == "y") { $tpl->setCurrentBlock("reload_tree"); if ($this->obj->getParentType() == "dbk") { $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer", "", false, false)); } else { $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false)); } $tpl->parseCurrentBlock(); } // } // get content $builded = $this->obj->buildDom(); // manage hierarchical ids if ($this->getOutputMode() == "edit") { // add pc ids, if necessary if (!$this->obj->checkPCIds()) { $this->obj->insertPCIds(); $this->obj->update(true, true); } $this->obj->addFileSizes(); $this->obj->addHierIDs(); $hids = $this->obj->getHierIds(); $row1_ids = $this->obj->getFirstRowIds(); $col1_ids = $this->obj->getFirstColumnIds(); $litem_ids = $this->obj->getListItemIds(); $fitem_ids = $this->obj->getFileItemIds(); // standard menues $hids = $this->obj->getHierIds(); foreach ($hids as $hid) { $tpl->setCurrentBlock("add_dhtml"); $tpl->setVariable("CONTEXTMENU", "contextmenu_" . $hid); $tpl->parseCurrentBlock(); } // column menues for tables foreach ($col1_ids as $hid) { $tpl->setCurrentBlock("add_dhtml"); $tpl->setVariable("CONTEXTMENU", "contextmenu_r" . $hid); $tpl->parseCurrentBlock(); } // row menues for tables foreach ($row1_ids as $hid) { $tpl->setCurrentBlock("add_dhtml"); $tpl->setVariable("CONTEXTMENU", "contextmenu_c" . $hid); $tpl->parseCurrentBlock(); } // list item menues foreach ($litem_ids as $hid) { $tpl->setCurrentBlock("add_dhtml"); $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid); $tpl->parseCurrentBlock(); } // file item menues foreach ($fitem_ids as $hid) { $tpl->setCurrentBlock("add_dhtml"); $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid); $tpl->parseCurrentBlock(); } } else { $this->obj->addFileSizes(); } //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>"; //echo "<br>-".htmlentities($this->getLinkXML())."-"; // set default link xml, if nothing was set yet if (!$this->link_xml_set) { $this->setDefaultLinkXml(); } //$content = $this->obj->getXMLFromDom(false, true, true, // $this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML()); $link_xml = $this->getLinkXML(); // disable/enable auto margins if ($this->getStyleId() > 0) { if (ilObject::_lookupType($this->getStyleId()) == "sty") { include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $style = new ilObjStyleSheet($this->getStyleId()); $template_xml = $style->getTemplateXML(); $disable_auto_margins = "n"; if ($style->lookupStyleSetting("disable_auto_margins")) { $disable_auto_margins = "y"; } } } if ($this->getAbstractOnly()) { $content = "<dummy><PageObject><PageContent><Paragraph>" . $this->obj->getFirstParagraphText() . $link_xml . "</Paragraph></PageContent></PageObject></dummy>"; } else { $content = $this->obj->getXMLFromDom(false, true, true, $link_xml . $this->getQuestionXML() . $template_xml . $this->getComponentPluginsXML()); } // check validation errors if ($builded !== true) { $this->displayValidationError($builded); } else { $this->displayValidationError($_SESSION["il_pg_error"]); } unset($_SESSION["il_pg_error"]); if (isset($_SESSION["citation_error"])) { ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid")); ilSession::clear("citation_error"); } // get title $pg_title = $this->getPresentationTitle(); $col_path = ilUtil::getImagePath("col.svg"); $row_path = ilUtil::getImagePath("row.svg"); $item_path = ilUtil::getImagePath("item.svg"); if ($this->getOutputMode() != "offline") { $enlarge_path = ilUtil::getImagePath("enlarge.svg"); $wb_path = ilUtil::getWebspaceDir("output") . "/"; } else { $enlarge_path = "images/enlarge.svg"; $wb_path = ""; } $pg_title_class = $this->getOutputMode() == "print" ? "ilc_PrintPageTitle" : ""; // page splitting only for learning modules and // digital books $enable_split_new = $this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk" ? "y" : "n"; // page splitting to next page only for learning modules and // digital books if next page exists in tree if (($this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk") && ilObjContentObject::hasSuccessorPage($this->obj->getParentId(), $this->obj->getId())) { $enable_split_next = "y"; } else { $enable_split_next = "n"; } $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline"); if ($this->getPageConfig()->getEnablePCType("Tabs")) { //include_once("./Services/YUI/classes/class.ilYuiUtil.php"); //ilYuiUtil::initTabView(); include_once "./Services/Accordion/classes/class.ilAccordionGUI.php"; ilAccordionGUI::addJavaScript(); ilAccordionGUI::addCss(); } $file_download_link = $this->determineFileDownloadLink(); $fullscreen_link = $this->determineFullscreenLink(); $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript(); // default values for various parameters (should be used by // all instances in the future) $media_mode = $this->getOutputMode() == "edit" ? $ilUser->getPref("ilPageEditor_MediaMode") : "enable"; include_once "./Modules/LearningModule/classes/class.ilEditClipboard.php"; $paste = ilEditClipboard::getAction() == "copy" && $this->getOutputMode() == "edit"; include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php"; $flv_video_player = $this->getOutputMode() != "offline" ? ilPlayerUtil::getFlashVideoPlayerFilename(true) : ilPlayerUtil::getFlashVideoPlayerFilename(true); $cfg = $this->getPageConfig(); // added UTF-8 encoding otherwise umlaute are converted too include_once "./Services/Maps/classes/class.ilMapUtil.php"; $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"), 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n", 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class, 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path, 'img_col' => $col_path, 'img_row' => $row_path, 'img_item' => $item_path, 'enable_split_new' => $enable_split_new, 'enable_split_next' => $enable_split_next, 'link_params' => $this->link_params, 'file_download_link' => $file_download_link, 'fullscreen_link' => $fullscreen_link, 'img_path' => $img_path, 'parent_id' => $this->obj->getParentId(), 'download_script' => $this->sourcecode_download_script, 'encoded_download_script' => urlencode($this->sourcecode_download_script), 'bib_id' => $this->getBibId(), 'citation' => (int) $this->isEnabledCitation(), 'pagebreak' => $this->lng->txt('dgl_pagebreak'), 'page' => $this->lng->txt('page'), 'citate_page' => $this->lng->txt('citate_page'), 'citate_from' => $this->lng->txt('citate_from'), 'citate_to' => $this->lng->txt('citate_to'), 'citate' => $this->lng->txt('citate'), 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n", 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n", 'enable_map' => $cfg->getEnablePCType("Map") && ilMapUtil::isActivated() ? "y" : "n", 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n", 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n", 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n", 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n", 'enable_content_templates' => count($this->getPageObject()->getContentTemplates()) > 0 ? "y" : "n", 'paste' => $paste ? "y" : "n", 'media_mode' => $media_mode, 'javascript' => $sel_js_mode, 'paragraph_plugins' => $paragraph_plugin_string, 'disable_auto_margins' => $disable_auto_margins, 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n", 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n", 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n", 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n", 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n", 'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n", 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n", 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n", 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n", 'flv_video_player' => $flv_video_player); if ($this->link_frame != "") { // todo other link types $params["pg_frame"] = $this->link_frame; } //$content = str_replace(" ", "", $content); // this ensures that cache is emptied with every update $params["version"] = ILIAS_VERSION; // ensure no cache hit, if included files/media objects have been changed $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements(); // run xslt $md5 = md5(serialize($params) . $link_xml . $template_xml); //$a = microtime(); // check cache (same parameters, non-edit mode and rendered time // > last change if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") && !$this->getCompareMode() && !$this->getAbstractOnly() && $md5 == $this->obj->getRenderMd5() && $this->obj->getLastChange() < $this->obj->getRenderedTime() && $this->obj->getRenderedTime() != "" && $this->obj->old_nr == 0) { // cache hit $output = $this->obj->getRenderedContent(); } else { $xsl = file_get_contents("./Services/COPage/xsl/page.xsl"); $args = array('/_xml' => $content, '/_xsl' => $xsl); $xh = xslt_create(); // echo "<b>XSLT</b>:".htmlentities($xsl).":<br>"; // echo "mode:".$this->getOutputMode().":<br>"; $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params); if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview") && !$this->getAbstractOnly() && $this->obj->old_nr == 0) { //echo "writerenderedcontent"; $this->obj->writeRenderedContent($output, $md5); } //echo xslt_error($xh); xslt_free($xh); } //$b = microtime(); //echo "$a - $b"; //echo "<pre>".htmlentities($output)."</pre>"; // unmask user html if (($this->getOutputMode() != "edit" || $ilUser->getPref("ilPageEditor_HTMLMode") != "disable") && !$this->getPageConfig()->getPreventHTMLUnmasking()) { $output = str_replace("<", "<", $output); $output = str_replace(">", ">", $output); } $output = str_replace("&", "&", $output); $output = ilUtil::insertLatexImages($output); // insert page snippets $output = $this->insertContentIncludes($output); // insert resource blocks $output = $this->insertResources($output); // insert page toc if ($this->getPageConfig()->getEnablePageToc()) { $output = $this->insertPageToc($output); } // insert advanced output trigger $output = $this->insertAdvTrigger($output); // workaround for preventing template engine // from hiding paragraph text that is enclosed // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand()) $output = $this->replaceCurlyBrackets($output); // remove all newlines (important for code / pre output) $output = str_replace("\n", "", $output); //echo htmlentities($output); $output = $this->postOutputProcessing($output); //echo htmlentities($output); if ($this->getOutputMode() == "edit" && !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) { $output = '<div class="il_editarea_disabled">' . $output . '</div>'; } // for all page components... include_once "./Services/COPage/classes/class.ilCOPagePCDef.php"; $defs = ilCOPagePCDef::getPCDefinitions(); foreach ($defs as $def) { ilCOPagePCDef::requirePCClassByName($def["name"]); $pc_class = $def["pc_class"]; $pc_obj = new $pc_class($this->getPageObject()); // post xsl page content modification by pc elements $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode()); // javascript files $js_files = $pc_obj->getJavascriptFiles($this->getOutputMode()); foreach ($js_files as $js) { $GLOBALS["tpl"]->addJavascript($js); } // css files $css_files = $pc_obj->getCssFiles($this->getOutputMode()); foreach ($css_files as $css) { $GLOBALS["tpl"]->addCss($css); } // onload code $onload_code = $pc_obj->getOnloadCode($this->getOutputMode()); foreach ($onload_code as $code) { $GLOBALS["tpl"]->addOnloadCode($code); } } // $output = $this->selfAssessmentRendering($output); // output if ($ilCtrl->isAsynch() && !$this->getRawPageContent() && $this->getOutputMode() == "edit") { // e.g. ###3:110dad8bad6df8620071a0a693a2d328### if ($_GET["updated_pc_id_str"] != "") { echo $_GET["updated_pc_id_str"]; } $tpl->setVariable($this->getTemplateOutputVar(), $output); $tpl->setCurrentBlock("edit_page"); $tpl->parseCurrentBlock(); echo $tpl->get("edit_page"); exit; } if ($this->outputToTemplate()) { $tpl->setVariable($this->getTemplateOutputVar(), $output); $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get()); return $output; } else { if ($this->getRawPageContent()) { return $output; } else { $tpl->setVariable($this->getTemplateOutputVar(), $output); return $tpl->get(); } } }
/** * Show terms of service */ protected function showTermsOfService() { /** * @var $lng ilLanguage * @var $tpl ilTemplate * @var $ilUser ilObjUser * @var $ilSetting ilSetting */ global $lng, $tpl, $ilUser, $ilSetting; $back_to_login = '******' != $this->ctrl->getCmd(); self::initStartUpTemplate('tpl.view_terms_of_service.html', $back_to_login, !$back_to_login); $tpl->setVariable('TXT_PAGEHEADLINE', $lng->txt('usr_agreement')); try { require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php'; $document = ilTermsOfServiceSignableDocumentFactory::getByLanguageObject($lng); if ('getAcceptance' == $this->ctrl->getCmd()) { if (isset($_POST['status']) && 'accepted' == $_POST['status']) { require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php'; ilTermsOfServiceHelper::trackAcceptance($ilUser, $document); if (ilSession::get('orig_request_target')) { $target = ilSession::get('orig_request_target'); ilSession::set('orig_request_target', ''); ilUtil::redirect($target); } else { ilUtil::redirect('index.php?target=' . $_GET['target'] . '&client_id=' . CLIENT_ID); } } $tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, $this->ctrl->getCmd())); $tpl->setVariable('ACCEPT_CHECKBOX', ilUtil::formCheckbox(0, 'status', 'accepted')); $tpl->setVariable('ACCEPT_TERMS_OF_SERVICE', $lng->txt('accept_usr_agreement')); $tpl->setVariable('TXT_SUBMIT', $lng->txt('submit')); } $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->getContent()); } catch (ilTermsOfServiceNoSignableDocumentFoundException $e) { $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', sprintf($lng->txt('no_agreement_description'), 'mailto:' . ilUtil::prepareFormOutput($ilSetting->get('feedback_recipient')))); } $tpl->show(); }
/** * Filter tooltips * * @param * @return */ function filterTooltips() { global $lng, $ilCtrl; ilSession::set("help_tt_comp", ilUtil::stripSlashes($_POST["help_tt_comp"])); $ilCtrl->redirect($this, "showTooltipList"); }
/** * init HTML output (level 3) */ protected static function initHTML() { global $ilUser; if (ilContext::hasUser()) { // load style definitions // use the init function with plugin hook here, too self::initStyle(); } // $tpl $tpl = new ilTemplate("tpl.main.html", true, true); self::initGlobal("tpl", $tpl); if (ilContext::hasUser() && ilContext::doAuthentication()) { /** * @var $ilUser ilObjUser * @var $ilCtrl ilCtrl */ global $ilUser, $ilCtrl; require_once 'Services/User/classes/class.ilUserRequestTargetAdjustment.php'; $request_adjuster = new ilUserRequestTargetAdjustment($ilUser, $ilCtrl); $request_adjuster->adjust(); } // load style sheet depending on user's settings $location_stylesheet = ilUtil::getStyleSheetLocation(); $tpl->setVariable("LOCATION_STYLESHEET", $location_stylesheet); require_once "./Services/UICore/classes/class.ilFrameTargetInfo.php"; self::initGlobal("ilNavigationHistory", "ilNavigationHistory", "Services/Navigation/classes/class.ilNavigationHistory.php"); self::initGlobal("ilBrowser", "ilBrowser", "./Services/Utilities/classes/class.ilBrowser.php"); self::initGlobal("ilHelp", "ilHelpGUI", "Services/Help/classes/class.ilHelpGUI.php"); self::initGlobal("ilToolbar", "ilToolbarGUI", "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php"); self::initGlobal("ilLocator", "ilLocatorGUI", "./Services/Locator/classes/class.ilLocatorGUI.php"); self::initGlobal("ilTabs", "ilTabsGUI", "./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php"); if (ilContext::hasUser()) { // $ilMainMenu include_once './Services/MainMenu/classes/class.ilMainMenuGUI.php'; $ilMainMenu = new ilMainMenuGUI("_top"); self::initGlobal("ilMainMenu", $ilMainMenu); unset($ilMainMenu); // :TODO: tableGUI related // set hits per page for all lists using table module $_GET['limit'] = (int) $ilUser->getPref('hits_per_page'); ilSession::set('tbl_limit', $_GET['limit']); // the next line makes it impossible to save the offset somehow in a session for // a specific table (I tried it for the user administration). // its not posssible to distinguish whether it has been set to page 1 (=offset = 0) // or not set at all (then we want the last offset, e.g. being used from a session var). // So I added the wrapping if statement. Seems to work (hopefully). // Alex April 14th 2006 if (isset($_GET['offset']) && $_GET['offset'] != "") { $_GET['offset'] = (int) $_GET['offset']; // old code } } else { // several code parts rely on ilObjUser being always included include_once "Services/User/classes/class.ilObjUser.php"; } }
function LogoutNotification($SessionID) { // Delete session of user using $SessionID to locate the user's session file // on the file system or in the database // Then delete this entry or record to clear the session // However, for that to work it is essential that the user's Shibboleth // SessionID is stored in the user session data! global $ilDB; $q = "SELECT session_id, data FROM usr_session WHERE expires > 'NOW()'"; $r = $ilDB->query($q); while ($session_entry = $r->fetchRow(DB_FETCHMODE_ASSOC)) { $user_session = unserializesession($session_entry['data']); // Look for session with matching Shibboleth session id // and then delete this ilias session foreach ($user_session as $user_session_entry) { if (is_array($user_session_entry) && array_key_exists('shibboleth_session_id', $user_session_entry) && $user_session_entry['shibboleth_session_id'] == $SessionID) { // Delete this session entry if (ilSession::_destroy($session_entry['session_id']) !== true) { return new SoapFault('LogoutError', 'Could not delete session entry in database.'); } } } } // If no SoapFault is returned, all is fine }
/** * kicks sessions of users that abidence after login * so people could not login and go for coffe break ;-) * * @global ilDB $ilDB * @global ilSetting $ilSetting * @return <type> */ private static function kickFirstRequestAbidencer(array $a_types) { global $ilDB, $ilSetting; $max_idle_after_first_request = (int) $ilSetting->get('session_max_idle_after_first_request') * 60; if ((int) $max_idle_after_first_request == 0) { return; } $query = "SELECT session_id,expires FROM usr_session WHERE " . "(ctime - createtime) < %s " . "AND (%s - createtime) > %s " . "AND " . $ilDB->in('type', $a_types, false, 'integer'); $res = $ilDB->queryF($query, array('integer', 'integer', 'integer'), array($max_idle_after_first_request, time(), $max_idle_after_first_request)); $session_ids = array(); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $session_ids[$row->session_id] = $row->expires; } ilSession::_destroy($session_ids, ilSession::SESSION_CLOSE_FIRST, true); self::debug(__METHOD__ . ' --> Finished kicking first request abidencer'); }
/** * This is to be called by the plugin at the end of the signature process to redirect the user back to the test. */ public function redirectToTest($success) { /** @var $ilCtrl ilCtrl */ /** @var $ilUser ilObjUser */ global $ilCtrl, $ilUser; $active = $this->test->getActiveIdOfUser($ilUser->getId()); $pass = $this->test->_getMaxPass($active); $key = 'signed_' . $active . '_' . $pass; ilSession::set($key, $success); $ilCtrl->redirect($this->ilTestOutputGUI, 'afterTestPassFinished'); return; }
function fillMessage() { global $lng; $ms = array("info", "success", "failure", "question"); $out = ""; foreach ($ms as $m) { if ($m == "question") { $m = "mess_question"; } $txt = ilSession::get($m) != "" ? ilSession::get($m) : $this->message[$m]; if ($m == "mess_question") { $m = "question"; } if ($txt != "") { $mtpl = new ilTemplate("tpl.message.html", true, true, "Services/Utilities"); $mtpl->setCurrentBlock($m . "_message"); $mtpl->setVariable("TEXT", $txt); $mtpl->setVariable("MESSAGE_HEADING", $lng->txt($m . "_message")); $mtpl->setVariable("ALT_IMAGE", $lng->txt("icon") . " " . $lng->txt($m . "_message")); $mtpl->setVariable("SRC_IMAGE", ilUtil::getImagePath("mess_" . $m . ".png")); $mtpl->parseCurrentBlock(); $out .= $mtpl->get(); } if ($m == "question") { $m = "mess_question"; } if (ilSession::get($m)) { ilSession::clear($m); } } if ($out != "") { $this->setVariable("MESSAGE", $out); } }
/** * @param int $sessionId * @return string */ public function getJsonResponse($sessionId) { /** * @var $ilDB ilDB * @var $ilUser ilObjUser * @var $ilClientIniFile ilIniFile * @var $lng ilLanguage */ global $ilDB, $ilUser, $lng, $ilClientIniFile; include_once 'Services/JSON/classes/class.ilJsonUtil.php'; $response = array('remind' => false); $res = $ilDB->queryF(' SELECT expires, user_id, data FROM usr_session WHERE session_id = %s', array('text'), array($sessionId)); $num = $ilDB->numRows($res); if ($num > 1) { $response['message'] = 'The determined session data is not unique.'; return ilJsonUtil::encode($response); } if ($num == 0) { $response['message'] = 'ILIAS could not determine the session data.'; return ilJsonUtil::encode($response); } $data = $ilDB->fetchAssoc($res); if (!$this->isAuthenticatedUsrSession($data)) { $response['message'] = 'ILIAS could not fetch the session data or the corresponding user is no more authenticated.'; return ilJsonUtil::encode($response); } $session = ilUtil::unserializeSession($data['data']); $idletime = null; foreach ((array) $session as $key => $entry) { if (strpos($key, '_auth__') === 0) { $idletime = $entry['idle']; break; } } if (null === $idletime) { $response['message'] = 'ILIAS could not determine the idle time from the session data.'; return ilJsonUtil::encode($response); } $expiretime = $idletime + ilSession::getIdleValue(); if ($this->isSessionAlreadyExpired($expiretime)) { $response['message'] = 'The session is already expired. The client should have received a remind command before.'; return ilJsonUtil::encode($response); } /** * @var $user ilObjUser */ $ilUser = ilObjectFactory::getInstanceByObjId($data['user_id']); include_once './Services/Authentication/classes/class.ilSessionReminder.php'; $remind_time = $expiretime - max(ilSessionReminder::MIN_LEAD_TIME, (double) $ilUser->getPref('session_reminder_lead_time')) * 60; if ($remind_time > time()) { // session will expire in <lead_time> minutes $response['message'] = 'Lead time not reached, yet. Current time: ' . date('Y-m-d H:i:s', time()) . ', Reminder time: ' . date('Y-m-d H:i:s', $remind_time); return ilJsonUtil::encode($response); } $dateTime = new ilDateTime($expiretime, IL_CAL_UNIX); switch ($ilUser->getTimeFormat()) { case ilCalendarSettings::TIME_FORMAT_12: $formatted_expiration_time = $dateTime->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone()); break; case ilCalendarSettings::TIME_FORMAT_24: default: $formatted_expiration_time = $dateTime->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone()); break; } $response = array('extend_url' => './ilias.php?baseClass=ilPersonalDesktopGUI', 'txt' => str_replace("\\n", '%0A', sprintf($lng->txt('session_reminder_alert'), ilFormat::_secondsToString($expiretime - time()), $formatted_expiration_time, $ilClientIniFile->readVariable('client', 'name') . ' | ' . ilUtil::_getHttpPath())), 'remind' => true); return ilJsonUtil::encode($response); }
public static function authenticate() { global $ilAuth, $ilias, $ilErr, $ilUser; $oldSid = session_id(); // error_log(">> init authenticate " . $oldSid); $ilAuth->start(); $ilias->setAuthError($ilErr->getLastError()); if ($ilAuth->getAuth() && $ilAuth->getStatus() == '') { error_log(">> init authenticate no session?"); if (ilSession::get("AccountId")) { // ensure that web users have access to the services self::initUserAccount(); } // self::initUserAccount(); // // self::handleAuthenticationSuccess(); } // // error_log(">> init authenticate user is: " . $ilUser->getId()); }
/** * @param bool|null $status * @return void|bool */ public function hasToAcceptTermsOfServiceInSession($status = null) { if (null === $status) { return ilSession::get('has_to_accept_agr_in_session'); } require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php'; if (ilTermsOfServiceHelper::isEnabled()) { ilSession::set('has_to_accept_agr_in_session', (int) $status); } }
protected function adminSync() { global $ilCtrl, $lng; // see ilSession::_writeData() $now = time(); ilSession::_destroyExpiredSessions(); ilSessionStatistics::aggretateRaw($now); ilUtil::sendSuccess($lng->txt("trac_sync_session_stats_success"), true); $ilCtrl->redirect($this); }
/** * Detail view of a mail */ public function showMail() { /** * @var $ilUser ilObjUser * @var $ilToolbar ilToolbarGUI * @var $ilTabs ilTabsGUI */ global $ilUser, $ilToolbar, $ilTabs; if ($_SESSION['mail_id']) { $_GET['mail_id'] = $_SESSION['mail_id']; $_SESSION['mail_id'] = ''; } $ilTabs->clearTargets(); $ilTabs->setBackTarget($this->lng->txt('back_to_folder'), $this->ctrl->getFormAction($this, 'showFolder')); $this->umail->markRead(array((int) $_GET['mail_id'])); $mailData = $this->umail->getMail((int) $_GET['mail_id']); $this->tpl->setTitle($this->lng->txt('mail_mails_of')); require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setPreventDoubleSubmission(false); $form->setTableWidth('100%'); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $form->setFormAction($this->ctrl->getFormAction($this, 'showMail')); $this->ctrl->clearParameters($this); $form->setTitle($this->lng->txt('mail_mails_of')); if ('tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) { $this->tpl->setVariable('FORM_TARGET', ilFrameTargetInfo::_getFrame('MainContent')); } include_once 'Services/Accessibility/classes/class.ilAccessKeyGUI.php'; /** * @var $sender ilObjUser */ $sender = ilObjectFactory::getInstanceByObjId($mailData['sender_id'], false); if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) { $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'reply'); $this->ctrl->clearParametersByClass('iliasmailformgui'); $ilToolbar->addButton($this->lng->txt('reply'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::REPLY); $this->ctrl->clearParameters($this); } $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'forward'); $this->ctrl->clearParametersByClass('iliasmailformgui'); $ilToolbar->addButton($this->lng->txt('forward'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::FORWARD_MAIL); $this->ctrl->clearParameters($this); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $ilToolbar->addButton($this->lng->txt('print'), $this->ctrl->getLinkTarget($this, 'printMail'), '_blank'); $this->ctrl->clearParameters($this); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameter($this, 'selected_cmd', 'deleteMails'); $ilToolbar->addButton($this->lng->txt('delete'), $this->ctrl->getLinkTarget($this), '', ilAccessKey::DELETE); $this->ctrl->clearParameters($this); if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) { $linked_fullname = $sender->getPublicName(); $picture = ilUtil::img($sender->getPersonalPicturePath('xsmall'), $sender->getPublicName()); $add_to_addb_button = ''; if (in_array(ilObjUser::_lookupPref($sender->getId(), 'public_profile'), array('y', 'g'))) { $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameter($this, 'user', $sender->getId()); $linked_fullname = '<br /><a href="' . $this->ctrl->getLinkTarget($this, 'showUser') . '" title="' . $linked_fullname . '">' . $linked_fullname . '</a>'; $this->ctrl->clearParameters($this); } if ($sender->getId() != $ilUser->getId()) { require_once 'Services/Contact/classes/class.ilAddressbook.php'; $abook = new ilAddressbook($ilUser->getId()); if ($abook->checkEntryByLogin($sender->getLogin()) == 0) { $tplbtn = new ilTemplate('tpl.buttons.html', true, true); $tplbtn->setCurrentBlock('btn_cell'); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $tplbtn->setVariable('BTN_LINK', $this->ctrl->getLinkTarget($this, 'add')); $this->ctrl->clearParameters($this); $tplbtn->setVariable('BTN_TXT', $this->lng->txt('mail_add_to_addressbook')); $tplbtn->parseCurrentBlock(); $add_to_addb_button = '<br />' . $tplbtn->get(); } } $from = new ilCustomInputGUI($this->lng->txt('from')); $from->setHtml($picture . ' ' . $linked_fullname . $add_to_addb_button); $form->addItem($from); } else { if (!$sender || !$sender->getId()) { $from = new ilCustomInputGUI($this->lng->txt('from')); $from->setHtml($mailData['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')'); $form->addItem($from); } else { $from = new ilCustomInputGUI($this->lng->txt('from')); $from->setHtml(ilUtil::img(ilUtil::getImagePath('HeaderIconAvatar.svg'), ilMail::_getIliasMailerName()) . '<br />' . ilMail::_getIliasMailerName()); $form->addItem($from); } } $to = new ilCustomInputGUI($this->lng->txt('mail_to')); $to->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_to']), false)); $form->addItem($to); if ($mailData['rcp_cc']) { $cc = new ilCustomInputGUI($this->lng->txt('cc')); $cc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_cc']), false)); $form->addItem($cc); } if ($mailData['rcp_bcc']) { $bcc = new ilCustomInputGUI($this->lng->txt('bc')); $bcc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_bcc']), false)); $form->addItem($bcc); } $subject = new ilCustomInputGUI($this->lng->txt('subject')); $subject->setHtml(ilUtil::htmlencodePlainString($mailData['m_subject'], true)); $form->addItem($subject); $date = new ilCustomInputGUI($this->lng->txt('date')); $date->setHtml(ilDatePresentation::formatDate(new ilDateTime($mailData['send_time'], IL_CAL_DATETIME))); $form->addItem($date); $message = new ilCustomInputGUI($this->lng->txt('message')); $message->setHtml(ilUtil::htmlencodePlainString($mailData['m_message'], true)); $form->addItem($message); if ($mailData['attachments']) { $att = new ilCustomInputGUI($this->lng->txt('attachments')); $radiog = new ilRadioGroupInputGUI('', 'filename'); foreach ($mailData['attachments'] as $file) { $radiog->addOption(new ilRadioOption($file, md5($file))); } $att->setHtml($radiog->render()); $form->addCommandButton('deliverFile', $this->lng->txt('download')); $form->addItem($att); } $isTrashFolder = false; if ($this->mbox->getTrashFolder() == $_GET['mobj_id']) { $isTrashFolder = true; } $current_folder_data = $this->mbox->getFolderData((int) $_GET['mobj_id']); $selectOptions = array(); $actions = $this->mbox->getActions((int) $_GET["mobj_id"]); foreach ($actions as $key => $action) { if ($key == 'moveMails') { $folders = $this->mbox->getSubFolders(); foreach ($folders as $folder) { if (($folder["type"] != 'trash' || !$isTrashFolder) && $folder['obj_id'] != $current_folder_data['obj_id']) { $optionText = ''; if ($folder['type'] != 'user_folder') { $optionText = $action . ' ' . $this->lng->txt('mail_' . $folder['title']) . ($folder['type'] == 'trash' ? ' (' . $this->lng->txt('delete') . ')' : ''); } else { $optionText = $action . ' ' . $folder['title']; } $selectOptions[$folder['obj_id']] = $optionText; } } } } if ($current_folder_data['type'] == 'user_folder') { $txt_folder = $current_folder_data['title']; } else { $txt_folder = $this->lng->txt('mail_' . $current_folder_data['title']); } $ilToolbar->addSeparator(); $ilToolbar->addText(sprintf($this->lng->txt('current_folder'), $txt_folder)); if (is_array($selectOptions) && count($selectOptions)) { include_once 'Services/Form/classes/class.ilSelectInputGUI.php'; $actions = new ilSelectInputGUI('', 'selected_cmd'); $actions->setOptions($selectOptions); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'showMail')); $ilToolbar->addInputItem($actions); $ilToolbar->addFormButton($this->lng->txt('submit'), 'changeFolder'); } // Navigation $prevMail = $this->umail->getPreviousMail((int) $_GET['mail_id']); $nextMail = $this->umail->getNextMail((int) $_GET['mail_id']); if (is_array($prevMail) || is_array($nextMail)) { $ilToolbar->addSeparator(); if ($prevMail['mail_id']) { $this->ctrl->setParameter($this, 'mail_id', $prevMail['mail_id']); $ilToolbar->addButton($this->lng->txt('previous'), $this->ctrl->getLinkTarget($this, 'showMail')); $this->ctrl->clearParameters($this); } if ($nextMail['mail_id']) { $this->ctrl->setParameter($this, 'mail_id', $nextMail['mail_id']); $ilToolbar->addButton($this->lng->txt('next'), $this->ctrl->getLinkTarget($this, 'showMail')); $this->ctrl->clearParameters($this); } } $this->tpl->setContent($form->getHTML()); $this->tpl->show(); }
/** * cancel deletion of export files */ function cancelDeleteExportFile() { ilSession::clear("ilExportFiles"); $this->ctrl->redirect($this, "showExportList"); }
protected function deleteOwnAccountLogout() { global $ilAuth, $ilUser; // we are setting the flag and ending the session in the same step $ilUser->activateDeletionFlag(); // see ilStartupGUI::showLogout() ilSession::setClosingContext(ilSession::SESSION_CLOSE_USER); $ilAuth->logout(); session_destroy(); ilUtil::redirect("login.php?target=usr_" . md5("usrdelown")); }
protected function initSessionStorage() { $sess = ilSession::get('frm'); if (!is_array($sess)) { $sess = array(); ilSession::set('frm', $sess); } if (isset($_GET['thr_fk']) && !is_array($sess[(int) $_GET['thr_fk']])) { $sess[(int) $_GET['thr_fk']] = array(); ilSession::set('frm', $sess); } }
/** * cancel deletion of export files */ public function cancelDeleteExportFileObject() { ilSession::clear("ilExportFiles"); $this->ctrl->redirect($this, "export"); }
function initIlias($context = "web") { global $ilDB, $ilUser, $ilLog, $ilErr, $ilClientIniFile, $ilIliasIniFile, $ilSetting, $ilias, $https, $ilObjDataCache, $ilLog, $objDefinition, $lng, $ilCtrl, $ilBrowser, $ilHelp, $ilTabs, $ilMainMenu, $rbacsystem, $ilNavigationHistory; // remove unsafe characters $this->removeUnsafeCharacters(); // error reporting // remove notices from error reporting if (version_compare(PHP_VERSION, '5.3.0', '>=')) { error_reporting(ini_get("error_reporting") & ~E_NOTICE & ~E_DEPRECATED); } else { error_reporting(ini_get('error_reporting') & ~E_NOTICE); } // include common code files $this->requireCommonIncludes(); global $ilBench; // set error handler (to do: check preconditions for error handler to work) $ilBench->start("Core", "HeaderInclude_GetErrorHandler"); $ilErr = new ilErrorHandling(); $GLOBALS['ilErr'] =& $ilErr; $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler')); $ilBench->stop("Core", "HeaderInclude_GetErrorHandler"); // prepare file access to work with safe mode (has been done in class ilias before) umask(0117); // set cookie params $this->setCookieParams(); // $ilIliasIniFile initialisation $this->initIliasIniFile(); // CLIENT_ID determination $this->determineClient(); // $ilAppEventHandler initialisation $this->initEventHandling(); // $ilClientIniFile initialisation $this->initClientIniFile(); // removed redirection madness the service should respond with SERVICE UNAVAILABLE // $ilDB initialisation $this->initDatabase(); // init plugin admin class include_once "Services/Component/classes/class.ilPluginAdmin.php"; $ilPluginAdmin = new ilPluginAdmin(); $GLOBALS['ilPluginAdmin'] = $ilPluginAdmin; // set session handler $this->setSessionHandler(); // $ilSetting initialisation $this->initSettings(); // $ilLog initialisation $this->initLog(); // $https initialisation require_once 'classes/class.ilHTTPS.php'; $https = new ilHTTPS(); $GLOBALS['https'] =& $https; $https->enableSecureCookies(); $https->checkPort(); if ($this->returnBeforeAuth()) { return; } $ilCtrl = new ilCtrl2(); $GLOBALS['ilCtrl'] =& $ilCtrl; // $ilAuth initialisation include_once "Services/Authentication/classes/class.ilAuthUtils.php"; ilAuthUtils::_initAuth(); global $ilAuth; $this->includePhp5Compliance(); // Do not accept external session ids if (!ilSession::_exists(session_id())) { // $_GET["PHPSESSID"] = ""; session_regenerate_id(); } // $ilias initialisation global $ilias, $ilBench; $ilBench->start("Core", "HeaderInclude_GetILIASObject"); $ilias = new ILIAS(); $GLOBALS['ilias'] =& $ilias; $ilBench->stop("Core", "HeaderInclude_GetILIASObject"); // $ilObjDataCache initialisation $ilObjDataCache = new ilObjectDataCache(); $GLOBALS['ilObjDataCache'] =& $ilObjDataCache; // workaround: load old post variables if error handler 'message' was called if (isset($_SESSION["message"]) && $_SESSION["message"]) { $_POST = $_SESSION["post_vars"]; } // put debugging functions here require_once "include/inc.debug.php"; // $objDefinition initialisation $ilBench->start("Core", "HeaderInclude_getObjectDefinitions"); $objDefinition = new ilObjectDefinition(); $GLOBALS['objDefinition'] =& $objDefinition; // $objDefinition->startParsing(); $ilBench->stop("Core", "HeaderInclude_getObjectDefinitions"); // init tree $tree = new ilTree(ROOT_FOLDER_ID); $GLOBALS['tree'] =& $tree; // $ilAccess and $rbac... initialisation $this->initAccessHandling(); // authenticate & start session PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, "errorHandler")); $ilBench->start("Core", "HeaderInclude_Authentication"); //var_dump($_SESSION); ////require_once('Log.php'); ////$ilAuth->logger = Log::singleton('error_log',PEAR_LOG_TYPE_SYSTEM,'TEST'); ////$ilAuth->enableLogging = true; if (!defined("IL_PHPUNIT_TEST")) { $oldSid = session_id(); $ilAuth->start(); $newSid = session_id(); include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php'; ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid); } //var_dump($_SESSION); $ilias->setAuthError($ilErr->getLastError()); $ilBench->stop("Core", "HeaderInclude_Authentication"); // workaround: force login if (!empty($_GET["cmd"]) && $_GET["cmd"] == "force_login" || $this->script == "login.php") { $ilAuth->logout(); if (!isset($_GET['forceShoppingCartRedirect'])) { $_SESSION = array(); } $_SESSION["AccountId"] = ""; $ilAuth->start(); $ilias->setAuthError($ilErr->getLastError()); } // check correct setup if (!$ilias->getSetting("setup_ok")) { die("Setup is not completed. Please run setup routine again."); } // $ilUser initialisation (1) $ilBench->start("Core", "HeaderInclude_getCurrentUser"); $ilUser = new ilObjUser(); $ilias->account =& $ilUser; $GLOBALS['ilUser'] =& $ilUser; $ilBench->stop("Core", "HeaderInclude_getCurrentUser"); // $ilCtrl initialisation //$ilCtrl = new ilCtrl(); // determin current script and up-path to main directory // (sets $this->script and $this->updir) $this->determineScriptAndUpDir(); // $styleDefinition initialisation and style handling for login and co. $this->initStyle(); if (in_array($this->script, array("login.php", "register.php", "view_usr_agreement.php")) || $_GET["baseClass"] == "ilStartUpGUI") { $this->handleStyle(); } // init locale $this->initLocale(); // handle ILIAS 2 imported users: // check ilias 2 password, if authentication failed // only if AUTH_LOCAL //echo "A"; if (AUTH_CURRENT == AUTH_LOCAL && !$ilAuth->getAuth() && $this->script == "login.php" && $_POST["username"] != "") { if (ilObjUser::_lookupHasIlias2Password(ilUtil::stripSlashes($_POST["username"]))) { if (ilObjUser::_switchToIlias3Password(ilUtil::stripSlashes($_POST["username"]), ilUtil::stripSlashes($_POST["password"]))) { $ilAuth->start(); $ilias->setAuthError($ilErr->getLastError()); ilUtil::redirect("index.php"); } } } // // SUCCESSFUL AUTHENTICATION // if ($ilAuth->getStatus() == '' && $ilias->account->isCurrentUserActive() || defined("IL_PHPUNIT_TEST") && DEVMODE) { //echo "C"; exit; $ilBench->start("Core", "HeaderInclude_getCurrentUserAccountData"); //var_dump($_SESSION); // get user data $this->initUserAccount(); //var_dump($_SESSION); // differentiate account security mode require_once 'Services/PrivacySecurity/classes/class.ilSecuritySettings.php'; $security_settings = ilSecuritySettings::_getInstance(); if ($security_settings->getAccountSecurityMode() == ilSecuritySettings::ACCOUNT_SECURITY_MODE_CUSTOMIZED) { // reset counter for failed logins ilObjUser::_resetLoginAttempts($ilUser->getId()); } $ilBench->stop("Core", "HeaderInclude_getCurrentUserAccountData"); } else { if (!$ilAuth->getAuth()) { require_once 'Services/PrivacySecurity/classes/class.ilSecuritySettings.php'; // differentiate account security mode $security = ilSecuritySettings::_getInstance(); if ($security->getAccountSecurityMode() == ilSecuritySettings::ACCOUNT_SECURITY_MODE_CUSTOMIZED) { if (isset($_POST['username']) && $_POST['username'] && $ilUser->getId() == 0) { $username = ilUtil::stripSlashes($_POST['username']); $usr_id = ilObjUser::_lookupId($username); if ($usr_id != ANONYMOUS_USER_ID) { ilObjUser::_incrementLoginAttempts($usr_id); $login_attempts = ilObjUser::_getLoginAttempts($usr_id); $max_attempts = $security->getLoginMaxAttempts(); if ($login_attempts >= $max_attempts && $usr_id != SYSTEM_USER_ID && $max_attempts > 0) { ilObjUser::_setUserInactive($usr_id); } } } } } } // // SUCCESSFUL AUTHENTICATED or NON-AUTH-AREA (Login, Registration, ...) // // $lng initialisation $this->initLanguage(); // store user language in tree $GLOBALS['tree']->initLangCode(); // ### AA 03.10.29 added new LocatorGUI class ### // when locator data array does not exist, initialise if (!isset($_SESSION["locator_level"])) { $_SESSION["locator_data"] = array(); $_SESSION["locator_level"] = -1; } // initialise global ilias_locator object // ECS Tasks include_once 'Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php'; $scheduler = ilECSTaskScheduler::start(); $ilBench->stop("Core", "HeaderInclude"); }
/** * cancel deletion of classroom object * * @access public */ function cancelDeleteClassroom() { ilSession::clear("saved_post"); ilUtil::sendInfo($this->lng->txt("msg_cancel"), true); $this->ctrl->redirectByClass("ilobjilinccoursegui"); }
public static function infoPanel($a_keep = true) { global $tpl, $ilias, $lng; if (!empty($_SESSION["infopanel"]) and is_array($_SESSION["infopanel"])) { $tpl->addBlockFile("INFOPANEL", "infopanel", "tpl.infopanel.html", "Services/Utilities"); $tpl->setCurrentBlock("infopanel"); if (!empty($_SESSION["infopanel"]["text"])) { $link = "<a href=\"" . $dir . $_SESSION["infopanel"]["link"] . "\" target=\"" . ilFrameTargetInfo::_getFrame("MainContent") . "\">"; $link .= $lng->txt($_SESSION["infopanel"]["text"]); $link .= "</a>"; } // deactivated if (!empty($_SESSION["infopanel"]["img"])) { $link .= "<td><a href=\"" . $_SESSION["infopanel"]["link"] . "\" target=\"" . ilFrameTargetInfo::_getFrame("MainContent") . "\">"; $link .= "<img src=\"" . $ilias->tplPath . $ilias->account->prefs["skin"] . "/images/" . $_SESSION["infopanel"]["img"] . "\" border=\"0\" vspace=\"0\"/>"; $link .= "</a></td>"; } $tpl->setVariable("INFO_ICONS", $link); $tpl->parseCurrentBlock(); } //if (!$a_keep) //{ ilSession::clear("infopanel"); //} }
public function getPlayer() { global $ilUser, $lng, $ilias, $ilSetting; // player basic config data $initSuspendData = null; $initAdlactData = null; if ($this->slm->getSequencing() == true) { $initSuspendData = json_decode($this->getSuspendDataInit()); $initAdlactData = json_decode($this->getADLActDataInit()); $initGlobalobjData = $this->readGObjectiveInit(); } $config = $this->getConfigForPlayer(); //session if ($this->slm->getSession()) { // $session_timeout = (int)($ilias->ini->readVariable("session","expire"))/2; $session_timeout = (int) ilSession::getIdleValue() / 2; } else { $session_timeout = 0; } $config['session_ping'] = $session_timeout; //url strings $store_url = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=cmi&ref_id=' . $_GET["ref_id"]; $unload_url = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=scormPlayerUnload&ref_id=' . $_GET["ref_id"]; if ($this->slm->getSessionDeactivated()) { $store_url = 'storeScorm2004.php?package_id=' . $this->packageId . '&ref_id=' . $_GET["ref_id"] . '&client_id=' . $this->ilias->client_id . '&do=store'; $unload_url = 'storeScorm2004.php?package_id=' . $this->packageId . '&ref_id=' . $_GET["ref_id"] . '&client_id=' . $this->ilias->client_id . '&do=unload'; } $config['cp_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=cp&ref_id=' . $_GET["ref_id"]; $config['cmi_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=cmi&ref_id=' . $_GET["ref_id"]; $config['store_url'] = $store_url; $config['get_adldata_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=getSharedData&ref_id=' . $_GET["ref_id"]; $config['set_adldata_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=setSharedData&ref_id=' . $_GET["ref_id"]; $config['adlact_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=adlact&ref_id=' . $_GET["ref_id"]; $config['specialpage_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=specialPage&ref_id=' . $_GET["ref_id"]; $config['suspend_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=suspend&ref_id=' . $_GET["ref_id"]; $config['get_suspend_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=getSuspend&ref_id=' . $_GET["ref_id"]; //next 2 lines could be deleted later $config['gobjective_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=gobjective&ref_id=' . $_GET["ref_id"]; $config['get_gobjective_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=getGobjective&ref_id=' . $_GET["ref_id"]; $config['ping_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=pingSession&ref_id=' . $_GET["ref_id"]; $config['scorm_player_unload_url'] = $unload_url; $config['post_log_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=postLogEntry&ref_id=' . $_GET["ref_id"]; $config['livelog_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=liveLogContent&ref_id=' . $_GET["ref_id"]; $config['package_url'] = $this->getDataDirectory() . "/"; //editor $config['envEditor'] = $this->envEditor; //debug $config['debug'] = $this->slm->getDebug(); $config['debug_fields'] = $this->getDebugValues(); $config['debug_fields_test'] = $this->getDebugValues(true); //language strings $langstrings['btnStart'] = $lng->txt('scplayer_start'); $langstrings['btnExit'] = $lng->txt('scplayer_exit'); $langstrings['btnExitAll'] = $lng->txt('scplayer_exitall'); $langstrings['btnSuspendAll'] = $lng->txt('scplayer_suspendall'); $langstrings['btnPrevious'] = $lng->txt('scplayer_previous'); $langstrings['btnContinue'] = $lng->txt('scplayer_continue'); $langstrings['btnhidetree'] = $lng->txt('scplayer_hidetree'); $langstrings['btnshowtree'] = $lng->txt('scplayer_showtree'); $langstrings['linkexpandTree'] = $lng->txt('scplayer_expandtree'); $langstrings['linkcollapseTree'] = $lng->txt('scplayer_collapsetree'); $config['langstrings'] = $langstrings; //template variables //$this->tpl = new ilTemplate("tpl.scorm2004.player.html", false, false, "Modules/Scorm2004"); $this->tpl = new ilTemplate("tpl.scorm2004.player.html", true, true, "Modules/Scorm2004"); // include ilias rte css, if given $rte_css = $this->slm->getDataDirectory() . "/ilias_css_4_2/css/style.css"; if (is_file($rte_css)) { $this->tpl->setCurrentBlock("rte_css"); $this->tpl->setVariable("RTE_CSS", $rte_css); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable('JSON_LANGSTRINGS', json_encode($langstrings)); include_once "./Services/YUI/classes/class.ilYuiUtil.php"; $this->tpl->setVariable('YUI_PATH', ilYuiUtil::getLocalPath()); $this->tpl->setVariable('TREE_JS', "./Services/UIComponent/NestedList/js/ilNestedList.js"); $this->tpl->setVariable($langstrings); $this->tpl->setVariable('DOC_TITLE', 'ILIAS SCORM 2004 Player'); if ($this->slm->getIe_compatibility()) { $this->tpl->setVariable('IE_COMPATIBILITY', '<meta http-equiv="X-UA-Compatible" content="IE=7" />'); } $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $this->tpl->setVariable('INIT_CP_DATA', json_encode(json_decode($this->getCPDataInit()))); $this->tpl->setVariable('INIT_CMI_DATA', json_encode($this->getCMIData($this->userId, $this->packageId))); $this->tpl->setVariable('INIT_ADLACT_DATA', json_encode($initAdlactData)); $this->tpl->setVariable('INIT_GLOBALOBJ_DATA', json_encode($initGlobalobjData)); $this->tpl->setVariable('JS_DATA', json_encode($config)); list($tsfrac, $tsint) = explode(' ', microtime()); $this->tpl->setVariable('TIMESTAMP', sprintf('%d%03d', $tsint, 1000 * (double) $tsfrac)); $this->tpl->setVariable('BASE_DIR', './Modules/Scorm2004/'); $this->tpl->setVariable('TXT_COLLAPSE', $lng->txt('scplayer_collapsetree')); if ($this->slm->getDebug()) { $this->tpl->setVariable('TXT_DEBUGGER', $lng->txt('scplayer_debugger')); $this->tpl->setVariable('DEBUG_URL', "PopupCenter('ilias.php?baseClass=ilSAHSPresentationGUI&cmd=debugGUI&ref_id=" . $_GET["ref_id"] . "','Debug',800,600);"); } else { $this->tpl->setVariable('TXT_DEBUGGER', ''); $this->tpl->setVariable('DEBUG_URL', ''); } //set icons path $this->tpl->setVariable('INLINE_CSS', ilSCORM13Player::getInlineCss()); //include scripts if ($this->slm->getCacheDeactivated()) { $this->tpl->setVariable('JS_SCRIPTS', 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=getRTEjs&ref_id=' . $_GET["ref_id"]); } else { $this->tpl->setVariable('JS_SCRIPTS', './Modules/Scorm2004/scripts/buildrte/rte-min.js'); } //disable top menu if ($this->slm->getNoMenu() == "y") { $this->tpl->setVariable("VAL_DISPLAY", "style=\"display:none;\""); } else { $this->tpl->setVariable("VAL_DISPLAY", ""); } //check for max_attempts and raise error if max_attempts is exceeded if ($this->get_max_attempts() != 0) { if ($this->get_actual_attempts() >= $this->get_max_attempts()) { header('Content-Type: text/html; charset=utf-8'); echo $lng->txt("cont_sc_max_attempt_exceed"); exit; } } //count attempt $this->increase_attemptAndsave_module_version(); $this->resetSharedData(); $this->tpl->show("DEFAULT", false); }
/** * set closing context (for statistics) * * @param int $a_context */ public static function setClosingContext($a_context) { self::$closing_context = (int) $a_context; }
/** * init general settings form * @return */ protected function initFormGeneralSettings() { global $ilSetting; $this->setSubTabs('settings'); $this->tabs_gui->setTabActive('settings'); $this->tabs_gui->setSubTabActive('general_settings'); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveGeneralSettings')); $this->form->setTitle($this->lng->txt('general_settings')); $lua = new ilCheckboxInputGUI($this->lng->txt('enable_local_user_administration'), 'lua'); $lua->setInfo($this->lng->txt('enable_local_user_administration_info')); $lua->setValue(1); $this->form->addItem($lua); $lrua = new ilCheckboxInputGUI($this->lng->txt('restrict_user_access'), 'lrua'); $lrua->setInfo($this->lng->txt('restrict_user_access_info')); $lrua->setValue(1); $this->form->addItem($lrua); // enable alphabetical navigation in user administration $alph = new ilCheckboxInputGUI($this->lng->txt('user_adm_enable_alpha_nav'), 'user_adm_alpha_nav'); //$alph->setInfo($this->lng->txt('restrict_user_access_info')); $alph->setValue(1); $this->form->addItem($alph); // account codes $code = new ilCheckboxInputGUI($this->lng->txt("user_account_code_setting"), "user_reactivate_code"); $code->setInfo($this->lng->txt('user_account_code_setting_info')); $this->form->addItem($code); // delete own account $own = new ilCheckboxInputGUI($this->lng->txt("user_allow_delete_own_account"), "user_own_account"); $this->form->addItem($own); $own_email = new ilEMailInputGUI($this->lng->txt("user_delete_own_account_notification_email"), "user_own_account_email"); $own->addSubItem($own_email); // BEGIN SESSION SETTINGS // create session handling radio group $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type'); // first option, fixed session duration $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED); // create session reminder subform $cb = new ilCheckboxInputGUI($this->lng->txt("session_reminder"), "session_reminder_enabled"); $expires = ilSession::getSessionExpireValue(); $time = ilFormat::_secondsToString($expires, true); $cb->setInfo($this->lng->txt("session_reminder_info") . "<br />" . sprintf($this->lng->txt('session_reminder_session_duration'), $time)); $fixed->addSubItem($cb); // add session handling to radio group $ssettings->addOption($fixed); // second option, session control $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT); // add session control subform require_once 'Services/Authentication/classes/class.ilSessionControl.php'; // this is the max count of active sessions // that are getting started simlutanously $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_count'), 'session_max_count'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_max_count_info')); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // after this (min) idle time the session can be deleted, // if there are further requests for new sessions, // but max session count is reached yet $sub_ti = new ilTextInputGUI($this->lng->txt('session_min_idle'), 'session_min_idle'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_min_idle_info')); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // after this (max) idle timeout the session expires // and become invalid, so it is not considered anymore // when calculating current count of active sessions $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle'), 'session_max_idle'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_max_idle_info')); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // this is the max duration that can elapse between the first and the secnd // request to the system before the session is immidietly deleted $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle_after_first_request'), 'session_max_idle_after_first_request'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_max_idle_after_first_request_info')); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // add session control to radio group $ssettings->addOption($ldsh); // add radio group to form if ($ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { // just shows the status wether the session //setting maintenance is allowed by setup $this->form->addItem($ssettings); } else { // just shows the status wether the session //setting maintenance is allowed by setup $ti = new ilNonEditableValueGUI($this->lng->txt('session_config'), "session_config"); $ti->setValue($this->lng->txt('session_config_maintenance_disabled')); $ssettings->setDisabled(true); $ti->addSubItem($ssettings); $this->form->addItem($ti); } // END SESSION SETTINGS $this->lng->loadLanguageModule('ps'); $pass = new ilFormSectionHeaderGUI(); $pass->setTitle($this->lng->txt('ps_password_settings')); $this->form->addItem($pass); // password generation $cb = new ilCheckboxInputGUI($this->lng->txt("passwd_generation"), "passwd_auto_generate"); $cb->setChecked($ilSetting->get("passwd_auto_generate")); $cb->setInfo($this->lng->txt("passwd_generation_info")); $this->form->addItem($cb); $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_change_on_first_login_enabled'), 'password_change_on_first_login_enabled'); $check->setInfo($this->lng->txt('ps_password_change_on_first_login_enabled_info')); $this->form->addItem($check); include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php'; $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_must_not_contain_loginame'), 'password_must_not_contain_loginame'); $check->setInfo($this->lng->txt('ps_password_must_not_contain_loginame_info')); $this->form->addItem($check); $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_chars_and_numbers_enabled'), 'password_chars_and_numbers_enabled'); //$check->setOptionTitle($this->lng->txt('ps_password_chars_and_numbers_enabled')); $check->setInfo($this->lng->txt('ps_password_chars_and_numbers_enabled_info')); $this->form->addItem($check); $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_special_chars_enabled'), 'password_special_chars_enabled'); //$check->setOptionTitle($this->lng->txt('ps_password_special_chars_enabled')); $check->setInfo($this->lng->txt('ps_password_special_chars_enabled_info')); $this->form->addItem($check); $text = new ilNumberInputGUI($this->lng->txt('ps_password_min_length'), 'password_min_length'); $text->setInfo($this->lng->txt('ps_password_min_length_info')); $text->setSize(1); $text->setMaxLength(2); $this->form->addItem($text); $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_length'), 'password_max_length'); $text->setInfo($this->lng->txt('ps_password_max_length_info')); $text->setSize(2); $text->setMaxLength(3); $this->form->addItem($text); $text = new ilNumberInputGUI($this->lng->txt('ps_password_uppercase_chars_num'), 'password_ucase_chars_num'); $text->setInfo($this->lng->txt('ps_password_uppercase_chars_num_info')); $text->setMinValue(0); $text->setSize(2); $text->setMaxLength(3); $this->form->addItem($text); $text = new ilNumberInputGUI($this->lng->txt('ps_password_lowercase_chars_num'), 'password_lowercase_chars_num'); $text->setInfo($this->lng->txt('ps_password_lowercase_chars_num_info')); $text->setMinValue(0); $text->setSize(2); $text->setMaxLength(3); $this->form->addItem($text); $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_age'), 'password_max_age'); $text->setInfo($this->lng->txt('ps_password_max_age_info')); $text->setSize(2); $text->setMaxLength(3); $this->form->addItem($text); // password assistance $cb = new ilCheckboxInputGUI($this->lng->txt("enable_password_assistance"), "password_assistance"); $cb->setInfo($this->lng->txt("password_assistance_info")); $this->form->addItem($cb); $pass = new ilFormSectionHeaderGUI(); $pass->setTitle($this->lng->txt('ps_security_protection')); $this->form->addItem($pass); $text = new ilNumberInputGUI($this->lng->txt('ps_login_max_attempts'), 'login_max_attempts'); $text->setInfo($this->lng->txt('ps_login_max_attempts_info')); $text->setSize(1); $text->setMaxLength(2); $this->form->addItem($text); // prevent login from multiple pcs at the same time $objCb = new ilCheckboxInputGUI($this->lng->txt('ps_prevent_simultaneous_logins'), 'ps_prevent_simultaneous_logins'); $objCb->setValue(1); $objCb->setInfo($this->lng->txt('ps_prevent_simultaneous_logins_info')); $this->form->addItem($objCb); $log = new ilFormSectionHeaderGUI(); $log->setTitle($this->lng->txt('loginname_settings')); $this->form->addItem($log); $chbChangeLogin = new ilCheckboxInputGUI($this->lng->txt('allow_change_loginname'), 'allow_change_loginname'); $chbChangeLogin->setValue(1); $this->form->addItem($chbChangeLogin); $chbCreateHistory = new ilCheckboxInputGUI($this->lng->txt('history_loginname'), 'create_history_loginname'); $chbCreateHistory->setInfo($this->lng->txt('loginname_history_info')); $chbCreateHistory->setValue(1); $chbChangeLogin->addSubItem($chbCreateHistory); $chbReuseLoginnames = new ilCheckboxInputGUI($this->lng->txt('reuse_of_loginnames_contained_in_history'), 'reuse_of_loginnames'); $chbReuseLoginnames->setValue(1); $chbReuseLoginnames->setInfo($this->lng->txt('reuse_of_loginnames_contained_in_history_info')); $chbChangeLogin->addSubItem($chbReuseLoginnames); $chbChangeBlockingTime = new ilNumberInputGUI($this->lng->txt('loginname_change_blocking_time'), 'loginname_change_blocking_time'); $chbChangeBlockingTime->allowDecimals(true); $chbChangeBlockingTime->setSuffix($this->lng->txt('days')); $chbChangeBlockingTime->setInfo($this->lng->txt('loginname_change_blocking_time_info')); $chbChangeBlockingTime->setSize(10); $chbChangeBlockingTime->setMaxLength(10); $chbChangeLogin->addSubItem($chbChangeBlockingTime); $this->form->addCommandButton('saveGeneralSettings', $this->lng->txt('save')); }
protected function isTestSignRedirectRequired($activeId, $lastFinishedPass) { if (!$this->object->getSignSubmission()) { return false; } if (!is_null(ilSession::get("signed_{$activeId}_{$lastFinishedPass}"))) { return false; } global $ilPluginAdmin; $activePlugins = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, 'Test', 'tsig'); if (!count($activePlugins)) { return false; } return true; }
/** * Check permission and redirect on error * * @param string $a_perm * @param string $a_cmd * @param string $a_type * @param int $a_ref_id * @return bool */ protected function checkPermission($a_perm, $a_cmd = "", $a_type = "", $a_ref_id = null) { if (!$this->checkPermissionBool($a_perm, $a_cmd, $a_type, $a_ref_id)) { if (!is_int(strpos($_SERVER["PHP_SELF"], "goto.php"))) { // create: redirect to parent if ($a_perm == "create") { if (!$a_ref_id) { $a_ref_id = $_GET["ref_id"]; } $type = ilObject::_lookupType($a_ref_id, true); } else { // does this make sense? if (!is_object($this->object)) { return; } if (!$a_ref_id) { $a_ref_id = $this->object->getRefId(); } $type = $this->object->getType(); } ilSession::clear("il_rep_ref_id"); ilUtil::sendFailure($this->lng->txt("permission_denied"), true); ilUtil::redirect("goto.php?target=" . $type . "_" . $a_ref_id); } else { die("Permission Denied."); } } }
/** * Save personal data form * */ public function savePersonalData() { global $tpl, $lng, $ilCtrl, $ilUser, $ilSetting, $ilAuth; $this->initPersonalDataForm(); if ($this->form->checkInput()) { $form_valid = true; // if form field name differs from setter $map = array("firstname" => "FirstName", "lastname" => "LastName", "title" => "UTitle", "sel_country" => "SelectedCountry", "phone_office" => "PhoneOffice", "phone_home" => "PhoneHome", "phone_mobile" => "PhoneMobile", "referral_comment" => "Comment", "interests_general" => "GeneralInterests", "interests_help_offered" => "OfferingHelp", "interests_help_looking" => "LookingForHelp"); include_once "./Services/User/classes/class.ilUserProfile.php"; $up = new ilUserProfile(); foreach ($up->getStandardFields() as $f => $p) { // if item is part of form, it is currently valid (if not disabled) $item = $this->form->getItemByPostVar("usr_" . $f); if ($item && !$item->getDisabled()) { $value = $this->form->getInput("usr_" . $f); switch ($f) { case "birthday": if (is_array($value)) { if (is_array($value['date'])) { if ($value['d'] > 0 && $value['m'] > 0 && $value['y'] > 0) { $ilUser->setBirthday(sprintf("%04d-%02d-%02d", $value['y'], $value['m'], $value['d'])); } else { $ilUser->setBirthday(""); } } else { $ilUser->setBirthday($value['date']); } } break; default: $m = ucfirst($f); if (isset($map[$f])) { $m = $map[$f]; } $ilUser->{"set" . $m}($value); break; } } } $ilUser->setFullname(); // set instant messengers if ($this->workWithUserSetting("instant_messengers")) { $ilUser->setInstantMessengerId('icq', $this->form->getInput("usr_im_icq")); $ilUser->setInstantMessengerId('yahoo', $this->form->getInput("usr_im_yahoo")); $ilUser->setInstantMessengerId('msn', $this->form->getInput("usr_im_msn")); $ilUser->setInstantMessengerId('aim', $this->form->getInput("usr_im_aim")); $ilUser->setInstantMessengerId('skype', $this->form->getInput("usr_im_skype")); $ilUser->setInstantMessengerId('jabber', $this->form->getInput("usr_im_jabber")); $ilUser->setInstantMessengerId('voip', $this->form->getInput("usr_im_voip")); } // check map activation include_once "./Services/Maps/classes/class.ilMapUtil.php"; if (ilMapUtil::isActivated()) { $location = $this->form->getInput("location"); $ilUser->setLatitude(ilUtil::stripSlashes($location["latitude"])); $ilUser->setLongitude(ilUtil::stripSlashes($location["longitude"])); $ilUser->setLocationZoom(ilUtil::stripSlashes($location["zoom"])); } // Set user defined data $defs = $this->user_defined_fields->getVisibleDefinitions(); $udf = array(); foreach ($defs as $definition) { $f = "udf_" . $definition['field_id']; $item = $this->form->getItemByPostVar($f); if ($item && !$item->getDisabled()) { $udf[$definition['field_id']] = $this->form->getInput($f); } } $ilUser->setUserDefinedData($udf); // if loginname is changeable -> validate $un = $this->form->getInput('username'); if ((int) $ilSetting->get('allow_change_loginname') && $un != $ilUser->getLogin()) { if (!strlen($un) || !ilUtil::isLogin($un)) { ilUtil::sendFailure($lng->txt('form_input_not_valid')); $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('login_invalid')); $form_valid = false; } else { if (ilObjUser::_loginExists($un, $ilUser->getId())) { ilUtil::sendFailure($lng->txt('form_input_not_valid')); $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('loginname_already_exists')); $form_valid = false; } else { $ilUser->setLogin($un); try { $ilUser->updateLogin($ilUser->getLogin()); $ilAuth->setAuth($ilUser->getLogin()); $ilAuth->start(); } catch (ilUserException $e) { ilUtil::sendFailure($lng->txt('form_input_not_valid')); $this->form->getItemByPostVar('username')->setAlert($e->getMessage()); $form_valid = false; } } } } // everthing's ok. save form data if ($form_valid) { $this->uploadUserPicture(); // profile ok $ilUser->setProfileIncomplete(false); // save user data & object_data $ilUser->setTitle($ilUser->getFullname()); $ilUser->setDescription($ilUser->getEmail()); $ilUser->update(); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); if (ilSession::get('orig_request_target')) { $target = ilSession::get('orig_request_target'); ilSession::set('orig_request_target', ''); ilUtil::redirect($target); } else { if ($redirect = $_SESSION['profile_complete_redirect']) { unset($_SESSION['profile_complete_redirect']); ilUtil::redirect($redirect); } else { $ilCtrl->redirect($this, "showPersonalData"); } } } } $this->form->setValuesByPost(); $this->showPersonalData(true); }