Esempio n. 1
0
    $mainScripts = getMainScripts();
    $smarty->assign("T_HEADER_MAIN_SCRIPTS", implode(",", $mainScripts));
    //Operation/file specific scripts
    $loadScripts = array_diff($loadScripts, $mainScripts);
    //Clear out duplicates
    $smarty->assign("T_HEADER_LOAD_SCRIPTS", implode(",", array_unique($loadScripts)));
    //array_unique, so it doesn't send duplicate entries
    if (in_array('news', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) {
        $smarty->assign("T_NEWS", news::getNews(0, true));
    }
    if (G_VERSIONTYPE == 'enterprise') {
        #cpp#ifdef ENTERPRISE
        require_once "../libraries/module_hcd_tools.php";
    }
    #cpp#endif
    if (EfrontUser::isOptionVisible('online_users') && in_array('online', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) {
        $smarty->assign("T_ONLINE_USERS_LIST", EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60));
    }
    $smarty->assign("T_CURRENT_USER", $currentUser);
    $smarty->load_filter('output', 'eF_template_setEditorOffset');
    $smarty->display('index.tpl');
} else {
    $smarty->load_filter('output', 'eF_template_setEditorOffset');
    $smarty->display('index.tpl');
}
$benchmark->set('smarty');
$benchmark->stop();
$output = $benchmark->display();
if (G_DEBUG) {
    echo $output;
}
Esempio n. 2
0
 /**
  * Lock system
  *
  * This function locks down system, so that no users can login (for example when upgrading)
  * If $logoutUsers is set, it logs out connected users as well
  * <br/>Example:
  * <code>
  * EfrontSystem::lockSystem('The system is locked due to maintenance', 1);
  * </code>
  *
  * @param string $message The message to display on the index page
  * @param boolean $logoutUsers Whether to disconnect connected users
  * @since 3.6.0
  * @access public
  * @static
  */
 public static function lockSystem($message, $logoutUsers)
 {
     EfrontConfiguration::setValue('lock_message', $message);
     EfrontConfiguration::setValue('lock_down', 1);
     if ($logoutUsers) {
         $onlineUsers = EfrontUser::getUsersOnline();
         foreach ($onlineUsers as $value) {
             if ($value['login'] != $_SESSION['s_login']) {
                 $user = EfrontUserFactory::factory($value['login']);
                 $user->logout();
             }
         }
     }
 }
 public function onPageFinishLoadingSmartyTpl()
 {
     if (!isset($_SESSION['lesson_rooms'])) {
         $_SESSION['lesson_rooms'] = array();
     }
     $smarty = $this->getSmartyVar();
     $mainScripts = array_merge(array('../modules/module_chat/js/chat'), getMainScripts());
     $smarty->assign("T_HEADER_MAIN_SCRIPTS", implode(",", $mainScripts));
     if ($this->isPopup()) {
         $smarty->assign("T_CHAT_MODULE_STATUS", "OFF");
     } else {
         $smarty->assign("T_CHAT_MODULE_STATUS", "ON");
     }
     if (!$_SESSION['chatter']) {
         $currentUser = $this->getCurrentUser();
         $_SESSION['chatter'] = $currentUser->login;
         $_SESSION['utype'] = $currentUser->getType();
         $this->calculateCommonality($currentUser->login);
         eF_executeNew("INSERT IGNORE INTO module_chat_users (username ,timestamp_) VALUES ('" . $_SESSION['chatter'] . "', CURRENT_TIMESTAMP);");
     } else {
         $currentUser = $this->getCurrentUser();
         if ($_SESSION['chatter'] != $currentUser->login) {
             $_SESSION['chatter'] = $currentUser->login;
             $_SESSION['utype'] = $currentUser->getType();
             $this->calculateCommonality($currentUser->login);
             eF_executeNew("INSERT IGNORE INTO module_chat_users (username ,timestamp_) VALUES ('" . $_SESSION['chatter'] . "', CURRENT_TIMESTAMP);");
         }
     }
     $smarty->assign("T_CHAT_MODULE_BASEURL", $this->moduleBaseUrl);
     $smarty->assign("T_CHAT_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_CHAT_MODULE_BASEDIR", $this->moduleBaseDir);
     $onlineUsers = EfrontUser::getUsersOnline();
     $smarty->assign("T_CHAT_MODULE_ONLINEUSERS", $onlineUsers);
     return $this->moduleBaseDir . "module_chat.tpl";
 }
