/** create the form, INTERNAL * this methods creates the form with the form definitions */ function _createForm() { $this->setHeadline($this->_headline); $this->_form->addText('text', $this->_translator->getMessage('COMMON_ATTENTION'), $this->_translator->getMessage('PREFERENCES_BACKUP_DESC', getCommSyVersion())); $this->_form->addFilefield('upload', $this->_translator->getMessage('COMMON_FILE'), ''); // buttons $this->_form->addButtonBar('option', $this->_translator->getMessage('PREFERENCES_BACKUP_BUTTON'), ''); }
/** create the form, INTERNAL * this methods creates the form with the form definitions */ function _createForm() { $this->setHeadline($this->_headline); $this->_form->addText('text', $this->_translator->getMessage('COMMON_CONFIGURATION_SCRIBD_TITLE'), $this->_translator->getMessage('COMMON_CONFIGURATION_SCRIBD_DESC', getCommSyVersion())); $this->_form->addTextfield('scribd_api_key', '', $this->_translator->getMessage('API Key'), '', 200, '40', false); $this->_form->addTextfield('scribd_secret', '', $this->_translator->getMessage('Secret'), '', 200, '40', false); // buttons $this->_form->addButtonBar('option', $this->_translator->getMessage('PREFERENCES_SAVE_BUTTON'), ''); }
function _getSystemInfoAsHTML() { $html = ''; $html .= '<div style="font-size:8pt; padding-left:5px; margin-top:3px;">' . LF; $html .= '<div class="footer" style="text-align:left; padding-left:0px; padding-right:0px; padding-top:0px; padding-bottom:10px;">' . LF; $html .= '<a href="http://tidy.sourceforge.net/" target="_top" title="HTML Tidy">' . '<img src="images/checked_by_tidy.gif" style="height:14px; vertical-align: bottom;" alt="Tidy"/></a>'; $html .= ' <a href="http://www.commsy.net" target="_top" title="' . $this->_translator->getMessage('COMMON_COMMSY_LINK_TITLE') . '">CommSy ' . getCommSyVersion() . '</a>'; $version_addon = $this->_environment->getConfiguration('c_version_addon'); if (!empty($version_addon)) { $html .= ' - ' . $version_addon; } $html .= '</div>' . LF; $html .= '</div>' . LF; return $html; }
if ( !empty($command) and isOption($command, $translator->getMessage('PORTAL_EXPORT_ROOM_BUTTON')) ) { $correct = $form->check(); if ( $correct ) { $filename = 'var/temp/xml_export_'.$_POST['iid'].'.xml'; if ( file_exists($filename) ) { unlink($filename); } $xmlfile = fopen($filename, 'a'); $xml = ''; $xml .= '<commsy_export>'.LF; $xml .= '<version>'.getCommSyVersion().'</version>'.LF; $xml .= '<data>'.LF; fputs($xmlfile, $xml); # commsy kernel $data_type_array = array(); $data_type_array[] = CS_USER_TYPE; $data_type_array[] = CS_ANNOUNCEMENT_TYPE; $data_type_array[] = CS_DATE_TYPE; $data_type_array[] = CS_DISCUSSION_TYPE; $data_type_array[] = CS_MATERIAL_TYPE; $data_type_array[] = CS_TODO_TYPE; $data_type_array[] = CS_DISCARTICLE_TYPE; $data_type_array[] = CS_LABEL_TYPE; $data_type_array[] = CS_FILE_TYPE; $data_type_array[] = CS_ANNOTATION_TYPE;
} if ($do_it) { libxml_use_internal_errors(true); $xml_object = simplexml_load_string($xml,'cNode'); if (!$xml_object) { $errors = libxml_get_errors(); foreach ($errors as $error) { echo(display_xml_error($error,$xml)); } libxml_clear_errors(); exit(); } $commsy_version = utf8_decode((string)$xml_object->version); $current_commsy_version = getCommSyVersion(); if ( $current_commsy_version != $commsy_version ) { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $params['width'] = 500; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('PREFERENCES_BACKUP_WARNING_VERSION',$current_commsy_version,$commsy_version)); $page->add($errorbox); } foreach ($xml_object->data->children() as $list) { $name = str_replace('_list','',$list->getName()); $manager = $environment->getManager(DBTable2Type($name)); $success = false; $success = $manager->backupDataFromXMLObject($list);
/** init data for form, INTERNAL * this methods init the data for the form, for example groups */ function _initForm() { // headline $this->_headline = $this->_translator->getMessage('CONFIGURATION_UPDATE_LINK'); // version code $this->_version_code = getCommSyVersion(); // version db $server_item = $this->_environment->getServerItem(); $this->_version_db = $server_item->getDBVersion(); unset($server_item); // now the scripts if ($this->_version_db != $this->_version_code) { $script_array = $this->_getRelevantUpdateFolder($this->_version_db); if (!empty($script_array)) { $script_array = $this->_getRelevantUpdateScripts($script_array); if (!empty($script_array)) { $this->_script_array = $script_array; } } } if (!empty($this->_script_array)) { $scripts = false; foreach ($this->_script_array as $key => $script_array) { if (!empty($script_array)) { $scripts = true; } } if (!$scripts) { $current_version_array = explode('_to_', $key); if (!empty($current_version_array[1])) { $current_version = $current_version_array[1]; $current_code_version = getCommSyVersion(); if (!strstr($current_code_version, 'beta') and !strstr($current_code_version, ' ') and substr_count($current_code_version, '.') == 2) { $current_context = $this->_environment->getServerItem(); $current_context->setDBVersion($current_version); $current_context->save(); redirect($this->_environment->getCurrentContextID(), $this->_environment->getCurrentModule(), $this->_environment->getCurrentFunction(), array()); } } } } }
// transfer script to view object if ( !empty($run_array) ) { $page->setFlushModeOn(); foreach ( $run_array as $folder => $scripts ) { foreach ( $scripts as $script ) { $update_view = $class_factory->getClass(UPDATE_VIEW,array('environment' => $environment)); $update_view->setScript($script); $update_view->setFolder($folder); $update_view->setPath($form->getRootScriptPath()); $page->add($update_view); } } $current_version_array = explode('_to_',$folder); if ( !empty($current_version_array[1])) { $current_version = $current_version_array[1]; $current_code_version = getCommSyVersion(); if ( !strstr($current_code_version,'beta') and !strstr($current_code_version,' ') and substr_count($current_code_version,'.') == 2 ) { $current_context->setDBVersion($current_version); $current_context->save(); } unset($form); $form = $class_factory->getClass(CONFIGURATION_UPDATE_FORM,array('environment' => $environment)); $form->setItem($current_context); $form->prepareForm(); $form->loadValues(); } } }
function _getPageAsHTML() { $retour = ''; $error = $this->_getErrorAsHTML(); $header = $this->_getHeaderAsHTML(); $logo = $this->_getLogoAsHTML(); $navigation = $this->_getNavigationAsHTML(); $content = $this->_getContentAsHTML(); $footer = $this->_getFooterAsHTML(); $retour .= '<div class="shadow5">' . LF; $retour .= '<div class="shadow4">' . LF; $retour .= '<div class="shadow3">' . LF; $retour .= '<div class="shadow2">' . LF; $retour .= '<div class="shadow">' . LF . LF; $retour .= '<div class="main">' . LF . LF; $retour .= '<table class="homepage" summary="Layout">' . LF; $retour .= '<tr>' . LF; $retour .= '<td class="header">' . LF; if (!empty($logo)) { $retour .= '<span class="logo">' . LF; $retour .= $logo; $retour .= LF . '</span>' . LF; } if (!empty($header)) { $retour .= '<span class="header">' . LF; $retour .= $header; $retour .= LF . '</span>' . LF; } $retour .= '</td>' . LF; $retour .= '<td class="empty">' . LF; $retour .= '</td>' . LF; $retour .= '</tr>' . LF; $retour .= '<tr>' . LF; $retour .= '<td class="content">' . LF; $retour .= '<hr class="content"/>' . LF; if (!empty($error)) { $retour .= '<div class="error">' . LF; $retour .= $error; $retour .= LF . '</div>' . LF; } if (!empty($content)) { $retour .= '<div class="content">' . LF; $retour .= $content; $retour .= LF . '</div>' . LF; } $retour .= '</td>' . LF; $current_context = $this->_environment->getCurrentContextItem(); if ($current_context->isServer() or $current_context->isPortal()) { $retour .= '<td class="empty">' . LF; $retour .= '</td>' . LF; } else { $retour .= '<td class="navigation">' . LF; if (!empty($navigation)) { $retour .= '<div class="navigation">' . LF; $retour .= $navigation; $retour .= LF . '</div>' . LF; // actions $current_user = $this->_environment->getCurrentUser(); if ($current_user->isUser()) { $retour .= BRLF . '<div class="navigation">' . LF; $retour .= $this->_getActionsAsHTML(); $retour .= LF . '</div>' . LF; } // door $retour .= BRLF . '<div class="navigation_login">' . LF; if ($current_user->isUser()) { $current_context_item = $this->_environment->getCurrentContextItem(); $retour .= '<div class="navigation_login_box">' . LF; $retour .= '<a href="http://www.commsy.net" target="_blank"><img src="images/commsy_logo_transparent.gif" alt="CommSy Logo, Link to CommSy Homepage" width="96" height="23" class="navigation_login_box"/></a><br/>' . LF; $actionCurl = ahref_curl($this->_environment->getCurrentContextID(), 'context', 'forward', array('tool' => 'commsy'), '<img src="images/door_open_middle.gif" alt="icon door open"/>', '', '_blank', '', '', '', '', '', 'homepage.php'); $retour .= '<table summary="Layout">' . LF; $retour .= '<tr>' . LF; $retour .= '<td class="navigation_login_box">' . $actionCurl . '</td>' . LF; $retour .= '<td class="navigation_login_box">' . $current_context_item->getTitle() . LF; $retour .= '</tr>' . LF; $retour .= '</table>' . LF; $retour .= '<div style="padding: 0px 0px 4px 5px;">' . LF; $retour .= $current_user->getFullname() . BRLF; $params = $this->_environment->getCurrentParameterArray(); $params['back_tool'] = 'homepage'; $retour .= ahref_curl($this->_environment->getCurrentContextID(), 'context', 'logout', $params, $this->_translator->getMessage('LOGOUT'), '', '', '', '', '', '', '', 'homepage.php') . BRLF; $retour .= '</div>' . LF; $retour .= '</div>' . LF; } else { // login box $current_context_item = $this->_environment->getCurrentContextItem(); $retour .= '<div style="width:11.0em;">' . LF; $retour .= '<div style="background-color: #F5F5F5; border: 2px solid rgb(213, 213, 213); padding: 0px; margin: 0px;">' . LF; $retour .= '<a href = "http://www.commsy.net" target="_blank"><img src="images/commsy_logo_transparent.gif" alt="CommSy Logo, Link to CommSy Homepage" width="96" height="23" style="border-width: 0px; margin-left: 5px; margin-top: 1px;"></a><br/>' . LF; $retour .= '<table summary="Layout"><tr><td style="padding: 5px 5px 10px 5px; vertical-align: middle;"><img src="images/door_closed_middle.gif" alt="icon door closed"/></td><td style="padding: 5px 5px 10px 5px">' . $current_context_item->getTitle() . '</tr></table>' . LF; $retour .= '<div style="margin: 0px 3px; padding=0px;">' . LF; $params = array(); $params['account'] = 'member'; $params['cs_modus'] = 'portalmember'; $action_url = ahref_curl($current_context_item->getItemID(), 'home', 'index', $params, $this->_translator->getMessage('HOMEPAGE_LOGIN_NEW_ACCOUNT_LINK_HOMEPAGE'), '', '', '', '', '', '', 'style="color:#800000;"', 'commsy'); $retour .= '<span style="font-size:10pt;">-' . $action_url . '</span>' . BRLF; unset($params); $params = array(); $params['cs_modus'] = 'account_forget'; $action_url = ahref_curl($current_context_item->getItemID(), 'home', 'index', $params, $this->_translator->getMessage('LOGIN_ACCOUNT_FORGET_LINK'), '', '', '', '', '', '', 'style="color:#800000;"', 'commsy'); $retour .= '<span style="font-size:10pt;">-' . $action_url . '</span>' . BRLF; unset($params); $params = array(); $params['cs_modus'] = 'password_forget'; $action_url = ahref_curl($current_context_item->getItemID(), 'home', 'index', $params, $this->_translator->getMessage('LOGIN_PASSWORD_FORGET_LINK'), '', '', '', '', '', '', 'style="color:#800000;"', 'commsy'); $retour .= '<span style="font-size:10pt;">-' . $action_url . '</span>' . BRLF; unset($params); $params = array(); $params['back_tool'] = 'homepage'; if ($current_context_item->isPortal()) { $login_context_id = $current_context_item->getItemID(); } elseif ($current_context_item->isServer()) { $login_context_id = $current_context_item->getItemID(); } else { $portal_item = $current_context_item->getContextItem(); $login_context_id = $portal_item->getItemID(); } $retour .= '<form method="post" action="' . curl($login_context_id, 'context', 'login', $params, '', '', 'homepage') . '" name="login" style="margin-bottom: 4px; padding=0px;">' . LF; unset($params); $retour .= '<table style="border: 1px solid rgb(213, 213, 213); margin-top: 8px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;" summary="Layout">' . LF; $retour .= '<tr>' . LF; $retour .= '<td>' . LF; $retour .= '<label for="user_id"><span style="font-size:8pt; color:#666;">' . $this->_translator->getMessage('COMMON_ACCOUNT') . ':</span></label>' . LF; $retour .= '</td>' . LF; $retour .= '<td>' . LF; $retour .= '<input type="text" name="user_id" style="width:5.9em;" tabindex="1"/>' . LF; $retour .= '</td>' . LF; $retour .= '</tr>' . LF; $retour .= '<tr>' . LF; $retour .= '<td>' . LF; $retour .= '<label for="password"><span style="font-size:8pt; color:#666;">' . $this->_translator->getMessage('COMMON_PASSWORD') . ':</span></label>' . LF; $retour .= '</td>' . LF; $retour .= '<td>' . LF; $retour .= '<input type="password" name="password" style="width:5.9em;" tabindex="2"/>' . LF; $retour .= '</td>' . LF; $retour .= '</tr>' . LF; $retour .= '<tr>' . LF; $retour .= '<td>' . LF; $retour .= '</td>' . LF; $retour .= '<td>' . LF; $retour .= '<input type="submit" name="option" style="width: 6.2em;" value="' . $this->_translator->getMessage('COMMON_LOGIN') . '" tabindex="3"/>' . LF; $retour .= '</td>' . LF; $retour .= '</tr>' . LF; $retour .= '</table>' . LF; $retour .= '</form>' . LF; $retour .= '</div>' . LF; $retour .= '</div>' . LF; $retour .= '</div>' . LF; } $retour .= LF . '</div>' . LF; } $retour .= '</td>' . LF; } $retour .= '</tr>' . LF; $retour .= '<tr>' . LF; $current_context = $this->_environment->getCurrentContextItem(); if ($current_context->isServer()) { $retour .= '<td class="footer">' . LF; $retour .= '<hr class="footer"/>' . LF; $retour .= '</td>' . LF; } else { $retour .= '<td class="footer">' . LF; if (!empty($footer)) { $retour .= '<hr class="footer"/>' . LF; $retour .= '<div class="footer">' . LF; $retour .= $footer; $retour .= LF . '</div>' . LF; } $retour .= '</td>' . LF; } $retour .= '<td class="empty">' . LF; $retour .= '</td>' . LF; $retour .= '</tr>' . LF; $retour .= '</table>' . LF; $retour .= LF . '</div>' . LF; $retour .= LF . '</div>' . LF; $retour .= '</div>' . LF; $retour .= '</div>' . LF; $retour .= '</div>' . LF; $retour .= '</div>' . LF; $retour .= '<div class="site_footer">' . LF; $retour .= ' <a href="http://www.commsy.net" target="_top" title="' . $this->_translator->getMessage('COMMSY_LINK_TITLE') . '">' . '<img src="images/commsy-logo-70x14.jpg" alt="commsy logo" style="vertical-align: bottom;" />' . '</a> ' . getCommSyVersion(); $retour .= '</div>' . LF; return $retour; }
/** * process basic template information */ private function processBaseTemplate() { $current_user = $this->_environment->getCurrentUser(); $own_room_item = $current_user->getOwnRoom(); $portal_user = $current_user->getRelatedPortalUserItem(); $portal_item = $this->_environment->getCurrentPortalItem(); $current_context = $this->_environment->getCurrentContextItem(); $translator = $this->_environment->getTranslationObject(); $portal_user_item = $current_user->getRelatedPortalUserItem(); if ($portal_user_item) { $this->assign('environment', 'user_language', $portal_user_item->getLanguage()); } $count_new_accounts = 0; if ($current_user->isModerator()) { // user count $manager = $this->_environment->getUserManager(); $manager->resetLimits(); $manager->setContextLimit($this->_environment->getCurrentContextID()); $manager->setStatusLimit(1); $manager->select(); $user = $manager->get(); $count_new_accounts = 0; if ($user->getCount() > 0) { $count_new_accounts = $user->getCount(); } // // tasks // $manager = $this->_environment->getTaskManager(); // $manager->resetLimits(); // $manager->setContextLimit($this->_environment->getCurrentContextID()); // $manager->setStatusLimit('REQUEST'); // $manager->select(); // $tasks = $manager->get(); // $task = $tasks->getFirst(); // $count_new_accounts = 0; // while($task){ // $mode = $task->getTitle(); // $task = $tasks->getNext(); // if ($mode == 'TASK_USER_REQUEST'){ // $count_new_accounts ++; // } // } } global $c_jsmath_enable; global $c_jsmath_url; if (!isset($c_jsmath_enable)) { $c_jsmath_enable = false; } if (!isset($c_jsmath_url)) { $c_jsmath_url = ''; } global $c_js_mode; global $c_commsy_url_path; global $c_commsy_domain; $url_path = ''; if ($c_commsy_url_path != '') { $url_path = $c_commsy_url_path . '/'; if (!(strpos($url_path, '/') === 0)) { $url_path = '/' . $c_commsy_url_path; } } else { $url_path = '/'; } $this->assign('basic', 'commsy_path', $c_commsy_domain . $url_path); $this->assign('basic', 'tpl_path', $c_commsy_domain . $url_path . $this->_tpl_path); $this->assign('environment', 'cid', $this->_environment->getCurrentContextID()); $this->assign('environment', 'pid', $this->_environment->getCurrentPortalID()); $this->assign('environment', 'current_user_id', $this->_environment->getCurrentUserID()); $this->assign('environment', 'function', $this->_environment->getCurrentFunction()); $this->assign('environment', 'module', $this->_environment->getCurrentModule()); $this->assign('environment', 'module_name', $translator->getMessage(strtoupper($this->_environment->getCurrentModule())) . '_INDEX'); $this->assign('environment', 'params', $this->_environment->getCurrentParameterString()); $this->assign('environment', 'params_array', $this->_environment->getCurrentParameterArray()); $this->assign('environment', 'username', $current_user->getFullName()); $this->assign('environment', 'user_item_id', $current_user->getItemID()); $this->assign('environment', 'user_picture', $current_user->getPicture()); $this->assign('environment', 'room_type_commnunity', $current_context->isCommunityRoom()); $this->assign('environment', 'room_type_group', $current_context->isGroupRoom()); $this->assign('environment', 'is_guest', $current_user->isReallyGuest()); $this->assign('environment', 'is_read_only', $current_user->isOnlyReadUser()); $this->assign('environment', 'is_moderator', $current_user->isModerator()); $this->assign('translation', 'act_month_long', getLongMonthName(date("n") - 1)); $this->assign('environment', 'lang', $this->_environment->getSelectedLanguage()); $this->assign('environment', 'logo', $current_context->getLogoFileName()); $this->assign('environment', 'room_title', $current_context->getTitle()); $this->assign('environment', 'portal_title', $portal_item->getTitle()); $this->assign('environment', 'show_room_title', $current_context->showTitle()); $this->assign('environment', 'language', $current_context->getLanguage()); $this->assign('environment', 'count_copies', $this->getUtils()->getCopyCount()); $this->assign('environment', 'show_moderator_link', $current_context->showMail2ModeratorLink()); $this->assign('environment', 'show_service_link', $portal_item->showServiceLink()); $this->assign('environment', 'service_link', $this->_getServiceMailLink()); $this->assign('environment', 'c_jsmath_enable', $c_jsmath_enable); $this->assign('environment', 'c_jsmath_url', $c_jsmath_url); $this->assign('environment', 'c_js_mode', isset($c_js_mode) && $c_js_mode === "layer" ? $c_js_mode : "source"); $this->assign('environment', 'count_new_accounts', $count_new_accounts); $this->assign('environment', 'post', $_POST); $this->assign('environment', 'get', $_GET); include_once 'functions/misc_functions.php'; $this->assign('environment', 'commsy_version', getCommSyVersion()); $c_version_addon = $this->_environment->getConfiguration('c_version_addon'); if (!empty($c_version_addon)) { $this->assign('environment', 'commsy_version_addon', $c_version_addon); } // archive $this->assign('environment', 'archive_mode', $this->_environment->isArchiveMode()); // archive // browser $current_browser = mb_strtolower($this->_environment->getCurrentBrowser(), 'UTF-8'); $current_browser_version = $this->_environment->getCurrentBrowserVersion(); $IE8 = false; if ($current_browser == 'msie' && strstr($current_browser_version, '8.')) { $IE8 = true; } $this->assign("environment", "IE8", $IE8); $ownRoomItem = $current_user->getOwnRoom(); if ($ownRoomItem) { $this->assign("own", "id", $ownRoomItem->getItemId()); $this->assign("own", "with_activating", $ownRoomItem->withActivatingContent()); } $this->assign('environment', 'use_problems', $this->getUseProblems()); if (isset($own_room_item) and !$this->_environment->isArchiveMode()) { $this->assign('cs_bar', 'show_widgets', $own_room_item->getCSBarShowWidgets()); $this->assign('cs_bar', 'show_calendar', $own_room_item->getCSBarShowCalendar()); $this->assign('cs_bar', 'show_stack', $own_room_item->getCSBarShowStack()); $this->assign('cs_bar', 'show_portfolio', $own_room_item->getCSBarShowPortfolio()); $this->assign('cs_bar', 'addon_information', $this->getAddonInformation()); if ($own_room_item->showCSBarConnection()) { $this->assign('cs_bar', 'show_connection', $own_room_item->getCSBarShowConnection()); } else { $this->assign('cs_bar', 'show_connection', false); } } else { $this->assign('cs_bar', 'show_widgets', false); $this->assign('cs_bar', 'show_calendar', false); $this->assign('cs_bar', 'show_stack', false); $this->assign('cs_bar', 'show_portfolio', false); $this->assign('cs_bar', 'show_connection', false); } $this->assign('cs_bar', 'show_limesurvey', !($this->_environment->inPortal() || $this->_environment->inServer()) && $current_context->isLimeSurveyActive() && $portal_item->isLimeSurveyActive() && $portal_item->withLimeSurveyFunctions()); // to javascript $to_javascript = array(); $to_javascript['template']['tpl_path'] = $this->_tpl_path; $to_javascript['environment']['lang'] = $this->_environment->getSelectedLanguage(); $to_javascript['environment']['single_entry_point'] = $this->_environment->getConfiguration('c_single_entry_point'); $to_javascript['environment']['max_upload_size'] = $this->_environment->getCurrentContextItem()->getMaxUploadSizeInBytes(); $to_javascript['environment']['portal_link_status'] = $portal_item->getProjectRoomLinkStatus(); // optional | mandatory $to_javascript['environment']['isPortal'] = $this->_environment->getCurrentContextItem()->isPortal(); // escape ' and replace it with \x27 $to_javascript['environment']['user_name'] = str_replace("'", '\\x27', $current_user->getFullName()); $current_portal_user = $this->_environment->getPortalUserItem(); // password expires soon alert if (!empty($current_portal_user) and $current_portal_user->getPasswordExpireDate() > getCurrentDateTimeInMySQL()) { $start_date = new DateTime(getCurrentDateTimeInMySQL()); $since_start = $start_date->diff(new DateTime($current_portal_user->getPasswordExpireDate())); $days = $since_start->days; if ($days == 0) { $days = 1; } $days_before_expiring_sendmail = $portal_item->getDaysBeforeExpiringPasswordSendMail(); if (isset($days_before_expiring_sendmail) and $days <= $days_before_expiring_sendmail) { $to_javascript["translations"]["password_expire_soon_alert"] = $translator->getMessage("COMMON_PASSWORD_EXPIRE_ALERT", $days); $to_javascript['environment']['password_expire_soon'] = true; } else { if (!isset($days_before_expiring_sendmail) and $days <= 14) { $to_javascript["translations"]["password_expire_soon_alert"] = $translator->getMessage("COMMON_PASSWORD_EXPIRE_ALERT", $days); $to_javascript['environment']['password_expire_soon'] = true; } } } else { $to_javascript['environment']['password_expire_soon'] = false; } // locking $checkLocking = $this->_environment->getConfiguration('c_item_locking'); $checkLocking = $checkLocking ? $checkLocking : false; $to_javascript["environment"]["item_locking"] = $checkLocking; // single categorie selection $singleCatSelection = $this->_environment->getConfiguration('c_single_cat_selection'); $singleCatSelection = $singleCatSelection ? $singleCatSelection : false; $to_javascript["environment"]["single_cat_selection"] = $singleCatSelection; $to_javascript['i18n']['COMMON_NEW_BLOCK'] = $translator->getMessage('COMMON_NEW_BLOCK'); $to_javascript['i18n']['COMMON_SAVE_BUTTON'] = $translator->getMessage('COMMON_SAVE_BUTTON'); $to_javascript['security']['token'] = getToken(); $to_javascript['autosave']['mode'] = 0; $to_javascript['autosave']['limit'] = 0; global $c_media_integration; if ($c_media_integration) { $to_javascript['c_media_integration'] = true; // check for rights for mdo $current_context_item = $this->_environment->getCurrentContextItem(); if ($current_context_item->isProjectRoom()) { // does this project room has any community room? $community_list = $current_context_item->getCommunityList(); if ($community_list->isNotEmpty()) { // check for community rooms activated the mdo feature $community = $community_list->getFirst(); while ($community) { $mdo_active = $community->getMDOActive(); if (!empty($mdo_active) && $mdo_active != '-1') { $to_javascript['mdo_active'] = true; break; } $community = $community_list->getNext(); } } } } else { $to_javascript['c_media_integration'] = false; } if ($ownRoomItem) { $to_javascript['own']['id'] = $ownRoomItem->getItemId(); $to_javascript['ownRoom']['id'] = $ownRoomItem->getItemId(); $to_javascript['ownRoom']['withPortfolio'] = $own_room_item->getCSBarShowPortfolio(); } // translations - should be managed elsewhere soon $to_javascript["translations"]["common_hide"] = $translator->getMessage("COMMON_HIDE"); $to_javascript["translations"]["common_show"] = $translator->getMessage("COMMON_SHOW"); $current_user = $this->_environment->getCurrentUserItem(); $auth_source_manager = $this->_environment->getAuthSourceManager(); $auth_source_item = $auth_source_manager->getItem($current_user->getAuthSource()); if (isset($auth_source_item)) { $show_tooltip = true; // password if ($auth_source_item->getPasswordLength() > 0) { $to_javascript["password"]["length"] = $translator->getMessage('PASSWORD_INFO2_LENGTH', $auth_source_item->getPasswordLength()); } else { $show_tooltip = false; } if ($auth_source_item->getPasswordSecureBigchar() == 1) { $to_javascript["password"]["big"] = $translator->getMessage('PASSWORD_INFO2_BIG'); } else { $show_tooltip = false; } if ($auth_source_item->getPasswordSecureSmallchar() == 1) { $to_javascript["password"]["small"] = $translator->getMessage('PASSWORD_INFO2_SMALL'); } else { $show_tooltip = false; } if ($auth_source_item->getPasswordSecureNumber() == 1) { $to_javascript["password"]["special"] = $translator->getMessage('PASSWORD_INFO2_SPECIAL'); } else { $show_tooltip = false; } if ($auth_source_item->getPasswordSecureSpecialchar() == 1) { $to_javascript["password"]["number"] = $translator->getMessage('PASSWORD_INFO2_NUMBER'); } else { $show_tooltip = false; } } else { $show_tooltip = false; } if ($show_tooltip) { $to_javascript["password"]["tooltip"] = 1; } else { $to_javascript["password"]["tooltip"] = 0; } if ($this->_environment->getCurrentFunction() == 'detail' and $this->_environment->getCurrentModule() == 'group') { $params = $this->_environment->getCurrentParameterArray(); $group_manager = $this->_environment->getGroupManager(); $group_item = $group_manager->getItem($params['iid']); if ($group_item->isGroupRoomActivated()) { $to_javascript['dev']['room_id'] = $group_item->getGroupRoomItemID(); } } // dev global $c_indexed_search; global $c_xhr_error_reporting; $this->assign('environment', 'with_indexed_search', isset($c_indexed_search) && $c_indexed_search === true ? true : false); $to_javascript['dev']['indexed_search'] = isset($c_indexed_search) && $c_indexed_search === true ? true : false; $to_javascript['dev']['xhr_error_reporting'] = isset($c_xhr_error_reporting) && !empty($c_xhr_error_reporting) ? true : false; if (isset($portal_user) && $portal_user->isAutoSaveOn()) { global $c_autosave_mode; global $c_autosave_limit; if (isset($c_autosave_mode) && isset($c_autosave_limit)) { $to_javascript['autosave']['mode'] = $c_autosave_mode; $to_javascript['autosave']['limit'] = $c_autosave_limit; } } // limesurvey if (!($this->_environment->inPortal() || $this->_environment->inServer()) && $current_context->isLimeSurveyActive() && $portal_item->isLimeSurveyActive() && $portal_item->withLimeSurveyFunctions()) { $rpcPathParsed = parse_url($portal_item->getLimeSurveyJsonRpcUrl()); $matches = array(); preg_match('/(.*)\\/index.php/', $rpcPathParsed['path'], $matches); $subPath = ''; if (isset($matches[1])) { $subPath = $matches[1]; } $to_javascript["limesurvey"]["newSurveyPath"] = $rpcPathParsed['scheme'] . "://" . $rpcPathParsed['host'] . $subPath . "/index.php/admin/survey/sa/index"; $to_javascript["limesurvey"]["adminPath"] = $rpcPathParsed['scheme'] . "://" . $rpcPathParsed['host'] . $subPath . "/index.php/admin/"; $to_javascript["limesurvey"]["roomName"] = $current_context = $current_context->getTitle(); } // mixin javascript variables if (is_array($this->_toJSMixin)) { $to_javascript = array_merge($to_javascript, $this->_toJSMixin); } $this->assign('javascript', 'variables_as_json', json_encode($to_javascript)); $this->assign("javascript", "locale", $this->_environment->getSelectedLanguage()); // version global $c_debug; if (isset($c_debug) && $c_debug === true) { $this->assign("javascript", "version", uniqid("", true)); } else { if (file_exists("version")) { $versionFromFile = trim(file_get_contents("version")); /* * It is very important to replace " " whitespaces, otherwhise dojo shows some odd behaviour * resulting in adding y11n body classes(high contrast css) */ $this->assign("javascript", "version", str_replace(" ", "_", $versionFromFile)); } else { $this->assign("javascript", "version", "unset"); } } // plugins $info_before_body_ends = LF . ' <!-- PLUGINS BEGIN -->' . LF; include_once 'functions/misc_functions.php'; $info_before_body_ends .= plugin_hook_output_all('getInfosForBeforeBodyEndAsHTML', array(), LF, false) . LF; $info_before_body_ends .= ' <!-- PLUGINS END -->' . LF . LF; $this->assign('basic', 'html_before_body_ends', $info_before_body_ends); }