/** redirect to a given commsy page * first save history in session * second save session than * construct a commsy url (custom url) related to a given schema * and redirect to the commsy page * * Module and function specify a target script to be called with this curl, * parameter and fragment are used to pass values to that script, * filehack is used to fake a files realname into a curl (used by * the material manager). * * @param $context_id id of the current context * @param $module commsy module referring to * @param $function functions are represented by filesnames (without extension) * @param $parameter (optional) normal parameters ARRAY * @param $fragment (optional) anchor what goes behind a '#' * @param $filehack (optional) for faking real filenames into file downloads */ function redirect_with_history_save($context_id, $module, $function, $parameter = '', $fragment = '', $filehack = '') { global $environment; $session = $environment->getSessionItem(); // TODO: maybe it becomes necessary to not store ajax requests in history $history = $session->getValue('history'); $current_page['context'] = $environment->getCurrentContextID(); $current_page['module'] = $environment->getCurrentModule(); $current_page['function'] = $environment->getCurrentFunction(); $current_page['parameter'] = $environment->getCurrentParameterArray(); if (empty($history)) { $history[0] = $current_page; } else { $new_history[0] = $current_page; if ($new_history[0] != $history[0]) { $history = array_merge($new_history, $history); } } while (count($history) > 5) { array_pop($history); } $session->setValue('history', $history); // redirect redirect_with_url(curl($context_id, $module, $function, $parameter, $fragment, $filehack)); }
/** * 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); }
} // 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); # } } else { // Benutzer nicht beim IDP eingeloggt, redirect zum idp? redirect_with_url('https://'.$_SERVER["SERVER_NAME"].'/Shibboleth.sso/Login'); }# and $source_type != "SHIBBOLETH" } elseif (!empty($user_id) and !empty($password) and $source_type != "Shibboleth") { //if (!empty($user_id) and !empty($password) ) { $authentication = $environment->getAuthenticationObject(); if ( isset($_POST['auth_source']) and !empty($_POST['auth_source']) ) { $auth_source = $_POST['auth_source']; } else { $auth_source = ''; } if(!empty($auth_source)){ $auth_manager = $environment->getAuthSourceManager(); $auth_item = $auth_manager->getItem($auth_source); unset($auth_manager); } $portal_item = $environment->getCurrentContextItem();
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); ?>
// This file is part of CommSy. // // CommSy is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // CommSy is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You have received a copy of the GNU General Public License // along with CommSy. // get data $_save = array(); if (!empty($_GET['cid'])) { $save['cid'] = $_GET['cid']; } if (!empty($_GET['aim'])) { $save['aim'] = $_GET['aim']; } // save data $log_manager = $environment->getLogAdsManager(); $log_manager->save($save); // redirect redirect_with_url($save['aim']); ?>