load->model('User'); $this->User->Login(); } public function index($sid=1){ $str = file_get_contents(FCPATH.'packs/zimu.ass'); $zimu = end(explode('[Events]', $str)); $data['sid'] = $sid; $data['zimu'] = str_replace("\r\n","",str_replace('{\b0}{\fs}{\fn}','',$zimu)); $this->load->view('setting.html',$data); } public function save(){ $Web_Path = $this->input->get_post('Web_Path',true); $Web_Url = $this->input->get_post('Web_Url',true); $Web_Domain = $this->input->get_post('Web_Domain',true); $Web_Play = $this->input->get_post('Web_Play',true); $Web_On = (int)$this->input->get_post('Web_On',true); $Admin_Name = $this->input->get_post('Admin_Name',true); $Admin_Code = $this->input->get_post('Admin_Code',true); $Web_Url = str_replace('http://','',$Web_Url); $Web_Domain = str_replace('http://','',$Web_Domain); $Web_Play = str_replace('http://','',$Web_Play); if(empty($Web_Url) || empty($Web_Domain)){ getjson('抱歉,域名不能留空'); } if(empty($Admin_Name) || empty($Admin_Code)){ getjson('抱歉,登录名称或密码不能留空'); } $Jpg_On = intval($this->input->get_post('Jpg_On',true)); $Jpg_Num = intval($this->input->get_post('Jpg_Num',true)); $Jpg_Time = intval($this->input->get_post('Jpg_Time',true)); $Jpg_Size = $this->input->get_post('Jpg_Size',true); if($Jpg_Num == 0) $Jpg_Num = 1; if($Jpg_Num > 20) getjson('抱歉,截图最多只能20张'); $Gif_On = intval($this->input->get_post('Gif_On',true)); $Gif_Time = intval($this->input->get_post('Gif_Time',true)); $Gif_Len = intval($this->input->get_post('Gif_Len',true)); $Gif_Size = $this->input->get_post('Gif_Size',true); if(empty($Web_Path)) $Web_Path = '/'; if($Jpg_On==0){ $jpgarr = explode('x', $Jpg_Size); if(!empty($Jpg_Size) && (sizeof($jpgarr)!=2 || intval($jpgarr[0])<1 || intval($jpgarr[1])<1)){ getjson('截图尺寸格式不正确'); } } if($Gif_On==0){ $gifarr = explode('x', $Gif_Size); if(!empty($Gif_Size) && (sizeof($gifarr)!=2 || intval($gifarr[0])<1 || intval($gifarr[1])<1)){ getjson('GIF动图尺寸格式不正确'); } if($Gif_Len<1) getjson('请设置GIF动图时长'); if($Gif_Len>10) $Gif_Len = 10; } $Mu_On = intval($this->input->get_post('Mu_On',true)); $Mu_Time = intval($this->input->get_post('Mu_Time',true)); $Mu_Type = intval($this->input->get_post('Mu_Type',true)); $Mu_Size = $this->input->get_post('Mu_Size',true); $Mu_Path = $this->input->get_post('Mu_Path',true); $Mu_M3u8_Name = $this->input->get_post('Mu_M3u8_Name',true); $Mu_Pic_Name = $this->input->get_post('Mu_Pic_Name',true); $Mu_Kbps = $this->input->get_post('Mu_Kbps',true); $Mu_Key = $this->input->get_post('Mu_Key',true); $Mu_Dir = $this->input->get_post('Mu_Dir',true); $Mu_Ffpath = $this->input->get_post('Mu_Ffpath',true); $Mu_PtTime = intval($this->input->get_post('Mu_PtTime',true)); $Mu_Tsext = $this->input->get_post('Mu_Tsext',true); $Mu_Preset = $this->input->get_post('Mu_Preset',true); $Mu_Size2 = $this->input->get_post('Mu_Size2',true); $Mu_Kbps2 = $this->input->get_post('Mu_Kbps2',true); if(empty($Mu_Ffpath)) getjson('ffmpeg安装路径不能留空'); if(empty($Mu_Path)) getjson('转码保存路径不能留空'); $muarr = explode('x', $Mu_Size); if(!empty($Mu_Size) && (sizeof($muarr)!=2 || intval($muarr[0])<1 || intval($muarr[1])<1)){ getjson('转码尺寸一格式不正确'); } $muarr = explode('x', $Mu_Size2); if(!empty($Mu_Size2) && (sizeof($muarr)!=2 || intval($muarr[0])<1 || intval($muarr[1])<1)){ getjson('转码尺寸二格式不正确'); } if(strpos($Mu_M3u8_Name, '[id]') === false && strpos($Mu_M3u8_Name, '[md5]') === false){ getjson('M3U8后缀格式不正确'); } if(empty($Mu_Pic_Name)){ getjson('截图后缀不能为空'); } //水印设置 $Wm_On = intval($this->input->get_post('Wm_On',true)); $Wm_Lt = $this->input->get_post('Wm_Lt',true); $Wm_On2 = intval($this->input->get_post('Wm_On2',true)); $Wm_Lt2 = $this->input->get_post('Wm_Lt2',true); $Wm_On3 = intval($this->input->get_post('Wm_On3',true)); $Wm_Lt3 = $this->input->get_post('Wm_Lt3',true); $Wm_On4 = intval($this->input->get_post('Wm_On4',true)); $Wm_Lt4 = $this->input->get_post('Wm_Lt4',true); $Wm_Zm = intval($this->input->get_post('Wm_Zm',true)); $Wm_ZmNei = $this->input->get_post('Wm_ZmNei'); if($Wm_Zm==1){ if(empty($Wm_ZmNei)) getjson('字幕内容不能为空'); } if(substr($Wm_ZmNei,0,9) != 'Dialogue:'){ getjson('字幕内容格式错误'); } //修改字幕内容 $str = file_get_contents(FCPATH.'packs/zimu.ass'); $zmarr = explode('Dialogue:',$Wm_ZmNei); unset($zmarr[0]); $Wm_ZmNei = "Dialogue:".implode("\r\n{\\b0}{\\fs}{\\fn}\r\nDialogue:",$zmarr); $zimu = current(explode('[Events]', $str))."[Events]\r\n".$Wm_ZmNei; write_file(FCPATH.'packs/zimu.ass', $zimu); if($Wm_On==1){ $wmarr = explode(':', $Wm_Lt3); if(sizeof($wmarr)<2) getjson('左上角水印间距格式不正确'); $Wm_Lt = intval($wmarr[0]).':'.intval($wmarr[1]); } if($Wm_On2==1){ $wmarr = explode(':', $Wm_Lt4); if(sizeof($wmarr)<2) getjson('右上角水印间距格式不正确'); $Wm_Lt2 = intval($wmarr[0]).':'.intval($wmarr[1]); } if($Wm_On3==1){ $wmarr = explode(':', $Wm_Lt); if(sizeof($wmarr)<2) getjson('左下角水印间距格式不正确'); $Wm_Lt3 = intval($wmarr[0]).':'.intval($wmarr[1]); } if($Wm_On4==1){ $wmarr = explode(':', $Wm_Lt2); if(sizeof($wmarr)<2) getjson('右下角水印间距格式不正确'); $Wm_Lt4 = intval($wmarr[0]).':'.intval($wmarr[1]); } //保存路径 $Video_Path = $this->input->get_post('Video_Path',true); $Video_SrcOn = intval($this->input->get_post('Video_SrcOn',true)); $Video_M3u8On = intval($this->input->get_post('Video_M3u8On',true)); if(empty($Video_Path)) getjson('上传文件路径不能为空'); $Web_CrossDomain = $this->input->get_post('Web_CrossDomain',true); $Web_CrossOn = intval($this->input->get_post('Web_CrossOn',true)); $Web_Cross = intval($this->input->get_post('Web_Cross',true)); $Web_M3u8On = intval($this->input->get_post('Web_M3u8On',true)); $Api_On = intval($this->input->get_post('Api_On',true)); $Api_Url = $this->input->get_post('Api_Url',true); $Api_Key = $this->input->get_post('Api_Key',true); if($Api_On == 1){ if(empty($Api_Url) || empty($Api_Key)) getjson('同步地址和同步秘钥不能为空'); if(substr($Api_Url,0,7) != 'http://' && substr($Api_Url,0,8) != 'https://') getjson('同步地址格式不正确'); } $Up_Api = intval($this->input->get_post('Up_Api',true)); $Up_Miao = intval($this->input->get_post('Up_Miao',true)); $Up_Ext = $this->input->get_post('Up_Ext',true); if(empty($Up_Ext)) getjson('支持的上传格式不能为空'); //m3u8域名 if(substr($Mu_Path,0,2) !== './' && $Web_M3u8On == 0 && empty($Web_Play)){ getjson('m3u8播放域名不能留空'); } $strs = "