/** * 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); }
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 be sure, that user didn't // switch between portals if ($environment->inServer()) { $session->setValue('commsy_id', $environment->getServerID()); } else { $session->setValue('commsy_id', $environment->getCurrentPortalID()); } // external tool if (mb_stristr($_SERVER['PHP_SELF'], 'homepage.php')) { $session->setToolName('homepage'); } // auth_source if (empty($auth_source)) { $auth_source = $authentication->getAuthSourceItemID(); } $session->setValue('auth_source', $auth_source);
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')); } if ( $session_item->issetValue('cookie') ) { $cookie = $session_item->getValue('cookie');