ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilStartUpGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
14 {
15 
19  function ilStartUpGUI()
20  {
21  global $ilCtrl;
22 
23  $this->ctrl =& $ilCtrl;
24 
25  $ilCtrl->saveParameter($this, array("rep_ref_id", "lang", "target", "client_id"));
26  }
27 
31  function &executeCommand()
32  {
33  $cmd = $this->ctrl->getCmd("processIndexPHP");
34  $next_class = $this->ctrl->getNextClass($this);
35 
36  switch($next_class)
37  {
38  case "ilaccountregistrationgui":
39  require_once("Services/Registration/classes/class.ilAccountRegistrationGUI.php");
40  return $this->ctrl->forwardCommand(new ilAccountRegistrationGUI());
41  break;
42 
43  case "ilpasswordassistancegui":
44  require_once("Services/Init/classes/class.ilPasswordAssistanceGUI.php");
45  return $this->ctrl->forwardCommand(new ilPasswordAssistanceGUI());
46  break;
47 
48  default:
49  $r = $this->$cmd();
50  return $r;
51  break;
52  }
53  }
54 
58  function jumpToRegistration()
59  {
60  $this->ctrl->setCmdClass("ilaccountregistrationgui");
61  $this->ctrl->setCmd("");
62  $this->executeCommand();
63  }
64 
69  {
70  $this->ctrl->setCmdClass("ilpasswordassistancegui");
71  $this->ctrl->setCmd("");
72  $this->executeCommand();
73  }
74 
78  function showLogin()
79  {
80  global $ilSetting, $ilAuth, $ilUser, $tpl, $ilIliasIniFile, $ilias, $lng;
81 
82  // if authentication of soap user failed, but email address is
83  // known, show users and ask for password
84  $status = $ilAuth->getStatus();
85  if ($status == "" && isset($_GET["auth_stat"]))
86  {
87  $status = $_GET["auth_stat"];
88  }
89  if ($status == AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL)
90  {
91  $this->showUserMappingSelection();
92  return;
93  }
94 
95  // login language selection is post type
96  if (isset($_POST["lang"]) && $_POST["lang"] != "")
97  {
98  $_GET["lang"] = ilUtil::stripSlashes($_POST["lang"]);
99  }
100 
101  // check for session cookies enabled
102  if (!isset($_COOKIE['iltest']))
103  {
104  if (empty($_GET['cookies']))
105  {
106  $additional_params = '';
107  if((int)$_GET['forceShoppingCartRedirect'])# && (int)$_SESSION['price_id'] && (int)$_SESSION['pobject_id'])
108  {
109  $additional_params .= '&login_to_purchase_object=1&forceShoppingCartRedirect=1';
110  }
111 
112  ilUtil::setCookie("iltest","cookie",false);
113  //header('Location: '.$_SERVER['PHP_SELF']."?target=".$_GET["target"]."&soap_pw=".$_GET["soap_pw"]."&ext_uid=".$_GET["ext_uid"]."&cookies=nocookies&client_id=".$_GET['client_id']."&lang=".$_GET['lang']);
114  header("Location: login.php?target=".$_GET["target"]."&soap_pw=".$_GET["soap_pw"]."&ext_uid=".$_GET["ext_uid"]."&cookies=nocookies&client_id=".rawurlencode(CLIENT_ID)."&lang=".$_GET['lang'].$additional_params);
115  }
116  else
117  {
118  $_COOKIE['iltest'] = "";
119  }
120  }
121  else
122  {
123  unset($_GET['cookies']);
124  }
125 
126  // check correct setup
127  if (!$ilSetting->get("setup_ok"))
128  {
129  die("Setup is not completed. Please run setup routine again. (Login)");
130  }
131 
132  if ($ilSetting->get("shib_active") && $ilSetting->get("shib_hos_type"))
133  {
134  require_once "./Services/AuthShibboleth/classes/class.ilShibbolethWAYF.php";
135  // Check if we user selects Home Organization
136  $WAYF = new ShibWAYF();
137  }
138 
139  if (isset($WAYF) && $WAYF->isSelection())
140  {
141  if ($WAYF->isValidSelection())
142  {
143  // Set cookie
144  $WAYF->setSAMLCookie();
145 
146  // Redirect
147  $WAYF->redirect();
148  }
149  }
150  elseif ($ilAuth->getAuth())
151  {
152  // Or we do authentication here
153  // To do: check whether some $ilInit method could be used here.
154 
155  if(!$ilUser->checkTimeLimit())
156  {
157  $ilAuth->logout();
158  session_destroy();
159 
160  // to do: get rid of this
161  ilUtil::redirect('login.php?time_limit=true');
162  }
163 
164  include_once './Services/Tracking/classes/class.ilOnlineTracking.php';
165  ilOnlineTracking::_addUser($ilUser->getId());
166 
167  // handle chat kicking
168  if ($ilSetting->get("chat_active"))
169  {
170  include_once "./Modules/Chat/classes/class.ilChatServerCommunicator.php";
171  include_once "./Modules/Chat/classes/class.ilChatRoom.php";
172 
174  ilChatRoom::_unkick($ilUser->getId());
175  }
176 
177  // update last forum visit
178  include_once './Modules/Forum/classes/class.ilObjForum.php';
179  ilObjForum::_updateOldAccess($ilUser->getId());
180 
181  if ($_GET["rep_ref_id"] != "")
182  {
183  $_GET["ref_id"] = $_GET["rep_ref_id"];
184  }
185  $this->processStartingPage();
186  exit;
187  }
188 
189  // Instantiate login template
190  // Use Shibboleth-only authentication if auth_mode is set to Shibboleth
191  $tpl->addBlockFile("CONTENT", "content", "tpl.login.html",
192  "Services/Init");
193 
194  //language handling
195  if ($_GET["lang"] == "")
196  {
197  $_GET["lang"] = $ilIliasIniFile->readVariable("language","default");
198  }
199 
200  //instantiate language
201  $lng = new ilLanguage($_GET["lang"]);
202 
203  $tpl->setVariable("PAGETITLE", $lng->txt("startpage"));
204  $tpl->setVariable("TXT_OK", $lng->txt("ok"));
205 
206  $languages = $lng->getInstalledLanguages();
207 
208  foreach ($languages as $lang_key)
209  {
210  $tpl->setCurrentBlock("languages");
211  $tpl->setVariable("LANG_KEY", $lang_key);
212  $tpl->setVariable("LANG_NAME",
213  ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key));
214  $tpl->setVariable("BORDER", 0);
215  $tpl->setVariable("VSPACE", 0);
216  $tpl->parseCurrentBlock();
217  }
218 
219  // allow new registrations?
220  include_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
222  {
223  $tpl->setCurrentBlock("new_registration");
224  $tpl->setVariable("REGISTER", $lng->txt("registration"));
225  $tpl->setVariable("CMD_REGISTER",
226  $this->ctrl->getLinkTargetByClass("ilaccountregistrationgui", ""));
227  $tpl->parseCurrentBlock();
228  }
229  // allow password assistance? Surpress option if Authmode is not local database
230  if ($ilSetting->get("password_assistance"))
231  {
232  $tpl->setCurrentBlock("password_assistance");
233  $tpl->setVariable("FORGOT_PASSWORD", $lng->txt("forgot_password"));
234  $tpl->setVariable("FORGOT_USERNAME", $lng->txt("forgot_username"));
235  $tpl->setVariable("CMD_FORGOT_PASSWORD",
236  $this->ctrl->getLinkTargetByClass("ilpasswordassistancegui", ""));
237  $tpl->setVariable("CMD_FORGOT_USERNAME",
238  $this->ctrl->getLinkTargetByClass("ilpasswordassistancegui", "showUsernameAssistanceForm"));
239  $tpl->setVariable("LANG_ID", $_GET["lang"]);
240  $tpl->parseCurrentBlock();
241  }
242 
243  if ($ilSetting->get("pub_section"))
244  {
245  $tpl->setCurrentBlock("homelink");
246  $tpl->setVariable("CLIENT_ID","?client_id=".$_COOKIE["ilClientId"]."&lang=".$_GET["lang"]);
247  $tpl->setVariable("TXT_HOME",$lng->txt("home"));
248  $tpl->parseCurrentBlock();
249  }
250 
251  if ($ilIliasIniFile->readVariable("clients","list"))
252  {
253  $tpl->setCurrentBlock("client_list");
254  $tpl->setVariable("TXT_CLIENT_LIST", $lng->txt("to_client_list"));
255  $tpl->setVariable("CMD_CLIENT_LIST",
256  $this->ctrl->getLinkTarget($this, "showClientList"));
257  $tpl->parseCurrentBlock();
258  }
259 
260  // shibboleth login link
261  if ($ilSetting->get("shib_active"))
262  {
263 
264  if($ilSetting->get("shib_hos_type") == 'external_wayf'){
265  $tpl->setCurrentBlock("shibboleth_login");
266  $tpl->setVariable("TXT_SHIB_LOGIN", $lng->txt("login_to_ilias_via_shibboleth"));
267  $tpl->setVariable("IL_TARGET", $_GET["target"]);
268  $tpl->setVariable("TXT_SHIB_FEDERATION_NAME", $ilSetting->get("shib_federation_name"));
269  $tpl->setVariable("TXT_SHIB_LOGIN_BUTTON", $ilSetting->get("shib_login_button"));
270  $tpl->setVariable("TXT_SHIB_LOGIN_INSTRUCTIONS", sprintf($lng->txt("shib_general_login_instructions"),$ilSetting->get("shib_federation_name")).' <a href="mailto:'.$ilias->getSetting("admin_email").'">ILIAS '. $lng->txt("administrator").'</a>.');
271  $tpl->setVariable("TXT_SHIB_CUSTOM_LOGIN_INSTRUCTIONS", $ilSetting->get("shib_login_instructions"));
272  $tpl->parseCurrentBlock();
273  } elseif($ilSetting->get("shib_hos_type") == 'embedded_wayf') {
274  $tpl->setCurrentBlock("shibboleth_custom_login");
275  $customInstructions = stripslashes( $ilSetting->get("shib_login_instructions"));
276  $tpl->setVariable("TXT_SHIB_CUSTOM_LOGIN_INSTRUCTIONS", $customInstructions);
277  $tpl->parseCurrentBlock();
278  } else {
279  $tpl->setCurrentBlock("shibboleth_wayf_login");
280  $tpl->setVariable("TXT_SHIB_LOGIN", $lng->txt("login_to_ilias_via_shibboleth"));
281  $tpl->setVariable("TXT_SHIB_FEDERATION_NAME", $ilSetting->get("shib_federation_name"));
282  $tpl->setVariable("TXT_SELECT_HOME_ORGANIZATION", sprintf($lng->txt("shib_select_home_organization"), $ilSetting->get("shib_federation_name")));
283  $tpl->setVariable("TXT_CONTINUE", $lng->txt("btn_next"));
284  $tpl->setVariable("TXT_SHIB_HOME_ORGANIZATION", $lng->txt("shib_home_organization"));
285  $tpl->setVariable("TXT_SHIB_LOGIN_INSTRUCTIONS", $lng->txt("shib_general_wayf_login_instructions").' <a href="mailto:'.$ilias->getSetting("admin_email").'">ILIAS '. $lng->txt("administrator").'</a>.');
286  $tpl->setVariable("TXT_SHIB_CUSTOM_LOGIN_INSTRUCTIONS", $ilSetting->get("shib_login_instructions"));
287  $tpl->setVariable("TXT_SHIB_INVALID_SELECTION", $WAYF->showNotice());
288  $tpl->setVariable("SHIB_IDP_LIST", $WAYF->generateSelection());
289  $tpl->setVariable("ILW_TARGET", $_GET["target"]);
290  $tpl->parseCurrentBlock();
291  }
292  }
293 
294  // cas login link
295  if ($ilSetting->get("cas_active"))
296  {
297  $tpl->setCurrentBlock("cas_login");
298  $tpl->setVariable("TXT_CAS_LOGIN", $lng->txt("login_to_ilias_via_cas"));
299  $tpl->setVariable("TXT_CAS_LOGIN_BUTTON", ilUtil::getImagePath("cas_login_button.gif"));
300  $tpl->setVariable("TXT_CAS_LOGIN_INSTRUCTIONS", $ilSetting->get("cas_login_instructions"));
301  $this->ctrl->setParameter($this, "forceCASLogin", "1");
302  $tpl->setVariable("TARGET_CAS_LOGIN",
303  $this->ctrl->getLinkTarget($this, "showLogin"));
304  $this->ctrl->setParameter($this, "forceCASLogin", "");
305  $tpl->parseCurrentBlock();
306  }
307 
308  // login via ILIAS (this also includes radius and ldap)
309  // If local authentication is enabled for shibboleth users, we
310  // display the login form for ILIAS here.
311  if (($ilSetting->get("auth_mode") != AUTH_SHIBBOLETH ||
312  $ilSetting->get("shib_auth_allow_local")) &&
313  $ilSetting->get("auth_mode") != AUTH_CAS)
314  {
315  $loginSettings = new ilSetting("login_settings");
316  if ($_GET["lang"] == false)
317  {
318  $information = $loginSettings->get("login_message_".$lng->getDefaultLanguage());
319  }
320  else
321  {
322  $information = $loginSettings->get("login_message_".$_GET["lang"]);
323  }
324 
325  if(strlen(trim($information)))
326  {
327  $tpl->setVariable("TXT_LOGIN_INFORMATION", $information);
328  }
329 
330  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
331  $form = new ilPropertyFormGUI();
332  $form->setOpenTag(false);
333  $form->setCloseTag(false);
334  $form->setTitle($lng->txt("login_to_ilias"));
335 
336  // auth selection
337  include_once('./Services/Authentication/classes/class.ilAuthModeDetermination.php');
339  if(ilAuthUtils::_hasMultipleAuthenticationMethods() and $det->isManualSelection())
340  {
341  $radg = new ilRadioGroupInputGUI($lng->txt("auth_selection"), "auth_mode");
342  foreach(ilAuthUtils::_getMultipleAuthModeOptions($lng) as $key => $option)
343  {
344  $op1 = new ilRadioOption($option['txt'], $key);
345  $radg->addOption($op1);
346  if (isset($option['checked']))
347  {
348  $radg->setValue($key);
349  }
350  }
351 
352  $form->addItem($radg);
353  }
354 
355  // username
356  $ti = new ilTextInputGUI($lng->txt("username"), "username");
357  $ti->setSize(20);
358  $form->addItem($ti);
359 
360  // password
361  $pi = new ilPasswordInputGUI($lng->txt("password"), "password");
362  $pi->setRetype(false);
363  $pi->setSize(20);
364  $form->addItem($pi);
365  $form->addCommandButton("butSubmit", $lng->txt("log_in"));
366  $tpl->setVariable("LOGIN_FORM", $form->getHTML());
367 
368  $tpl->setVariable("TXT_ILIAS_LOGIN", $lng->txt("login_to_ilias"));
369  $tpl->setVariable("TXT_USERNAME", $lng->txt("username"));
370  $tpl->setVariable("TXT_PASSWORD", $lng->txt("password"));
371  if (isset($_POST["username"]))
372  {
373  $tpl->setVariable("USERNAME", ilUtil::prepareFormOutput($_POST["username"], true));
374  }
375  $tpl->setVariable("TXT_SUBMIT", $lng->txt("submit"));
376  $tpl->parseCurrentBlock();
377  }
378 
379  // Show openid login screen
380  $this->showOpenIdLogin();
381 
382  $tpl->setVariable("ILIAS_RELEASE", $ilSetting->get("ilias_version"));
383 
384  if (isset($_GET['forceShoppingCartRedirect']))
385  {
386  $this->ctrl->setParameter($this, 'forceShoppingCartRedirect', 1);
387  }
388 
389  $this->ctrl->setTargetScript("login.php");
390  $tpl->setVariable("FORMACTION",
391  $this->ctrl->getFormAction($this));
392 //echo "-".htmlentities($this->ctrl->getFormAction($this, "showLogin"))."-";
393  $tpl->setVariable("LANG_FORM_ACTION",
394  $this->ctrl->getFormAction($this));
395  $tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
396  $tpl->setVariable("LANG_ID", $_GET["lang"]);
397 
398  if (isset($_GET['inactive']) && $_GET['inactive'])
399  {
400  $this->showFailure($lng->txt("err_inactive"));
401  }
402  else if (isset($_GET['expired']) && $_GET['expired'])
403  {
404  $this->showFailure($lng->txt("err_session_expired"));
405  }
406  else if (isset($_GET['login_to_purchase_object']) && $_GET['login_to_purchase_object'])
407  {
408  $lng->loadLanguageModule('payment');
409  $this->showFailure($lng->txt("payment_login_to_buy_object"));
410  }
411  else if (isset($_GET['reg_confirmation_msg']) && strlen(trim($_GET['reg_confirmation_msg'])))
412  {
413  $lng->loadLanguageModule('registration');
414  if($_GET['reg_confirmation_msg'] == 'reg_account_confirmation_successful')
415  $this->showSuccess($lng->txt(trim($_GET['reg_confirmation_msg'])));
416  else
417  $this->showFailure($lng->txt(trim($_GET['reg_confirmation_msg'])));
418  }
419  elseif(isset($_GET['reached_session_limit']) && $_GET['reached_session_limit'])
420  {
421  $this->showFailure($lng->txt("reached_session_limit"));
422  }
423 
424  // TODO: Move this to header.inc since an expired session could not detected in login script
425  $status = $ilAuth->getStatus();
426 
427  if ($status == "" && isset($_GET["auth_stat"]))
428  {
429  $status = $_GET["auth_stat"];
430  }
431  $auth_error = $ilias->getAuthError();
432 
433  if (!empty($status))
434  {
435  switch ($status)
436  {
437  case AUTH_EXPIRED:
438  $this->showFailure($lng->txt("err_session_expired"));
439  break;
440  case AUTH_IDLED:
441  // lang variable err_idled not existing
442  //$tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_idled"));
443  break;
444 
446  $this->showFailure($lng->txt("err_auth_cas_no_ilias_user"));
447  break;
448 
450  $this->showFailure($lng->txt("err_auth_soap_no_ilias_user"));
451  break;
452 
454  $this->showFailure($lng->txt("err_auth_ldap_no_ilias_user"));
455  break;
456 
458  $this->showFailure($lng->txt("err_auth_radius_no_ilias_user"));
459  break;
460 
461  case AUTH_MODE_INACTIVE:
462  $this->showFailure($lng->txt("err_auth_mode_inactive"));
463  break;
464 
465  case AUTH_APACHE_FAILED:
466  $this->showFailure($lng->txt("err_auth_apache_failed"));
467  break;
468 
469  case AUTH_WRONG_LOGIN:
470  default:
471  $add = "";
472  if (is_object($auth_error))
473  {
474  $add = "<br>".$auth_error->getMessage();
475  }
476  $this->showFailure($lng->txt("err_wrong_login").$add);
477  break;
478  }
479  }
480 
481 
482  if (isset($_GET['time_limit']) && $_GET['time_limit'])
483  {
484  $this->showFailure($lng->txt("time_limit_reached"));
485  }
486 
487  // output wrong IP message
488  if (isset($_GET['wrong_ip']) && $_GET['wrong_ip'])
489  {
490  $this->showFailure($lng->txt("wrong_ip_detected")." (".$_SERVER["REMOTE_ADDR"].")");
491  }
492 
493  // outout simultaneous login message
494  if (isset($_GET['simultaneous_login']) && $_GET['simultaneous_login'])
495  {
496  $this->showFailure($lng->txt("simultaneous_login_detected"));
497  }
498 
499  $this->ctrl->setTargetScript("ilias.php");
500  $tpl->setVariable("PHP_SELF", $_SERVER['PHP_SELF']);
501  $tpl->setVariable("USER_AGREEMENT", $lng->txt("usr_agreement"));
502  $tpl->setVariable("LINK_USER_AGREEMENT",
503  $this->ctrl->getLinkTarget($this, "showUserAgreement"));
504 
505  // browser does not accept cookies
506  if (isset($_GET['cookies']) && $_GET['cookies'] == 'nocookies')
507  {
508  $this->showFailure($lng->txt("err_no_cookies"));
509  $tpl->setVariable("COOKIES_HOWTO", $lng->txt("cookies_howto"));
510  $tpl->setVariable("LINK_NO_COOKIES",
511  $this->ctrl->getLinkTarget($this, "showNoCookiesScreen"));
512  }
513 
514  $tpl->show("DEFAULT", false);
515  }
516 
517  function showFailure($a_mess)
518  {
519  global $tpl, $lng;
520 
521  $tpl->setCurrentBlock("warning");
522  $tpl->setVariable('TXT_MSG_LOGIN_FAILED', $a_mess);
523  $tpl->setVariable("MESSAGE_HEADING", $lng->txt("failure_message"));
524  $tpl->setVariable("ALT_IMAGE", $lng->txt("icon")." ".$lng->txt("failure_message"));
525  $tpl->setVariable("SRC_IMAGE", ilUtil::getImagePath("mess_failure.gif"));
526  $tpl->parseCurrentBlock();
527  }
528 
529  public function showSuccess($a_mess)
530  {
531  global $tpl, $lng;
532 
533  $tpl->setCurrentBlock('success');
534  $tpl->setVariable('TXT_MSG_LOGIN_SUCCESS', $a_mess);
535  $tpl->setVariable('MESSAGE_HEADING', $lng->txt('success_message'));
536  $tpl->setVariable('ALT_IMAGE', $lng->txt('icon').' '.$lng->txt('success_message'));
537  $tpl->setVariable('SRC_IMAGE', ilUtil::getImagePath('mess_success.gif'));
538  $tpl->parseCurrentBlock();
539  }
540 
548  public function showAccountMigration($a_message = '')
549  {
550  global $tpl,$lng;
551 
552  $lng->loadLanguageModule('auth');
553  $tpl->addBlockFile("CONTENT",
554  "content",
555  "tpl.login_account_migration.html",
556  "Services/Init");
557 
558  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
559  $form = new ilPropertyFormGUI();
560  $form->setFormAction($this->ctrl->getFormAction($this,'migrateAccount'));
561 
562  $form->setTitle($lng->txt('auth_account_migration'));
563  $form->addCommandButton('migrateAccount', $lng->txt('save'));
564  $form->addCommandButton('showLogin', $lng->txt('cancel'));
565 
566  $rad = new ilRadioGroupInputGUI($lng->txt('auth_account_migration_name'),'account_migration');
567  $rad->setValue(1);
568 
569  $keep = new ilRadioOption($lng->txt('auth_account_migration_keep'),1,$lng->txt('auth_info_migrate'));
570  $user = new ilTextInputGUI($lng->txt('login'),'mig_username');
571  $user->setValue(ilUtil::prepareFormOutput($_POST['mig_username']));
572  $user->setSize(32);
573  $user->setMaxLength(128);
574  $keep->addSubItem($user);
575 
576  $pass = new ilPasswordInputGUI($lng->txt('password'),'mig_password');
577  $pass->setValue(ilUtil::prepareFormOutput($_POST['mig_password']));
578  $pass->setRetype(false);
579  $pass->setSize(12);
580  $pass->setMaxLength(128);
581  $keep->addSubItem($pass);
582  $rad->addOption($keep);
583 
584  $new = new ilRadioOption($lng->txt('auth_account_migration_new'),2,$lng->txt('auth_info_add'));
585  $rad->addOption($new);
586 
587  $form->addItem($rad);
588 
589  $tpl->setVariable('MIG_FORM',$form->getHTML());
590 
591  if(strlen($a_message))
592  {
593  $this->showFailure($a_message);
594  }
595 
596  $tpl->show('DEFAULT');
597  }
598 
605  public function migrateAccount()
606  {
607  global $lng,$ilClientIniFile,$ilLog,$rbacadmin;
608 
609  $lng->loadLanguageModule('auth');
610 
611  if(!isset($_POST['account_migration']))
612  {
613  $this->showAccountMigration($lng->txt('err_choose_migration_type'));
614  return false;
615  }
616 
617  if($_POST['account_migration'] == 1 and (!strlen($_POST['mig_username']) or !strlen($_POST['mig_password'])))
618  {
619  $this->showAccountMigration($lng->txt('err_wrong_login'));
620  return false;
621  }
622 
623  if($_POST['account_migration'] == 1)
624  {
625  if(!$user_id = ilObjUser::_lookupId(ilUtil::stripSlashes($_POST['mig_username'])))
626  {
627  $this->showAccountMigration($lng->txt('err_wrong_login'));
628  return false;
629  }
630  $_POST['username'] = $_POST['mig_username'];
631  $_POST['password'] = $_POST['mig_password'];
632 
633  include_once './Services/Authentication/classes/class.ilAuthFactory.php';
634  include_once './Services/Database/classes/class.ilAuthContainerMDB2.php';
635 
637  $ilAuth->start();
638  if(!$ilAuth->checkAuth())
639  {
640  $ilAuth->logout();
641  $this->showAccountMigration($lng->txt('err_wrong_login'));
642  return false;
643  }
644 
645  $user = new ilObjUser($user_id);
646  $user->setAuthMode($_SESSION['tmp_auth_mode']);
647  $user->setExternalAccount($_SESSION['tmp_external_account']);
648  $user->update();
649 
650  // Assign to default role
651  if(is_array($_SESSION['tmp_roles']))
652  {
653  foreach($_SESSION['tmp_roles'] as $role)
654  {
655  $rbacadmin->assignUser((int) $role,$user->getId());
656  }
657  }
658 
659  // Log migration
660  $ilLog->write(__METHOD__.': Migrated '.$_SESSION['tmp_external_account'].' to ILIAS account '.$user->getLogin().'.');
661  }
662  elseif($_POST['account_migration'] == 2)
663  {
664  switch($_SESSION['tmp_auth_mode'])
665  {
666  case 'apache':
667  $_POST['username'] = $_SESSION['tmp_external_account'];
668  $_POST['password'] = $_SESSION['tmp_pass'];
669 
670  include_once('Services/Database/classes/class.ilAuthContainerApache.php');
671  $container = new ilAuthContainerApache();
672  $container->forceCreation(true);
673  $ilAuth = ilAuthFactory::factory($container);
674  $ilAuth->start();
675  break;
676 
677  case 'ldap':
678  $_POST['username'] = $_SESSION['tmp_external_account'];
679  $_POST['password'] = $_SESSION['tmp_pass'];
680 
681  include_once('Services/LDAP/classes/class.ilAuthContainerLDAP.php');
682  $container = new ilAuthContainerLDAP();
683  $container->forceCreation(true);
684  $ilAuth = ilAuthFactory::factory($container);
685  $ilAuth->start();
686  break;
687 
688  case 'radius':
689  $_POST['username'] = $_SESSION['tmp_external_account'];
690  $_POST['password'] = $_SESSION['tmp_pass'];
691 
692  include_once './Services/Authentication/classes/class.ilAuthFactory.php';
693  include_once './Services/Radius/classes/class.ilAuthContainerRadius.php';
694 
695  $container = new ilAuthContainerRadius();
696  $container->forceCreation(true);
697  $ilAuth = ilAuthFactory::factory($container);
698  $ilAuth->start();
699  break;
700 
701  case 'openid':
702  $_POST['username'] = $_SESSION['tmp_external_account'];
703  $_POST['password'] = $_SESSION['tmp_pass'];
704  $_POST['oid_username'] = $_SESSION['tmp_oid_username'];
705  $_SESSION['force_creation'] = true;
706 
707  include_once './Services/Authentication/classes/class.ilAuthFactory.php';
708  include_once './Services/OpenId/classes/class.ilAuthContainerOpenId.php';
709 
710  $container = new ilAuthContainerOpenId();
711  $container->forceCreation(true);
713  $ilAuth = ilAuthFactory::factory($container);
714  $ilAuth->callProvider($_POST['username'], null, null);
715  $ilAuth->start();
716  break;
717  }
718  }
719  // show personal desktop
720  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
721  }
722 
726  function showLogout()
727  {
729 
730  // LOGOUT CHAT USER
731  if($ilSetting->get("chat_active"))
732  {
733  include_once "./Modules/Chat/classes/class.ilChatServerCommunicator.php";
735  }
736 
737  $ilAuth->logout();
738  session_destroy();
739 
740  // reset cookie
741  $client_id = $_COOKIE["ilClientId"];
742  ilUtil::setCookie("ilClientId","");
743 
744  //instantiate logout template
745  $tpl->addBlockFile("CONTENT", "content", "tpl.logout.html",
746  "Services/Init");
747 
748  if ($ilSetting->get("pub_section"))
749  {
750  $tpl->setCurrentBlock("homelink");
751  $tpl->setVariable("CLIENT_ID","?client_id=".$client_id."&lang=".$_GET['lang']);
752  $tpl->setVariable("TXT_HOME",$lng->txt("home"));
753  $tpl->parseCurrentBlock();
754  }
755 
756  if ($ilIliasIniFile->readVariable("clients","list"))
757  {
758  $tpl->setCurrentBlock("client_list");
759  $tpl->setVariable("TXT_CLIENT_LIST", $lng->txt("to_client_list"));
760  $this->ctrl->setParameter($this, "client_id", $client_id);
761  $tpl->setVariable("CMD_CLIENT_LIST",
762  $this->ctrl->getLinkTarget($this, "showClientList"));
763  $tpl->parseCurrentBlock();
764  $this->ctrl->setParameter($this, "client_id", "");
765  }
766 
767  $tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("logout"));
768  $tpl->setVariable("TXT_LOGOUT_TEXT", $lng->txt("logout_text"));
769  $tpl->setVariable("TXT_LOGIN", $lng->txt("login_to_ilias"));
770  $tpl->setVariable("CLIENT_ID","?client_id=".$client_id."&lang=".$_GET['lang']);
771 
772  $tpl->show();
773  }
774 
780  {
781  global $ilAuth, $tpl, $lng;
782 
783  $valid = $ilAuth->getValidationData();
784 
785  $tpl->addBlockFile("CONTENT", "content", "tpl.user_mapping_selection.html",
786  "Services/Init");
787  $email_user = ilObjUser::_getLocalAccountsForEmail($valid["email"]);
788 
789 
790  if ($ilAuth->sub_status == AUTH_WRONG_LOGIN)
791  {
792  $this->showFailure($lng->txt("err_wrong_login"));
793  }
794 
795  include_once('./Services/User/classes/class.ilObjUser.php');
796  if (count($email_user) == 1)
797  {
798  //$user = new ilObjUser(key($email_user));
799  $tpl->setCurrentBlock("one_user");
800  $tpl->setVariable("TXT_USERNAME", $lng->txt("username"));
801  $tpl->setVariable("VAL_USERNAME", current($email_user));
802  $tpl->setVariable("USER_ID", key($email_user));
803  $tpl->parseCurrentBlock();
804  }
805  else
806  {
807  foreach($email_user as $key => $login)
808  {
809  $tpl->setCurrentBlock("user");
810  $tpl->setVariable("USR_ID", $key);
811  $tpl->setVariable("VAL_USER", $login);
812  $tpl->parseCurrentBlock();
813  }
814  $tpl->setCurrentBlock("multpiple_user");
815  $tpl->parseCurrentBlock();
816  }
817 
818  $tpl->setCurrentBlock("content");
819  $this->ctrl->setParameter($this, "ext_uid", urlencode($_GET["ext_uid"]));
820  $this->ctrl->setParameter($this, "soap_pw", urlencode($_GET["soap_pw"]));
821  $this->ctrl->setParameter($this, "auth_stat", $_GET["auth_stat"]);
822  $tpl->setVariable("FORMACTION",
823  $this->ctrl->getFormAction($this));
824  $tpl->setVariable("TXT_ILIAS_LOGIN", $lng->txt("login_to_ilias"));
825  if (count($email_user) == 1)
826  {
827  $tpl->setVariable("TXT_EXPLANATION", $lng->txt("ums_explanation"));
828  $tpl->setVariable("TXT_EXPLANATION_2", $lng->txt("ums_explanation_2"));
829  }
830  else
831  {
832  $tpl->setVariable("TXT_EXPLANATION", $lng->txt("ums_explanation_3"));
833  $tpl->setVariable("TXT_EXPLANATION_2", $lng->txt("ums_explanation_4"));
834  }
835  $tpl->setVariable("TXT_CREATE_USER", $lng->txt("ums_create_new_account"));
836  $tpl->setVariable("TXT_PASSWORD", $lng->txt("password"));
837  $tpl->setVariable("PASSWORD", ilUtil::prepareFormOutput($_POST["password"]));
838  $tpl->setVariable("TXT_SUBMIT", $lng->txt("login"));
839 
840  $tpl->show();
841  }
842 
846  function showClientList()
847  {
848  global $tpl, $ilIliasIniFile, $ilCtrl;
849 //echo "1";
850  if (!$ilIliasIniFile->readVariable("clients","list"))
851  {
852  $this->processIndexPHP();
853  return;
854  }
855 //echo "2";
856  $tpl = new ilTemplate("tpl.main.html", true, true);
857 
858  // to do: get standard style
859  $tpl->setVariable("PAGETITLE","Client List");
860  $tpl->setVariable("LOCATION_STYLESHEET","./templates/default/delos.css");
861 
862  // load client list template
863  $tpl->addBlockfile("CONTENT", "content", "tpl.client_list.html",
864  "Services/Init");
865 
866  // load template for table
867  $tpl->addBlockfile("CLIENT_LIST", "client_list", "tpl.table.html");
868 
869  // load template for table content data
870  $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
871 
872  // load table content data
873  require_once("setup/classes/class.ilClientList.php");
874  require_once("setup/classes/class.ilClient.php");
875  require_once("setup/classes/class.ilDBConnections.php");
876  require_once("./Services/Table/classes/class.ilTableGUI.php");
877  $this->db_connections = new ilDBConnections();
878  $clientlist = new ilClientList($this->db_connections);
879  $list = $clientlist->getClients();
880 
881  if (count($list) == 0)
882  {
883  header("Location: ./setup/setup.php");
884  exit();
885  }
886 
887  foreach ($list as $key => $client)
888  {
889  $client->setDSN();
890  if ($client->checkDatabaseExists() and $client->ini->readVariable("client","access") and $client->getSetting("setup_ok"))
891  {
892  $this->ctrl->setParameter($this, "client_id", $key);
893  //$data[] = array(
894  // $client->getName(),
895  // "<a href=\"".$ilCtrl->getLinkTarget($this, "processIndexPHP")."\">Start page</a>",
896  // "<a href=\"".$ilCtrl->getLinkTarget($this, "showLogin")."\">Login page</a>"
897  // );
898  //$data[] = array(
899  // $client->getName(),
900  // "<a href=\"".$ilCtrl->getLinkTarget($this, "processIndexPHP")."\">Start page</a>",
901  // "<a href=\""."login.php?cmd=force_login&client_id=".urlencode($key)."\">Login page</a>"
902  // );
903  $data[] = array(
904  $client->getName(),
905  "<a href=\""."repository.php?client_id=".urlencode($key)."\">Start page</a>",
906  "<a href=\""."login.php?cmd=force_login&client_id=".urlencode($key)."\">Login page</a>"
907  );
908  }
909  }
910  $this->ctrl->setParameter($this, "client_id", "");
911 
912  // create table
913  $tbl = new ilTableGUI();
914 
915  // title & header columns
916  $tbl->setTitle("Available Clients");
917  $tbl->setHeaderNames(array("Installation Name","Public Access","Login"));
918  $tbl->setHeaderVars(array("name","index","login"));
919  $tbl->setColumnWidth(array("50%","25%","25%"));
920 
921  // control
922  $tbl->setOrderColumn($_GET["sort_by"],"name");
923  $tbl->setOrderDirection($_GET["sort_order"]);
924  $tbl->setLimit($_GET["limit"]);
925  $tbl->setOffset($_GET["offset"]);
926 
927  // content
928  $tbl->setData($data);
929 
930  // footer
931  $tbl->setFooter("tblfooter");
932 
933  // styles
934  $tbl->setStyle("table","std");
935 
936  $tbl->disable("icon");
937  $tbl->disable("numinfo");
938  $tbl->disable("sort");
939 
940  // render table
941  $tbl->render();
942  $tpl->show("DEFAULT", true, true);
943  }
944 
951  {
952  global $tpl;
953 
954  $str = "<p style=\"margin:15px;\">
955  You need to enable Session Cookies in your Browser to use ILIAS.
956  <br/>
957  <br/><b>Firefox</b>
958  <br/>Tools -> Options -> Privacy -> Cookies
959  <br/>Enable 'Allow sites to set cookies' and activate option 'Keep
960  <br/>cookies' auf 'until I close Firefox'
961  <br/>
962  <br/><b>Mozilla/Netscape</b>
963  <br/>Edit -> Preferences -> Privacy&Security -> Cookies
964  <br/>Go to 'Cookie Lifetime Policy' and check option 'Accept for current
965  <br/>session only'.
966  <br/>
967  <br/><b>Internet Explorer</b>
968  <br/>Tools -> Internet Options -> Privacy -> Advanced
969  <br/>- Check 'Override automatic cookie handling'
970  <br/>- Check 'Always allow session cookies'
971  </p>";
972  $tpl->setVariable("CONTENT", $str);
973  $tpl->show();
974  }
975 
979  function getAcceptance()
980  {
981  $this->showUserAgreement();
982  }
983 
987  function showUserAgreement()
988  {
989  global $lng, $tpl, $ilUser;
990 
991  require_once "./Services/User/classes/class.ilUserAgreement.php";
992 
993  $tpl->addBlockFile("CONTENT", "content", "tpl.view_usr_agreement.html",
994  "Services/Init");
995  $tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
996 
997 // ilUtil::sendInfo();
998  // display infopanel if something happened
1000 
1001  $tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
1002  $tpl->setVariable("TXT_OK", $lng->txt("ok"));
1003 
1004  // language selection
1005  $languages = $lng->getInstalledLanguages();
1006 
1007  $count = (int) round(count($languages) / 2);
1008  $num = 1;
1009 
1010  foreach ($languages as $lang_key)
1011  {
1012  $tpl->setCurrentBlock("languages");
1013  $tpl->setVariable("LANG_VAL_CMD", $this->ctrl->getCmd());
1014  $tpl->setVariable("AGR_LANG_ACTION",
1015  $this->ctrl->getFormAction($this));
1016  $tpl->setVariable("LANG_NAME",
1017  ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key));
1018  $tpl->setVariable("LANG_ICON", $lang_key);
1019  $tpl->setVariable("LANG_KEY", $lang_key);
1020  $tpl->setVariable("BORDER", 0);
1021  $tpl->setVariable("VSPACE", 0);
1022  $tpl->parseCurrentBlock();
1023 
1024  $num++;
1025  }
1026  $tpl->setCurrentBlock("content");
1027 
1028  // display tabs
1029  $tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("usr_agreement"));
1030  $tpl->setVariable("TXT_PAGETITLE", "ILIAS3 - ".$lng->txt("usr_agreement"));
1031  $tpl->setVariable("TXT_USR_AGREEMENT", ilUserAgreement::_getText());
1032 
1033  if ($this->ctrl->getCmd() == "getAcceptance")
1034  {
1035  if ($_POST["status"]=="accepted")
1036  {
1037  $ilUser->writeAccepted();
1038  ilUtil::redirect("index.php?target=".$_GET["target"]."&client_id=".CLIENT_ID);
1039  }
1040  $tpl->setVariable("VAL_CMD", "getAcceptance");
1041  $tpl->setVariable("AGR_LANG_ACTION",
1042  $this->ctrl->getFormAction($this));
1043  $tpl->setCurrentBlock("get_acceptance");
1044  $tpl->setVariable("FORM_ACTION",
1045  $this->ctrl->getFormAction($this));
1046  $tpl->setVariable("ACCEPT_CHECKBOX", ilUtil::formCheckbox(0, "status", "accepted"));
1047  $tpl->setVariable("ACCEPT_AGREEMENT", $lng->txt("accept_usr_agreement"));
1048  $tpl->setVariable("TXT_SUBMIT", $lng->txt("submit"));
1049  $tpl->parseCurrentBlock();
1050  }
1051  else
1052  {
1053  $tpl->setCurrentBlock("back");
1054  $tpl->setVariable("BACK", $lng->txt("back"));
1055  $tpl->setVariable("LINK_BACK",
1056  $this->ctrl->getLinkTargetByClass("ilstartupgui", "showLogin"));
1057  $tpl->parseCurrentBlock();
1058  }
1059 
1060  $tpl->show();
1061 
1062 
1063  }
1064 
1068  function processIndexPHP()
1069  {
1071 
1072  // display client selection list if enabled
1073  if (!isset($_GET["client_id"]) &&
1074  $_GET["cmd"] == "" &&
1075  $ilIliasIniFile->readVariable("clients","list"))
1076  {
1077  $this->showClientList();
1078  //include_once "./include/inc.client_list.php";
1079  exit();
1080  }
1081 
1082  /*
1083  if ($_GET["cmd"] == "login")
1084  {
1085  $rep_ref_id = $_SESSION["il_rep_ref_id"];
1086 
1087  $ilAuth->logout();
1088  session_destroy();
1089 
1090  // reset cookie
1091  $client_id = $_COOKIE["ilClientId"];
1092  setcookie ("ilClientId","");
1093  $_COOKIE["ilClientId"] = "";
1094 
1095  $_GET["client_id"] = $client_id;
1096  $_GET["rep_ref_id"] = $rep_ref_id;
1097 
1098 
1099  ilUtil::redirect("login.php?client_id=".$client_id."&lang=".$_GET['lang'].
1100  "&rep_ref_id=".$rep_ref_id);
1101  }*/
1102 
1103 
1104  // if no start page was given, ILIAS defaults to the standard login page
1105  if ($start == "")
1106  {
1107  $start = "login.php";
1108  }
1109 
1110 
1111  //
1112  // index.php is called and public section is enabled
1113  //
1114  // && $ilAuth->status == -101 is important for soap auth (public section on + user mapping, alex)
1115  // $ilAuth->status -1 is given, if session ends (if public section -> jump to public section)
1116 
1117  if ($ilSetting->get("pub_section") && $_POST["sendLogin"] != "1"
1118  && ($ilAuth->getStatus() != -101 && $_GET["soap_pw"] == ""))
1119  {
1120  //
1121  // TO DO: THE FOLLOWING BLOCK IS COPY&PASTED FROM HEADER.INC
1122 
1123  $_POST["username"] = "anonymous";
1124  $_POST["password"] = "anonymous";
1125 
1126  $oldSid = session_id();
1127 
1128  $ilAuth->start();
1129  if (ANONYMOUS_USER_ID == "")
1130  {
1131  die ("Public Section enabled, but no Anonymous user found.");
1132  }
1133  if (!$ilAuth->getAuth())
1134  {
1135  die("ANONYMOUS user with the object_id ".ANONYMOUS_USER_ID." not found!");
1136  }
1137 
1138  if(IS_PAYMENT_ENABLED)
1139  {
1140  $newSid = session_id();
1141  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
1142  ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
1143  }
1144 
1145  // get user id
1146  $ilInit->initUserAccount();
1147  $this->processStartingPage();
1148 
1149  exit;
1150  }
1151  else
1152  {
1153  // index.php is called and public section is disabled
1154  $this->showLogin();
1155  }
1156  }
1157 
1158 
1165  {
1166  global $ilBench, $ilCtrl, $ilAccess, $lng, $ilUser;
1167 //echo "here";
1168  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID || !empty($_GET["ref_id"]))
1169  {
1170 //echo "A";
1171  // if anonymous and a target given...
1172  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID && $_GET["target"] != "")
1173  {
1174  // target is accessible -> goto target
1175  if ($this->_checkGoto($_GET["target"]))
1176  {
1177 //echo "B";
1178  ilUtil::redirect("./goto.php?target=".$_GET["target"]);
1179  }
1180  else // target is not accessible -> login
1181  {
1182 //echo "C";
1183  $this->showLogin();
1184  }
1185  }
1186 
1187  // just go to public section
1188  if (empty($_GET["ref_id"]))
1189  {
1190  $_GET["ref_id"] = ROOT_FOLDER_ID;
1191  }
1192  $ilCtrl->initBaseClass("");
1193  $ilCtrl->setCmd("frameset");
1194  $start_script = "repository.php";
1195  include($start_script);
1196  return true;
1197  }
1198  else
1199  {
1200  if(IS_PAYMENT_ENABLED)
1201  {
1202  $usr_id = $ilUser->getId();
1203  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
1205  }
1206 
1207  if (!$this->_checkGoto($_GET["target"]))
1208  {
1209  // message if target given but not accessible
1210  if ($_GET["target"] != "")
1211  {
1212  $tarr = explode("_", $_GET["target"]);
1213  if ($tarr[0] != "pg" && $tarr[0] != "st" && $tarr[1] > 0)
1214  {
1215  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1217  }
1218  }
1219 
1220  // show personal desktop
1221  #$ilCtrl->initBaseClass("ilPersonalDesktopGUI");
1222  #$start_script = "ilias.php";
1223  // Redirect here to switch back to http if desired
1224  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
1225  }
1226  else
1227  {
1228 //echo "3";
1229  ilUtil::redirect("./goto.php?target=".$_GET["target"]);
1230  }
1231  }
1232 
1233  include($start_script);
1234  }
1235 
1236  function _checkGoto($a_target)
1237  {
1238  global $objDefinition;
1239 
1240  if ($a_target == "")
1241  {
1242  return false;
1243  }
1244 
1245  $t_arr = explode("_", $_GET["target"]);
1246  $type = $t_arr[0];
1247 
1248  if ($type == "git")
1249  {
1250  $type = "glo";
1251  }
1252 
1253  if ($type == "pg" | $type == "st")
1254  {
1255  $type = "lm";
1256  }
1257 
1258  $class = $objDefinition->getClassName($type);
1259  if ($class == "")
1260  {
1261  return false;
1262  }
1263  $location = $objDefinition->getLocation($type);
1264  $full_class = "ilObj".$class."Access";
1265  include_once($location."/class.".$full_class.".php");
1266 
1267  return call_user_func(array($full_class, "_checkGoto"),
1268  $a_target);
1269  }
1270 
1271  public function confirmRegistration()
1272  {
1273  global $lng, $ilias, $ilLog;
1274 
1275  ilUtil::setCookie('iltest', 'cookie', false);
1276 
1277  if(!isset($_GET['rh']) || !strlen(trim($_GET['rh'])))
1278  {
1279  ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg=reg_confirmation_hash_not_passed');
1280  }
1281 
1282  try
1283  {
1284  require_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
1285  $oRegSettings = new ilRegistrationSettings();
1286 
1289  $oUser->setActive(true);
1290  if($oRegSettings->passwordGenerationEnabled())
1291  {
1292  $passwd = ilUtil::generatePasswords(1);
1293  $password = $passwd[0];
1294  $oUser->setPasswd($password, IL_PASSWD_PLAIN);
1295  $oUser->setLastPasswordChangeTS( time() );
1296  }
1297  $oUser->update();
1298 
1299  if($lng->getLangKey() != $oUser->getPref('language'))
1300  {
1301  $lng = new ilLanguage($oUser->getPref('language'));
1302  }
1303 
1304  // send email
1305  // try individual account mail in user administration
1306  include_once("Services/Mail/classes/class.ilAccountMail.php");
1307  include_once './Services/User/classes/class.ilObjUserFolder.php';
1308  $amail = ilObjUserFolder::_lookupNewAccountMail($oUser->getPref('language'));
1309  if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
1310  {
1311  $acc_mail = new ilAccountMail();
1312  $acc_mail->setUser($oUser);
1313  if($oRegSettings->passwordGenerationEnabled())
1314  {
1315  $acc_mail->setUserPassword($password);
1316  }
1317  $acc_mail->send();
1318  }
1319  else // do default mail
1320  {
1321  include_once 'Services/Mail/classes/class.ilMail.php';
1322  $mail_obj = new ilMail(ANONYMOUS_USER_ID);
1323 
1324  // mail subject
1325  $subject = $lng->txt("reg_mail_subject");
1326 
1327  // mail body
1328  $body = $lng->txt("reg_mail_body_salutation")." ".$oUser->getFullname().",\n\n".
1329  $lng->txt("reg_mail_body_text1")."\n\n".
1330  $lng->txt("reg_mail_body_text2")."\n".
1331  ILIAS_HTTP_PATH."/login.php?client_id=".CLIENT_ID."\n";
1332  $body .= $lng->txt("login").": ".$oUser->getLogin()."\n";
1333 
1334  if($oRegSettings->passwordGenerationEnabled())
1335  {
1336  $body.= $lng->txt("passwd").": ".$password."\n";
1337  }
1338 
1339  $body.= "\n";
1340  $body.= $lng->txt('reg_mail_body_forgot_password_info')."\n";
1341 
1342  $body.= "\n";
1343 
1344  $body .= ($lng->txt("reg_mail_body_text3")."\n\r");
1345  $body .= $oUser->getProfileAsString($lng);
1346  $mail_obj->enableSoap(false);
1347  $mail_obj->appendInstallationSignature(true);
1348  $mail_obj->sendMail($oUser->getEmail(), '', '',
1349  $subject,
1350  $body,
1351  array(), array('normal'));
1352  }
1353 
1354  ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg=reg_account_confirmation_successful');
1355  }
1356  catch(ilRegConfirmationLinkExpiredException $exception)
1357  {
1358  include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
1359  $soap_client = new ilSoapClient();
1360  $soap_client->setTimeout(1);
1361  $soap_client->setResponseTimeout(1);
1362  $soap_client->enableWSDL(true);
1363  $soap_client->init();
1364 
1365  $ilLog->write(__METHOD__.': Triggered soap call (background process) for deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
1366 
1367  $soap_client->call
1368  (
1369  'deleteExpiredDualOptInUserObjects',
1370  array
1371  (
1372  $_COOKIE['PHPSESSID'].'::'.$_COOKIE['ilClientId'], // session id and client id, not used for checking access -> not possible for anonymous
1373  $exception->getCode() // user id
1374  )
1375  );
1376 
1377  ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg='.$exception->getMessage());
1378  }
1379  catch(ilRegistrationHashNotFoundException $exception)
1380  {
1381  ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg='.$exception->getMessage());
1382  }
1383  }
1384 
1389  protected function showOpenIdLogin()
1390  {
1391  global $lng,$tpl;
1392 
1393  include_once './Services/OpenId/classes/class.ilOpenIdSettings.php';
1394  if(!ilOpenIdSettings::getInstance()->isActive())
1395  {
1396  return;
1397  }
1398 
1399  $lng->loadLanguageModule('auth');
1400 
1401  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1402  $form = new ilPropertyFormGUI();
1403  $form->setFormAction($this->ctrl->getFormAction($this,'login'));
1404  $form->setTitle($lng->txt('login_to_ilias_via_openid'));
1405 
1406  $openid = new ilTextInputGUI($lng->txt('auth_openid_login'),'oid_username');
1407  $openid->setSize(18);
1408  $openid->setMaxLength(255);
1409  $openid->setRequired(true);
1410  $openid->setCssClass('ilOpenIDBox');
1411  $openid->setInfo($lng->txt('auth_openid_login_info_a'));
1412  $form->addItem($openid);
1413 
1414  include_once './Services/OpenId/classes/class.ilOpenIdProviders.php';
1415  $pro = new ilSelectInputGUI($lng->txt('auth_openid_provider'),'oid_provider');
1416  $pro->setOptions(ilOpenIdProviders::getInstance()->getProviderSelection());
1417  $pro->setValue(ilOpenIdProviders::getInstance()->getSelectedProvider());
1418  $form->addItem($pro);
1419 
1420 
1421  $form->addCommandButton("showLogin", $lng->txt("log_in"));
1422 
1423  $tpl->setVariable('OID_LOGIN_FORM',$form->getHTML());
1424  }
1425 }
1426 ?>