示例#1
0
 public function verification($admin, $rand, $code)
 {
     $key = $this->keys($admin);
     $url = $this->url . 'verification?key=' . $key . '&code=' . cs_base64_encode(arraystring(array('host' => Web_Url, 'name' => Web_Name, 'admin' => $admin, 'code' => $code, 'rand' => $rand, 'version' => CS_Version)));
     $str = $this->get_url($url);
     return $str;
 }
示例#2
0
 public function caiji()
 {
     $ac = $this->input->get('ac', true);
     $id = intval($this->input->get('id'));
     $xid = intval($this->input->get('xid'));
     $page = intval($this->input->get('page'));
     $okid = intval($this->input->get('okid'));
     if ($page == 0) {
         $page = 1;
     }
     if ($xid == 0) {
         $xid = 1;
     }
     if ($id == 0) {
         admin_msg(L('plub_09'), 'javascript:history.back();', 'no');
     }
     //ID不能为空
     $row = $this->db->query("SELECT * FROM " . CS_SqlPrefix . "caiji where id='" . $id . "'")->row();
     if (!$row) {
         admin_msg(L('plub_10'), 'javascript:history.back();', 'no');
     }
     //记录存在
     //总页数
     $pagejs = $row->jsid - $row->ksid;
     if ($pagejs < 1) {
         $pagejs = 1;
     }
     //倒顺采集
     if ($row->dxid == 1) {
         if ($xid == 1) {
             $xid = $row->jsid;
         }
         $cjurl = str_replace('{$id}', $xid, $row->cjurl);
         $data['ids'] = $xid;
         $xid = $xid - 1;
     } else {
         if ($xid == 1) {
             $xid = $row->ksid;
         }
         $cjurl = str_replace('{$id}', $xid, $row->cjurl);
         $data['ids'] = $xid;
         $xid = $xid + 1;
     }
     //读取列表文件
     $Content = trim($this->caiji->str($cjurl, $row->code));
     if (empty($Content)) {
         admin_msg(L('plub_11'), site_url('collect'), 'no');
     }
     //赋予网站主路径
     $this->caiji->weburl($row->url);
     //获取列表开始-结束
     $Liststr = $this->caiji->getstr($Content, trim($row->listks), trim($row->listjs));
     if (empty($Liststr)) {
         admin_msg(L('plub_12'), site_url('collect'), 'no');
     }
     //获取到连接地址 返回数组
     $LinkArr = $this->caiji->getarr(trim($row->linkks), trim($row->linkjs), $Liststr);
     if (empty($LinkArr)) {
         admin_msg(L('plub_13'), site_url('collect'), 'no');
     }
     //列表页采集图片
     $pic = '';
     if ($row->picmode == 1) {
         //获取到图片地址 返回数组
         $PicArr = $this->caiji->getarr(trim($row->picks), trim($row->picjs), $Liststr);
         $pic = $PicArr[$okid];
         if (!empty($pic) && substr($pic, 0, 7) != 'http://') {
             $pic = $row->url . $pic;
         }
     }
     $data['pic'] = $pic;
     //当前页内容总数
     $LinkCount = count($LinkArr);
     if ($page > $pagejs + 1) {
         //采集完毕
         admin_msg(L('plub_14'), site_url('collect'));
     }
     //采集内容页开始
     $data['err'] = '';
     $data['pagejs'] = $pagejs + 1;
     $data['page'] = $page;
     $data['okid'] = $okid;
     $data['xid'] = $xid;
     $data['oknum'] = $okid + 1;
     $data['names'] = $row->name;
     $data['linkcount'] = $LinkCount;
     $data['title'] = '';
     $neirurl = substr($LinkArr[$okid], 0, 7) != 'http://' ? $row->url . $LinkArr[$okid] : $LinkArr[$okid];
     //读取内容文件
     $cjzt = 0;
     $DanceContent = $this->caiji->str($neirurl, $row->code);
     if (empty($DanceContent)) {
         $data['err'] = vsprintf(L('plub_15'), array($neirurl));
     } else {
         //标题
         $name = $this->caiji->getstr($DanceContent, trim($row->nameks), trim($row->namejs));
         $data['name'] = str_checkhtml($this->caiji->rep($name, $row->strth));
         //图片
         if ($row->picmode == 2) {
             $data['pic'] = $this->caiji->getstr($DanceContent, trim($row->picks), trim($row->picjs));
         } else {
             $data['pic'] = str_checkhtml($pic);
         }
         if (empty($data['name'])) {
             $data['err'] = L('plub_16');
         } else {
             //获取自定义
             $query = $this->db->query("SELECT * FROM " . CS_SqlPrefix . "cjannex where cid=" . $id . " order by id desc");
             foreach ($query->result() as $rowz) {
                 $zdy = $this->caiji->getstr($DanceContent, trim($rowz->ks), trim($rowz->js));
                 $data['zdy']['name'][] = $rowz->name;
                 $data['zdy']['zd'][] = $rowz->zd;
                 if ($rowz->fid == 1) {
                     $data['zdy']['text'][] = $rowz->fname;
                 } else {
                     $data['zdy']['text'][] = str_checkhtml($this->caiji->rep($zdy, $row->strth));
                 }
             }
             if ($ac == 'ceshi') {
                 //测试不入库
                 $data['title'] = L('plub_17');
             } else {
                 $cjzt = 1;
                 //---------------------------入库---------------------------------------
                 $add['name'] = $data['name'];
                 $add['pic'] = $data['pic'];
                 $add['dir'] = $row->dir;
                 $add['zdy'] = !empty($data['zdy']) ? arraystring($data['zdy']) : '';
                 $add['addtime'] = time();
                 //------------------------判断保存图片到本地----------------------------------
                 if ($row->picid == 1) {
                     if (!empty($data['pic']) && substr($data['pic'], 0, 7) == 'http://') {
                         $picdata = @file_get_contents($data['pic']);
                         // 读文件内容
                         $picfolder = FCPATH . "attachment/vod/";
                         $picname = date('Ymd') . "/" . date('Ymd') . time() . mt_rand(1, 100) . ".jpg";
                         if (!empty($picdata)) {
                             if (write_file($picfolder . $picname, $picdata)) {
                                 $add['pic'] = $picname;
                             }
                         }
                     }
                 }
                 //------------------------判断入未审核库----------------------------------
                 if ($row->rkid == 0) {
                     //临时库
                     $add['cfid'] = $row->cfid;
                     //判断相同数据
                     $rows = $this->db->query("SELECT id FROM " . CS_SqlPrefix . "cjdata where name='" . $add['name'] . "' and dir='" . $row->dir . "'")->row();
                     if ($rows) {
                         if ($row->cfid == 0) {
                             //不入库
                             $data['title'] = L('plub_18');
                         } elseif ($row->cfid == 1) {
                             //新增
                             $this->CsdjDB->get_insert('cjdata', $add);
                             $data['title'] = "入库成功~!";
                         } elseif ($row->cfid == 2) {
                             //覆盖
                             $this->CsdjDB->get_update('cjdata', $rows->id, $add);
                             $data['title'] = L('plub_19');
                         }
                     } else {
                         $this->CsdjDB->get_insert('cjdata', $add);
                         $data['title'] = L('plub_20');
                     }
                 } else {
                     //入板块主数据库
                     //判断板块数据表是否存在
                     if ($this->db->table_exists(CS_SqlPrefix . $row->dir)) {
                         $strs = '';
                         unset($add['dir']);
                         unset($add['zdy']);
                         //判断名称字段
                         if (!$this->db->field_exists('name', CS_SqlPrefix . $row->dir)) {
                             unset($add['name']);
                         } else {
                             $strs .= "and name='" . $add['name'] . "' ";
                         }
                         //判断图片字段
                         if (!$this->db->field_exists('pic', CS_SqlPrefix . $row->dir)) {
                             unset($add['pic']);
                         } else {
                             $strs .= "and pic='" . $add['pic'] . "' ";
                         }
                         //判断时间字段
                         if (!$this->db->field_exists('addtime', CS_SqlPrefix . $row->dir)) {
                             unset($add['addtime']);
                         }
                         //自定义规则
                         $zdy = $data['zdy'];
                         if (!empty($zdy)) {
                             for ($i = 0; $i < count($zdy['zd']); $i++) {
                                 $add[$zdy['zd'][$i]] = $zdy['text'][$i];
                                 if (strlen($zdy['text'][$i]) < 200) {
                                     $strs .= "and " . $zdy['zd'][$i] . "='" . $zdy['text'][$i] . "' ";
                                 }
                             }
                         }
                         $strs = substr($strs, 3);
                         $rowk = $this->db->query("SELECT id FROM " . CS_SqlPrefix . $row->dir . " where " . $strs . "")->row();
                         if ($rowk) {
                             if ($row->cfid == 2) {
                                 //覆盖
                                 $data['title'] = L('plub_19');
                                 $this->CsdjDB->get_update($row->dir, $rowk->id, $add);
                             } elseif ($row->cfid == 1) {
                                 //新增
                                 $this->CsdjDB->get_insert($row->dir, $add);
                                 $data['title'] = L('plub_20');
                             } else {
                                 $data['title'] = L('plub_18');
                             }
                         } else {
                             $this->CsdjDB->get_insert($row->dir, $add);
                             $data['title'] = L('plub_20');
                         }
                     }
                 }
                 //修改采集时间
                 $cjtdata['addtime'] = time();
                 $this->CsdjDB->get_update('caiji', $row->id, $cjtdata);
             }
         }
     }
     if ($ac != 'ceshi' && !empty($data['name'])) {
         //写入采集记录,测试不入库
         $cjdata['name'] = $data['name'];
         $cjdata['names'] = $row->name;
         $cjdata['dir'] = $row->dir;
         $cjdata['url'] = $neirurl;
         $cjdata['zid'] = $cjzt;
         $this->CsdjDB->get_insert('cjlist', $cjdata);
     }
     $data['id'] = $row->id;
     $data['ac'] = $ac;
     $this->load->view('collect_caiji.html', $data);
 }
