/** * constructor */ public function __construct(cs_environment $environment) { // CommSy-Plugin logout-hook plugin_hook('logout'); // delete session $session_manager = $environment->getSessionManager(); $session = $environment->getSessionItem(); $history = $session->getValue('history'); $cookie = $session->getValue('cookie'); $javascript = $session->getValue('javascript'); $https = $session->getValue('https'); $flash = $session->getValue('flash'); if ($session->issetValue('root_session_id')) { $root_session_id = $session->getValue('root_session_id'); } $session_manager->delete($session->getSessionID(), true); $session->reset(); include_once 'classes/cs_session_item.php'; $session = new cs_session_item(); $session->createSessionID('guest'); if ($cookie == '1') { $session->setValue('cookie', 2); } else { $session->setValue('cookie', 0); } if ($javascript == '1') { $session->setValue('javascript', 1); } elseif ($javascript == '-1') { $session->setValue('javascript', -1); } if ($https == '1') { $session->setValue('https', 1); } elseif ($https == '-1') { $session->setValue('https', -1); } if ($flash == '1') { $session->setValue('flash', 1); } elseif ($flash == '-1') { $session->setValue('flash', -1); } if (!empty($_GET['back_tool'])) { $back_tool = $_GET['back_tool']; $back_file = $back_tool . '.php'; } else { $back_tool = ''; $back_file = ''; } if (mb_stristr($_SERVER['PHP_SELF'], 'homepage.php')) { $session->setToolName('homepage'); } $environment->setSessionItem($session); // redirect $current_context = $environment->getCurrentContextItem(); if (isset($root_session_id) and !empty($root_session_id)) { // change cookie if ($cookie == '1') { $session_manager = $environment->getSessionManager(); $session = $session_manager->get($root_session_id); $session->setValue('cookie', 2); unset($session_manager); $environment->setSessionItem($session); } $params = $history[0]['parameter']; $params['SID'] = $root_session_id; redirect($history[0]['context'], $history[0]['module'], $history[0]['function'], $params, '', '', $back_tool); } elseif (!$current_context->isOpenForGuests() and (empty($back_tool) or !empty($back_tool) and $back_tool == 'commsy')) { if (!$current_context->isServer()) { $parent_context = $current_context->getContextItem(); if ($parent_context->isOpenForGuests()) { if ($parent_context->isPortal()) { $params = array(); $params['room_id'] = $current_context->getItemID(); if ($current_context->isGroupRoom()) { $project_room_item_id = $current_context->getLinkedProjectItemID(); if (!empty($project_room_item_id)) { $params['room_id'] = $project_room_item_id; } } redirect($parent_context->getItemID(), 'home', 'index', $params, '', '', $back_tool); unset($params); } else { redirect($parent_context->getItemID(), 'home', 'index', '', '', '', $back_tool); } } } else { redirect($current_context->getItemID(), 'home', 'index', '', '', '', $back_tool); } } else { redirect($history[0]['context'], $history[0]['module'], $history[0]['function'], $history[0]['parameter'], '', '', $back_tool); } $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; redirect_with_url($url); }
// case: login with CommSy if (isset($session)) { $history = $session->getValue('history'); $cookie = $session->getValue('cookie'); $javascript = $session->getValue('javascript'); $https = $session->getValue('https'); $flash = $session->getValue('flash'); } else { $history = array(); $cookie = ''; $javascript = ''; $https = ''; $flash = ''; } $session = new cs_session_item(); $session->createSessionID($user_id); if ($cookie == '1') { $session->setValue('cookie', 2); } elseif (empty($cookie)) { // do nothing, so CommSy will try to save cookie } else { $session->setValue('cookie', 0); } if ($javascript == '1') { $session->setValue('javascript', 1); } elseif ($javascript == '-1') { $session->setValue('javascript', -1); } if ($https == '1') { $session->setValue('https', 1); } elseif ($https == '-1') {
if ($_SERVER['Shib_userId']){ $session_manager->delete($SID,true); $session->reset(); redirect_with_url($environment->getConfiguration('c_shibboleth_redirect_url')); } } else { $session_manager->delete($SID,true); $session->reset(); } setcookie("expired_password_shown", null); include_once('classes/cs_session_item.php'); $session = new cs_session_item(); $session->createSessionID('guest'); if ($cookie == '1') { $session->setValue('cookie',2); } else { $session->setValue('cookie',0); } if ($javascript == '1') { $session->setValue('javascript',1); } elseif ($javascript == '-1') { $session->setValue('javascript',-1); } if ($https == '1') { $session->setValue('https',1); } elseif ($https == '-1') { $session->setValue('https',-1); }
function execute() { $success = false; $class_params = array(); $class_params['environment'] = $this->_environment; $form = $this->_class_factory->getClass(HOME_MEMBER2_FORM, $class_params); unset($class_params); // Load form data from postvars if (!empty($this->_post_vars)) { $form->setFormPost($this->_post_vars); } if (!empty($this->_get_vars)) { $form->setFormGet($this->_get_vars); } $form->prepareForm(); $form->loadValues(); // cancel if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('COMMON_CANCEL_BUTTON'))) { $this->_redirect_back(); } // Save item if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('ACCOUNT_GET_BUTTON'))) { $correct = $form->check(); if ($correct) { if (isset($this->_post_vars['auth_source']) and !empty($this->_post_vars['auth_source'])) { $auth_source = $this->_post_vars['auth_source']; } else { include_once 'functions/error_functions.php'; trigger_error('lost auth source', E_USER_ERROR); } $portal_item = $this->_environment->getCurrentPortalItem(); $auth_source_item = $portal_item->getAuthSource($auth_source); $redirect_to_login = true; // CAS if ($auth_source_item->getSourceType() == 'CAS') { $redirect_to_login = false; } elseif ($auth_source_item->getSourceType() == 'Typo3') { $redirect_to_login = false; } elseif ($auth_source_item->getSourceType() == 'Joomla') { $redirect_to_login = false; } elseif ($auth_source_item->getSourceType() == 'MYSQL') { $redirect_to_login = false; } elseif ($auth_source_item->getSourceType() == 'LDAP') { $redirect_to_login = false; } elseif ($auth_source_item->isCommSyDefault()) { $redirect_to_login = false; } if ($redirect_to_login) { // if someting is wrong $params = $this->_environment->getCurrentParameterArray(); unset($params['cs_modus']); redirect($this->_environment->getCurrentContextID(), 'home', 'index', $params); exit; } // Create new item $authentication = $this->_environment->getAuthenticationObject(); $new_account = $authentication->getNewItem(); $new_account->setUserID($this->_post_vars['user_id']); $new_account->setFirstname($this->_post_vars['firstname']); $new_account->setLastname($this->_post_vars['lastname']); $new_account->setLanguage($this->_post_vars['language']); $new_account->setEmail($this->_post_vars['email']); $new_account->setPortalID($this->_environment->getCurrentPortalID()); $new_account->setAuthSourceID($auth_source); $save_only_user = true; $authentication->save($new_account, $save_only_user); $portal_user = $authentication->getUserItem(); $error = $authentication->getErrorMessage(); if (empty($error)) { $success = true; $portal_item = $this->_environment->getCurrentPortalItem(); if ($this->_environment->getCurrentContextItem()->withAGB() and $this->_environment->getCurrentContextItem()->withAGBDatasecurity()) { if ($this->_post_vars['terms_of_use']) { $portal_user->setAGBAcceptance(); } } if ($portal_item->getConfigurationHideMailByDefault()) { // hide $portal_user->setDefaultMailNotVisible(); } else { $portal_user->setDefaultMailVisible(); } #if ( $portal_item->checkNewMembersAlways() # or $portal_item->checkNewMembersSometimes() # ) { # // portal: generate and save task # $task_manager = $environment->getTaskManager(); # $task_item = $task_manager->getNewItem(); # $task_item->setContextID($portal_item->getItemID()); # $task_item->getCreatorItem($portal_user); # $task_item->setTitle('TASK_USER_REQUEST'); # $task_item->setStatus('REQUEST'); # $task_item->setItem($portal_user); # $task_item->save(); #} // portal: send mail to moderators in different languages $user_list = $portal_item->getModeratorList(); $email_addresses = array(); $user_item = $user_list->getFirst(); $recipients = ''; $language = $portal_item->getLanguage(); while ($user_item) { $want_mail = $user_item->getAccountWantMail(); if (!empty($want_mail) and $want_mail == 'yes') { if ($language == 'user' and $user_item->getLanguage() != 'browser') { $email_addresses[$user_item->getLanguage()][] = $user_item->getEmail(); } elseif ($language == 'user' and $user_item->getLanguage() == 'browser') { $email_addresses[$this->_environment->getSelectedLanguage()][] = $user_item->getEmail(); } else { $email_addresses[$language][] = $user_item->getEmail(); } $recipients .= $user_item->getFullname() . LF; } $user_item = $user_list->getNext(); } $save_language = $this->_translator->getSelectedLanguage(); foreach ($email_addresses as $key => $value) { $this->_translator->setSelectedLanguage($key); if (count($value) > 0) { include_once 'classes/cs_mail.php'; $mail = new cs_mail(); $mail->set_to(implode(',', $value)); $server_item = $this->_environment->getServerItem(); $default_sender_address = $server_item->getDefaultSenderAddress(); if (!empty($default_sender_address)) { $mail->set_from_email($default_sender_address); } else { $mail->set_from_email('@'); } $mail->set_from_name($this->_translator->getMessage('SYSTEM_MAIL_MESSAGE', $portal_item->getTitle())); $mail->set_reply_to_name($portal_user->getFullname()); $mail->set_reply_to_email($portal_user->getEmail()); $mail->set_subject($this->_translator->getMessage('USER_GET_MAIL_SUBJECT', $portal_user->getFullname())); $body = $this->_translator->getMessage('MAIL_AUTO', $this->_translator->getDateInLang(getCurrentDateTimeInMySQL()), $this->_translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $temp_language = $portal_user->getLanguage(); if ($temp_language == 'browser') { $temp_language = $this->_environment->getSelectedLanguage(); } $body .= $this->_translator->getMessage('USER_GET_MAIL_BODY', $portal_user->getFullname(), $portal_user->getUserID(), $portal_user->getEmail(), $this->_translator->getLanguageLabelTranslated($temp_language)); unset($temp_language); $body .= LF . LF; # if ( !$portal_item->checkNewMembersNever() # or $portal_item->checkNewMembersSometimes() # ) { # $check_message = 'YES'; # } else { $check_message = 'NO'; # } switch ($check_message) { case 'YES': $body .= $this->_translator->getMessage('USER_GET_MAIL_STATUS_YES'); break; case 'NO': $body .= $this->_translator->getMessage('USER_GET_MAIL_STATUS_NO'); break; default: break; } $body .= LF . LF; if (!empty($_POST['explanation'])) { $body .= $this->_translator->getMessage('MAIL_COMMENT_BY', $portal_user->getFullname(), ''); $body .= LF . LF; } $body .= $this->_translator->getMessage('MAIL_SEND_TO', $recipients); $body .= LF; $body .= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $portal_item->getItemID() . '&mod=account&fct=index' . '&selstatus=1'; $mail->set_message($body); $mail->send(); } } $this->_translator->setSelectedLanguage($save_language); // activate user #$login = false; #if ($portal_item->checkNewMembersNever()) { $portal_user->makeUser(); $portal_user->save(); $current_user = $portal_user; $this->_environment->setCurrentUserItem($current_user); #$this->setCurrentUser($this->_environment->getCurrentUserItem()); #$login = true; #} // send email to user if ($current_user->isUser()) { if (!$this->_environment->inPortal()) { // change translation context $this->_translator->setContext('portal'); $current_portal = $this->_environment->getCurrentPortalItem(); $this->_translator->setEmailTextArray($current_portal->getEmailTextArray()); $this->_translator->setSelectedLanguage($current_portal->getLanguage()); } $mod_text = ''; $mod_list = $portal_item->getContactModeratorList(); if (!$mod_list->isEmpty()) { $mod_item = $mod_list->getFirst(); $contact_moderator = $mod_item; while ($mod_item) { if (!empty($mod_text)) { $mod_text .= ',' . LF; } $mod_text .= $mod_item->getFullname(); $mod_text .= ' (' . $mod_item->getEmail() . ')'; $mod_item = $mod_list->getNext(); } } $language = getSelectedLanguage(); $this->_translator->setSelectedLanguage($language); include_once 'classes/cs_mail.php'; $mail = new cs_mail(); $mail->set_to($current_user->getEmail()); $mail->set_from_name($this->_translator->getMessage('SYSTEM_MAIL_MESSAGE', $portal_item->getTitle())); $server_item = $this->_environment->getServerItem(); $default_sender_address = $server_item->getDefaultSenderAddress(); if (!empty($default_sender_address)) { $mail->set_from_email($default_sender_address); } else { $user_manager = $this->_environment->getUserManager(); $root_user = $user_manager->getRootUser(); $root_mail_address = $root_user->getEmail(); if (!empty($root_mail_address)) { $mail->set_from_email($root_mail_address); } else { $mail->set_from_email('@'); } } if (!empty($contact_moderator)) { $mail->set_reply_to_email($contact_moderator->getEmail()); $mail->set_reply_to_name($contact_moderator->getFullname()); } $mail->set_subject($this->_translator->getMessage('MAIL_SUBJECT_USER_ACCOUNT_FREE', $portal_item->getTitle())); $body = $this->_translator->getMessage('MAIL_AUTO', $this->_translator->getDateInLang(getCurrentDateTimeInMySQL()), $this->_translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $body .= $this->_translator->getEmailMessage('MAIL_BODY_HELLO', $current_user->getFullname()); $body .= LF . LF; $body .= $this->_translator->getEmailMessage('MAIL_BODY_USER_STATUS_USER', $portal_user->getUserID(), $portal_item->getTitle()); $body .= LF . LF; if (empty($contact_moderator)) { $body .= $this->_translator->getMessage('SYSTEM_MAIL_REPLY_INFO') . LF; $body .= $mod_text; $body .= LF . LF; } else { $body .= $this->_translator->getEmailMessage('MAIL_BODY_CIAO', $contact_moderator->getFullname(), $portal_item->getTitle()); $body .= LF . LF; } $body .= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $this->_environment->getCurrentContextID(); $mail->set_message($body); $mail->send(); if (!$this->_environment->inPortal()) { // change translation context back $current_context = $this->_environment->getCurrentContextItem(); if ($current_context->isProjectRoom()) { $this->_translator->setContext('project'); } else { $this->_translator->setContext('community'); } $this->_translator->setEmailTextArray($current_context->getEmailTextArray()); $this->_translator->setSelectedLanguage($current_context->getLanguage()); } } // login in user #if ($login) { $session = $this->_environment->getSessionItem(); #if ($session->issetValue('last_step')) { #$last_step = $session->getValue('last_step'); #$session->unsetValue('last_step'); #} $cookie = $session->getValue('cookie'); include_once 'classes/cs_session_item.php'; global $session; // for PHP5 and TBD !!!!!!!!!! $session = new cs_session_item(); $session->createSessionID($_POST['user_id']); if ($cookie == '1') { $session->setValue('cookie', 2); } else { $session->setValue('cookie', 0); } // save portal id in session to be sure, that user didn't // switch between portals $session->setValue('commsy_id', $this->_environment->getCurrentPortalID()); // auth_source if (empty($auth_source)) { $auth_source = $authentication->getAuthSourceItemID(); } $session->setValue('auth_source', $auth_source); $this->_environment->setSessionItem($session); } } } if (!$success) { return $this->_show_form($form); } else { $this->_redirect_back(); } }
public function authenticateForApp($user_id, $password, $portal_id = 99, $auth_source_id = 0) { el('authenticate ' . $user_id); el('authenticate'); $user_id = $this->_encode_input($user_id); $password = $this->_encode_input($password); $portal_id = $this->_encode_input($portal_id); if (!empty($auth_source_id) and $auth_source_id != 0) { $auth_source_id = $this->_encode_input($auth_source_id); } $result = ''; $info = 'ERROR'; $info_text = 'default-error'; if (empty($user_id) or empty($password)) { el('authenticate 1'); $info = 'ERROR'; $info_text = 'user_id or password lost'; } else { el('authenticate 2'); if (!isset($this->_environment)) { el('authenticate 3'); $info = 'ERROR'; $info_text = 'environment lost'; } else { el('authenticate 4'); $this->_environment->setCurrentContextID($portal_id); $authentication = $this->_environment->getAuthenticationObject(); if (isset($authentication)) { el('authenticate 5'); if ($authentication->isAccountGranted($user_id, $password, $auth_source_id)) { el('authenticate 6'); if ($this->_isSessionActiveForApp($user_id, $portal_id)) { el('authenticate 7'); $result = $this->_getActiveSessionIDForApp($user_id, $portal_id); if (empty($result)) { el('authenticate 8'); $info = 'ERROR'; $info_text = 'no session id from session manager -> database error'; } } else { el('authenticate 9'); // make session include_once 'classes/cs_session_item.php'; $session = new cs_session_item(); $session->createSessionID($user_id); // save portal id in session to be sure, that user didn't // switch between portals $session->setValue('user_id', $user_id); $session->setValue('commsy_id', $portal_id); if (empty($auth_source_id) or $auth_source_id == 0) { $auth_source_id = $authentication->getAuthSourceItemID(); } $session->setValue('auth_source', $auth_source_id); $session->setValue('cookie', '0'); $session->setSoapSession(); // save session $session_manager = $this->_environment->getSessionManager(); $session_manager->save($session); $result = $session->getSessionID(); } } else { $info = 'ERROR'; $info_text = 'account not granted ' . $user_id . ' - ' . $password . ' - ' . $portal_id; } } else { $info = 'ERROR'; $info_text = 'authentication object lost'; } } } el('authenticate: $result ' . $result); el('authenticate: $info ' . $info); el('authenticate: $info_text ' . $info_text); if (empty($result) and !empty($info)) { $result = new SoapFault($info, $info_text); } else { $result = $this->_encode_output($result); } return $result; }
public function getSessionIdFromConnectionKeySOAP($session_id, $portal_id, $user_key, $server_key) { $retour = ''; $auth = true; // test server key $server_item = $this->_environment->getServerItem(); $server_connection_info = $server_item->getServerConnectionInfoByKey($server_key); if (empty($server_connection_info)) { $auth = false; } // find user with user_key if ($auth) { $user_manager = $this->_environment->getUserManager(); $user_manager->setContextLimit($portal_id); #$user_manager->setExternalConnectionUserKeyLimit($user_key); $user_manager->setOwnConnectionUserKeyLimit($user_key); $user_manager->select(); $user_list = $user_manager->get(); if (!empty($user_list) and $user_list->isNotEmpty() and $user_list->getCount() == 1) { $user_item = $user_list->getFirst(); $user_id = $user_item->getUserID(); $auth_source_id = $user_item->getAuthSource(); } else { $auth = false; } } if ($auth) { $result = $this->_getActiveSessionIDFromConnectionKey($user_key, $portal_id); if (empty($result)) { // make session include_once 'classes/cs_session_item.php'; $session = new cs_session_item(); $session->createSessionID($user_id); // save portal id in session to be sure, that user didn't // switch between portals $session->setValue('user_id', $user_id); $session->setValue('commsy_id', $portal_id); $session->setValue('auth_source', $auth_source_id); $session->setValue('CONNECTION_KEY', $user_key); $session->setValue('cookie', '3'); // special handling for commsy connections $session->setValue('javascript', '1'); // save session $session_manager = $this->_environment->getSessionManager(); $session_manager->save($session); $retour = $session->getSessionID(); } else { // cookie management $session_manager = $this->_environment->getSessionManager(); $session_item = $session_manager->get($result); if ($session_item->issetValue('cookie') and $session_item->getValue('cookie') != 3) { // save cookie again when user jump to other portal $session_item->setValue('cookie', 3); $session_manager->save($session_item); } $retour = $result; } } return $retour; }
function execute() { $success = false; $class_params = array(); $class_params['environment'] = $this->_environment; $form = $this->_class_factory->getClass(PASSWORD_FORGET_FORM, $class_params); unset($class_params); // Load form data from postvars if (!empty($this->_post_vars)) { $form->setFormPost($this->_post_vars); } $form->prepareForm(); $form->loadValues(); // cancel if (!empty($this->_command) and (isOption($this->_command, $this->_translator->getMessage('COMMON_CANCEL_BUTTON')) or isOption($this->_command, $this->_translator->getMessage('COMMON_FORWARD_BUTTON')))) { $this->_redirect_back(); } // Save item if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('PASSWORD_GENERATE_BUTTON'))) { $correct = $form->check(); if ($correct) { // save special session $user_manager = $this->_environment->getUserManager(); $user_manager->setContextLimit($this->_environment->getCurrentPortalID()); $user_manager->setUserIDLimit($this->_post_vars['user_id']); if (!empty($this->_post_vars['auth_source'])) { $user_manager->setAuthSourceLimit($this->_post_vars['auth_source']); } $user_manager->select(); $user_list = $user_manager->get(); $user_item = $user_list->getFirst(); $success = true; while ($user_item) { // auth source $auth_source_manager = $this->_environment->getAuthSourceManager(); $auth_source_item = $auth_source_manager->getItem($user_item->getAuthSource()); if ($auth_source_item->allowAddAccount()) { include_once 'classes/cs_session_item.php'; $new_special_session_item = new cs_session_item(); $new_special_session_item->createSessionID($this->_post_vars['user_id']); $new_special_session_item->setValue('auth_source', $user_item->getAuthSource()); if ($this->_post_vars['user_id'] == 'root') { $new_special_session_item->setValue('commsy_id', $this->_environment->getServerID()); } else { $new_special_session_item->setValue('commsy_id', $this->_environment->getCurrentPortalID()); } if (isset($_SERVER["SERVER_ADDR"]) and !empty($_SERVER["SERVER_ADDR"])) { $new_special_session_item->setValue('password_forget_ip', $_SERVER["SERVER_ADDR"]); } else { $new_special_session_item->setValue('password_forget_ip', $_SERVER["HTTP_HOST"]); } include_once 'functions/date_functions.php'; $new_special_session_item->setValue('password_forget_time', getCurrentDateTimeInMySQL()); $new_special_session_item->setValue('javascript', -1); $new_special_session_item->setValue('cookie', 0); $session_manager = $this->_environment->getSessionManager(); $session_manager->save($new_special_session_item); } $user_email = ''; $user_fullname = ''; $user_id = ''; $portal = $this->_environment->getCurrentPortalItem(); $user_fullname = $user_item->getFullName(); $user_email = $user_item->getEMail(); $user_id = $user_item->getUserID(); $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $this->_environment->getCurrentPortalID(); if ($auth_source_item->allowAddAccount()) { $url .= '&SID=' . $new_special_session_item->getSessionID(); } // send email $context_item = $this->_environment->getCurrentPortalItem(); $mod_text = ''; $mod_list = $context_item->getModeratorList(); if (!$mod_list->isEmpty()) { $mod_item = $mod_list->getFirst(); $contact_moderator = $mod_item; while ($mod_item) { if (!empty($mod_text)) { $mod_text .= ',' . LF; } $mod_text .= $mod_item->getFullname(); $mod_text .= ' (' . $mod_item->getEmail() . ')'; $mod_item = $mod_list->getNext(); } } $translator = $this->_environment->getTranslationObject(); include_once 'classes/cs_mail.php'; $mail = new cs_mail(); $mail->set_to($user_email); $server_item = $this->_environment->getServerItem(); $default_sender_address = $server_item->getDefaultSenderAddress(); if (!empty($default_sender_address)) { $mail->set_from_email($default_sender_address); } else { $mail->set_from_email('@'); } if (!empty($contact_moderator)) { $mail->set_reply_to_email($contact_moderator->getEmail()); $mail->set_reply_to_name($contact_moderator->getFullname()); } $mail->set_from_name($this->_translator->getMessage('SYSTEM_MAIL_MESSAGE', $context_item->getTitle())); $mail->set_subject($translator->getMessage('USER_PASSWORD_MAIL_SUBJECT', $context_item->getTitle())); $body = $translator->getMessage('MAIL_AUTO', $translator->getDateInLang(getCurrentDateTimeInMySQL()), $translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $body .= $translator->getEmailMessage('MAIL_BODY_HELLO', $user_fullname); $body .= LF . LF; if ($auth_source_item->allowAddAccount()) { $body .= $translator->getMessage('USER_PASSWORD_MAIL_BODY', $user_id, $context_item->getTitle(), $url, '15'); } else { $body .= $translator->getMessage('USER_PASSWORD_MAIL_BODY_SORRY', $user_id, $context_item->getTitle()); $body .= LF . LF; $body .= $translator->getMessage('USER_PASSWORD_MAIL_BODY_SORRY2', $auth_source_item->getTitle()); $link = $auth_source_item->getPasswordChangeLink(); $contact_mail = $auth_source_item->getContactEMail(); if (!empty($link)) { $body .= LF . LF; $body .= $translator->getMessage('USER_PASSWORD_MAIL_BODY_SORRY2_LINK', $link); } if (!empty($contact_mail)) { $body .= LF . LF; $body .= $translator->getMessage('USER_PASSWORD_MAIL_BODY_SORRY2_MAIL', $auth_source_item->getTitle(), $contact_mail); } $body .= LF . LF; $body .= $translator->getMessage('USER_PASSWORD_MAIL_BODY_SORRY3'); } $body .= LF . LF; if (empty($contact_moderator)) { $body .= $translator->getMessage('SYSTEM_MAIL_REPLY_INFO') . LF; $body .= $mod_text; $body .= LF . LF; } else { $body .= $translator->getEmailMessage('MAIL_BODY_CIAO', $contact_moderator->getFullname(), $context_item->getTitle()); $body .= LF . LF; } $mail->set_message($body); $success = $success and $mail->send(); $user_item = $user_list->getNext(); } if ($success) { // show little status page that mail was sent successful $form->showMailSent($user_email); } else { // show little status page that mail was not sent successful $form->showMailFailure(); } } } return $this->_show_form($form); }
public function actionDetail() { $session = $this->_environment->getSessionItem(); // try to set the item $this->setItem(); $this->setupInformation(); // check for item type $item_manager = $this->_environment->getItemManager(); $type = $item_manager->getItemType($_GET['iid']); if ($type !== CS_USER_TYPE) { throw new cs_detail_item_type_exception('wrong item type', 0); } else { // TODO: check if unused // used to signal which "creator infos" of annotations are expanded... $creatorInfoStatus = array(); if (!empty($_GET['creator_info_max'])) { $creatorInfoStatus = explode('-', $_GET['creator_info_max']); } // init $user_manager = $this->_environment->getUserManager(); $current_user = $this->_environment->getCurrentUser(); $current_module = $this->_environment->getCurrentModule(); // check if item exists if ($this->_item === null) { include_once 'functions/error_functions.php'; trigger_error('Item ' . $_GET['iid'] . ' does not exist!', E_USER_ERROR); } elseif ($this->_item->isDeleted()) { throw new cs_detail_item_type_exception('item deleted', 1); } elseif (!$this->_item->maySee($current_user)) { // TODO: implement error handling /* * $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('LOGIN_NOT_ALLOWED')); $page->add($errorbox); */ } elseif (($current_user->isRoot() || $current_user->isModerator()) && $this->_environment->inPortal() && isset($_GET['mode']) && $_GET['mode'] === 'take_over') { $history = $session->getValue('history'); $cookie = $session->getValue('cookie'); $javascript = $session->getValue('javascript'); $https = $session->getValue('https'); $flash = $session->getValue('flash'); $session_id = $session->getSessionID(); $session = new cs_session_item(); $session->createSessionID($user_item->getUserID()); $session->setValue('auth_source', $user_item->getAuthSource()); $session->setValue('root_session_id', $session_id); // TODO: checking strings, but setting integers??? // improve to type-secure checks // set cookie in session, if cookie is empty, do nothing, commsy will try to save it if ($cookie == '1') { $session->setValue('cookie', 2); } elseif (!empty($cookie)) { $session->setValue('cookie', 0); } if ($javascript == '1') { $session->setValue('javascript', 1); } elseif ($javascript == '-1') { $session->setValue('javascript', -1); } if ($https == '1') { $session->setValue('https', 1); } elseif ($https == '-1') { $session->setValue('https', -1); } if ($flash == '1') { $session->setValue('flash', 1); } elseif ($flash == '-1') { $session->setValue('flash', -1); } // save portal id in session to ensure, that user didn't switch between portals if ($this->_environment->inServer()) { $session->setValue('commsy_id', $this->_environment->getServerID()); } else { $session->setValue('commsy_id', $this->_environment->getCurrentPortalID()); } $this->_environment->setSessionItem($session); redirect($this->_environment->getCurrentContextID(), 'home', 'index', array()); } else { $config = array(); // mark as read and noticed $this->markRead(); $this->markNoticed(); $current_context = $this->_environment->getCurrentContextItem(); // create view /* * $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = $current_context->isOpen(); $params['creator_info_status'] = $creatorInfoStatus; $detail_view = $class_factory->getClass(USER_DETAIL_VIEW,$params); unset($params); */ // configuration overview $config['show_configuration'] = false; if ($this->_item->getItemID() === $current_user->getItemID() || isset($this->_display_mod) && $display_mod === 'admin' && $current_user->isModerator() || $current_user->isRoot()) { if (!$this->_environment->inPrivateRoom()) { $config['show_configuration'] = true; } } // only show leave action, if watching yourself $config["show_leave"] = $this->_item->getItemID() === $this->_environment->getCurrentUserItem()->getItemID() ? true : false; // TODO: check this, should be handled by parent class /* * // Set up browsing order if ( !isset($_GET['single']) and $session->issetValue('cid'.$environment->getCurrentContextID().'_'.$current_module.'_index_ids')) { $user_ids = $session->getValue('cid'.$environment->getCurrentContextID().'_'.$current_module.'_index_ids'); } else { $user_ids = array(); } $detail_view->setBrowseIDs($user_ids); if ( isset($_GET['pos']) ) { $detail_view->setPosition($_GET['pos']); } */ // set up rubric connections and browsing if ($this->_environment->getCurrentModule() !== 'account' && ($current_context->isProjectRoom() || $current_context->isCommunityRoom())) { $current_room_modules = $current_context->getHomeConf(); $room_modules = array(); if (!empty($current_room_modules)) { $room_modules = explode(',', $current_room_modules); } $first = array(); $second = array(); foreach ($room_modules as $module) { list($module_name, $display_mode) = explode('_', $module); if ($display_mode !== 'none' && $module_name !== CS_USER_TYPE && $module_name !== $this->_environment->getCurrentModule()) { // TODO: /* * switch ($detail_view->_is_perspective($link_name[0])) { case true: $first[] = $link_name[0]; break; case false: $second[] = $link_name[0]; break; } */ } } $room_modules = $first; $rubric_connections = array(); foreach ($room_modules as $module) { if ($current_context->withRubric($module)) { $ids = $this->_item->getLinkedItemIDArray($module); $session->setValue('cid' . $this->_environment->getCurrentContextID() . '_' . $module . '_index_ids', $ids); if ($module !== CS_TOPIC_TYPE && $module !== CS_INSTITUTION_TYPE && $module !== CS_GROUP_TYPE) { $ids = $this->_item->getModifiedItemIDArray($module, $this->_item->getItemID()); // TODO: implement //$detail_view->addModifiedItemIDArray($module,$ids); } $rubric_connections[] = $module; } } $room_modules = $second; foreach ($room_modules as $module) { if ($current_context->withRubric($module)) { if ($this->_environment->inPortal()) { $ids = array(); if ($module === CS_PROJECT_TYPE) { $room_list = $this->_item->getRelatedProjectList(); } elseif ($module === CS_COMMUNITY_TYPE) { $room_list = $this->_item->getRelatedCommunityList(); } if ($room_list->isNotEmpty()) { $room_item = $room_list->getFirst(); while ($room_item) { if ($room_item->isOpen()) { $ids[] = $room_item->getItemID(); } $room_item = $room_list->getNext(); } } } else { if ($module === CS_GROUP_TYPE || $module === CS_INSTITUTION_TYPE || $module === CS_TOPIC_TYPE) { $ids = $this->_item->getLinkedItemIDArray($module); $session->setValue('cid' . $this->_environment->getCurrentContextID() . '_' . $module . '_index_ids', $ids); } else { $ids = $this->_item->getModifiedItemIDArray($module, $this->_item->getItemID()); } } // TODO: implement //$detail_view->addModifiedItemIDArray($module,$ids); } } $this->_rubric_connections = $rubric_connections; } /* * TODO // highlight search words in detail views $session_item = $environment->getSessionItem(); if ( $session->issetValue('cid'.$environment->getCurrentContextID().'_campus_search_parameter_array') ) { $search_array = $session->getValue('cid'.$environment->getCurrentContextID().'_campus_search_parameter_array'); if ( !empty($search_array['search']) ) { $detail_view->setSearchText($search_array['search']); } unset($search_array); } if ( $environment->inPortal() or $environment->inServer() ){ $page->addForm($detail_view); }else{ $page->add($detail_view); } */ $this->assign('detail', 'content', $this->getDetailContent()); $this->assign('detail', 'config', $config); if ($config['show_configuration'] === true) { $this->assign('detail', 'configcontent', $this->getConfigContent()); } } } }
or $current_user->isModerator() ) and $environment->inPortal() and isset($_GET['mode']) and $_GET['mode'] == 'take_over' and (!$current_user->isDeactivatedLoginAsAnotherUser() or $current_user->isTemporaryAllowedToLoginAs()) ) { $history = $session->getValue('history'); $cookie = $session->getValue('cookie'); $javascript = $session->getValue('javascript'); $https = $session->getValue('https'); $flash = $session->getValue('flash'); $session_id = $session->getSessionID(); $session = new cs_session_item(); $session->createSessionID($user_item->getUserID()); $session->setValue('auth_source',$user_item->getAuthSource()); $session->setValue('root_session_id',$session_id); if ( $cookie == '1' ) { $session->setValue('cookie',2); } elseif ( empty($cookie) ) { // do nothing, so CommSy will try to save cookie } else { $session->setValue('cookie',0); } if ($javascript == '1') { $session->setValue('javascript',1); } elseif ($javascript == '-1') { $session->setValue('javascript',-1); } if ($https == '1') {
$auth_item->setFirstname($_POST['firstname']); $auth_item->setLastname($_POST['lastname']); $auth_item->setLanguage($_POST['language']); $auth_item->setEmail($_POST['email']); $auth_item->setCommSyID($environment->getCurrentContextID()); $authentication = $environment->getAuthenticationObject(); $authentication->save($auth_item); // save user information $user = $authentication->getUserItem(); $user->makeModerator(); $user->save(); // create session $session = new cs_session_item(); $session->createSessionID($_POST['user_id']); // redirect to initialize first portal redirect($environment->getCurrentContextID(), 'campus', 'initialize', ''); } } // display form $class_params = array(); $class_params['environment'] = $environment; $class_params['with_modifying_actions'] = true; $form_view = $class_factory->getClass(FORM_VIEW,$class_params); unset($class_params); $form_view->setAction(curl($environment->getCurrentContextID(),'server','initialize','')); $form_view->setForm($form); $page->add($form_view);
} $url .= '?cid='.$environment->getCurrentContextID().'&fct=detail'; if ( !isset($cookie) or $cookie != '1') { $url .= '&SID='.$new_session->getSessionID(); } include_once('functions/misc_functions.php'); redirect_with_url($url); } elseif ( $external_tool == 'commsy' ) { // session $session_item = $environment->getSessionItem(); include_once('classes/cs_session_item.php'); $new_session = new cs_session_item(); $current_user = $environment->getCurrentUserItem(); $new_session->createSessionID($current_user->getUserID()); $new_session->setValue('commsy_id',$environment->getCurrentPortalID()); $new_session->setToolName($external_tool); if ( isset($session_item) ) { if ( $session_item->issetValue('javascript') ) { $new_session->setValue('javascript',$session_item->getValue('javascript')); } if ( $session_item->issetValue('https') ) { $new_session->setValue('https',$session_item->getValue('https')); } if ( $session_item->issetValue('flash') ) { $new_session->setValue('flash',$session_item->getValue('flash')); } if ( $session_item->issetValue('auth_source') ) { $new_session->setValue('auth_source',$session_item->getValue('auth_source')); }