// You have received a copy of the GNU General Public License // along with CommSy. header("Content-type: text/css"); // load required classes chdir('../..'); include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'classes/cs_environment.php'; // create environment of this page $color = $cs_color['DEFAULT']; // find out the room we're in if (!empty($_GET['cid'])) { $cid = $_GET['cid']; $environment = new cs_environment(); $environment->setCurrentContextID($cid); $room = $environment->getCurrentContextItem(); $color = $room->getColorArray(); } ?> /*General Settings */ body { margin: 0px; padding: 0px; width:800px; font-family: 'Trebuchet MS','lucida grande',tahoma,'ms sans serif',verdana,arial,sans-serif; font-size:80%; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal;
/** * 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 (isset($c_webserver) and $c_webserver == 'lighttpd') { $path = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; } else { $path = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']; } $path = str_replace('rss.php', '', $path); // start of execution time include_once 'functions/misc_functions.php'; $time_start = getmicrotime(); include_once 'classes/cs_environment.php'; include_once 'functions/curl_functions.php'; // needed for setting fileArray $environment = new cs_environment(); $environment->setCurrentContextID($_GET['cid']); $hash_manager = $environment->getHashManager(); $context_item = $environment->getCurrentContextItem(); $validated = false; if ($context_item->isOpenForGuests()) { $validated = true; } function setFileArray($item) { global $environment; $file_array = $item->getFileList()->to_Array(); $file_name_array = array(); foreach ($file_array as $file) { $file_name_array[htmlentities($file->getDisplayName(), ENT_NOQUOTES, 'UTF-8')] = $file; } $environment->getTextConverter()->setFileArray($file_name_array); } if (!$context_item->isPortal() and !$context_item->isServer() and isset($_GET['hid']) and !empty($_GET['hid']) and !$validated and !$context_item->isLocked() and $hash_manager->isRSSHashValid($_GET['hid'], $context_item)) {
} else { $current_function = 'index'; } } elseif (isset($_GET['fct'])) { $current_function = $_GET['fct']; } if ($current_function != 'index' and $current_function != 'detail' and $current_function != 'edit' and $current_function != 'getfile' and $current_function != 'move' and $current_function != 'forward' and $current_function != 'logout' and $current_function != 'login') { $current_function = 'detail'; } $environment->setCurrentContextID($current_context); $environment->setCurrentModule($current_module); $environment->setCurrentFunction($current_function); unset($current_context); unset($current_module); unset($current_function); $context_item_current = $environment->getCurrentContextItem(); if ($environment->inPortal() or $environment->inServer()) { $class_factory->setDesignTo6(); } else { $class_factory->setDesignTo7(); } /*********** SERVER INITIALIZATION AND JUMP TO HOMEPAGE INDEX ***********/ // send user to ... // homepage overview, if cid in URL was empty or current context does not exist if ($cid_not_set) { // redirect to module = homepage; function = index } /*********** SESSION AND AUTHENTICATION ***********/ // get Session ID (SID) if (!empty($_COOKIE['SID_homepage'])) { $SID = $_COOKIE['SID_homepage'];
$environment->setCurrentContextID($server_item->getItemID()); # don't set cid_set to true, because default portal id should work } } } // default portal id if (!$set_cid) { $default_portal_id = $server_item->getDefaultPortalItemID(); if (is_numeric($default_portal_id)) { $environment->setCurrentContextID($default_portal_id); } } unset($set_cid); } unset($server_item); $context_item_current = $environment->getCurrentContextItem(); /*********** SERVER INITIALIZATION AND JUMP TO SINGLE PORTAL ***********/ // send user to item with id == iid - rewriteRule - TinyUrl with CommSy ID if (isset($_GET['item_id'])) { $iid = $_GET['item_id']; if (!empty($iid)) { $item_manager = $environment->getItemManager(); $item = $item_manager->getItem($iid); if (isset($item) and !empty($item)) { $item_type = $item->getItemType(); if ($item_type == 'project' or $item_type == 'community') { redirect($iid, 'home', 'index'); } else { $params = array(); $params['iid'] = $iid; redirect($item->getContextID(), $item->getItemType(), 'detail', $params);
// get requested uri $uri = $_SERVER['REQUEST_URI']; // adjust uri $pattern = '/.*\\/commsy\\/(.*)/'; preg_match($pattern, $uri, $matches); $uri = $matches[1]; // try to get file id from scorm package $pattern = '/var\\/.*\\/.*\\/public\\/scorm\\/scorm_(.*).zip\\/.*/'; preg_match($pattern, $uri, $matches); if (isset($matches[1])) { $file_id = $matches[1]; // authentification $file_manager = $environment->getFileManager(); $file = $file_manager->getItem($file_id); unset($file_manager); // are we allowed to open this file? $link_manager = $environment->getLinkManager(); $material_id = $link_manager->getMaterialIDForFileID($file->getFileID()); $material_manager = $environment->getMaterialManager(); $material = $material_manager->getItem($material_id); unset($material_manager); $current_user = $environment->getCurrentUser(); // set current context $environment->setCurrentContextID($material->getContextID()); var_dump($environment->getCurrentContextItem()->mayEnter($current_user)); if (!($material->isNotActivated() && $current_user->getItemID() != $material->getCreatorID() && !$current_user->isModerator()) && $environment->getCurrentContextItem()->mayEnterByUserID($current_user->getUserID(), $current_user->getAuthSource())) { //($material->maySee($current_user) || $material->mayExternalSee($current_user))) { // deliver secured content readfile($uri); } }