Example #1
0
            $tool_content .= $ann_content;
            $tool_content .= "</ul></div></div>";
        }
        $tool_content .= "</div>";
        $tool_content .= "<div class='col-md-4'>";

    // display extras right
    if (isset($langExtrasRight) and !empty($langExtrasRight)) {
        $tool_content .= "<div class='panel'>
            <div class='panel-body'>$langExtrasRight
                </a>
            </div>
        </div>";
    }
    // display online users
    $online_users = getOnlineUsers();
    if ($online_users > 0) {
        $tool_content .= "<div class='panel'>
               <div class='panel-body'>
                   <span class='fa fa-group space-after-icon'></span> &nbsp;$langOnlineUsers: $online_users
               </div>
           </div>";
    }
    if (!isset($openCoursesExtraHTML)) {
        $openCoursesExtraHTML = '';
        setOpenCoursesExtraHTML();
    }
    if (get_config('opencourses_enable')) {
        if ($openCoursesExtraHTML) {
            $tool_content .= "<div class='panel opencourses'>
                    <div class='panel-body'>
Example #2
0
    $ttlpvstyl = "No";
    $fcrankFA = '<i class="fa fa-frown-o text-danger"></i>';
    $dksFA = '<i class="fa fa-frown-o text-danger"></i>';
    $vstylFA = '<i class="fa fa-frown-o text-danger"></i>';
    $uOff = getOfflineUsers();
} else {
    $userID = getUserID($_SESSION['username']);
    $fcrank = getUserFCardRank($userID);
    $ttldks = getStat('ttldks', $userID);
    $ttlpvstyl = getStat('ttlpvstyl', $userID);
    $fcrankFA = $fcrank > 50 ? '<i class="fa fa-frown-o text-danger"></i>' : ($fcrank > 25 ? '<i class="fa fa-meh-o"></i>' : ($fcrank <= 25 ? '<i class="fa fa-smile-o text-success"></i>' : ''));
    $dksFA = $ttldks < 3 ? '<i class="fa fa-frown-o text-danger"></i>' : ($ttldks >= 3 && $ttldks < 7 ? '<i class="fa fa-meh-o"></i>' : ($ttldks >= 7 ? '<i class="fa fa-smile-o text-success"></i>' : ''));
    $vstylFA = $ttlpvstyl < 3 ? '<i class="fa fa-frown-o text-danger"></i>' : ($ttlpvstyl >= 3 && $ttlpvstyl < 7 ? '<i class="fa fa-meh-o"></i>' : ($ttlpvstyl >= 7 ? '<i class="fa fa-smile-o text-success"></i>' : ''));
}
$uOff = getOfflineUsers();
$uOn = getOnlineUsers();
?>


<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- Super important! Tells googlebot that this site is responsive!-->
	<meta name="robots" content="NOODP">
	<title>Users Learning Japanese at JPVocab.com</title>
	<meta name="description" content="We're dedicated to Japanese practice. Learn elsewhere, practice here. We feature modern design, anime flashcards, and free online Japanese practice quizzes.">
	<meta name="keywords" content="Learning Japanese, Japanese practice, online Japanese exercises, login, sign up">
	<meta property="og:title" content="Best Free Online Japanese practice site. Lobby!" />
	<meta property="og:type" content="website" />
	<meta property="og:url" content="http://www.tehJapaneseSite.com" />
 public static function get()
 {
     $functions = array();
     /**
      * Get one or couple entities.
      * If get one entity of the UsersModel, we also get user statistic
      *
      * @param $modelName
      * @param array $id
      * @return array
      * @throws Exception
      */
     $functions['fetch'] = function ($modelName, $id = array()) {
         $Register = Register::getInstance();
         try {
             $model = $Register['ModManager']->getModelInstance($modelName);
             // get collection of entities
             if (is_array($id) && count($id)) {
                 $id = array_map(function ($n) {
                     $n = intval($n);
                     if ($n < 1) {
                         throw new Exception('Only integer value might send as ID.');
                     }
                     return $n;
                 }, $id);
                 $ids = implode(", ", $id);
                 $result = $model->getCollection(array("`id` IN ({$ids})"));
                 // get one entity
             } else {
                 if (is_numeric($id)) {
                     $id = intval($id);
                     if ($id < 1) {
                         throw new Exception('Only integer value might send as ID.');
                     }
                     $result = $model->getById($id);
                     if ($result && strtolower($modelName) == 'users') {
                         $stat = $model->getFullUserStatistic($id);
                         $result->setStatistic($stat);
                     }
                 }
             }
         } catch (Exception $e) {
             throw new Exception($e->getMessage());
         }
         return !empty($result) ? $result : array();
     };
     /**
      * Format date.
      * If date_format == 'atm-format', just call AtmGetSimpleDate.
      *
      * @param $date string
      * @param $format string
      * @return string
      */
     $functions['AtmGetDate'] = function ($date, $format = false) {
         return AtmDateTime::getDate($date, $format);
     };
     /**
      * Return date formatted as(example) - "3 seconds before"
      *
      * @param $date string
      * @return string
      */
     $functions['AtmGetSimpleDate'] = function ($date) {
         return AtmDateTime::getSimpleDate($date);
     };
     /**
      * Check access according with ACL rules.
      *
      * @param $params array
      * @return bool
      */
     $functions['checkAccess'] = function ($params = array()) {
         if (isset($params) && is_array($params)) {
             $Register = Register::getInstance();
             return $Register['ACL']->turn($params, false);
         }
         return false;
     };
     $functions['get_url'] = function ($url, $notRoot = false, $useLang = true) {
         return get_url($url, $notRoot, $useLang);
     };
     /**
      * Return URl to the user avatar
      * or default image if avatar image is not exists.
      *
      * @param null $id_user
      * @param null $email_user
      * @return string
      */
     $functions['getAvatar'] = function ($id_user = null, $email_user = null) {
         $def = get_url('/template/' . getTemplateName() . '/img/noavatar.png', false, false);
         if (isset($id_user) && $id_user > 0) {
             if (is_file(ROOT . '/sys/avatars/' . $id_user . '.jpg')) {
                 return get_url('/sys/avatars/' . $id_user . '.jpg', false, false);
             } else {
                 $Register = Register::getInstance();
                 $Viewer = $Register['Viewer'];
                 if (Config::read('use_gravatar', 'users') && $Viewer->customFunctionExists('getGravatar')) {
                     if (!isset($email_user)) {
                         $usersModel = $Register['ModManager']->getModelInstance('Users');
                         $user = $usersModel->getById($id_user);
                         if ($user) {
                             $email_user = $user->getEmail();
                         } else {
                             return $def;
                         }
                     }
                     return $Viewer->runCustomFunction('getGravatar', array($email_user));
                 } else {
                     return $def;
                 }
             }
         } else {
             return $def;
         }
     };
     /**
      * Get either a Gravatar URL or complete image tag for a specified email address.
      *
      * @param string $email The email address
      * @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ]
      * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
      * @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
      * @return String containing either just a URL or a complete image tag
      */
     $functions['getGravatar'] = function ($email, $s = 120, $d = 'mm', $r = 'g') {
         $url = 'http://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . ".png?s={$s}&d={$d}&r={$r}";
         return $url;
     };
     $functions['getOrderLink'] = function ($params) {
         if (!$params || !is_array($params) || count($params) < 2) {
             return '';
         }
         $order = !empty($_GET['order']) ? strtolower(trim($_GET['order'])) : '';
         $new_order = strtolower($params[0]);
         $active = $order === $new_order;
         $asc = $active && isset($_GET['asc']);
         $url = $_SERVER['REQUEST_URI'];
         $url = preg_replace('#(order=[^&]*[&]?)|(asc=[^&]*[&]?)#i', '', $url);
         if (substr($url, -1) !== '&' && substr($url, -1) !== '?') {
             $url .= !strstr($url, '?') ? '?' : '&';
         }
         return '<a href="' . $url . 'order=' . $new_order . ($asc ? '' : '&asc=1') . '">' . $params[1] . ($active ? ' ' . ($asc ? '↑' : '↓') : '') . '</a>';
     };
     /**
      * Checks is an user online or not.
      *
      * @param $user_id int
      */
     $functions['CheckUserOnline'] = function ($user_id) {
         $users = getOnlineUsers();
         return array_key_exists($user_id, $users);
     };
     /**
      * Returns user rank img such as Stars or Progressbar
      *
      * @param $rating int
      */
     $functions['getUserRatingImg'] = function ($rating) {
         $Register = Register::getInstance();
         $settingsModel = $Register['ModManager']->getModelInstance('UsersSettings');
         $rating_settings = $settingsModel->getCollection(array('type' => 'rating'));
         $rating_settings = count($rating_settings) > 0 ? $rating_settings[0]->getValues() : '';
         $rank = getUserRating($rating, $rating_settings);
         return $rank['img'];
     };
     $custom_functions = self::loadCustomTemplateFunctions();
     if (is_array($custom_functions)) {
         $functions = array_merge($functions, $custom_functions);
     }
     return $functions;
 }
Example #4
0
require_once 'modalconfirmation.php';

$pageName = $langAdmin;
define('HIDE_TOOL_TITLE', 1);

// Construct a table with platform identification info
$tool_content .= action_bar(array(
        array('title' => $langBack,
            'url' => "${urlServer}main/portfolio.php",
            'icon' => 'fa-reply',
            'level' => 'primary-label')),false);
$tool_content .= "
    <div class='row'>
        <div class='col-md-12'>
        <div class='panel'><div class='panel-body'>
            $langOnlineUsers : <b>" . getOnlineUsers() . "</b>
                </div></div>
        </div>
    </div>
    <div class='row'>
        <div class='col-md-12'>
            <div class='panel panel-default'>
                <div class='panel-heading'>
                    <h3 class='panel-title'>$langPlatformIdentity</h3>
                </div>                
                <div class='panel-body'>                
                    <div class='row margin-bottom-thin'>
                    <div class='col-sm-3'>
                        " . icon('fa-check') . " <strong>$langWebServerVersion</strong> 
                    </div>
                    <div class='col-sm-9'>
Example #5
0
 * be useful (without any warranty), under the terms of the GNU (General
 * Public License) as published by the Free Software Foundation.
 * The full license can be read in "/info/license/license_gpl.txt".
 *
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
$require_usermanage_user = TRUE;
require_once '../../include/baseTheme.php';
require_once 'modalconfirmation.php';
$pageName = $langAdmin;
define('HIDE_TOOL_TITLE', 1);
// Construct a table with platform identification info
$tool_content .= "\n    <div class='row'>\n        <div class='col-md-12'>\n            <div class='alert alert-info'>{$langOnlineUsers}: <b>" . getOnlineUsers() . "</b></div>\n        </div>\n    </div>\n    <div class='row'>\n        <div class='col-md-12'>\n            <div class='panel panel-default'>\n                <div class='panel-heading'>\n                    <h3 class='panel-title'>{$langPlatformIdentity}</h3>\n                </div>\n                <div class='panel-body'>\n                    <dl class='dl-horizontal'>\n                        <dt>Version:</dt>\n                        <dd>{$langAboutText} <b>{$siteName} " . ECLASS_VERSION . "</b></dd>\n                        <dt>IP Host:</dt>\n                        <dd>{$langHostName} <b>{$_SERVER['SERVER_NAME']}</b></dd>\n                        <dt>Web Server:</dt>\n                        <dd>{$langWebVersion} <b>{$_SERVER['SERVER_SOFTWARE']}</b></dd>\n                        <dt>Data Base Server:</dt>\n                        <dd>";
$tool_content .= "{$langMySqlVersion}<b>" . Database::get()->attributes()->serverVersion() . "</b>";
$tool_content .= "</dd>\n                    </dl>\n                </div>\n            </div>";
// Count prof requests with status = 1
$count_prof_requests = Database::get()->querySingle("SELECT COUNT(*) AS cnt FROM user_request WHERE state = 1 AND status = 1")->cnt;
if ($count_prof_requests > 0) {
    $prof_request_msg = "{$langThereAre} {$count_prof_requests} {$langOpenRequests}";
} else {
    $prof_request_msg = $langNoOpenRequests;
}
// Find last course created
$myrow = Database::get()->querySingle("SELECT code, title, prof_names FROM course ORDER BY id DESC LIMIT 0, 1");
if ($myrow) {
    $last_course_info = "<b>" . q($myrow->title) . "</b> " . q($myrow->code) . ", " . q($myrow->prof_names) . ")";
} else {
    $last_course_info = $langNoCourses;
Example #6
0
         $line = '{"timestamp":"' . $hour . ':' . $min . ':' . $sec . '","id_sender":"' . $id_sender . '","name_sender":"' . $ids[1] . '","msg":"' . $m . '"},';
         $msgs .= $line;
     }
     /* set extracted lines status to: "old" */
     $query3 = "UPDATE " . $GLOBALS['prefix_lms'] . "_instmsg SET status='1' WHERE id_receiver='" . $id_receiver . "' AND status='0'";
     @sql_query($query3);
     if ($msgs) {
         $msgs = substr($msgs, 0, strlen($msgs) - 1);
     }
     $msgs = "[" . $msgs . "]";
     $list = getOnlineUsers();
     $content = '{"content":' . $msgs . ',' . $list . '}';
     aout($content);
     break;
 case "getUsersList":
     $list = "{" . getOnlineUsers() . "}";
     aout($list);
     break;
 case "getContent":
     $wChat = Get::req('wChat', DOTY_ALPHANUM, '');
     $id_sender = Get::req('id_sender', DOTY_INT, '');
     $id_receiver = Get::req('id_receiver', DOTY_INT, '');
     $name_sender = Get::req('name_sender', DOTY_ALPHANUM, '');
     $name_receiver = Get::req('name_receiver', DOTY_ALPHANUM, '');
     /* delete lines older than 1 day */
     $query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_instmsg WHERE ((id_receiver='" . $id_receiver . "' AND id_sender='" . $id_sender . "') OR (id_receiver='" . $id_sender . "' AND id_sender='" . $id_receiver . "')) AND DATE_ADD(data,INTERVAL 1 DAY) < NOW()";
     @sql_query($query);
     /* extract lines */
     $query = "SELECT * FROM " . $GLOBALS['prefix_lms'] . "_instmsg WHERE (id_receiver='" . $id_receiver . "' AND id_sender='" . $id_sender . "') OR (id_receiver='" . $id_sender . "' AND id_sender='" . $id_receiver . "') ORDER BY data";
     $result = sql_query($query);
     $msgs = "";
Example #7
0
 /**
  * Return posts list
  */
 public function view_theme($id_theme = null)
 {
     $id_theme = (int) $id_theme;
     if (empty($id_theme) || $id_theme < 1) {
         redirect('/forum/');
     }
     $themeModel = $this->Register['ModManager']->getModelInstance('Themes');
     $themeModel->bindModel('forum');
     $themeModel->bindModel('poll');
     $theme = $themeModel->getById($id_theme);
     if (!$theme->getForum()) {
         return $this->showInfoMessage(__('Can not find forum'), '/forum/');
     }
     //turn access
     $this->ACL->turn(array('forum', 'view_themes'));
     // Check access to this forum. May be locked by pass or posts count
     $this->__checkForumAccess($theme->getForum());
     $id_forum = $theme->getId_forum();
     $this->__checkThemeAccess($theme);
     if ($this->cached && $this->Cache->check($this->cacheKey)) {
         $source = $this->Cache->read($this->cacheKey);
     } else {
         // Если запрошенной темы не существует - возвращаемся на форум
         if (empty($theme)) {
             return $this->showInfoMessage(__('Topic not found'), '/forum/');
         }
         // Заголовок страницы (содержимое тега title)
         $this->addToPageMetaContext('entity_title', h($theme->getTitle()));
         $this->addToPageMetaContext('category_title', h($theme->getForum()->getTitle()));
         $markers = array();
         $markers['navigation'] = get_link(__('Forums list'), '/forum/') . __('Separator') . get_link($theme->getForum()->getTitle(), '/forum/view_forum/' . $id_forum) . __('Separator') . get_link($theme->getTitle(), '/forum/view_theme/' . $id_theme);
         if (!empty($description)) {
             $markers['navigation'] .= ' (' . $theme->getDescription() . ')';
         }
         // Page nav
         $postsModelName = $this->Register['ModManager']->getModelName('Posts');
         $postsModel = new $postsModelName();
         $total = $postsModel->getTotal(array('cond' => array('id_theme' => $id_theme)));
         if ($total === 0) {
             $this->__delete_theme($id_theme);
             return $this->showInfoMessage(__('Topic not found'), '/forum/view_forum/' . $id_forum);
         }
         list($pages, $page) = pagination($total, $this->Register['Config']->read('posts_per_page', 'forum'), '/forum/view_theme/' . $id_theme);
         $markers['pagination'] = $pages;
         $this->addToPageMetaContext('page', $page);
         // SELECT posts
         $postsModel->bindModel('author');
         $postsModel->bindModel('editor');
         $postsModel->bindModel('attacheslist');
         $posts = $postsModel->getCollection(array('id_theme' => $id_theme), array('order' => 'time ASC, id ASC', 'page' => $page, 'limit' => $this->Register['Config']->read('posts_per_page', 'forum')));
         // Ссылка "Ответить" (если тема закрыта - выводим сообщение "Тема закрыта")
         if ($theme->getLocked() == 0) {
             $markers['add_link'] = get_link(get_img('/template/' . $this->Register['Config']->read('template') . '/img/reply.png', array('alt' => __('Answer'), 'title' => __('Answer'))), '/forum/view_theme/' . $id_theme . '#sendForm');
         } else {
             $markers['add_link'] = '';
             // __('Theme is locked')
             $markers['closed_theme'] = true;
         }
         if (!$this->ACL->turn(array('forum', 'add_posts', $theme->getId_forum()), false)) {
             $markers['add_link'] = '';
         }
         $markers['meta'] = '';
         $this->_globalize($markers);
         $post_num = ($page - 1) * $this->Register['Config']->read('posts_per_page', 'forum');
         //serialize rating settings
         $settingsModelName = $this->Register['ModManager']->getModelName('UsersSettings');
         $settingsModel = new $settingsModelName();
         $rating_settings = $settingsModel->getCollection(array('type' => 'rating'));
         $rating_settings = count($rating_settings) > 0 ? $rating_settings[0]->getValues() : '';
         $usersModel = $this->Register['ModManager']->getModelInstance('Users');
         $first_top = false;
         if ($page > 1 && $theme->getFirst_top() == '1') {
             $post = $postsModel->getCollection(array('id_theme' => $id_theme), array('order' => 'time ASC, id ASC', 'limit' => 1));
             if (is_array($post) && count($post) == 1) {
                 $posts = array_merge($post, $posts);
                 $first_top = true;
             }
         }
         foreach ($posts as $post) {
             // Если автор сообщения (поста) - зарегистрированный пользователь
             $postAuthor = $post->getAuthor();
             if ($post->getId_author()) {
                 // Аватар
                 if (is_file(ROOT . '/sys/avatars/' . $post->getId_author() . '.jpg')) {
                     $postAuthor->setAvatar(get_url('/sys/avatars/' . $post->getId_author() . '.jpg'));
                 } else {
                     $postAuthor->setAvatar(get_url('/sys/img/noavatar.png'));
                 }
                 // Статус пользователя
                 $status = $this->ACL->get_group_info();
                 $user_status = array_key_exists($postAuthor->getStatus(), $status) ? $status[$postAuthor->getStatus()] : $status[0];
                 $postAuthor->setStatus_title($user_status['title']);
                 // Рейтинг пользователя (по количеству сообщений)
                 $rating = $postAuthor->getPosts();
                 $rank_star = getUserRating($rating, $rating_settings);
                 $postAuthor->setRank($rank_star['rank']);
                 if ($postAuthor->getState()) {
                     $postAuthor->setRank($postAuthor->getState());
                 }
                 $postAuthor->setUser_rank(get_img('/sys/img/' . $rank_star['img']));
                 // Если автор сообщения сейчас "на сайте"
                 $users_on_line = getOnlineUsers();
                 if (isset($users_on_line) && isset($users_on_line[$post->getId_author()])) {
                     $postAuthor->setStatus_on(__('Online'));
                 } else {
                     $postAuthor->setStatus_on(__('Offline'));
                 }
                 // Если пользователь заблокирован
                 if ($postAuthor->getBlocked()) {
                     $postAuthor->setStatus_on('<span class="statusBlock">' . __('Banned') . '</span>');
                 }
                 // Если автор сообщения - незарегистрированный пользователь
             } else {
                 $postAuthor->setAvatar(get_url('/sys/img/noavatar.png'));
                 $postAuthor->setName(__('Guest'));
             }
             $message = $this->Textarier->parseBBCodes($post->getMessage(), $post);
             $post->setMessage($message);
             $signature = $postAuthor->getSignature() ? $this->Textarier->getSignature($postAuthor->getSignature(), $postAuthor->getStatus()) : '';
             $postAuthor->setSignature($signature);
             // If author is authorized user.
             $email = '';
             $privat_message = '';
             $author_site = '';
             $user_profile = '';
             $icon_params = array('class' => 'user-details');
             if ($post->getId_author()) {
                 $user_profile = '&nbsp;' . get_link(get_img('/sys/img/icon_profile.gif', array('alt' => __('View profile'), 'title' => __('View profile'))), getProfileUrl($post->getId_author()), $icon_params);
                 if (isset($_SESSION['user'])) {
                     $email = '&nbsp;' . get_link(get_img('/sys/img/icon_email.gif', array('alt' => __('Send mail'), 'title' => __('Send mail'))), '/users/send_mail_form/' . $post->getId_author(), $icon_params);
                     $privat_message = '&nbsp;' . get_link(get_img('/sys/img/icon_pm.gif', array('alt' => __('PM'), 'title' => __('PM'))), '/users/pm_send_form/' . $post->getId_author(), $icon_params);
                 }
                 $author_site = $post->getAuthor()->getUrl() ? '&nbsp;' . get_link(get_img('/sys/img/icon_www.gif', array('alt' => __('Author site'), 'title' => __('Author site'))), h($post->getAuthor()->getUrl()), array_merge($icon_params, array('target' => '_blank')), true) : '';
             }
             $post->getAuthor()->setAuthor_site($author_site);
             $post->getAuthor()->setProfile_url($user_profile);
             $post->getAuthor()->setEmail_url($email);
             $post->getAuthor()->setPm_url($privat_message);
             // Если сообщение редактировалось...
             if ($post->getId_editor()) {
                 if ($post->getId_author() && $post->getId_author() == $post->getId_editor()) {
                     $editor = __('Edit by author') . ' ' . AtmDateTime::getDate($post->getEdittime());
                 } else {
                     $status_info = $this->ACL->get_user_group($post->getEditor()->getStatus());
                     $editor = __('Edited') . $post->getEditor()->getName() . '(' . $status_info['title'] . ') ' . AtmDateTime::getDate($post->getEdittime());
                 }
             } else {
                 $editor = '';
             }
             $post->setEditor_info($editor);
             //edit and delete links
             $edit_link = '';
             $delete_link = '';
             if (!empty($_SESSION['user'])) {
                 if ($this->ACL->turn(array('forum', 'edit_posts', $theme->getId_forum()), false) || !empty($_SESSION['user']['id']) && $post->getId_author() == $_SESSION['user']['id'] && $this->ACL->turn(array('forum', 'edit_mine_posts', $theme->getId_forum()), false)) {
                     $edit_link = get_link('', '/forum/edit_post_form/' . $post->getId(), array('class' => 'fps-edit'));
                 }
                 if ($this->ACL->turn(array('forum', 'delete_posts', $theme->getId_forum()), false) || !empty($_SESSION['user']['id']) && $post->getId_author() == $_SESSION['user']['id'] && $this->ACL->turn(array('forum', 'delete_mine_posts', $theme->getId_forum()), false)) {
                     $delete_link = get_link('', '/forum/delete_post/' . $post->getId(), array('class' => 'fps-delete', 'onClick' => "return confirm('" . __('Are you sure') . "')"));
                 }
             }
             $on_top = get_link('', '#top', array('class' => 'fps-up'), true);
             $post->setOn_top_link($on_top);
             $post->setEdit_link($edit_link);
             $post->setDelete_link($delete_link);
             //message number
             if ($first_top) {
                 $post->setPost_number(1);
                 $first_top = false;
             } else {
                 $post_num++;
                 $post->setPost_number($post_num);
             }
             $post_number_url = 'http://' . $_SERVER['HTTP_HOST'] . get_url('/' . $this->module . '/view_post/' . $post->getId(), true);
             $post->setPost_number_url($post_number_url);
             //set tags for cache
             $this->setCacheTag(array('post_id_' . $post->getId(), 'user_id_' . $post->getId_author()));
         }
         $this->setCacheTag('theme_id_' . $id_theme);
         // Polls render
         $polls = $theme->getPoll();
         if (!empty($polls[0])) {
             $theme->setPoll($this->_renderPoll($polls[0]));
         } else {
             $theme->setPoll('');
         }
         $markers = array('reply_form' => $this->add_post_form($theme));
         $this->_globalize($markers);
         $source = $this->render('posts_list.html', array('posts' => $posts, 'theme' => $theme));
         //write into cache
         if ($this->cached) {
             $this->Cache->write($source, $this->cacheKey, $this->cacheTags);
         }
     }
     // Если страницу темы запросил зарегистрированный пользователь, значит он ее просмотрит
     if (isset($_SESSION['user']) and isset($_SESSION['newThemes'])) {
         if (count($_SESSION['newThemes']) > 0) {
             if (in_array($id_theme, $_SESSION['newThemes'])) {
                 unset($_SESSION['newThemes'][$id_theme]);
             }
         } else {
             unset($_SESSION['newThemes']);
         }
     }
     $theme->setViews($theme->getViews() + 1);
     $theme->save();
     $_SESSION['VIEW_PAGE'] = 'theme' . $id_theme;
     //clean cache
     $this->Cache->clean(CACHE_MATCHING_TAG, array('action_viev_forum', 'theme_id_' . $id_theme));
     return $this->_view($source);
 }
Example #8
0
 case "getOnlineUsers":
     $timeFilter = isset($_REQUEST['timeFilter']) && $_REQUEST['timeFilter'] == "offlineTime" ? "offlineTime" : "onlineTime";
     $beginTime = isset($_REQUEST['beginTime']) ? $_REQUEST['beginTime'] : date('Y-m-d H:i:s', time() - 3600 * 24 * 7);
     $endTime = isset($_REQUEST['endTime']) ? $_REQUEST['endTime'] : date('Y-m-d H:i:s');
     $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '1';
     $orderBy = isset($_REQUEST['orderBy']) ? $_REQUEST['orderBy'] : 'onlineTime';
     $order = isset($_REQUEST['order']) && $_REQUEST['order'] == "desc" ? "desc" : "asc";
     $count = getOnlineUsersCount($beginTime, $endTime);
     $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $count;
     $res = array();
     $res['total'] = $count;
     $res['page'] = $page;
     $res['limit'] = $limit;
     $res['orderBy'] = $orderBy;
     $res['order'] = $order;
     $res['data'] = getOnlineUsers($timeFilter, $beginTime, $endTime, $page, $limit, $orderBy, $order);
     break;
     //TODO
 //TODO
 case "getUserOnlineInfo":
     $res = getUserOnlineInfo();
     break;
     //TODO
 //TODO
 case "getUserDepartments":
     $res = getUserDepartments();
     break;
 case "getUserListByDepartment":
     $res = getUserListByDepartment($_REQUEST["department"]);
     break;
 case "getAdminMembers":
Example #9
0
$_SESSION['username'] = Session::getUserID();
if (empty($_SESSION['username'])) {
    header('Location: ' . Url::error());
    exit;
}
//*JAG - Page id is a unique id assigned to each page that loads a chatbox. Currently, only one chat box will load per page.
//        this allows us to track which records have been loaded if multiple tabs for the same chat room are open.
$pageId = Filter::text($_GET['pageId']);
$isValidPageId = Filter::isValidTimestamp($pageId);
if (empty($isValidPageId)) {
    $pageId = time();
}
$slug = Filter::text($_GET['slug']);
$project = Project::getProjectFromSlug($slug);
if ($_GET['action'] == "getonlineusers") {
    getOnlineUsers($slug);
}
if ($_GET['action'] == "chatheartbeat") {
    chatHeartbeat($slug, $pageId);
}
if ($_GET['action'] == "sendchat") {
    sendChat($pageId);
}
if ($_GET['action'] == "closechat") {
    closeChat();
}
if ($_GET['action'] == "startchatsession") {
    startChatSession($pageId);
}
if (!isset($_SESSION['chatHistory'])) {
    $_SESSION['chatHistory'] = array();
Example #10
0
File: data.php Project: perrr/svada
} elseif ($_GET['action'] == 'setStatus') {
    setStatus($_SESSION['user']['id'], $_POST['status']);
} elseif ($_GET['action'] == 'logOn') {
    logOn($_SESSION['user']['id']);
} elseif ($_GET['action'] == 'getAllUsers') {
    getAllUsers();
} elseif ($_GET['action'] == 'editMessage') {
    editMessage($_SESSION['user']['id'], $_POST['message'], $_POST['content']);
} elseif ($_GET['action'] == 'getAllEmoticons') {
    getAllEmoticons();
} elseif ($_GET['action'] == 'getAllImages') {
    getAllImages();
} elseif ($_GET['action'] == 'getTopic') {
    getTopic();
} elseif ($_GET['action'] == 'getOnlineUsers') {
    getOnlineUsers();
} elseif ($_GET['action'] == 'setProfilePicture') {
    setUserImage($_SESSION['user']['id'], $_POST['image']);
} elseif ($_GET['action'] == 'setStatusMessage') {
    setStatusMessage($_SESSION['user']['id'], $_POST['statusMessage']);
} elseif ($_GET['action'] == 'setDisplayName') {
    setDisplayName($_SESSION['user']['id'], $_POST['displayName']);
} elseif ($_GET['action'] == 'setHighPriorityUserInformation') {
    setHighPriorityUserInformation($_SESSION['user']['id'], $_POST['status'], $_POST['isTyping']);
} elseif ($_GET['action'] == 'setLowPriorityUserInformation') {
    setLowPriorityUserInformation($_SESSION['user']['id'], $_POST['statusMessage'], $_POST['imageId']);
} elseif ($_GET['action'] == 'searchMessages') {
    searchMessages($_POST['string'], $_POST['caseSensitive'], (int) $_POST['userId']);
} elseif ($_GET['action'] == 'setTopic') {
    setTopic($_POST['topic'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'setChatName') {
Example #11
0
marginwidth="0">
<?
include "top.php";
?>
<TABLE cellSpacing=0 cellPadding=5 width="100%" border=0>
  <TBODY>
  <TR>
    <TD class=menu_cell_repeater style="PADDING-LEFT: 15px" vAlign=top width=140>
<?
include ("left.php");
?>
	</TD><td valign="TOP"><center> <b>Users Online</b><br>
	<table class=table_lines cellSpacing=0 cellPadding=6 width="50%" 
border=0>
	<tr><TD>UserName</td><td>Nation</td><TD>Rank</td></tr>
	<? $users = getOnlineUsers();
$all_cache = array();
for ($i = 0;$i < count($users);$i++) {
	$tag = '';
	if (in_array($users[$i]->alliance, $all_cache) AND !isset($all_cache[$users[$i]->alliance])) {
		$tag = $all_cache[$users[$i]->alliance];
	} elseif ($users[$i]->alliance > 0) {
		$qal = mysql_query("SELECT tag FROM alliances WHERE ID='" . $users[$i]->alliance . "'") or die(mysql_error());
		$r = mysql_fetch_array($qal, MYSQL_ASSOC);
		$all_cache[$users[$i]->alliance] = $r['tag'];
		if ($r['tag']) {
			$tag = "[" . $r['tag'] . "]";
		} else {
			$tag = '';
		}
	}