xinhuChajian.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. class xinhuChajian extends Chajian{
  3. private $updatekey = '';
  4. private $updatekeys = 'aHR0cDovLzEyNy4wLjAuMS9hcHAvcm9ja3hpbmh1d2ViLw::';
  5. protected function initChajian()
  6. {
  7. if(getconfig('systype')=='dev'){
  8. $this->updatekey = $this->rock->jm->base64decode($this->updatekeys);
  9. }else{
  10. $this->updatekey = URLY;
  11. }
  12. if(isempt($this->updatekey))$this->updatekey=$this->rock->jm->base64decode('aHR0cDovL3d3dy5yb2Nrb2EuY29tLw::');
  13. }
  14. public function getwebsite()
  15. {
  16. return $this->updatekey;
  17. }
  18. public function geturlstr($act, $can=array())
  19. {
  20. $url = $this->updatekey;
  21. $url.= 'api.php?a='.$act.'';
  22. $url.= '&host='.$this->rock->jm->base64encode(HOST).'&version='.VERSION.'&time='.time().'&web='.$this->rock->web.'&ipstr='.$this->rock->ip.'&randkey='.getconfig('randkey').'&xinhukey='.getconfig('xinhukey').'';
  23. $url.= '&authorkey='.getconfig('authorkey').'&cfrom='.getconfig('xinhutype').'';
  24. if($act!='xinhuinstall')$url.= '&aukey='.m('option')->getval('auther_aukey').'';
  25. foreach($can as $k=>$v)$url.='&'.$k.'='.$v.'';
  26. return $url;
  27. }
  28. public function getdata($act, $can=array())
  29. {
  30. $url = $this->geturlstr($act, $can);
  31. $cont = c('curl')->getcurl($url);
  32. $data = array('code'=>199,'msg'=>'出错'.URLY.',返回:'.htmlspecialchars($cont).'');
  33. if($cont!='' && substr($cont,0,1)=='{'){
  34. $data = json_decode($cont, true);
  35. }
  36. return $data;
  37. }
  38. public function helpstr($num, $na='')
  39. {
  40. if($na=='')$na='帮助';
  41. return '<a style="color:blue" href="'.$this->updatekey.'view_'.$num.'.html" target="_blank">['.$na.']</a>';
  42. }
  43. }
粤ICP备19079148号