Example #1
0
 function putcomment($item, $name)
 {
     // $s = '';
     // foreach($item as $k => $v) {
     // $s .= "$k=>$v\n";
     // }
     // $s .= "\n" . Getter::getcidfromname($name) . "\n\n";
     // 返回0表示要求断开链接
     if (strlen($item['message']) == 0) {
         return 2;
     }
     if ($item['playTime'] + 0 == 0) {
         return 3;
     }
     if (strlen($item['message']) > MAX_LEN) {
         $item['message'] = substr($item['message'], 0, MAX_LEN);
     }
     $cid = Getter::getcidfromname($name);
     $cmtdb = new CmtDB($cid);
     if ($cmtdb) {
         $cmtdb->insert_cmt($item);
         return 1;
     }
     return 0;
 }
Example #2
0
 function connectDB()
 {
     if (CmtDB::$database) {
         $this->db = CmtDB::$database;
         return;
     }
     if (!$this->db) {
         $this->db = new PDO('sqlite:' . MUKIOCMT_DB);
         if (!$this->db) {
             $this->alert('Database connecting failed.');
         } else {
             CmtDB::$database = $this->db;
         }
     }
 }
Example #3
0
 function insertCmtMetas($post_ID, $author)
 {
     require_once MUKIO_CMTDB_PATH;
     foreach ($this->videos as $k => $v) {
         $cm = new CmtDB($v['cid']);
         if ($v['cid'] != 'xxx' && $cm) {
             $cm->createCM($post_ID, $author);
         }
         unset($cm);
         //重要
     }
     // die('');
 }
Example #4
0
 function list_cmt_post()
 {
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         return;
     }
     foreach ($this->cvmgr->videos as $key => $v) {
         if (isset($_POST[$v['cid']])) {
             $cm = new CmtDB($v['cid']);
             $cm->set_enable(!$cm->enable);
             $this->alert(($cm->enable ? '解锁' : '锁定') . '成功');
             unset($cm);
             return;
         }
     }
 }