示例#3
0
 public function bottom()
 {
     $data['code'] = cs_base64_encode(arraystring(array('self' => Web_Path . SELF, 'version' => CS_Version, 'charset' => CS_Charset, 'uptime' => CS_Uptime)));
     $this->load->view('bottom.html', $data);
 }
示例#4
0
 function keys($data, $mx = 'plub')
 {
     $url = CS_YPTURL . $mx . '/key?param=' . cs_base64_encode(arraystring(array('site' => Web_Url, 'url' => 'http://' . Web_Url . Web_Path, 'data' => $data, 'admin' => SELF, 'encry' => CS_Encryption_Key)));
     return htmlall($url);
 }
示例#5
0
 public function role_save()
 {
     $app = $this->input->post('sys', true);
     $dir = $this->input->post('dir', true);
     $id = intval($this->input->post('id', true));
     if (!empty($app)) {
         $apps = implode(',', $app);
     } else {
         $apps = '';
     }
     $row = $this->db->query("SELECT app FROM " . CS_SqlPrefix . "adminzu where id='" . $id . "'")->row();
     $apparr = unarraystring($row->app);
     $apparr[$dir] = $apps;
     $data['app'] = arraystring($apparr);
     $this->CsdjDB->get_update('adminzu', $id, $data);
     die("<script>alert('" . L('plub_30') . "');parent.\$('.webox').css({display:'none'});parent.\$('.background').css({display:'none'});parent.parent.web_box(2);</script>");
 }