public function getEvents()
 {
     $just_started = isset($_REQUEST['init']) ? (int) $_REQUEST['init'] : 0;
     if (isset($_REQUEST['init']) && Config::getSafe('log_mac_clones', false) && $just_started == 0 && Stb::getInstance()->getParam('just_started') == 0) {
         $clone_ip = Middleware::getClonesIPAddress($this->stb->mac);
         if ($clone_ip) {
             Stb::logDoubleMAC($clone_ip);
         }
     }
     if ($this->stb->getParam('ip') != $this->stb->ip) {
         $user = User::getInstance($this->stb->id);
         $user->getInfoFromOSS();
     }
     $this->db->update('users', array('keep_alive' => 'NOW()', 'ip' => $this->stb->ip, 'now_playing_type' => intval($_REQUEST['cur_play_type']), 'just_started' => $just_started, 'last_watchdog' => 'NOW()'), array('mac' => $this->stb->mac));
     $events = Event::getAllNotEndedEvents($this->stb->id);
     $messages = count($events);
     $res['data'] = array();
     $res['data']['msgs'] = $messages;
     if ($messages > 0) {
         if ($events[0]['sended'] == 0) {
             Event::setSended($events[0]['id']);
             if ($events[0]['need_confirm'] == 0) {
                 Event::setEnded($events[0]['id']);
             }
         }
         if ($events[0]['id'] != @$_GET['data']['event_active_id']) {
             $res['data']['id'] = $events[0]['id'];
             $res['data']['event'] = $events[0]['event'];
             $res['data']['need_confirm'] = $events[0]['need_confirm'];
             $res['data']['msg'] = $events[0]['msg'];
             $res['data']['reboot_after_ok'] = $events[0]['reboot_after_ok'];
             $res['data']['auto_hide_timeout'] = $events[0]['auto_hide_timeout'];
             $res['data']['param1'] = $events[0]['param1'];
             if (Config::getSafe('display_send_time_in_message', false)) {
                 $res['data']['send_time'] = $events[0]['addtime'];
             }
         }
     }
     $res['data']['additional_services_on'] = Config::getSafe('enable_tariff_plans', false) ? '1' : $this->stb->additional_services_on;
     return $res;
 }
 public function get(RESTApiRequest $request, $parent_id)
 {
     $events = \Event::getAllNotEndedEvents($parent_id);
     if (empty($events)) {
         return null;
     }
     $allowed_events = array('send_msg', 'update_epg', 'reboot', 'cut_off', 'cut_on');
     foreach ($events as $event) {
         \Event::setConfirmed($event['id']);
         if (!in_array($event['event'], $allowed_events)) {
             continue;
         }
         $result = array();
         $result['id'] = $event['id'];
         $result['type'] = $event['event'];
         $result['msg'] = $event['msg'];
         $result['send_time'] = strtotime($event['addtime']);
         return $result;
     }
     return null;
 }
Example #3
0
            break;
        case 'update_image':
            $event->sendUpdateImage();
            break;
    }
}
$mac = '';
if (!empty($_POST['mac'])) {
    $mac = $_POST['mac'];
} else {
    if (!empty($_GET['mac'])) {
        $mac = $_GET['mac'];
    }
}
$uid = Middleware::getUidByMac($mac);
$events = Event::getAllNotEndedEvents($uid);
$debug = '<!--' . ob_get_contents() . '-->';
ob_clean();
echo $debug;
if (!empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'events.php') === false) {
    $_SESSION['back_url'] = $_SERVER['HTTP_REFERER'];
} elseif (empty($_SERVER['HTTP_REFERER'])) {
    $_SESSION['back_url'] = 'index.php';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">

body {