Ejemplo n.º 1
0
 public static function setActive()
 {
     if (!\Audit::instance()->isbot()) {
         if (class_exists('\\Activity\\Models\\Actors')) {
             $actor = \Activity\Models\Actors::fetch();
             if ($actor->isExcluded()) {
                 return;
             }
         }
         if (\Dsc\System::instance()->get('input')->get('ping', null, 'int') != 1) {
             $fw = \Base::instance();
             $path = $fw->hive()['PATH'];
             switch ($path) {
                 // ignore certain paths, even if they aren't specifically pings
                 case strpos($path, '/minify/') === 0 ? true : false:
                 case "/minify/css":
                 case "/minify/js":
                     break;
                 default:
                     (new \Dsc\Mongo\Collections\Sessions())->store();
                     break;
             }
         }
     }
     \Dsc\Mongo\Collections\Sessions::throttledCleanup();
 }
Ejemplo n.º 2
0
 public static function cleanup($max = null)
 {
     if (empty($max)) {
         $max = 300;
         // 5 minutes
     }
     $active_session_ids = \Dsc\Mongo\Collections\Sessions::collection()->distinct("session_id", array('timestamp' => array('$gt' => time() - $max), 'site_id' => 'site'));
     if (empty($active_session_ids)) {
         $conditions = array('messages' => array('$size' => 0));
         static::collection()->remove($conditions, array('w' => 0));
         // get all chat_sessions that remain, and archive them all
         if ($remaining = (new static())->getItems()) {
             foreach ($remaining as $chat) {
                 $chat->archive();
             }
         }
     } else {
         $conditions = array('session_id_user' => array('$nin' => $active_session_ids), 'messages' => array('$size' => 0));
         static::collection()->remove($conditions, array('w' => 0));
         // get chat_sessions $nin $active_session_ids and archive them
         $remaining = (new static())->setState('filter.user_session', array('$nin' => $active_session_ids))->getItems();
         if ($remaining) {
             foreach ($remaining as $chat) {
                 $chat->archive();
             }
         }
     }
     return true;
 }
foreach ($operators = \Support\Models\Operators::fetchActive() as $operator) {
    ?>
<div class="list-group-item">
    <b><?php 
    echo $operator->fullName();
    ?>
</b>
    <p class="help-block"><small><?php 
    echo (int) $operator->openSessions();
    ?>
 open sessions</small></p>
    
    <div class="help-block">
        <div><small>Last active: <?php 
    echo \Dsc\Mongo\Collections\Sessions::ago($operator->last_activity);
    ?>
</small></div>               
    </div>    
</div>
<?php 
}
?>

<?php 
if (empty($operators)) {
    ?>
<div class="list-group-item">
    <p>No online operators</p>
</div>
<?php 
Ejemplo n.º 4
0
            <?php 
    if (!empty($chat_session->admin_name)) {
        ?>
                <div class="help-block">
                    <div><small>In session with: <?php 
        echo $chat_session->admin_name;
        ?>
</small></div>
                </div>
            <?php 
    } elseif (!empty($chat_session->id)) {
        ?>
                <div class="help-block">
                    <div><b>Unclaimed, Open Request</b></div>
                    <div><small>Requested: <?php 
        echo \Dsc\Mongo\Collections\Sessions::ago($chat_session->{'metadata.created.time'});
        ?>
</small></div>
                </div>                            
            <?php 
    } else {
        ?>

            <?php 
    }
    ?>
        </div>
        <div class="col-xs-2">
            <?php 
    if (!empty($chat_session->id)) {
        ?>
Ejemplo n.º 5
0
                        <h3 class="panel-title"><i class="fa fa-users"></i> Admins Online </h3>
                    </div>
                </div>
            </div>
            
            <div class="list-group">
            <?php 
foreach ($admin_users as $user) {
    ?>
                <div class="list-group-item clearfix">
                    <span class="text-success"><?php 
    echo $user['identity'];
    ?>
</span>
                    <span class="pull-right"><?php 
    echo \Dsc\Mongo\Collections\Sessions::ago($user['timestamp']);
    ?>
</span>
                </div>
             <?php 
}
?>

             <?php 
if (empty($admin_users_count)) {
    ?>
                <div class="list-group-item clearfix">
                    None
                </div>
             <?php 
}