/**
  * Try authentication
  * 
  * This will basically validate the current session
  */
 public static function authenticate()
 {
     global $ilAuth, $ilias, $ilErr;
     $current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
     if (self::blockedAuthentication($current_script)) {
         return;
     }
     $oldSid = session_id();
     $ilAuth->start();
     $ilias->setAuthError($ilErr->getLastError());
     if (IS_PAYMENT_ENABLED) {
         // cart is "attached" to session, has to be updated
         $newSid = session_id();
         if ($oldSid != $newSid) {
             include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
             ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
         }
     }
     if ($ilAuth->getAuth() && $ilAuth->getStatus() == '') {
         self::initUserAccount();
         self::handleAuthenticationSuccess();
     } else {
         if (!self::showingLoginForm($current_script)) {
             // :TODO: should be moved to context?!
             $mandatory_auth = $current_script != "shib_login.php" && $current_script != "shib_logout.php" && $current_script != "error.php" && $current_script != "chat.php" && $current_script != "index.php";
             // #10316
             if ($mandatory_auth) {
                 self::handleAuthenticationFail();
             }
         }
     }
 }
 private function showItemsTable(&$a_tpl, $a_result_set, $a_pay_method = 0)
 {
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     $genSet = ilPaymentSettings::_getInstance();
     include_once './Services/Payment/classes/class.ilShoppingCartTableGUI.php';
     $tbl = new ilShoppingCartTableGUI($this);
     $tbl->setId('tbl_id_' . $a_pay_method);
     $tbl->setTitle($this->lng->txt('paya_shopping_cart') . " (" . $this->lng->txt('payment_system') . ": " . ilPayMethods::getStringByPaymethod($a_pay_method['pm_title']) . ")");
     $coupon_session = $a_pay_method['pm_title'];
     $tbl->setRowTemplate("tpl.shop_shoppingcart_row.html", "Services/Payment");
     $tbl->addColumn('', 'item', '1%', true);
     $tbl->addColumn($this->lng->txt('title'), "table" . $a_pay_method['pm_title'] . "_title", '30%');
     $tbl->addColumn($this->lng->txt('duration'), "table" . $a_pay_method['pm_title'] . "_duration", '30%');
     $tbl->addColumn($this->lng->txt('vat_rate'), "table" . $a_pay_method['pm_title'] . "_vat_rate", '15%');
     $tbl->addColumn($this->lng->txt('vat_unit'), "table" . $a_pay_method['pm_title'] . "_vat_unit", '15%');
     $tbl->addColumn($this->lng->txt('price_a'), "table" . $a_pay_method['pm_title'] . "_price", '10%');
     $tbl->setPrefix("table" . $a_pay_method['pm_title'] . "_");
     $tbl->addMultiCommand('deleteItem', $this->lng->txt('delete'));
     // show total amount of costs
     $sc_obj = new ilPaymentShoppingCart($this->user_obj);
     $totalAmount = $sc_obj->getTotalAmount();
     if (!empty($_SESSION['coupons'][$coupon_session])) {
         if (count($items = $sc_obj->getEntries($a_pay_method['pm_id']))) {
             $tbl->setTotalData('TXT_SUB_TOTAL', $this->lng->txt('pay_bmf_subtotal_amount') . ": ");
             $tbl->setTotalData('VAL_SUB_TOTAL', number_format($totalAmount[$a_pay_method['pm_id']], 2, ',', '.') . " " . $genSet->get('currency_unit'));
             foreach ($_SESSION['coupons'][$coupon_session] as $coupon) {
                 $this->coupon_obj->setId($coupon['pc_pk']);
                 $this->coupon_obj->setCurrentCoupon($coupon);
                 $total_object_price = 0.0;
                 $current_coupon_bonus = 0.0;
                 foreach ($items as $item) {
                     $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']);
                     if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) {
                         $price_data = ilPaymentPrices::_getPrice($item['price_id']);
                         $price = (double) $price_data['price'];
                         $total_object_price += $price;
                     }
                     unset($tmp_pobject);
                 }
                 $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
                 $totalAmount[$current_coupon_bonus] += $current_coupon_bonus * -1;
             }
             $tbl->setTotalData('TXT_COUPON_BONUS', $this->lng->txt('paya_coupons_coupon') . ": ");
             # . $coupon['pcc_code'] . ": ");
             #$tbl->setTotalData('VAL_COUPON_BONUS', number_format($current_coupon_bonus * (-1), 2, ',', '.') . " " . $genSet->get('currency_unit'));
             $tbl->setTotalData('VAL_COUPON_BONUS', number_format($totalAmount[$current_coupon_bonus], 2, ',', '.') . " " . $genSet->get('currency_unit'));
             if ($totalAmount[$a_pay_method['pm_id']] < 0) {
                 $totalAmount[$a_pay_method['pm_id']] = 0;
                 $this->totalVat = 0;
             }
         }
     }
     $this->totalAmount[$a_pay_method['pm_id']] = $totalAmount[$a_pay_method['pm_id']] - $totalAmount[$current_coupon_bonus] * -1;
     $tbl->setTotalData('TXT_TOTAL_AMOUNT', $this->lng->txt('pay_bmf_total_amount') . ": ");
     $tbl->setTotalData('VAL_TOTAL_AMOUNT', number_format($this->totalAmount[$a_pay_method['pm_id']], 2, ',', '.') . " " . $genSet->get('currency_unit'));
     #.$item['currency']);
     if ($this->totalVat > 0) {
         $tbl->setTotalData('TXT_TOTAL_VAT', $this->lng->txt('pay_bmf_vat_included') . ": ");
         $tbl->setTotalData('VAL_TOTAL_VAT', number_format($this->totalVat, 2, ',', '.') . " " . $genSet->get('currency_unit'));
     }
     $tbl->setData($a_result_set);
     $a_tpl->setVariable('ITEMS_TABLE', $tbl->getCartHTML());
     return true;
 }
 /**
  * Render main menu entry
  *
  * @param
  * @return
  */
 function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top")
 {
     global $lng, $ilNavigationHistory, $ilSetting, $rbacsystem, $ilCtrl;
     $id = strtolower($a_id);
     $id_up = strtoupper($a_id);
     $a_tpl->setCurrentBlock("entry_" . $id);
     include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php";
     // repository
     if ($a_id == "repository") {
         $gl = new ilGroupedListGUI();
         $gl->setAsDropDown(true);
         include_once "./Services/Link/classes/class.ilLink.php";
         $icon = ilUtil::img(ilObject::_getIcon(ilObject::_lookupObjId(1), "tiny"));
         $gl->addEntry($icon . " " . $a_txt . " - " . $lng->txt("rep_main_page"), ilLink::_getStaticLink(1, 'root', true), "_top");
         $items = $ilNavigationHistory->getItems();
         reset($items);
         $cnt = 0;
         $first = true;
         foreach ($items as $k => $item) {
             if ($cnt >= 10) {
                 break;
             }
             if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) || ($item["ref_id"] != $_GET["ref_id"] || !$first)) {
                 if ($cnt == 0) {
                     $gl->addGroupHeader($lng->txt("last_visited"), "ilLVNavEnt");
                 }
                 $obj_id = ilObject::_lookupObjId($item["ref_id"]);
                 $cnt++;
                 $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"));
                 $ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true);
                 // #11023
                 $gl->addEntry($icon . " " . $ititle, $item["link"], "_top", "", "ilLVNavEnt");
             }
             $first = false;
         }
         if ($cnt > 0) {
             $gl->addEntry("ยป " . $lng->txt("remove_entries"), "#", "", "return il.MainMenu.removeLastVisitedItems('" . $ilCtrl->getLinkTargetByClass("ilnavigationhistorygui", "removeEntries", "", true) . "');", "ilLVNavEnt");
         }
         $a_tpl->setVariable("REP_EN_OV", $gl->getHTML());
     }
     // desktop
     if ($a_id == "desktop") {
         $gl = new ilGroupedListGUI();
         $gl->setAsDropDown(true);
         // overview
         $gl->addEntry($lng->txt("overview"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSelectedItems", "_top", "", "", "mm_pd_sel_items", ilHelp::getMainMenuTooltip("mm_pd_sel_items"), "left center", "right center", false);
         // my groups and courses, if both is available
         if ($ilSetting->get('disable_my_offers') == 0 && $ilSetting->get('disable_my_memberships') == 0) {
             $gl->addEntry($lng->txt("my_courses_groups"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToMemberships", "_top", "", "", "mm_pd_crs_grp", ilHelp::getMainMenuTooltip("mm_pd_crs_grp"), "left center", "right center", false);
         }
         // bookmarks
         if (!$this->ilias->getSetting("disable_bookmarks")) {
             $gl->addEntry($lng->txt("bookmarks"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks", "_top", "", "", "mm_pd_bookm", ilHelp::getMainMenuTooltip("mm_pd_bookm"), "left center", "right center", false);
         }
         // private notes
         if (!$this->ilias->getSetting("disable_notes")) {
             $gl->addEntry($lng->txt("notes_and_comments"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes", "_top", "", "", "mm_pd_notes", ilHelp::getMainMenuTooltip("mm_pd_notes"), "left center", "right center", false);
         }
         // news
         if ($ilSetting->get("block_activated_news")) {
             $gl->addEntry($lng->txt("news"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews", "_top", "", "", "mm_pd_news", ilHelp::getMainMenuTooltip("mm_pd_news"), "left center", "right center", false);
         }
         // overview is always active
         $gl->addSeparator();
         $separator = false;
         if (!$ilSetting->get("disable_personal_workspace")) {
             // workspace
             $gl->addEntry($lng->txt("personal_workspace"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace", "_top", "", "", "mm_pd_wsp", ilHelp::getMainMenuTooltip("mm_pd_wsp"), "left center", "right center", false);
             $separator = true;
         }
         // portfolio
         if ($ilSetting->get('user_portfolios')) {
             $gl->addEntry($lng->txt("portfolio"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio", "_top", "", "", "mm_pd_port", ilHelp::getMainMenuTooltip("mm_pd_port"), "left center", "right center", false);
             $separator = true;
         }
         // skills
         $skmg_set = new ilSetting("skmg");
         if ($skmg_set->get("enable_skmg")) {
             $gl->addEntry($lng->txt("skills"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills", "_top", "", "", "mm_pd_skill", ilHelp::getMainMenuTooltip("mm_pd_skill"), "left center", "right center", false);
             $separator = true;
         }
         // Learning Progress
         include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
         if (ilObjUserTracking::_enabledLearningProgress() && (ilObjUserTracking::_hasLearningProgressOtherUsers() || ilObjUserTracking::_hasLearningProgressLearner())) {
             //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
             $gl->addEntry($lng->txt("learning_progress"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP", "_top", "", "", "mm_pd_lp", ilHelp::getMainMenuTooltip("mm_pd_lp"), "left center", "right center", false);
             $separator = true;
         }
         if ($separator) {
             $gl->addSeparator();
         }
         $separator = false;
         // calendar
         include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
         $settings = ilCalendarSettings::_getInstance();
         if ($settings->isEnabled()) {
             $gl->addEntry($lng->txt("calendar"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar", "_top", "", "", "mm_pd_cal", ilHelp::getMainMenuTooltip("mm_pd_cal"), "left center", "right center", false);
             $separator = true;
         }
         // mail
         if ($this->mail) {
             $gl->addEntry($lng->txt('mail'), 'ilias.php?baseClass=ilMailGUI', '_top', "", "", "mm_pd_mail", ilHelp::getMainMenuTooltip("mm_pd_mail"), "left center", "right center", false);
             $separator = true;
         }
         // contacts
         if (!$this->ilias->getSetting('disable_contacts') && ($this->ilias->getSetting('disable_contacts_require_mail') || $rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId()))) {
             $gl->addEntry($lng->txt('mail_addressbook'), 'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '_top', "", "", "mm_pd_contacts", ilHelp::getMainMenuTooltip("mm_pd_contacts"), "left center", "right center", false);
             $separator = true;
         }
         if ($separator) {
             $gl->addSeparator();
         }
         // profile
         $gl->addEntry($lng->txt("personal_profile"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile", "_top", "", "", "mm_pd_profile", ilHelp::getMainMenuTooltip("mm_pd_profile"), "left center", "right center", false);
         // settings
         $gl->addEntry($lng->txt("personal_settings"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings", "_top", "", "", "mm_pd_sett", ilHelp::getMainMenuTooltip("mm_pd_sett"), "left center", "right center", false);
         $a_tpl->setVariable("DESK_CONT_OV", $gl->getHTML());
     }
     if (IS_PAYMENT_ENABLED) {
         // shop
         if ($a_id == "shop") {
             $gl = new ilGroupedListGUI();
             $gl->setAsDropDown(true);
             // shop_content
             $gl->addEntry($lng->txt("content"), "ilias.php?baseClass=ilShopController&amp;cmd=firstpage", "_top");
             // shoppingcart
             include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php';
             global $ilUser;
             $objShoppingCart = new ilPaymentShoppingCart($ilUser);
             $items = $objShoppingCart->getEntries();
             if (count($items) > 0) {
                 $gl->addEntry($lng->txt("shoppingcart") . ' (' . count($items) . ')', "ilias.php?baseClass=ilShopController&amp;cmdClass=ilshopshoppingcartgui", "_top");
             }
             $a_tpl->setVariable("SHOP_CONT_OV", $gl->getHTML());
         }
     }
     $a_tpl->setVariable("TXT_" . $id_up, $a_txt);
     $a_tpl->setVariable("SCRIPT_" . $id_up, $a_script);
     $a_tpl->setVariable("TARGET_" . $id_up, $a_target);
     if ($this->active == $a_id || $this->active == "" && $a_id == "repository") {
         //$a_tpl->setVariable("MM_CLASS", "MMActive");
         $a_tpl->setVariable("SEL", '<span class="ilAccHidden">(' . $lng->txt("stat_selected") . ')</span>');
     } else {
         //$a_tpl->setVariable("MM_CLASS", "MMInactive");
     }
     if ($a_id == "repository") {
         include_once "./Services/Accessibility/classes/class.ilAccessKey.php";
         if (ilAccessKey::getKey(ilAccessKey::LAST_VISITED) != "") {
             $a_tpl->setVariable("ACC_KEY_REPOSITORY", 'accesskey="' . ilAccessKey::getKey(ilAccessKey::LAST_VISITED) . '"');
         }
     }
     if ($a_id == "desktop") {
         include_once "./Services/Accessibility/classes/class.ilAccessKey.php";
         if (ilAccessKey::getKey(ilAccessKey::PERSONAL_DESKTOP) != "") {
             $a_tpl->setVariable("ACC_KEY_DESKTOP", 'accesskey="' . ilAccessKey::getKey(ilAccessKey::PERSONAL_DESKTOP) . '"');
         }
     }
     $a_tpl->parseCurrentBlock();
 }
Example #4
0
 /**
  * open start page (personal desktop or repository)
  *
  * precondition: authentication (maybe anonymous) successfull
  */
 function processStartingPage()
 {
     /**
      * @var $ilUser ilObjUser
      */
     global $ilUser;
     // fallback, should never happen
     if ($ilUser->getId() == ANONYMOUS_USER_ID) {
         ilInitialisation::goToPublicSection();
     } else {
         // for password change and incomplete profile
         // see ilPersonalDesktopGUI
         if (IS_PAYMENT_ENABLED) {
             include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
             ilPaymentShoppingCart::_assignObjectsToUserId($ilUser->getId());
             if ((int) $_GET['forceShoppingCartRedirect']) {
                 ilUtil::redirect('ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilshopshoppingcartgui');
             }
         }
         if (!$_GET["target"]) {
             // Redirect here to switch back to http if desired
             include_once './Services/User/classes/class.ilUserUtil.php';
             ilUtil::redirect(ilUserUtil::getStartingPointAsUrl());
         } else {
             // will handle shop redirects, too
             ilUtil::redirect("goto.php?target=" . $_GET["target"]);
         }
     }
 }
 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");
 }
 function sendCreditCard()
 {
     $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
     $this->psc_obj->clearCouponItemsSession();
     if (!count($items = $this->psc_obj->getEntries($this->pm_id))) {
         $this->tpl->setVariable("HEADER", $this->lng->txt('pay_bmf_your_order'));
         $this->tpl->touchBlock("stop_floating");
         ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
     } else {
         $payment = new KreditkartenzahlungWS();
         $customer = new Kunde($this->user_obj->getId());
         $creditCard = new Kreditkarte();
         $sc_obj = new ilPaymentShoppingCart($this->user_obj);
         $tmp_bookEntries = $sc_obj->getShoppingCart();
         if (!is_array($tmp_bookEntries)) {
             ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
         } else {
             $totalAmount = 0;
             for ($i = 0; $i < count($tmp_bookEntries); $i++) {
                 $booking = true;
                 if (!empty($_SESSION["coupons"]["bmf"])) {
                     $price = $tmp_bookEntries[$i]["price"];
                     $tmp_bookEntries[$i]["math_price"] = $price;
                     foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon) {
                         $this->coupon_obj->setId($coupon["pc_pk"]);
                         $this->coupon_obj->setCurrentCoupon($coupon);
                         $tmp_pobject = new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i]['pobject_id']);
                         if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) {
                             $_SESSION["coupons"]["bmf"][$key]["total_objects_coupon_price"] += $price;
                             $_SESSION["coupons"]["bmf"][$key]["items"][] = $tmp_bookEntries[$i];
                             $booking = false;
                         }
                         unset($tmp_pobject);
                     }
                 }
                 if ($booking) {
                     $tmp_bookEntries[$i]["price_string"] = number_format((double) $tmp_bookEntries[$i]["price"], 2, ",", ".");
                     $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
                     $totalAmount += $tmp_bookEntries[$i]["price"];
                 } else {
                     $tmp_bookEntries[$i]["price_string"] = number_format((double) $tmp_bookEntries[$i]["price"], 2, ",", ".");
                 }
             }
             $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION["coupons"]["bmf"]);
             if (is_array($coupon_discount_items) && !empty($coupon_discount_items)) {
                 foreach ($coupon_discount_items as $item) {
                     $item["price"] = number_format((double) $item["discount_price"], 2, ".", "");
                     $bookEntries[] = new Buchung($item);
                     $totalAmount += $item["discount_price"];
                 }
             }
             $totalAmount = number_format((double) $totalAmount, 2, ".", "");
             $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
             $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
         }
         $resultObj = $payment->zahlenUndAnlegenKunde($customer, $creditCard, $bookingList);
         $result = $resultObj->ergebnis;
         if (is_object($result)) {
             if ($result->code < 0) {
                 $this->tpl->setVariable("HEADER", $this->lng->txt('error'));
                 $this->tpl->touchBlock("stop_floating");
                 $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
                 if ($result->code == -103 || $result->code == -104 || $result->code == -107 || $result->code <= -202 && $result->code >= -208 || $result->code == -213) {
                     ilUtil::sendInfo($error);
                     $this->showPersonalData();
                 } else {
                     if ($result->code == -507 || $result->code == -510 || $result->code == -511) {
                         ilUtil::sendInfo($error);
                         $this->showPaymentType();
                     } else {
                         if ($result->code == -701 || $result->code == -1701 || $result->code == -1706 || $result->code == -1707 || $result->code == -1710 || $result->code == -1711) {
                             ilUtil::sendInfo($error);
                             $this->showCreditCard();
                         } else {
                             $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
                             ilUtil::sendInfo($error);
                             $this->showPersonalData();
                         }
                     }
                 }
             } else {
                 // everything ok => send confirmation, fill statistik, delete session, delete shopping cart.
                 $external_data = array();
                 $external_data['voucher'] = $resultObj->buchungsListe->buchungen[$b++]->belegNr;
                 $external_data['transaction_extern'] = $resultObj->buchungsListe->kassenzeichen;
                 $external_data['street'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse) . ' ' . utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
                 $external_data['po_box'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
                 $external_data['zipcode'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
                 $external_data['city'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
                 $external_data['country'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
                 parent::__addbookings($external_data);
                 $this->__emptyShoppingCart();
                 $this->__clearSession();
                 $this->tpl->setVariable("HEADER", $this->lng->txt('pay_bmf_your_order'));
                 $this->tpl->setVariable("DESCRIPTION", $this->lng->txt('pay_bmf_thanks'));
                 $this->tpl->touchBlock("stop_floating");
                 ilUtil::sendInfo($this->lng->txt('pay_bmf_thanks'));
                 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.pay_bmf_credit_card.html', 'Services/Payment');
                 if ($this->ilias->getSetting("https") != 1) {
                     $this->tpl->setCurrentBlock("buyed_objects");
                     $link = $this->ctrl->getLinkTargetByClass('ilshopboughtobjectsgui');
                     $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", $link);
                     $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
                     $this->tpl->parseCurrentBlock("buyed_objects");
                 }
                 $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
             }
         } else {
             $this->tpl->setVariable("HEADER", $this->lng->txt('error'));
             $this->tpl->touchBlock("stop_floating");
             ilUtil::sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
         }
         /**/
         #zum testen
     }
 }
 public function updateDetails()
 {
     if (!$_GET['pobject_id']) {
         ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
         $this->showObjects();
         return true;
     }
     $this->__initPaymentObject((int) $_GET['pobject_id']);
     $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']);
     // read old settings
     $old_status = $this->pobject->getStatus();
     // check status changed from not_buyable
     if ($old_status == $this->pobject->STATUS_NOT_BUYABLE and (int) $_POST['status'] != $old_status) {
         // check pay_method edited
         switch ((int) $_POST['pay_method']) {
             case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
                 ilUtil::sendInfo($this->lng->txt('paya_select_pay_method_first'));
                 $this->editDetails();
                 return false;
             default:
         }
         // check minimum one price
         include_once './Services/Payment/classes/class.ilPaymentPrices.php';
         $prices_obj = new ilPaymentPrices((int) $_GET['pobject_id']);
         if (!count($prices_obj->getPrices())) {
             ilUtil::sendInfo($this->lng->txt('paya_edit_prices_first'));
             $this->editDetails();
             return false;
         }
     }
     if ((int) $_POST['status'] == 0) {
         // Status: not buyable -> delete depending shoppingcart entries
         include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
         ilPaymentShoppingCart::_deleteShoppingCartEntries($this->pobject->getPobjectId());
     }
     $this->pobject->setStatus((int) $_POST['status']);
     $this->pobject->setVendorId((int) $_POST['vendor']);
     $this->pobject->setPayMethod((int) $_POST['pay_method']);
     $this->pobject->setTopicId((int) $_POST['topic_id']);
     $this->pobject->setVatId((int) $_POST['vat_id']);
     $this->pobject->setSubtype((string) $_POST['exc_subtype']);
     $this->pobject->setSpecial((int) $_POST['is_special']);
     if ((int) $_POST['thumbnail_delete']) {
         $oFile = new ilFileDataShop($this->pobject->getPobjectId());
         $oFile->deassignFileFromPaymentObject();
     } else {
         if ($_FILES['thumbnail']['tmp_name'] != '') {
             $this->lng->loadLanguageModule('form');
             include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
             $oThumbnail = new ilImageFileInputGUI($this->lng->txt('pay_thumbnail'), 'thumbnail');
             if ($oThumbnail->checkInput()) {
                 $oFile = new ilFileDataShop($this->pobject->getPobjectId());
                 if ($oFile->storeUploadedFile($_FILES['thumbnail']) !== false) {
                     $oFile->assignFileToPaymentObject();
                 }
             } else {
                 ilUtil::sendInfo($oThumbnail->getAlert());
                 return $this->editDetails();
             }
         }
     }
     $this->pobject->update();
     ilUtil::sendInfo($this->lng->txt('paya_details_updated'));
     $this->showObjects();
     return true;
 }