Esempio n. 1
0
 /**
  *
  * @return Content_model
  */
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Esempio n. 2
0
 public function logs()
 {
     $ret = array();
     $logsModel = null;
     $this->load->model('Logs_model', NULL, TRUE);
     $logsModel = new Logs_model();
     $elementId = isset($_POST['element_id']) ? intval($_POST['element_id']) : 0;
     $type = isset($_POST['type']) ? intval($_POST['type']) : 'video';
     $urlId = isset($_POST['url_id']) ? intval($_POST['url_id']) : 0;
     $status = isset($_POST['status']) ? intval($_POST['status']) : 0;
     $hasSub = isset($_POST['has_sub']) ? intval($_POST['has_sub']) : 0;
     if ($status == 0) {
         $ret['urlId'] = $urlId;
         $this->load->library('simple_html_dom');
         $this->load->file(APPPATH . 'components/ImportDramaCool.php');
         $dramaCool = new ImportDramaCool();
         $videoObj = $this->Video_model->getById($elementId);
         if ($videoObj) {
             $updateResult = $dramaCool->updateStreamingInLog($videoObj['id'], $videoObj['original_url'], $hasSub);
             if ($updateResult) {
                 $ret['msg'] = 'updated';
                 if (isset($updateResult[$urlId])) {
                     $ret['surl'] = $updateResult[$urlId];
                 }
             } else {
                 $ret['msg'] = 'cannot updated';
             }
         } else {
             $ret['msg'] = 'file not found';
         }
     } else {
         $ret['msg'] = 'playing';
         if ($elementId) {
             $logsModel->writeLogs($elementId, $type);
         }
     }
     echo json_encode($ret);
 }