Esempio n. 4
0
        //    echo $active_menu;
    }
    $smarty->assign("T_ACTIVE_MENU", $active_menu);
    $_SESSION['last_id'] = 0;
    // Each time the sidebar reloads you need to get the five last minuites
    $smarty->assign("T_MENU", $newMenu->menu);
    if ($currentUser->getType() != "administrator" && !isset($currentLesson)) {
        $smarty->assign("T_MENUCOUNT", $newMenu->menuCount - 1);
    } else {
        $smarty->assign("T_MENUCOUNT", $newMenu->menuCount);
    }
}
if (isset($GLOBALS['currentTheme']->options['sidebar_interface']) && $GLOBALS['currentTheme']->options['sidebar_interface'] < 2 || $GLOBALS['currentTheme']->options['sidebar_interface'] == 2 && $GLOBALS['currentTheme']->options['show_header'] == 2) {
    if (isset($GLOBALS['currentLesson']) && $GLOBALS['currentLesson']->options['online'] && $GLOBALS['currentLesson']->options['online'] == 1 || $_SESSION['s_type'] == 'administrator') {
        //$currentUser = EfrontUserFactory :: factory($_SESSION['s_login']);
        $onlineUsers = EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60);
        if (!$_SESSION['s_login']) {
            eF_redirect("index.php?message=" . rawurlencode(_INACTIVITYLOGOUT));
        }
        $size = sizeof($onlineUsers);
        if ($size) {
            $smarty->assign("T_ONLINE_USERS_COUNT", $size);
        }
        $smarty->assign("T_ONLINE_USERS_LIST", $onlineUsers);
    }
}
if (!isset($horizontal_inframe_version) || !$horizontal_inframe_version) {
    if (EfrontUser::isOptionVisible('messages')) {
        if ($currentUser->coreAccess['personal_messages'] || $currentUser->coreAccess['personal_messages'] != 'hidden') {
            $unreadMessages = $messages = eF_getTableData("f_personal_messages pm, f_folders ff", "count(*)", "pm.users_LOGIN='******'s_login'] . "' and viewed='no' and f_folders_ID=ff.id and ff.name='Incoming'");
            $smarty->assign("T_UNREAD_MESSAGES", $messages[0]['count(*)']);
Esempio n. 5
0
            $jsonValues['entity_id'] = current($entity);
            if ($newTime && is_numeric($newTime)) {
                $result = eF_executeNew("insert into users_to_content (users_LOGIN, content_ID, lessons_ID) values('" . $_SESSION['s_login'] . "', " . key($entity) . ", " . $_SESSION['s_lessons_ID'] . ") on duplicate key update total_time={$newTime}");
                $jsonValues['time_in_unit'] = EfrontTimes::formatTimeForReporting($newTime);
            } else {
                $jsonValues['old_time_in_unit'] = EfrontTimes::formatTimeForReporting(EfrontLesson::getUserActiveTimeInUnit($_SESSION['s_login'], key($entity)));
                $jsonValues['old_time_in_lesson'] = EfrontTimes::formatTimeForReporting(EfrontLesson::getUserActiveTimeInLesson($_SESSION['s_login'], $_SESSION['s_lessons_ID']));
            }
        }
        if (empty($_SESSION['last_periodic_check']) || time() - $_SESSION['last_periodic_check'] >= ceil($GLOBALS['configuration']['updater_period'] / 1000)) {
            $result = eF_executeNew("update user_times set time=time+(" . time() . "-timestamp_now),timestamp_now=" . time() . "\n\t\t\t\t\twhere session_expired = 0 and session_custom_identifier = '" . $_SESSION['s_custom_identifier'] . "' and users_LOGIN = '******'s_login'] . "'\n\t\t\t\t\tand entity = '" . current($entity) . "' and entity_id = '" . key($entity) . "'");
            $_SESSION['last_periodic_check'] = time();
            //Check online users every 5 minutes
            if (empty($_SESSION['last_periodic_check_users']) || time() - $_SESSION['last_periodic_check_users'] >= 300) {
                $_SESSION['last_periodic_check_users'] = $_SESSION['last_periodic_check'];
                $jsonValues['online'] = EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60);
                $_SESSION['online_users'] = $jsonValues['online'];
            } else {
                $jsonValues['online'] = $_SESSION['online_users'];
            }
            //$messages = eF_getTableData("f_personal_messages pm, f_folders ff", "count(*)", "pm.users_LOGIN='******'s_login']."' and viewed='no' and f_folders_ID=ff.id and ff.name='Incoming'");
            //$jsonValues['messages'] = $messages[0]['count(*)'];
            $jsonValues['status'] = 1;
            echo json_encode($jsonValues);
        } else {
            echo json_encode(array('status' => 1, 'code' => 0));
        }
    }
} catch (Exception $e) {
    handleAjaxExceptions($e);
}