public function set_current_theme()
 {
     if (!$this->isAjax || $this->method != 'POST' || empty($this->postData['themename'])) {
         $this->app->abort(404, 'Page not found...');
     }
     if ($no_auth = $this->checkAuth()) {
         return $no_auth;
     }
     $data = array();
     $data['action'] = 'manageTheme';
     $error = $this->setlocalization('There is no such skin');
     $data['name'] = $data['title'] = $data['preview'] = '';
     $themes = \Middleware::getThemes();
     if (!empty($themes) && in_array($this->postData['themename'], $themes)) {
         $this->db->setCurrentTheme($this->postData['themename']);
         $error = '';
         $event = new \SysEvent();
         $event->setUserListByMac('online');
         $event->sendReboot();
         $data['name'] = $this->postData['themename'];
         $data['title'] = ucwords(str_replace('_', ' ', $this->postData['themename']));
         $data['preview'] = $this->theme_path . $this->postData['themename'] . "/preview.png";
     }
     $response = $this->generateAjaxResponse($data, $error);
     return new Response(json_encode($response), empty($error) ? 200 : 500);
 }
 public function create(RESTRequest $request)
 {
     $stb_list = $request->getConvertedIdentifiers();
     $identifiers = $request->getIdentifiers();
     if (empty($stb_list) && !empty($identifiers)) {
         throw new RESTCommandException('STB not found');
     }
     $event = new SysEvent();
     if (empty($identifiers)) {
         $event->setUserListByMac('all');
     } else {
         $event->setUserListById($stb_list);
     }
     if ($request->getData('ttl')) {
         $event->setTtl($request->getData('ttl'));
     }
     switch ($request->getData('event')) {
         case 'send_msg':
             if ($request->getData('need_reboot')) {
                 $event->sendMsgAndReboot($request->getData('msg'));
             } else {
                 $event->sendMsg($request->getData('msg'));
             }
             if ($request->getData('auto_hide_timeout')) {
                 $event->setAutoHideTimeout($request->getData('auto_hide_timeout'));
             }
             break;
         case 'send_msg_with_video':
             $event->sendMsgWithVideo($request->getData('msg'), $request->getData('video'));
             break;
         case 'reboot':
             $event->sendReboot();
             break;
         case 'reload_portal':
             $event->sendReloadPortal();
             break;
         case 'update_channels':
             $event->sendUpdateChannels();
             break;
         case 'play_channel':
             $event->sendPlayChannel($request->getData('channel'));
             break;
         case 'play_radio_channel':
             $event->sendPlayRadioChannel($request->getData('channel'));
             break;
         case 'update_image':
             $event->sendUpdateImage();
             break;
         case 'cut_off':
             $event->sendCutOff();
             break;
         case 'show_menu':
             $event->sendShowMenu();
             break;
         default:
             return false;
     }
     return true;
 }
Beispiel #3
0
        Mysql::getInstance()->query($sql);
        $event->sendCutOff();
    }
    switch ($_POST['event']) {
        case 'send_msg':
            if (@$_POST['need_reboot']) {
                $event->sendMsgAndReboot(@$_POST['msg']);
            } else {
                $event->sendMsg(@$_POST['msg']);
            }
            break;
        case 'send_msg_with_video':
            $event->sendMsgWithVideo(@$_POST['msg'], @$_POST['video_url']);
            break;
        case 'reboot':
            $event->sendReboot();
            break;
        case 'reload_portal':
            $event->sendReloadPortal();
            break;
        case 'update_channels':
            $event->sendUpdateChannels();
            break;
        case 'play_channel':
            $event->sendPlayChannel(@$_POST['channel']);
            break;
        case 'update_image':
            $event->sendUpdateImage();
            break;
    }
}
 public function updateByUids($uids = array(), $data)
 {
     if (empty($data)) {
         return false;
     }
     $result = Mysql::getInstance();
     $result = $result->in('id', $uids);
     if (array_key_exists("reboot", $data)) {
         unset($data['reboot']);
         $event = new SysEvent();
         $event->setUserListById($uids);
         $event->sendReboot();
     }
     if (!empty($data)) {
         $result = $result->update('users', $data);
     }
     if (array_key_exists("status", $data)) {
         $event = new SysEvent();
         $event->setUserListById($uids);
         if ($data["status"] == 0) {
             $event->sendCutOn();
         } else {
             $event->sendCutOff();
         }
     }
     if (!$result) {
         return false;
     }
     return $this->getByUids($uids);
 }