// GNU General Public License for more details. // // 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;
unset($rss_item); } } $rss .= $rss_end; // debugging #pr($rss); #$db_connector = $environment->getDBConnector(); #$sql_query_array = $db_connector->getQueryArray(); #pr($sql_query_array); #exit(); // Wir werden eine XML Datei ausgeben header('Content-type: application/rss+xml; charset=UTF-8'); echo $rss; # logging if (!empty($_GET['hid'])) { $l_current_user_item = $hash_manager->getUserByRSSHash($_GET['hid']); if (!empty($l_current_user_item)) { $environment->setCurrentUserItem($l_current_user_item); } } include_once 'include/inc_log.php'; exit; } else { chdir('..'); include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $translator = $environment->getTranslationObject(); die($translator->getMessage('RSS_NO_CONTEXT')); }
/** * 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); }
function moveRoom(cs_environment $environment, cs_list $afterList, cs_room_item $roomItem, $exec = false, $newPortalId) { $linkedProjectedRoomItems = new cs_list(); if ($exec) { if ($roomItem) { global $environment; $oldPortalId = $roomItem->getContextID(); $portalManager = $environment->getPortalManager(); $oldPortal = $portalManager->getItem($oldPortalId); $userManager = $environment->getUserManager(); $roomList = new cs_list(); $roomList->add($roomItem); // search for associated project rooms in list after this entry if ($roomItem->isCommunityRoom()) { $projectRoomList = $roomItem->getProjectRoomList(); $afterListItem = $afterList->getFirst(); while ($afterListItem) { if ($projectRoomList->inList($afterListItem)) { $linkedProjectedRoomItems->add($afterListItem); } $afterListItem = $afterList->getNext(); } $roomList->addList($linkedProjectedRoomItems); } else if ($roomItem->isGrouproomActive()) { $groupManager = $environment->getGroupManager(); $groupManager->setContextLimit($roomItem->getItemID()); $groupManager->select(); $groupList = $groupManager->get(); if ($groupList->isNotEmpty()) { $groupItem = $groupList->getFirst(); while($groupItem) { if ($groupItem->isGroupRoomActivated()) { $groupRoomItem = $groupItem->getGroupRoomItem(); if (isset($groupRoomItem) && !empty($groupRoomItem)) { $roomList->add($groupRoomItem); } } $groupItem = $groupList->getNext(); } } } $roomNameArray = array(); $userArray = array(); $authSourceArray = array(); $roomListItem = $roomList->getFirst(); while ($roomListItem) { $roomNameArray[$roomListItem->getItemID()] = $roomListItem->getTitle(); $userManager->resetLimits(); $userManager->setContextLimit($roomListItem->getItemID()); $userManager->select(); $userList = $userManager->get(); if ($userList->isNotEmpty()) { $userItem = $userList->getFirst(); while($userItem) { $authSourceArray[$userItem->getAuthSource()] = $userItem->getAuthSource(); $userIdTest = $userItem->getUserID(); if (!empty($userIdTest)) { $userRoomArray[$userItem->getUserID() . "__CS__" . $userItem->getAuthSource()] = $roomListItem->getItemID(); if (empty($userArray[$userItem->getUserID()])) { $portalUserItem = $userItem->getRelatedCommSyUserItem(); if (isset($portalUserItem)) { $userArray[$userItem->getUserID() . "__CS__" . $userItem->getAuthSource()] = $portalUserItem; } } $userIdTest = $userItem->getUserID(); } $userItem = $userList->getNext(); } } $roomListItem = $roomList->getNext(); } $authSourceTranslationArray = array(); $authSourceFindArray = array(); $authSourceItemArray = array(); $newPortal = $portalManager->getItem($newPortalId); $authSourceListNew = $newPortal->getAuthSourceList(); foreach ($authSourceArray as $authSourceId) { $authSourceManager = $environment->getAuthSourceManager(); $authSourceItemOld = $authSourceManager->getItem($authSourceId); $authSourceItemArray[$authSourceItemOld->getItemID()] = $authSourceItemOld; if (!$authSourceListNew->isEmpty()) { $authSourceItemNew = $authSourceListNew->getFirst(); while ($authSourceItemNew) { $authSourceItemArray[$authSourceItemNew->getItemID()] = $authSourceItemNew; if ($authSourceItemOld->isCommSyDefault() && $authSourceItemNew->isCommSyDefault()) { $authSourceTranslationArray[$authSourceItemOld->getItemID()] = $authSourceItemNew->getItemID(); } $authSourceItemNew = $authSourceListNew->getNext(); } } } $authSourceNotTranslationArray = array(); foreach ($authSourceArray as $authSourceId) { if (!array_key_exists($authSourceId, $authSourceTranslationArray)) { $authSourceNotTranslationArray[] = $authSourceId; } } $authSourceManager = $environment->getAuthSourceManager(); foreach ($authSourceNotTranslationArray as $authSourceId) { $authSourceItemOld = $authSourceManager->getItem($authSourceId); $authSourceItemNew = clone $authSourceItemOld; $authSourceItemNew->setItemID(''); $authSourceItemNew->setContextID($newPortalId); $authSourceItemNew->save(); $authSourceTranslationArray[$authSourceItemOld->getItemID()] = $authSourceItemNew->getItemID(); $authSourceItemArray[$authSourceItemNew->getItemID()] = $authSourceItemNew; } $userArrayAll = $userArray; $userArrayNew = array(); $failure = false; $userChangeArray = array(); foreach ($userArrayAll as $key => $userItem) { // does the user exist on current portal? $authentication = $environment->getAuthenticationObject(); $userId = $userItem->getUserID(); $authSource = $userItem->getAuthSource(); $first = true; $go = true; while ($go) { $userManager->resetLimits(); $userManager->setContextLimit($newPortalId); $userManager->setAuthSourceLimit($authSourceTranslationArray[$authSource]); $userManager->setUserIDLimit($userId); $userManager->select(); $userList = $userManager->get(); // commsy auth source, user id already exists if ($userList->isNotEmpty() && $userList->getCount() == 1) { $userItem2 = $userList->getFirst(); // email is equal if ($userItem2->getEmail() == $userItem->getEmail()) { unset($userArray[$userItem->getUserID() . "__CS__" . $userItem->getAuthSource()]); if ($userItem->getUserID() != $userId) { $userChangeArray[$userItem->getUserID() . "__CS__" . $authSourceTranslationArray[$authSource]] = $userId; } else { $userArrayNoChange[$userItem->getUserID() . "__CS__" . $authSourceTranslationArray[$authSource]] = $userItem; } $go = false; } else { // generate new user id if ($first) { $first = false; $userId .= '1'; } else { $count = $userId{mb_strlen($userId) - 1}; $count = (int) $count; $count++; $userId = mb_substr($userId, 0, mb_strlen($userId) - 1); $userId .= $count; } } } elseif ($userList->isNotEmpty() && $userList->getCount() > 1) { include_once('functions/error_functions.php'); trigger_error('ERROR: multiple user id ' . $userId . ' for one portal',E_USER_WARNING); $go = false; $failure = true; } else { // find free user id if ($userItem->getUserID() != $userId) { $userChangeArray[$userItem->getUserID() . "__CS__" . $authSourceTranslationArray[$authSource]] = $userId; } else { $userArrayNoChange[$userItem->getUserID() . "__CS__" . $authSourceTranslationArray[$authSource]] = $userItem; } $go = false; } } } if ($failure) { die("ERROR"); } // commsy auth source // copy auth (user_id and password) and user (normal information) items foreach ($userArray as $key => $userItem) { $keyArray = explode("__CS__", $key); $userIdKey = $keyArray[0]; $authSourceKey = $keyArray[1]; // old auth source $authManager = $authentication->getAuthManager($userItem->getAuthSource()); $authManager->setContextLimit($oldPortalId); $authItemOld = $authManager->getItem($userItem->getUserID()); if (!empty($authItemOld)) { $authItemNew = clone $authItemOld; $authItemNew->setPortalID($newPortalId); $authItemNew->setAuthSourceID($authSourceTranslationArray[$authSourceKey]); if (!empty($userChangeArray[$userIdKey . "__CS__" . $authSourceTranslationArray[$authSourceKey]])) { $authItemNew->setUserID($userChangeArray[$userIdKey . "__CS__" . $authSourceTranslationArray[$authSourceKey]]); } $authManager = $authentication->getAuthManager($authSourceTranslationArray[$authSourceKey]); $authManager->setContextLimit($newPortalId); $userIdAuthNew = $authItemNew->getUserID(); if (!empty($userIdAuthNew)) { $authManager->save($authItemNew); } } unset ($userIdAuthNew); $userItemNew = $userItem->cloneData(); $userItemNew->setContextID($newPortalId); $tempUser = $userManager->getItem($userItem->getCreatorID()); $userItemNew->setCreatorItem($tempUser); if (!empty($userChangeArray[$userIdKey . "__CS__" . $authSourceTranslationArray[$authSourceKey]])) { $userItemNew->setUserID($userChangeArray[$userIdKey . "__CS__" . $authSourceTranslationArray[$authSourceKey]]); } $userIdUserNew = $userItemNew->getUserID(); $userItemNew->setAuthSource($authSourceTranslationArray[$authSourceKey]); if (!empty($userIdUserNew)) { $userItemNew->save(); $userItemNew->setCreatorID2ItemID(); } } // external auth sources foreach ($userArrayNew as $key => $userItem) { $keyArray = explode("__CS__", $key); $userIdKey = $keyArray[0]; $authSourceKey = $keyArray[1]; $userItemnew = $userItem->cloneData(); $userItemNew->setContextID($newPortalId); $tempUser = $userManager->getItem($userItem->getCreatorID()); $userItemNew->setCreatorItem($tempUser); $userIdUserNew = $userItemNew->getUserID(); $userItemNew->setAuthSource($authSourceKey); if (!empty($userIdUserNew)) { $userItemNew->save(); $userItemNew->setCreatorID2ItemID(); } } // change user ids of user in rooms to move // and cahnge auth source of user in rooms to move $roomListItem = $roomList->getFirst(); while ($roomListItem) { $userManager = $environment->getUserManager(); $userManager->resetLimits(); $userManager->setContextLimit($roomListItem->getItemID()); $userManager->select(); $userList = $userManager->get(); if ($userList->isNotEmpty()) { $userItem = $userList->getFirst(); while ($userItem) { $userIdTest = $userItem->getUserID(); if (!empty($userIdTest) && !empty($userChangeArray[$userIdTest . "__CS__" . $authSourceTranslationArray[$userItem->getAuthSource()]])) { $userItem->setUserID($userChangeArray[$userIdTest . "__CS__" . $authSourceTranslationArray[$userItem->getAuthSource()]]); } $newAuthSourceForUser = $authSourceTranslationArray[$userItem->getAuthSource()]; $userItem->setAuthSource($newAuthSourceForUser); $userItem->setChangeModificationOnSave(false); $userItem->setSaveWithoutLinkModifier(); $userItem->save(); $userItem = $userList->getNext(); } } // delete old links from community room to project rooms // before saving on new potal if ($linkedProjectedRoomItems->isEmpty() && $roomListItem->isCommunityRoom()) { $roomListItem->setProjectListByID(array()); $roomListItem->save(); } // move files from old portal folder to new portal folder $oldContext = $roomListItem->getContextID(); $newContext = $newPortalId; if ($oldContext != $newContext) { $discManager = $environment->getDiscManager(); $discManager->moveFiles($roomListItem->getItemID(), $oldContext, $newContext); } $roomListItem->setContextID($newPortalId); // set link between project and community room if ($linkedProjectedRoomItems->isNotEmpty() && $roomListItem->isProjectRoom()) { $tempArray = array(); $tempArray[] = $roomItem->getItemID(); $roomListItem->setCommunityListByID($tempArray); } // save room with new context id $roomListItem->save(); echo ProgressBar::next(); $roomListItem = $roomList->getNext(); } } } else { usleep(1000); echo ProgressBar::next(); } return $linkedProjectedRoomItems; }
<?php header("Content-type: application/x-javascript"); // init chdir('../../../../../../..'); include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'functions/misc_functions.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $text1 = ' '; $text2 = ' '; // only if cid is set if (!empty($_GET['cid']) and $_GET['cid'] > 99) { // transform POST_VARS and GET_VARS --- move into page object, if exist include_once 'functions/text_functions.php'; $_GET = encode(FROM_GET, $_GET); // multi master implementation $db = $environment->getConfiguration('db'); if (count($db) > 1) { if (!empty($_COOKIE['db_pid'])) { $environment->setDBPortalID($_COOKIE['db_pid']); } elseif (!empty($_GET['db_pid'])) { $environment->setDBPortalID($_GET['db_pid']); } } // multi master implementation - END // set current context $environment->setCurrentContextID($_GET['cid']); // get plugins from plugins $text1 = plugin_hook_output_all('getTextFormatingInformationAsHTML', '', BRLF);
trigger_error('"magic_quotes_runtime" must be switched off for CommSy to work correctly. See "htaccess-dist".', E_USER_ERROR); } } else { include_once 'functions/error_functions.php'; trigger_error('"magic_quotes_runtime" must be switched off for CommSy to work correctly. See "htaccess-dist".', E_USER_ERROR); } } if (isPHP5()) { if (ini_get('register_globals')) { include_once 'functions/error_functions.php'; trigger_error('"register_globals" must be switched off for CommSy to work correctly. This must be set in php.ini, .htaccess or httpd.conf.', E_USER_ERROR); } } // setup commsy-environment include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $translator = $environment->getTranslationObject(); $class_factory = $environment->getClassFactory(); // transform POST_VARS and GET_VARS --- move into page object, if exist include_once 'functions/text_functions.php'; $_POST = encode(FROM_FORM, $_POST); $_GET = encode(FROM_FORM, $_GET); // include classes needed for this script include_once 'classes/cs_session_item.php'; include_once 'classes/cs_session_manager.php'; $current_user = $environment->getCurrentUser(); /*********** INITIALIZE ENVIRONMENT ***********/ // initialize environment // - context id // - module // - function
// 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. // pretend, we work from the CommSy basedir to allow // giving include files without "../" prefix all the time. chdir('..'); mb_internal_encoding('UTF-8'); // include base-config include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; // setup commsy-environment include_once 'classes/cs_environment.php'; $environment = new cs_environment(); // Die Methoden in dieser Klasse werden weiter unten als Soap Service bereit gestellt require_once 'classes/cs_connection_soap.php'; // Den WSDL Cache abschalten #ini_set("soap.wsdl_cache_enabled", "0"); /* Erzeugt eine neue SoapServer Instanz. Der erste Parameter (null) bedeutet, dass keine WSDL Datei verwendet werden soll. Wenn keine WSDL Datei angegeben wird, muss die uri Option gesetzt sein. */ $uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; // plugins if (!empty($_GET['plugin'])) { $plugin_config_file = 'etc/commsy/plugin.php'; if (file_exists($plugin_config_file)) { include_once $plugin_config_file; $plugin_name = $_GET['plugin'];
echo $wsdl; exit; } } } else { // merge plugin soap functions into CommSy soap functions $soap_functions_array = plugin_hook_output_all('getSOAPAPIArray', array(), 'ARRAY'); } } // soap_functions from classes if (!isset($environment)) { include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'functions/misc_functions.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); } $connection_obj = $environment->getCommSyConnectionObject(); if (!empty($connection_obj)) { $soap_functions_array_from_class = $connection_obj->getSoapFunctionArray(); if (!empty($soap_functions_array_from_class)) { $soap_functions_array = array_merge($soap_functions_array, $soap_functions_array_from_class); } } ?> <<?php echo '?'; ?> xml version ='1.0' encoding ='UTF-8'?> <definitions name='CommSy' targetNamespace='<?php
$result_mail->send(); } } } // mark e-mail for deletion imap_delete($mbox, $msgno); } chdir('..'); include_once 'etc/commsy/development.php'; include_once 'classes/cs_mail.php'; include_once 'functions/curl_functions.php'; // setup commsy-environment include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $environment->setCacheOff(); $server_item = $environment->getServerItem(); $portal_id_array = $server_item->getPortalIDArray(); // open connection $options = $environment->getConfiguration('c_email_upload_server_options'); if (!isset($options)) { $options = ''; } $mbox = imap_open('{' . $c_email_upload_server . ':' . $c_email_upload_server_port . $options . '}', $c_email_upload_email_account, $c_email_upload_email_password); if (!empty($mbox)) { // get and process e-mails $message_count = imap_num_msg($mbox); for ($msgno = 1; $msgno <= $message_count; ++$msgno) { email_to_commsy($mbox, $msgno); }
// // 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'; include_once 'functions/curl_functions.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(); $portal = $environment->getCurrentPortalItem(); $color = $room->getColorArray(); } ?> .small_font {8pt;} /************************************** **** commsy_right_boxes_css *********** **************************************/ /*Panel Style*/ #commsy_panels .commsy_panel, #commsy_panel_form .commsy_panel{
chdir('../..'); include_once('etc/cs_config.php'); include_once('functions/misc_functions.php'); $work = false; if(isset($_GET['work']) && $_GET['work'] === 'true') { $work = true; } // disable timeout set_time_limit(0); // setup commsy-environment include_once('classes/cs_environment.php'); $environment = new cs_environment(); // get a list of all files, used in zzz-rooms $db_connector = $environment->getDBConnector(); $qry = ' SHOW TABLES FROM commsy LIKE \'zzz\_%\' '; $result = $db_connector->performQuery($qry); foreach($result as $table) { $table_name = array_values($table); $table_name = $table_name[0];
} $item = $item_list->getNext(); } if ($current_module == CS_DATE_TYPE) { $dateiname = $translator->getMessage('DATES_EXPORT_FILENAME') . '_' . $_GET['cid']; } elseif ($current_module == CS_TODO_TYPE) { $dateiname = $translator->getMessage('TODO_EXPORT_FILENAME') . '_' . $_GET['cid']; } #echo $iCal->getOutput(); $iCal->outputFile($dateiname); # logging include_once 'include/inc_log.php'; } else { include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $environment->setCurrentContextID($_GET['cid']); $translator = $environment->getTranslationObject(); die($translator->getMessage('RSS_NOT_ALLOWED')); } } else { chdir('..'); include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $environment->setCurrentContextID($_GET['cid']); $translator = $environment->getTranslationObject(); die($translator->getMessage('RSS_NO_CONTEXT')); }
} } else { include_once 'functions/error_functions.php'; trigger_error('"magic_quotes_runtime" must be switched off for CommSy to work correctly. See "htaccess-dist".', E_USER_ERROR); } } if (isPHP5()) { $ini_reg_globals = ini_get('register_globals'); if (!empty($ini_reg_globals) and strtolower($ini_reg_globals) != 'off') { include_once 'functions/error_functions.php'; trigger_error('"register_globals" must be switched off for CommSy to work correctly. This must be set in php.ini, .htaccess or httpd.conf.', E_USER_ERROR); } } // setup commsy-environment include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $class_factory = $environment->getClassFactory(); // transform POST_VARS and GET_VARS --- move into page object, if exist include_once 'functions/text_functions.php'; $_POST = encode(FROM_FORM, $_POST); $_GET = encode(FROM_GET, $_GET); $_GET = encode(FROM_FORM, $_GET); // multi master implementation (06.09.2012 IJ) $db = $environment->getConfiguration('db'); if (count($db) > 1) { if (!empty($_COOKIE['db_pid'])) { $environment->setDBPortalID($_COOKIE['db_pid']); } elseif (!empty($_GET['db_pid'])) { $environment->setDBPortalID($_GET['db_pid']); } elseif (!empty($_POST['db_pid'])) { $environment->setDBPortalID($_POST['db_pid']);
if ($memory_limit < $memory_limit2) { ini_set('memory_limit', $memory_limit2); $memory_limit3 = ini_get('memory_limit'); if ($memory_limit3 != $memory_limit2) { fwrite($file, 'Waring: Can not set memory limit. Script may stop. Please try 640M in your php.ini.' . LF); } } // start of execution time include_once 'functions/misc_functions.php'; $time_start = getmicrotime(); $start_time = date('d.m.Y H:i:s'); // setup commsy-environment include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $environment->setCacheOff(); $result_array = array(); echo '<h1>CommSy Cron Jobs</h1>' . LF; #$result_html .= '<h1>CommSy Cron Jobs</h1>'.LF; fwrite($file, '<h1>CommSy Cron Jobs</h1>' . LF); // server $server_item = $environment->getServerItem(); // server cron jobs must be run AFTER all other portal crons // portals and rooms $result_array['portal'] = array(); $portal_id_array = $server_item->getPortalIDArray(); $portal_manager = $environment->getPortalManager(); foreach ($portal_id_array as $portal_id) { if (!isset($context_id) or $context_id == $portal_id) { // portal
<?php if (!empty($_SERVER["argv"][1])) { $room_id = $_SERVER["argv"][1]; $is_private_room = false; if (!empty($_SERVER["argv"][2])) { if ($_SERVER["argv"][2] == 'private') { $is_private_room = true; } } // setup commsy-environment include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $environment->setCacheOff(); if ($is_private_room) { $room_manager = $environment->getPrivateRoomManager(); } else { $room_manager = $environment->getRoomManager(); } $room_manager->setCacheOff(); $room = $room_manager->getItem($room_id); echo json_encode($room->runCron()); }
<?php // pretend, we work from the CommSy basedir to allow // giving include files without "../" prefix all the time. chdir('..'); // setup commsy-environment include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $environment->setCacheOff(); // 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);