root пре 1 година
комит
487087ed64
100 измењених фајлова са 5809 додато и 0 уклоњено
  1. 1 0
      .htaccess
  2. 1 0
      .user.ini
  3. 7 0
      404.html
  4. 60 0
      README.md
  5. 39 0
      api.php
  6. 102 0
      config/config.php
  7. 12 0
      config/iplist.php
  8. 88 0
      config/iplogs.php
  9. 3 0
      config/version.php
  10. BIN
      favicon.ico
  11. BIN
      images/adddk.png
  12. BIN
      images/apply.png
  13. BIN
      images/back.png
  14. BIN
      images/bq.png
  15. BIN
      images/bwl.png
  16. BIN
      images/bwl2.png
  17. BIN
      images/calendar.png
  18. BIN
      images/checkbox0.png
  19. BIN
      images/checkbox1.png
  20. BIN
      images/close.gif
  21. BIN
      images/crm.png
  22. BIN
      images/daiban.png
  23. BIN
      images/daily.png
  24. BIN
      images/del.png
  25. BIN
      images/email.png
  26. BIN
      images/error.png
  27. BIN
      images/ewml.png
  28. BIN
      images/fawen.png
  29. BIN
      images/file.png
  30. BIN
      images/files.png
  31. BIN
      images/fkuan.png
  32. BIN
      images/flow.png
  33. BIN
      images/folder.png
  34. BIN
      images/gong.png
  35. BIN
      images/group.png
  36. BIN
      images/gw.png
  37. BIN
      images/gzt.png
  38. BIN
      images/helpbg.png
  39. BIN
      images/hetong.png
  40. BIN
      images/i.gif
  41. BIN
      images/jia.png
  42. BIN
      images/jian1.gif
  43. BIN
      images/jian2.gif
  44. BIN
      images/jiank.png
  45. BIN
      images/jwcl.png
  46. BIN
      images/kaoqin.png
  47. BIN
      images/kaoshi.png
  48. BIN
      images/keji.png
  49. BIN
      images/loading.gif
  50. BIN
      images/loadings.gif
  51. BIN
      images/logo.png
  52. BIN
      images/meet.png
  53. BIN
      images/mloading.gif
  54. BIN
      images/nav_chat0.png
  55. BIN
      images/nav_chat1.png
  56. BIN
      images/nav_my0.png
  57. BIN
      images/nav_my1.png
  58. BIN
      images/nav_user0.png
  59. BIN
      images/nav_user1.png
  60. BIN
      images/nav_ying0.png
  61. BIN
      images/nav_ying1.png
  62. BIN
      images/new.gif
  63. BIN
      images/news.png
  64. BIN
      images/noface.png
  65. BIN
      images/noimg.jpg
  66. BIN
      images/nologo.png
  67. BIN
      images/project.png
  68. BIN
      images/sale.png
  69. BIN
      images/shouwen.png
  70. BIN
      images/skuan.png
  71. BIN
      images/sousuo.png
  72. BIN
      images/taolun.png
  73. BIN
      images/tiku.png
  74. BIN
      images/todo.png
  75. BIN
      images/tongxunlu.png
  76. BIN
      images/waichu.png
  77. BIN
      images/wclose.png
  78. BIN
      images/white.gif
  79. BIN
      images/wjj.png
  80. BIN
      images/work.png
  81. BIN
      images/xh829.png
  82. BIN
      images/xiangyou1.png
  83. BIN
      images/zhishi.png
  84. 209 0
      include/Action.php
  85. 47 0
      include/Chajian.php
  86. 191 0
      include/Model.php
  87. 2320 0
      include/PHPMailer/class.phpmailer.php
  88. 407 0
      include/PHPMailer/class.pop3.php
  89. 814 0
      include/PHPMailer/class.smtp.php
  90. 90 0
      include/View.php
  91. 165 0
      include/chajian/JPushChajian.php
  92. 386 0
      include/chajian/PHPExcelChajian.php
  93. 65 0
      include/chajian/PHPExcelReaderChajian.php
  94. 69 0
      include/chajian/PHPWordChajian.php
  95. 88 0
      include/chajian/aliossChajian.php
  96. 180 0
      include/chajian/alismsChajian.php
  97. 95 0
      include/chajian/arrayChajian.php
  98. 123 0
      include/chajian/cacheChajian.php
  99. 247 0
      include/chajian/calendarChajian.php
  100. 0 0
      include/chajian/checkChajian.php

+ 1 - 0
.htaccess

@@ -0,0 +1 @@
+ 

+ 1 - 0
.user.ini

@@ -0,0 +1 @@
+open_basedir=/www/wwwroot/zq.oa.nxjiewei.com/:/tmp/

+ 7 - 0
404.html

@@ -0,0 +1,7 @@
+<html>
+<head><title>404 Not Found</title></head>
+<body>
+<center><h1>404 Not Found</h1></center>
+<hr><center>nginx</center>
+</body>
+</html>

+ 60 - 0
README.md

@@ -0,0 +1,60 @@
+# 信呼,免费开源的办公OA系统
+
+开发者:雨中磐石(rainrock)  
+邮箱:admin@rockoa.com  
+公司团队:信呼开发团队  
+官网网站:http://www.rockoa.com/  
+源码仅供学习二次开发使用,禁止二次发布,禁止用于商业用途出售等(违者必究)  
+版权:Copyright @2016-2023 信呼开发团队  
+版本整理时间:2023-08-22 23:59:59  
+版本号:V2.6.0   
+
+
+### V2.6.0更新说明
+1、完善系统安全性。  
+2、更多升级日志详见:http://www.rockoa.com/view_core.html  
+
+
+### 安装说明
+1、环境要求:可以运行在Win/Linux系统下,php5.2—7.3,mysql5.3—5.7  
+2、测试环境搭建详见:http://www.rockoa.com/view_install.html  
+3、自己手动安装详见:http://www.rockoa.com/view_anzz.html  
+4、配置文件:webmain/webmainConfig.php,也可到【系统→系统工具→系统设置】下修改  
+5、打开浏览器访问:http://您的地址/  
+6、您使用此系统时,请务必遵守我们的开源思想,请尊重我们的劳动成果,谢谢!
+
+### 开发帮助文档
+地址:http://www.rockoa.com/help.html  
+
+### 信呼相关产品
+1、信呼OA系统(后台/手机网页版/REIM)  
+2、安卓APP  
+3、信呼服务端(即时通信,计划任务使用)  
+4、REIM即时通信PC客户端  
+5、以上下载地址:http://www.rockoa.com/view_down.html  
+
+
+
+### 信呼声明 
+1、没有一款系统是100%安全,信呼也是如此,任何暴露在公网中的系统,都有数据泄露的风险,一旦您决定将信呼OA部署在公网环境中,请仔细评估可能由此带来的风险,并尽可能的加强安全措施。  
+2、或许您觉得此系统不好有缺陷或漏洞等,欢迎提意见和您的想法给我们,或者发邮件给我们:admin@rockoa.com。  
+
+### 声明感谢  
+系统有用到一些开源的项目,特别感谢他们提供奉献,不分先后顺序。    
+1、PHP后端语言:http://www.php.net/   
+2、MySql数据库:https://www.mysql.com/    
+3、Bootstrap后台样式组件:http://v3.bootcss.com/components/  
+4、字体图标:http://www.bootcss.com/p/font-awesome/  
+5、Jquery框架:http://jquery.com/  
+6、PHPMailer邮件发送组件:https://github.com/PHPMailer/PHPMailer  
+7、kindeditor富文本编辑器:http://kindeditor.net/  
+8、pdfjs预览pdf:http://mozilla.github.io/pdf.js/  
+9、weui手机端框架:https://weui.io/0.4.x/#/  
+10、phpqrcode生成二维码:http://phpqrcode.sourceforge.net/    
+11、JPush极光推送:https://www.jiguang.cn/  
+12、小米推送:https://dev.mi.com/console/appservice/push.html  
+13、workerman服务端phpsocket框架:http://www.workerman.net/  
+14、nwjs的PC客户端框架:https://nwjs.io/  
+15、iconfont图标库:http://www.iconfont.cn/   
+16、腾讯地图:http://map.qq.com/  
+16、nodejs:https://nodejs.org/ 

+ 39 - 0
api.php

@@ -0,0 +1,39 @@
+<?php
+/**
+*	api的入口地址请求访问,访问方法:http://我的域名/api.php?m=index&a=方法
+*	主页:http://www.rockoa.com/
+*	软件:信呼
+*	作者:雨中磐石(rainrock)
+*/
+define('ENTRANCE', 'api');
+include_once('config/config.php');
+$_paths = '';
+$d		= 'task';$m	= 'index';$a = 'index';
+if(isset($_GET['m'])){
+	$m  = $rock->get('m');
+	$a  = $rock->get('a', $a);
+}else{
+	if(isset($_SERVER['PHP_SELF']))$_paths=$_SERVER['PHP_SELF'];
+	if($_paths==''&&isset($_SERVER['ORIG_PATH_INFO']))$_paths=$_SERVER['ORIG_PATH_INFO'];
+	$_patha = explode('api.php', $_paths);
+	$_paths = '/index/index';
+	if(isset($_patha[1])){
+		$_paths = $_patha[1];
+	}else{
+		if(isset($_SERVER['PATH_INFO']))$_paths=$_SERVER['PATH_INFO'];
+	}
+}
+unset($_GET['d']);
+unset($_GET['m']);
+unset($_GET['a']);
+if($_paths){
+	$_pa = explode('/', $_paths);
+	if(isset($_pa[1])&&$_pa[1])$m=$_pa[1];
+	if(isset($_pa[2])&&$_pa[2])$a=$_pa[2];
+}
+if(substr($m,0,4)=='open'){
+	$m 	= ''.$m.'|openapi';
+}else{
+	$m 	= ''.$m.'|api';
+}
+include_once('include/View.php');

+ 102 - 0
config/config.php

@@ -0,0 +1,102 @@
+<?php
+/**
+*	来自:信呼开发团队
+*	作者:磐石(rainrock)
+*	网址:http://www.rockoa.com/
+*	系统默认配置文件,请不要去修改
+*	要修改配置文件在:webmain/webmainConfig.php
+*/
+@session_start();
+if(function_exists('date_default_timezone_set'))date_default_timezone_set('Asia/Shanghai'); //设置默认时区
+header('Content-Type:text/html;charset=utf-8');
+define('ROOT_PATH',str_replace('\\','/',dirname(dirname(__FILE__))));	//系统跟目录路径
+
+include_once(''.ROOT_PATH.'/include/rockFun.php');
+include_once(''.ROOT_PATH.'/include/Chajian.php');
+include_once(''.ROOT_PATH.'/include/class/rockClass.php');
+$rock 		= new rockClass();
+
+$db			= null;		
+$smarty		= false;
+define('HOST', $rock->host);
+define('REWRITE', 'true');
+if(!defined('PROJECT'))define('PROJECT', 'webmain');
+if(!defined('ENTRANCE'))define('ENTRANCE', 'index');
+
+$config		= array(
+	'title'		=> '信呼',
+	'url'		=> '',
+	'urly'		=> 'http://www.rockoa.com/',	//官网域名地址,修改后就无法提供在线升级了。
+	'db_host'	=> '127.0.0.1',
+	'db_user'	=> 'root',
+	'db_pass'	=> '',
+	'db_base'	=> '',
+	'perfix'	=> '',
+	'qom'		=> '',
+	'highpass'	=> '',
+	'install'	=> false,
+	'version'	=> require('version.php'),
+	'path'		=> 'index',
+	'updir'		=> 'upload',
+	'dbencrypt'	=> false,
+	'sqllog'	=> false,
+	'checksign'	=> false,			//列表请求是否验证
+	'memory_limit'	=> '',			//运行内存大小
+	'timeout'		=> -1,			//抄送时间(秒),-1默认的
+	'db_drive'		=> 'mysqli',	//数据库操作驱动
+	'db_engine'		=> 'MyISAM',	//数据库默认引擎
+	'debug'			=> true,	//默认debug模式
+	'reim_show' 	=> true,	//首页是否显示REIM
+	'mobile_show' 	=> true,	//首页是否显示手机版
+	'accesslogs' 	=> false,	//是否记录访问日志和限制IP
+	'upurl'			=> '', 		//上传文件附件地址(还不能使用)
+	'authorkey'		=> '', 		//系统授权的key,请联系官网获取
+	'companymode'	=> false 	//是否开启多单位模式切换
+);
+
+//引入配置文件
+$_confpath		= $rock->strformat('?0/?1/?1Config.php', ROOT_PATH, PROJECT);
+if(file_exists($_confpath)){
+	$_tempconf	= require($_confpath);
+	foreach($_tempconf as $_tkey=>$_tvs)$config[$_tkey] = $_tvs;
+	if(isempt($config['url']))$config['url'] = $rock->url();
+	if(!isempt($config['memory_limit']) && function_exists('ini_set'))
+		ini_set('memory_limit', $config['memory_limit']);
+	if($config['timeout']>-1 && function_exists('set_time_limit'))set_time_limit($config['timeout']);	
+}
+
+$_confpath	= ''.ROOT_PATH.'/config/author.php';
+if(file_exists($_confpath)){
+	$config['authorkey'] = require($_confpath);
+}
+
+$_confpath	= ''.ROOT_PATH.'/config/xinhuplat.php';
+if(file_exists($_confpath))include_once($_confpath);
+if(!defined('COMPANYNUM'))define('COMPANYNUM', '');
+
+define('DEBUG', $config['debug']);
+error_reporting(DEBUG ? E_ALL : 0);
+
+define('TITLE', $config['title']);
+define('URL', $config['url']);
+define('URLY', $config['urly']);
+define('PATH', $config['path']);
+
+define('DB_DRIVE', $config['db_drive']);
+define('DB_HOST', $config['db_host']);
+define('DB_USER', $config['db_user']);
+define('DB_PASS', $config['db_pass']);
+define('DB_BASE', $config['db_base']);
+
+define('UPDIR', $config['updir']);
+define('PREFIX', $config['perfix']);
+define('QOM', $config['qom']);
+define('VERSION', $config['version']);
+define('HIGHPASS', $config['highpass']);
+define('SYSURL', ''.URL.PATH.'.php');
+define('UPURL', $config['upurl']);
+define('ISMORECOM', $config['companymode']);
+
+$_confpath	= ''.ROOT_PATH.'/config/iplogs.php'; //这个用来限制IP访问的
+if(file_exists($_confpath) && PHP_SAPI != 'cli')include_once($_confpath);
+$rock->initRock();

+ 12 - 0
config/iplist.php

@@ -0,0 +1,12 @@
+<?php
+/**
+*	这个页面是设置黑白名单访问的
+*/
+return array(
+
+	//黑名单IP,多个,分开如:127.0.0.1,192.168.1.100,也可以写192.168.1这样就是现在192.168.1.*所有的
+	'blackip' 	=> '',
+	
+	 //白名单
+	'whiteip'	=> ''
+);

+ 88 - 0
config/iplogs.php

@@ -0,0 +1,88 @@
+<?php
+/**
+*	添加方法日志,和IP限制判断
+*/
+function ipwhiteshow($ip, $rock){
+	$iplist = ''.ROOT_PATH.'/config/iplist.php';
+	$bool 	= 0;
+	if(file_exists($iplist)){
+		$iparr 	= require($iplist);
+	}else{
+		$iparr 	= array(
+			'blackip' 	=> '',
+			'whiteip'	=> '' 
+		);
+	}
+
+	//白名单判断
+	$whiteip = $iparr['whiteip'];
+	if($whiteip!=''){
+		$whiteipa = explode(',', $whiteip);
+		foreach($whiteipa as $ips){
+			$bo = strpos($ip, $ips);
+			if($bo===0 || $ips=='*'){
+				$bool = 1; //可以访问
+				break;
+			}
+		}
+	}
+	
+	//黑名单判断
+	if($bool==0){
+		$blackip = $iparr['blackip'];
+		if($blackip!=''){
+			$blackipa = explode(',', $blackip);
+			foreach($blackipa as $ips){
+				$bo = strpos($ip, $ips);
+				if($bo===0 || $ips=='*'){
+					$bool = 2;//不能访问
+					break;
+				}
+			}
+		}
+	}
+
+	//创建访问日志
+	if(getconfig('accesslogs')){
+		$str = '';
+		foreach($_SERVER as $k=>$v)$str.='['.$k.']:'.$v.chr(10).'';
+		
+		$str1 = '';
+		foreach($_GET as $k=>$v)$str1.='['.$k.']:'.$v.chr(10).'';
+		
+		$str2 = '';
+		foreach($_POST as $k=>$v)$str2.='['.$k.']:'.$v.chr(10).'';
+		$act  = arrvalue($_SERVER,'REQUEST_METHOD');
+		if($act=='POST' && $str2==''){
+			$str2 = arrvalue($GLOBALS, 'HTTP_RAW_POST_DATA');
+		}
+
+		$logs = ''.UPDIR.'/logs/'.date('Y-m-d').'/'.date('H').'/'.date('H.i.s').'_'.$act.'_'.$ip.'_'.rand(100,999).'.log';
+$logstr = '[datetime]:'.$rock->now.'
+[URL]:'.$rock->nowurl().'	
+[ACTION]:'.$act.'
+[IP]:'.$ip.'
+[GET]
+'.$str1.'
+[POST]
+'.$str2.'
+[SERVER]
+'.$str.'	
+';
+		$rock->createtxt($logs, $logstr);
+	}
+	
+	
+	if($bool==2){
+		$logs = ''.UPDIR.'/logs_access/'.date('YmdHis').'_'.rand(100,999).'.log';
+		$logstr = '[datetime]:'.$rock->now.''.chr(10).'[URL]:'.$rock->nowurl().''.chr(10).'[IP]:'.$ip.'';		
+		$rock->createtxt($logs, $logstr);
+		exit('您IP['.$ip.']禁止访问我们站点,有问题请联系我们');
+	}
+}
+
+function ipwhiteshows($ips, $rock){
+	$ipa = explode(',', $ips); 
+	foreach($ipa as $ip)ipwhiteshow($ip, $rock);
+}
+ipwhiteshows($rock->ip, $rock);

+ 3 - 0
config/version.php

@@ -0,0 +1,3 @@
+<?php
+//版本2.6.1
+return '2.6.1';








BIN
images/calendar.png


BIN
images/checkbox0.png


BIN
images/checkbox1.png




BIN
images/daiban.png












BIN
images/folder.png






BIN
images/helpbg.png


BIN
images/hetong.png








BIN
images/kaoqin.png


BIN
images/kaoshi.png



BIN
images/loading.gif


BIN
images/loadings.gif




BIN
images/mloading.gif


BIN
images/nav_chat0.png


BIN
images/nav_chat1.png


BIN
images/nav_my0.png


BIN
images/nav_my1.png


BIN
images/nav_user0.png


BIN
images/nav_user1.png


BIN
images/nav_ying0.png


BIN
images/nav_ying1.png




BIN
images/noface.png



BIN
images/nologo.png


BIN
images/project.png



BIN
images/shouwen.png



BIN
images/sousuo.png


BIN
images/taolun.png




BIN
images/tongxunlu.png


BIN
images/waichu.png


BIN
images/wclose.png






BIN
images/xiangyou1.png


BIN
images/zhishi.png


+ 209 - 0
include/Action.php

@@ -0,0 +1,209 @@
+<?php 
+/**
+	*****************************************************************
+	* 联系QQ: 290802026/1073744729									*
+	* 版  本: V2.0													*
+	* 开发者:雨中磐石工作室										*
+	* 邮  箱: admin@rockoa.com										*
+	* 网  址: http://www.rockoa.com/								*
+	* 说  明: 主控制器处理											*
+	* 备  注: 未经允许不得商业出售,代码欢迎参考纠正				*
+	*****************************************************************
+*/
+
+abstract class mainAction{
+	
+	public $rock;
+	public $db;
+	public $smarty;
+	public $smartydata	= array();	//模版数据
+	public $assigndata	= array();
+	public $display		= true;		//是否显示模板	
+	public $bodytitle	= '';		//副标题
+	public $keywords	= '';		//关键词
+	public $description	= '';		//说明
+	public $linkdb		= true;		//是否连接数据库
+	public $params		= array();	//参数
+	public $now;
+	public $date;
+	public $ip;
+	public $web;
+	public $title		= TITLE;
+	public $titles		= '';
+	public $option;
+	public $jm;
+	
+	public $table;
+	public $extentid	= 0;
+	public $importjs	= '';
+	public $perfix		= '';
+	public $tplname		= '';		//模板文件
+	public $tplpath		= '';		//模板文件路径
+	public $tpltype		= 'tpl';
+	public $tpldom		= 'html';
+	public $displayfile	= '';
+	
+	public $bodyMessage	= '';		//返回的内容
+	
+	public function __construct()
+	{
+		$this->rock		= $GLOBALS['rock'];
+		$this->smarty	= $GLOBALS['smarty'];
+		$this->jm		= c('jm', true);
+		$_obj = c('lang');if($_obj!=NULL && method_exists($_obj,'initLang'))$_obj->initLang();
+		$this->now		= $this->rock->now();
+		$this->date		= $this->rock->date;
+		$this->ip		= $this->rock->ip;
+		$this->web		= $this->rock->web;
+		$this->perfix	= PREFIX;
+		$this->display	= true;
+		$this->initMysql();	
+		$this->initConstruct();
+		$this->initProject();
+		$this->initAction();
+	}
+	
+	public function defaultAction(){}
+	public function initAction(){}
+	public function initProject(){}
+	public function afterAction(){}
+	public function initMysql(){}
+	public function beforeAction(){}
+	
+	public function T($n)
+	{
+		return $this->perfix.''.$n;
+	}
+	
+	public function assign($k, $v)
+	{
+		$this->assigndata[$k]=$v;
+	}
+
+	private function initConstruct()
+	{
+		$linkdb			= $this->rock->get('linkdb','true');
+		$this->params	= explode('-', $this->rock->get('s'));	//参数
+		if($linkdb == 'true' && $this->linkdb){
+			$this->initMysqllink();
+		}
+	}
+
+	private function initMysqllink()
+	{
+		$this->db		= import(DB_DRIVE);
+		$GLOBALS['db']	= $this->db;
+		include_once(''.ROOT_PATH.'/include/Model.php');
+		$this->option	= m('option');
+	}
+	
+	private function setBasedata()
+	{
+		$this->smartydata['bodytitle']	= $this->bodytitle;
+		$this->smartydata['keywords']	= $this->keywords;
+		$this->smartydata['description']= $this->description;
+		$this->smartydata['title']		= $this->title;
+		$this->smartydata['titles']		= $this->titles;
+		$this->smartydata['rewrite']	= REWRITE;
+		$this->smartydata['now']		= $this->now;
+		$this->smartydata['web']		= $this->rock->web;
+		$this->smartydata['ip']			= $this->ip;
+		$this->smartydata['url']		= URL;
+		$this->smartydata['urly']		= URLY;
+		$web 	= $this->rock->web;
+		$this->assign('web', $web);
+		$showheader	= 1;
+		$hide 	= $this->get('hideheader', $this->getsession('hideheader'));
+		if($hide=='true')$this->rock->savesession(array('hideheader' => $hide));
+		if($this->rock->iswebbro(0)
+			|| $this->rock->iswebbro(1)
+			|| $this->rock->iswebbro(4)
+			|| $this->rock->iswebbro(7)
+			|| $hide=='true'
+			|| $this->get('headerhide')=='true'
+			|| $this->rock->iswebbro(2))$showheader = 0; //隐藏头部
+		if($this->get('showheader')=='true')$showheader = 1;
+		$this->assign('showheader', $showheader);
+	}
+
+	public function setSmartyData()
+	{
+		$this->setBasedata();
+	}
+	
+	public function setHtmlData()
+	{
+		$this->setBasedata();
+		
+	}
+
+	public function getsession($name,$dev='')
+	{
+		return $this->rock->session($name, $dev);
+	}
+	
+	public function post($na, $dev='', $lx=0)
+	{
+		return $this->rock->post($na, $dev, $lx);
+	}
+	
+	public function get($na, $dev='', $lx=0)
+	{
+		return $this->rock->get($na, $dev, $lx);
+	}
+	
+	public function request($na, $dev='', $lx=0)
+	{
+		return $this->rock->request($na, $dev, $lx);
+	}
+	
+	public function isempt($str)
+	{
+		return $this->rock->isempt($str);
+	}
+	
+	public function contain($str, $a)
+	{
+		return $this->rock->contain($str, $a);
+	}
+	
+	public function getcookie($name, $dev='')
+	{
+		return $this->rock->cookie($name, $dev);
+	}
+	
+	public function stringformat($str, $arr=array())
+	{
+		return $this->rock->stringformat($str, $arr);
+	}
+	
+	public function getcan($i,$dev='')
+	{
+		$val	= '';
+		if(isset($this->params[$i]))$val=$this->params[$i];
+		if($this->rock->isempt($val)){
+			$val=$dev;
+		}else{
+			$val=str_replace('[a]','-',$val);
+		}
+		return $val;
+	}
+	
+	public function getmnumAjax()
+	{
+		$mnum	= $this->rock->request('mnum');
+		$rows	= $this->option->getmnum($mnum);
+		echo json_encode($rows);
+	}
+	
+	public function returnjson($arr)
+	{
+		echo json_encode($arr);
+		exit();
+	}
+		
+	public function showreturn($arr='', $msg='', $code=200)
+	{
+		showreturn($arr, $msg, $code);
+	}
+}

+ 47 - 0
include/Chajian.php

@@ -0,0 +1,47 @@
+<?php 
+/**
+	*****************************************************************
+	* 联系QQ: 290802026/1073744729									*
+	* 版  本: V2.0													*
+	* 开发者:雨中磐石工作室										*
+	* 邮  箱: qqqq2900@126.com										*
+	* 网  址: http://www.rockoa.com/								*
+	* 说  明: 插件主类												*
+	* 备  注: 未经允许不得商业出售,代码欢迎参考纠正			*
+	* 创建时间: 2014-08-30											*
+	*****************************************************************
+*/
+abstract class Chajian{
+	
+	public	$rock;
+	public 	$db;
+	public 	$adminname;
+	public 	$adminid;
+	
+	public function __construct()
+	{
+		$this->rock			= $GLOBALS['rock'];
+		$this->db			= $GLOBALS['db'];
+		$this->adminid		= $this->rock->adminid;
+		$this->adminname	= $this->rock->adminname;
+		$this->initChajian();
+	}
+	
+	public function __destruct()
+	{
+		$this->destChajian();
+	}
+	
+	public function isempt($str)
+	{
+		return $this->rock->isempt($str);
+	}
+	
+	public function contain($str, $s1)
+	{
+		return $this->rock->contain($str, $s1);
+	}
+		
+	protected function initChajian(){}
+	protected function destChajian(){}
+}

+ 191 - 0
include/Model.php

@@ -0,0 +1,191 @@
+<?php 
+/**
+	*****************************************************************
+	* 联系QQ: 290802026											*
+	* 版  本: V2.0													*
+	* 开发者:雨中磐石工作室										*
+	* 邮  箱: admin@rockoa.com										*
+	* 网  址: http://www.rockoa.com/								*
+	* 说  明: 数据模型												*
+	* 备  注: 未经允许不得商业出售,代码欢迎参考纠正				*
+	*****************************************************************
+*/
+
+abstract class Model{
+	
+	public 	$perfix		= PREFIX;
+	public	$rock;
+	public 	$db;
+	public  $table;
+	public 	$adminname;
+	public 	$adminid;
+	public 	$tempxinxi	= array();
+	
+	public function __construct($table='')
+	{
+		$this->rock			= $GLOBALS['rock'];
+		$this->db			= $GLOBALS['db'];
+		$this->adminid		= $this->rock->adminid;
+		$this->adminname	= $this->rock->adminname;
+		$this->settable($table);
+		$this->initModel();
+	}
+	
+	public function settable($table, $qzbo=true)
+	{
+		$this->table	= ''.$this->perfix.''.$table.'';
+		if(!$qzbo)$this->table = $table;
+	}
+	
+	public function initModel(){}
+	
+
+	public function getmou($fields, $where, $order='')
+	{
+		return $this->db->getmou($this->table, $fields, $where, $order);
+	}
+
+	public function getone($where, $fields='*', $order='')
+	{
+		return $this->db->getone($this->table, $where, $fields, $order);
+	}
+	
+	public function getrows($where, $fields='*', $order='', $limit='')
+	{
+		return $this->db->getrows($this->table, $where, $fields, $order, $limit);
+	}
+	
+	public function getall($where, $fields='*', $order='', $limit='')
+	{
+		$sql	= $this->db->getsql(array(
+			'fields'	=> $fields,
+			'table'		=> $this->table,
+			'where'		=> $where,
+			'order'		=> $order,
+			'limit'		=> $limit
+		));
+		return $this->db->getall($sql);
+	}
+	
+	public function getarr($where, $fields='*', $kfied='id')
+	{
+		return $this->db->getarr($this->table, $where, $fields, $kfied);
+	}
+	public function rows($where)
+	{
+		return $this->db->rows($this->table, $where);
+	}
+
+	public function query($where, $fields='*', $order='', $limit='')
+	{
+		$sql	= $this->db->getsql(array(
+			'fields'	=> $fields,
+			'table'		=> $this->table,
+			'where'		=> $where,
+			'order'		=> $order,
+			'limit'		=> $limit
+		));
+		return $this->db->query($sql);
+	}
+	
+	public function record($arr, $where='')
+	{
+		return $this->db->record($this->table, $arr, $where);
+	}
+	
+	public function update($arr,$where)
+	{
+		return $this->record($arr, $where);
+	}
+	
+	public function insert($arr)
+	{
+		$nid = 0;
+		if($this->record($arr, ''))$nid = $this->db->insert_id();
+		return $nid;
+	}
+	
+	public function insertAll($arr)
+	{
+		$name 	= $values = '';
+		foreach($arr as $k=>$rs){
+			$cont = '';
+			foreach($rs as $i=>$v){
+				if($k==0)$name.=',`'.$i.'`';
+				$cont.=",".$this->db->toaddval($v)."";
+			}
+			$cont = substr($cont, 1);
+			if($k>0)$values.=',';
+			$values.='('.$cont.')';
+		}
+		return $this->db->insert($this->table, substr($name, 1),'values '.$values.'', true);
+	}
+	
+	public function getwhere($where='')
+	{
+		return $this->db->getwhere($where);
+	}
+	
+	public function getfields()
+	{
+		return $this->db->getallfields($this->table);
+	}
+	
+	public function delete($where)
+	{
+		return  $this->db->delete($this->table, $where);
+	}
+	
+	public function getlimit($where, $page=1, $fields='*', $order='', $limit=20, $table='')
+	{
+		if($order != '')$order = 'order by '.$order.'';
+		$where  	= $this->getwhere($where);
+		if($table == '')$table = $this->table;
+		$sql 		= "select $fields from $table where $where $order ";
+		$count 		= $this->db->rows($table, $where);
+		if($page <= 0)$page=1;
+		$sql	.= "limit ".($page-1)*$limit.",$limit";
+		$rows	 = $this->db->getall($sql);
+		$maxpage = ceil($count/$limit);
+		return array(
+			'rows'		=> $rows,
+			'count'		=> $count,
+			'maxpage'  	=> $maxpage,
+			'page'		=> $page,
+			'limit'		=> $limit,
+			'prevpage'	=> $page-1,
+			'nextpage'	=> $page+1,
+			'url'		=> ''
+		);
+	}
+	
+	public function isempt($str)
+	{
+		return $this->rock->isempt($str);
+	}
+	
+	public function contain($str, $s1)
+	{
+		return $this->rock->contain($str, $s1);
+	}
+	
+	public function getLastSql()
+	{
+		return $this->db->getLastSql();
+	}
+	
+	public function count($where='1=1')
+	{
+		return $this->rows($where);
+	}
+	
+	public function getXinxi($id,$fields='*')
+	{
+		if(isset($this->tempxinxi[$id]))return $this->tempxinxi[$id];
+		$rs = $this->getone($id,$fields);
+		$this->tempxinxi[$id] = $rs;
+		return $rs;
+	}
+}
+
+class sModel extends Model{}

Разлика између датотеке није приказан због своје велике величине
+ 2320 - 0
include/PHPMailer/class.phpmailer.php


+ 407 - 0
include/PHPMailer/class.pop3.php

@@ -0,0 +1,407 @@
+<?php
+/*~ class.pop3.php
+.---------------------------------------------------------------------------.
+|  Software: PHPMailer - PHP email class                                    |
+|   Version: 5.1                                                            |
+|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
+|      Info: http://phpmailer.sourceforge.net                               |
+|   Support: http://sourceforge.net/projects/phpmailer/                     |
+| ------------------------------------------------------------------------- |
+|     Admin: Andy Prevost (project admininistrator)                         |
+|   Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
+|          : Marcus Bointon (coolbru) coolbru@users.sourceforge.net         |
+|   Founder: Brent R. Matzelle (original founder)                           |
+| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved.               |
+| Copyright (c) 2001-2003, Brent R. Matzelle                                |
+| ------------------------------------------------------------------------- |
+|   License: Distributed under the Lesser General Public License (LGPL)     |
+|            http://www.gnu.org/copyleft/lesser.html                        |
+| This program is distributed in the hope that it will be useful - WITHOUT  |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
+| FITNESS FOR A PARTICULAR PURPOSE.                                         |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com):                |
+| - Web Hosting on highly optimized fast and secure servers                 |
+| - Technology Consulting                                                   |
+| - Oursourcing (highly qualified programmers and graphic designers)        |
+'---------------------------------------------------------------------------'
+*/
+
+/**
+ * PHPMailer - PHP POP Before SMTP Authentication Class
+ * NOTE: Designed for use with PHP version 5 and up
+ * @package PHPMailer
+ * @author Andy Prevost
+ * @author Marcus Bointon
+ * @copyright 2004 - 2009 Andy Prevost
+ * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
+ * @version $Id: class.pop3.php 444 2009-05-05 11:22:26Z coolbru $
+ */
+
+/**
+ * POP Before SMTP Authentication Class
+ * Version 5.0.0
+ *
+ * Author: Richard Davey (rich@corephp.co.uk)
+ * Modifications: Andy Prevost
+ * License: LGPL, see PHPMailer License
+ *
+ * Specifically for PHPMailer to allow POP before SMTP authentication.
+ * Does not yet work with APOP - if you have an APOP account, contact Richard Davey
+ * and we can test changes to this script.
+ *
+ * This class is based on the structure of the SMTP class originally authored by Chris Ryan
+ *
+ * This class is rfc 1939 compliant and implements all the commands
+ * required for POP3 connection, authentication and disconnection.
+ *
+ * @package PHPMailer
+ * @author Richard Davey
+ */
+
+class POP3 {
+  /**
+   * Default POP3 port
+   * @var int
+   */
+  public $POP3_PORT = 110;
+
+  /**
+   * Default Timeout
+   * @var int
+   */
+  public $POP3_TIMEOUT = 30;
+
+  /**
+   * POP3 Carriage Return + Line Feed
+   * @var string
+   */
+  public $CRLF = "\r\n";
+
+  /**
+   * Displaying Debug warnings? (0 = now, 1+ = yes)
+   * @var int
+   */
+  public $do_debug = 2;
+
+  /**
+   * POP3 Mail Server
+   * @var string
+   */
+  public $host;
+
+  /**
+   * POP3 Port
+   * @var int
+   */
+  public $port;
+
+  /**
+   * POP3 Timeout Value
+   * @var int
+   */
+  public $tval;
+
+  /**
+   * POP3 Username
+   * @var string
+   */
+  public $username;
+
+  /**
+   * POP3 Password
+   * @var string
+   */
+  public $password;
+
+  /////////////////////////////////////////////////
+  // PROPERTIES, PRIVATE AND PROTECTED
+  /////////////////////////////////////////////////
+
+  private $pop_conn;
+  private $connected;
+  private $error;     //  Error log array
+
+  /**
+   * Constructor, sets the initial values
+   * @access public
+   * @return POP3
+   */
+  public function __construct() {
+    $this->pop_conn  = 0;
+    $this->connected = false;
+    $this->error     = null;
+  }
+
+  /**
+   * Combination of public events - connect, login, disconnect
+   * @access public
+   * @param string $host
+   * @param integer $port
+   * @param integer $tval
+   * @param string $username
+   * @param string $password
+   */
+  public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
+    $this->host = $host;
+
+    //  If no port value is passed, retrieve it
+    if ($port == false) {
+      $this->port = $this->POP3_PORT;
+    } else {
+      $this->port = $port;
+    }
+
+    //  If no port value is passed, retrieve it
+    if ($tval == false) {
+      $this->tval = $this->POP3_TIMEOUT;
+    } else {
+      $this->tval = $tval;
+    }
+
+    $this->do_debug = $debug_level;
+    $this->username = $username;
+    $this->password = $password;
+
+    //  Refresh the error log
+    $this->error = null;
+
+    //  Connect
+    $result = $this->Connect($this->host, $this->port, $this->tval);
+
+    if ($result) {
+      $login_result = $this->Login($this->username, $this->password);
+
+      if ($login_result) {
+        $this->Disconnect();
+
+        return true;
+      }
+
+    }
+
+    //  We need to disconnect regardless if the login succeeded
+    $this->Disconnect();
+
+    return false;
+  }
+
+  /**
+   * Connect to the POP3 server
+   * @access public
+   * @param string $host
+   * @param integer $port
+   * @param integer $tval
+   * @return boolean
+   */
+  public function Connect ($host, $port = false, $tval = 30) {
+    //  Are we already connected?
+    if ($this->connected) {
+      return true;
+    }
+
+    /*
+    On Windows this will raise a PHP Warning error if the hostname doesn't exist.
+    Rather than supress it with @fsockopen, let's capture it cleanly instead
+    */
+
+    set_error_handler(array(&$this, 'catchWarning'));
+
+    //  Connect to the POP3 server
+    $this->pop_conn = fsockopen($host,    //  POP3 Host
+                  $port,    //  Port #
+                  $errno,   //  Error Number
+                  $errstr,  //  Error Message
+                  $tval);   //  Timeout (seconds)
+
+    //  Restore the error handler
+    restore_error_handler();
+
+    //  Does the Error Log now contain anything?
+    if ($this->error && $this->do_debug >= 1) {
+      $this->displayErrors();
+    }
+
+    //  Did we connect?
+    if ($this->pop_conn == false) {
+      //  It would appear not...
+      $this->error = array(
+        'error' => "Failed to connect to server $host on port $port",
+        'errno' => $errno,
+        'errstr' => $errstr
+      );
+
+      if ($this->do_debug >= 1) {
+        $this->displayErrors();
+      }
+
+      return false;
+    }
+
+    //  Increase the stream time-out
+
+    //  Check for PHP 4.3.0 or later
+    if (version_compare(phpversion(), '5.0.0', 'ge')) {
+      stream_set_timeout($this->pop_conn, $tval, 0);
+    } else {
+      //  Does not work on Windows
+      if (substr(PHP_OS, 0, 3) !== 'WIN') {
+        socket_set_timeout($this->pop_conn, $tval, 0);
+      }
+    }
+
+    //  Get the POP3 server response
+    $pop3_response = $this->getResponse();
+
+    //  Check for the +OK
+    if ($this->checkResponse($pop3_response)) {
+    //  The connection is established and the POP3 server is talking
+    $this->connected = true;
+      return true;
+    }
+
+  }
+
+  /**
+   * Login to the POP3 server (does not support APOP yet)
+   * @access public
+   * @param string $username
+   * @param string $password
+   * @return boolean
+   */
+  public function Login ($username = '', $password = '') {
+    if ($this->connected == false) {
+      $this->error = 'Not connected to POP3 server';
+
+      if ($this->do_debug >= 1) {
+        $this->displayErrors();
+      }
+    }
+
+    if (empty($username)) {
+      $username = $this->username;
+    }
+
+    if (empty($password)) {
+      $password = $this->password;
+    }
+
+    $pop_username = "USER $username" . $this->CRLF;
+    $pop_password = "PASS $password" . $this->CRLF;
+
+    //  Send the Username
+    $this->sendString($pop_username);
+    $pop3_response = $this->getResponse();
+
+    if ($this->checkResponse($pop3_response)) {
+      //  Send the Password
+      $this->sendString($pop_password);
+      $pop3_response = $this->getResponse();
+
+      if ($this->checkResponse($pop3_response)) {
+        return true;
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  }
+
+  /**
+   * Disconnect from the POP3 server
+   * @access public
+   */
+  public function Disconnect () {
+    $this->sendString('QUIT');
+
+    fclose($this->pop_conn);
+  }
+
+  /////////////////////////////////////////////////
+  //  Private Methods
+  /////////////////////////////////////////////////
+
+  /**
+   * Get the socket response back.
+   * $size is the maximum number of bytes to retrieve
+   * @access private
+   * @param integer $size
+   * @return string
+   */
+  private function getResponse ($size = 128) {
+    $pop3_response = fgets($this->pop_conn, $size);
+
+    return $pop3_response;
+  }
+
+  /**
+   * Send a string down the open socket connection to the POP3 server
+   * @access private
+   * @param string $string
+   * @return integer
+   */
+  private function sendString ($string) {
+    $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
+
+    return $bytes_sent;
+  }
+
+  /**
+   * Checks the POP3 server response for +OK or -ERR
+   * @access private
+   * @param string $string
+   * @return boolean
+   */
+  private function checkResponse ($string) {
+    if (substr($string, 0, 3) !== '+OK') {
+      $this->error = array(
+        'error' => "Server reported an error: $string",
+        'errno' => 0,
+        'errstr' => ''
+      );
+
+      if ($this->do_debug >= 1) {
+        $this->displayErrors();
+      }
+
+      return false;
+    } else {
+      return true;
+    }
+
+  }
+
+  /**
+   * If debug is enabled, display the error message array
+   * @access private
+   */
+  private function displayErrors () {
+    echo '<pre>';
+
+    foreach ($this->error as $single_error) {
+      print_r($single_error);
+    }
+
+    echo '</pre>';
+  }
+
+  /**
+   * Takes over from PHP for the socket warning handler
+   * @access private
+   * @param integer $errno
+   * @param string $errstr
+   * @param string $errfile
+   * @param integer $errline
+   */
+  private function catchWarning ($errno, $errstr, $errfile, $errline) {
+    $this->error[] = array(
+      'error' => "Connecting to the POP3 server raised a PHP warning: ",
+      'errno' => $errno,
+      'errstr' => $errstr
+    );
+  }
+
+  //  End of class
+}
+?>

+ 814 - 0
include/PHPMailer/class.smtp.php

@@ -0,0 +1,814 @@
+<?php
+/*~ class.smtp.php
+.---------------------------------------------------------------------------.
+|  Software: PHPMailer - PHP email class                                    |
+|   Version: 5.1                                                            |
+|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
+|      Info: http://phpmailer.sourceforge.net                               |
+|   Support: http://sourceforge.net/projects/phpmailer/                     |
+| ------------------------------------------------------------------------- |
+|     Admin: Andy Prevost (project admininistrator)                         |
+|   Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
+|          : Marcus Bointon (coolbru) coolbru@users.sourceforge.net         |
+|   Founder: Brent R. Matzelle (original founder)                           |
+| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved.               |
+| Copyright (c) 2001-2003, Brent R. Matzelle                                |
+| ------------------------------------------------------------------------- |
+|   License: Distributed under the Lesser General Public License (LGPL)     |
+|            http://www.gnu.org/copyleft/lesser.html                        |
+| This program is distributed in the hope that it will be useful - WITHOUT  |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
+| FITNESS FOR A PARTICULAR PURPOSE.                                         |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com):                |
+| - Web Hosting on highly optimized fast and secure servers                 |
+| - Technology Consulting                                                   |
+| - Oursourcing (highly qualified programmers and graphic designers)        |
+'---------------------------------------------------------------------------'
+*/
+
+/**
+ * PHPMailer - PHP SMTP email transport class
+ * NOTE: Designed for use with PHP version 5 and up
+ * @package PHPMailer
+ * @author Andy Prevost
+ * @author Marcus Bointon
+ * @copyright 2004 - 2008 Andy Prevost
+ * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
+ * @version $Id: class.smtp.php 444 2009-05-05 11:22:26Z coolbru $
+ */
+
+/**
+ * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
+ * commands except TURN which will always return a not implemented
+ * error. SMTP also provides some utility methods for sending mail
+ * to an SMTP server.
+ * original author: Chris Ryan
+ */
+
+class SMTP {
+  /**
+   *  SMTP server port
+   *  @var int
+   */
+  public $SMTP_PORT = 25;
+
+  /**
+   *  SMTP reply line ending
+   *  @var string
+   */
+  public $CRLF = "\r\n";
+
+  /**
+   *  Sets whether debugging is turned on
+   *  @var bool
+   */
+  public $do_debug;       // the level of debug to perform
+
+  /**
+   *  Sets VERP use on/off (default is off)
+   *  @var bool
+   */
+  public $do_verp = false;
+
+  /////////////////////////////////////////////////
+  // PROPERTIES, PRIVATE AND PROTECTED
+  /////////////////////////////////////////////////
+
+  private $smtp_conn; // the socket to the server
+  private $error;     // error if any on the last call
+  private $helo_rply; // the reply the server sent to us for HELO
+
+  /**
+   * Initialize the class so that the data is in a known state.
+   * @access public
+   * @return void
+   */
+  public function __construct() {
+    $this->smtp_conn = 0;
+    $this->error = null;
+    $this->helo_rply = null;
+
+    $this->do_debug = 0;
+  }
+
+  /////////////////////////////////////////////////
+  // CONNECTION FUNCTIONS
+  /////////////////////////////////////////////////
+
+  /**
+   * Connect to the server specified on the port specified.
+   * If the port is not specified use the default SMTP_PORT.
+   * If tval is specified then a connection will try and be
+   * established with the server for that number of seconds.
+   * If tval is not specified the default is 30 seconds to
+   * try on the connection.
+   *
+   * SMTP CODE SUCCESS: 220
+   * SMTP CODE FAILURE: 421
+   * @access public
+   * @return bool
+   */
+  public function Connect($host, $port = 0, $tval = 30) {
+    // set the error val to null so there is no confusion
+    $this->error = null;
+
+    // make sure we are __not__ connected
+    if($this->connected()) {
+      // already connected, generate error
+      $this->error = array("error" => "Already connected to a server");
+      return false;
+    }
+
+    if(empty($port)) {
+      $port = $this->SMTP_PORT;
+    }
+
+    // connect to the smtp server
+    $this->smtp_conn = @fsockopen($host,    // the host of the server
+                                 $port,    // the port to use
+                                 $errno,   // error number if any
+                                 $errstr,  // error message if any
+                                 $tval);   // give up after ? secs
+    // verify we connected properly
+    if(empty($this->smtp_conn)) {
+      $this->error = array("error" => "Failed to connect to server",
+                           "errno" => $errno,
+                           "errstr" => $errstr);
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+
+    // SMTP server can take longer to respond, give longer timeout for first read
+    // Windows does not have support for this timeout function
+    if(substr(PHP_OS, 0, 3) != "WIN")
+     socket_set_timeout($this->smtp_conn, $tval, 0);
+
+    // get any announcement
+    $announce = $this->get_lines();
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />';
+    }
+
+    return true;
+  }
+
+  /**
+   * Initiate a TLS communication with the server.
+   *
+   * SMTP CODE 220 Ready to start TLS
+   * SMTP CODE 501 Syntax error (no parameters allowed)
+   * SMTP CODE 454 TLS not available due to temporary reason
+   * @access public
+   * @return bool success
+   */
+  public function StartTLS() {
+    $this->error = null; # to avoid confusion
+
+    if(!$this->connected()) {
+      $this->error = array("error" => "Called StartTLS() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"STARTTLS" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
+    }
+
+    if($code != 220) {
+      $this->error =
+         array("error"     => "STARTTLS not accepted from server",
+               "smtp_code" => $code,
+               "smtp_msg"  => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+
+    // Begin encrypted connection
+    if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Performs SMTP authentication.  Must be run after running the
+   * Hello() method.  Returns true if successfully authenticated.
+   * @access public
+   * @return bool
+   */
+  public function Authenticate($username, $password) {
+    // Start authentication
+    fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 334) {
+      $this->error =
+        array("error" => "AUTH not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+
+    // Send encoded username
+    fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 334) {
+      $this->error =
+        array("error" => "Username not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+
+    // Send encoded password
+    fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 235) {
+      $this->error =
+        array("error" => "Password not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Returns true if connected to a server otherwise false
+   * @access public
+   * @return bool
+   */
+  public function Connected() {
+    if(!empty($this->smtp_conn)) {
+      $sock_status = socket_get_status($this->smtp_conn);
+      if($sock_status["eof"]) {
+        // the socket is valid but we are not connected
+        if($this->do_debug >= 1) {
+            echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
+        }
+        $this->Close();
+        return false;
+      }
+      return true; // everything looks good
+    }
+    return false;
+  }
+
+  /**
+   * Closes the socket and cleans up the state of the class.
+   * It is not considered good to use this function without
+   * first trying to use QUIT.
+   * @access public
+   * @return void
+   */
+  public function Close() {
+    $this->error = null; // so there is no confusion
+    $this->helo_rply = null;
+    if(!empty($this->smtp_conn)) {
+      // close the connection and cleanup
+      fclose($this->smtp_conn);
+      $this->smtp_conn = 0;
+    }
+  }
+
+  /////////////////////////////////////////////////
+  // SMTP COMMANDS
+  /////////////////////////////////////////////////
+
+  /**
+   * Issues a data command and sends the msg_data to the server
+   * finializing the mail transaction. $msg_data is the message
+   * that is to be send with the headers. Each header needs to be
+   * on a single line followed by a <CRLF> with the message headers
+   * and the message body being seperated by and additional <CRLF>.
+   *
+   * Implements rfc 821: DATA <CRLF>
+   *
+   * SMTP CODE INTERMEDIATE: 354
+   *     [data]
+   *     <CRLF>.<CRLF>
+   *     SMTP CODE SUCCESS: 250
+   *     SMTP CODE FAILURE: 552,554,451,452
+   * SMTP CODE FAILURE: 451,554
+   * SMTP CODE ERROR  : 500,501,503,421
+   * @access public
+   * @return bool
+   */
+  public function Data($msg_data) {
+    $this->error = null; // so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Data() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"DATA" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
+    }
+
+    if($code != 354) {
+      $this->error =
+        array("error" => "DATA command not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+
+    /* the server is ready to accept data!
+     * according to rfc 821 we should not send more than 1000
+     * including the CRLF
+     * characters on a single line so we will break the data up
+     * into lines by \r and/or \n then if needed we will break
+     * each of those into smaller lines to fit within the limit.
+     * in addition we will be looking for lines that start with
+     * a period '.' and append and additional period '.' to that
+     * line. NOTE: this does not count towards limit.
+     */
+
+    // normalize the line breaks so we know the explode works
+    $msg_data = str_replace("\r\n","\n",$msg_data);
+    $msg_data = str_replace("\r","\n",$msg_data);
+    $lines = explode("\n",$msg_data);
+
+    /* we need to find a good way to determine is headers are
+     * in the msg_data or if it is a straight msg body
+     * currently I am assuming rfc 822 definitions of msg headers
+     * and if the first field of the first line (':' sperated)
+     * does not contain a space then it _should_ be a header
+     * and we can process all lines before a blank "" line as
+     * headers.
+     */
+
+    $field = substr($lines[0],0,strpos($lines[0],":"));
+    $in_headers = false;
+    if(!empty($field) && !strstr($field," ")) {
+      $in_headers = true;
+    }
+
+    $max_line_length = 998; // used below; set here for ease in change
+
+    while(list(,$line) = @each($lines)) {
+      $lines_out = null;
+      if($line == "" && $in_headers) {
+        $in_headers = false;
+      }
+      // ok we need to break this line up into several smaller lines
+      while(strlen($line) > $max_line_length) {
+        $pos = strrpos(substr($line,0,$max_line_length)," ");
+
+        // Patch to fix DOS attack
+        if(!$pos) {
+          $pos = $max_line_length - 1;
+          $lines_out[] = substr($line,0,$pos);
+          $line = substr($line,$pos);
+        } else {
+          $lines_out[] = substr($line,0,$pos);
+          $line = substr($line,$pos + 1);
+        }
+
+        /* if processing headers add a LWSP-char to the front of new line
+         * rfc 822 on long msg headers
+         */
+        if($in_headers) {
+          $line = "\t" . $line;
+        }
+      }
+      $lines_out[] = $line;
+
+      // send the lines to the server
+      while(list(,$line_out) = @each($lines_out)) {
+        if(strlen($line_out) > 0)
+        {
+          if(substr($line_out, 0, 1) == ".") {
+            $line_out = "." . $line_out;
+          }
+        }
+        fputs($this->smtp_conn,$line_out . $this->CRLF);
+      }
+    }
+
+    // message data has been sent
+    fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "DATA not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the HELO command to the smtp server.
+   * This makes sure that we and the server are in
+   * the same known state.
+   *
+   * Implements from rfc 821: HELO <SP> <domain> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500, 501, 504, 421
+   * @access public
+   * @return bool
+   */
+  public function Hello($host = '') {
+    $this->error = null; // so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+            "error" => "Called Hello() without being connected");
+      return false;
+    }
+
+    // if hostname for HELO was not specified send default
+    if(empty($host)) {
+      // determine appropriate default to send to server
+      $host = "localhost";
+    }
+
+    // Send extended hello first (RFC 2821)
+    if(!$this->SendHello("EHLO", $host)) {
+      if(!$this->SendHello("HELO", $host)) {
+        return false;
+      }
+    }
+
+    return true;
+  }
+
+  /**
+   * Sends a HELO/EHLO command.
+   * @access private
+   * @return bool
+   */
+  private function SendHello($hello, $host) {
+    fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />';
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => $hello . " not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+
+    $this->helo_rply = $rply;
+
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command.
+   *
+   * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,421
+   * @access public
+   * @return bool
+   */
+  public function Mail($from) {
+    $this->error = null; // so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Mail() without being connected");
+      return false;
+    }
+
+    $useVerp = ($this->do_verp ? "XVERP" : "");
+    fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "MAIL not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the quit command to the server and then closes the socket
+   * if there is no error or the $close_on_error argument is true.
+   *
+   * Implements from rfc 821: QUIT <CRLF>
+   *
+   * SMTP CODE SUCCESS: 221
+   * SMTP CODE ERROR  : 500
+   * @access public
+   * @return bool
+   */
+  public function Quit($close_on_error = true) {
+    $this->error = null; // so there is no confusion
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Quit() without being connected");
+      return false;
+    }
+
+    // send the quit command to the server
+    fputs($this->smtp_conn,"quit" . $this->CRLF);
+
+    // get any good-bye messages
+    $byemsg = $this->get_lines();
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />';
+    }
+
+    $rval = true;
+    $e = null;
+
+    $code = substr($byemsg,0,3);
+    if($code != 221) {
+      // use e as a tmp var cause Close will overwrite $this->error
+      $e = array("error" => "SMTP server rejected quit command",
+                 "smtp_code" => $code,
+                 "smtp_rply" => substr($byemsg,4));
+      $rval = false;
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />';
+      }
+    }
+
+    if(empty($e) || $close_on_error) {
+      $this->Close();
+    }
+
+    return $rval;
+  }
+
+  /**
+   * Sends the command RCPT to the SMTP server with the TO: argument of $to.
+   * Returns true if the recipient was accepted false if it was rejected.
+   *
+   * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250,251
+   * SMTP CODE FAILURE: 550,551,552,553,450,451,452
+   * SMTP CODE ERROR  : 500,501,503,421
+   * @access public
+   * @return bool
+   */
+  public function Recipient($to) {
+    $this->error = null; // so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Recipient() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
+    }
+
+    if($code != 250 && $code != 251) {
+      $this->error =
+        array("error" => "RCPT not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the RSET command to abort and transaction that is
+   * currently in progress. Returns true if successful false
+   * otherwise.
+   *
+   * Implements rfc 821: RSET <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500,501,504,421
+   * @access public
+   * @return bool
+   */
+  public function Reset() {
+    $this->error = null; // so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Reset() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"RSET" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "RSET failed",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in and send them an email.
+   *
+   * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  public function SendAndMail($from) {
+    $this->error = null; // so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+          "error" => "Called SendAndMail() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "SAML not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * This is an optional command for SMTP that this class does not
+   * support. This method is here to make the RFC821 Definition
+   * complete for this class and __may__ be implimented in the future
+   *
+   * Implements from rfc 821: TURN <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE FAILURE: 502
+   * SMTP CODE ERROR  : 500, 503
+   * @access public
+   * @return bool
+   */
+  public function Turn() {
+    $this->error = array("error" => "This method, TURN, of the SMTP ".
+                                    "is not implemented");
+    if($this->do_debug >= 1) {
+      echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />';
+    }
+    return false;
+  }
+
+  /**
+  * Get the current error
+  * @access public
+  * @return array
+  */
+  public function getError() {
+    return $this->error;
+  }
+
+  /////////////////////////////////////////////////
+  // INTERNAL FUNCTIONS
+  /////////////////////////////////////////////////
+
+  /**
+   * Read in as many lines as possible
+   * either before eof or socket timeout occurs on the operation.
+   * With SMTP we can tell if we have more lines to read if the
+   * 4th character is '-' symbol. If it is a space then we don't
+   * need to read anything else.
+   * @access private
+   * @return string
+   */
+  private function get_lines() {
+    $data = "";
+    while($str = @fgets($this->smtp_conn,515)) {
+      if($this->do_debug >= 4) {
+        echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '<br />';
+        echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '<br />';
+      }
+      $data .= $str;
+      if($this->do_debug >= 4) {
+        echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '<br />';
+      }
+      // if 4th character is a space, we are done reading, break the loop
+      if(substr($str,3,1) == " ") { break; }
+    }
+    return $data;
+  }
+
+}
+
+?>

+ 90 - 0
include/View.php

@@ -0,0 +1,90 @@
+<?php
+if(!isset($ajaxbool))$ajaxbool = $rock->jm->gettoken('ajaxbool', 'false');
+$ajaxbool	= $rock->get('ajaxbool', $ajaxbool);
+$p			= PROJECT;
+if(!isset($m))$m='index';
+if(!isset($a))$a='default';
+if(!isset($d))$d='';
+$m			= $rock->get('m', $m);
+$a			= $rock->get('a', $a);
+$d			= $rock->get('d', $d);
+
+define('M', $m);
+define('A', $a);
+define('D', $d);
+define('P', $p);
+
+$_m			= $m;
+if($rock->contain($m, '|')){
+	$_mas 	= explode('|', $m);
+	$m 		= $_mas[0];
+	$_m		= $_mas[1];
+}
+include_once($rock->strformat('?0/?1/?1Action.php',ROOT_PATH, $p));
+$rand		= date('YmdHis').rand(1000,9999);
+if(substr($d,-1)!='/' && $d!='')$d.='/';
+$errormsg	= '';
+$methodbool	= true;
+$actpath	= $rock->strformat('?0/?1/?2?3',ROOT_PATH, $p, $d, $_m);
+define('ACTPATH', $actpath);
+$actfile	= $rock->strformat('?0/?1Action.php',$actpath, $m);
+$actfile1	= $rock->strformat('?0/?1Action.php',$actpath, $_m);
+$actbstr 	= null;
+if(file_exists($actfile1))include_once($actfile1);
+if(file_exists($actfile)){
+	include_once($actfile);
+	$clsname	= ''.$m.'ClassAction';
+	$xhrock		= new $clsname();
+	$actname	= ''.$a.'Action';
+	if($ajaxbool == 'true')$actname	= ''.$a.'Ajax';
+	if(method_exists($xhrock, $actname)){
+		$xhrock->beforeAction();
+		$actbstr = $xhrock->$actname();
+		$xhrock->bodyMessage = $actbstr;
+		if(is_string($actbstr)){echo $actbstr;$xhrock->display=false;}
+		if(is_array($actbstr)){echo json_encode($actbstr);$xhrock->display=false;}
+	}else{
+		$methodbool = false;
+		if($ajaxbool == 'false')echo ''.$actname.' not found;';
+	}
+	$xhrock->afterAction();
+}else{
+	echo 'actionfile not exists;';
+	$xhrock		= new Action();
+}
+
+$_showbool = false;
+if($xhrock->display && ($ajaxbool == 'html' || $ajaxbool == 'false')){
+	$xhrock->smartydata['p']	= $p;
+	$xhrock->smartydata['a']	= $a;
+	$xhrock->smartydata['m']	= $m;
+	$xhrock->smartydata['d']	= $d;
+	$xhrock->smartydata['rand']	= $rand;
+	$xhrock->smartydata['qom']	= QOM;
+	$xhrock->smartydata['path']	= PATH;
+	$xhrock->smartydata['sysurl']= SYSURL;
+	$temppath					= ''.ROOT_PATH.'/'.$p.'/';
+	$tplpaths					= ''.$temppath.''.$d.''.$m.'/';
+	$tplname					= 'tpl_'.$m.'';
+	if($a!='default')$tplname  .= '_'.$a.'';
+	$tplname				   .= '.'.$xhrock->tpldom.'';
+	$mpathname					= $tplpaths.$tplname;
+	if($xhrock->displayfile!='' && file_exists($xhrock->displayfile))$mpathname = $xhrock->displayfile;
+	if(!file_exists($mpathname) || !$methodbool){
+		if(!$methodbool){
+			$errormsg	= 'in ('.$m.') not found Method('.$a.');';
+		}else{
+			$errormsg	= ''.$tplname.' not exists;';
+		}
+		echo $errormsg;
+	}else{
+		$_showbool = true;
+	}
+}
+if($xhrock->display && ($ajaxbool == 'html' || $xhrock->tpltype=='html' || $ajaxbool == 'false') && $_showbool){
+	$xhrock->setHtmlData();
+	$da = $xhrock->smartydata;
+	foreach($xhrock->assigndata as $_k=>$_v)$$_k=$_v;
+	include_once($mpathname);
+	$_showbool = false;
+}

+ 165 - 0
include/chajian/JPushChajian.php

@@ -0,0 +1,165 @@
+<?php 
+/**
+* 	最新系统推送1.9.7后
+*	软件:信呼OA
+*	最后更新:2021-10-09
+*/
+class JPushChajian extends Chajian{
+
+
+	//-------------最新原生app推送app是1.2.3版本 和 最新app+---------------
+	public function push($title, $desc, $cont, $palias)
+	{
+
+		$uids		= $palias['uids'];
+		$alias2019	= $palias['alias2019'];
+		$pushuids	= $palias['pushuids']; //可以推送的用户ID
+		$xmpush		= c('xmpush');
+		$hwpush		= c('hwpush');
+		$getui		= c('getui');
+		
+		//可推送判断
+		$ketualia	= array();
+		foreach($alias2019 as $ali1){
+			$ali1aa = explode('|', $ali1);
+			$_uid	= $ali1aa[2];
+			if(in_array($_uid, $pushuids))$ketualia[] = $ali1;
+		}
+		$alias2019 = $ketualia;
+		
+		
+		//$this->rock->debugs($palias,'pushalias');//判断能不能推送,打印这个
+		
+		$xharr = array(
+			'uids'  => $uids,
+			'title' => $this->rock->jm->base64encode($title),
+			//'cont'  => $this->rock->jm->base64encode($cont),
+			'desc'  => $desc,
+			'systype'=> getconfig('systype')
+		);
+		
+		if(!$alias2019)return;
+		
+		$getuiand = $getuiios = $mybyarr = $xmarr = $hwarr = $iosar = $puarr = array();
+		foreach($alias2019 as $k=>$ali1){
+			$ali1aa = explode('|', $ali1);
+			$regid  = $ali1aa[0];
+			$_web   = $ali1aa[1];
+			if(contain($_web,'custpile')){
+				$mybyarr[] =  $k; //3
+			}else if(contain($_web,'getui')){
+				if(contain($_web,'iphone')){
+					$getuiios[] =  $k; //3
+				}else{
+					$getuiand[] =  $k; //3
+				}
+			}else if(contain($_web,'mi')){
+				$xmarr[] 	=  $k; //0
+			}else if(contain($_web,'huawei')){
+				$hwarr[] 	=  $k; //3
+			}else if(contain($_web,'iphone')){	
+				$iosar[] 	=  $k; //0
+			}else{
+				$puarr[]	= $ali1;
+			}
+		}
+		
+		$mymsg = '';
+		$desc = $this->rock->jm->base64decode($desc);
+		if($xmarr){
+			if($xmpush->sendbool()){
+				$vstr = $this->getVal($alias2019, $xmarr, 0);
+				$msg  = $xmpush->androidsend($vstr, $title, $desc);
+				if($msg)$mymsg.=chr(10).$msg;
+			}else{
+				$vsta = $this->getVala($alias2019, $xmarr);
+				foreach($vsta as $v)$puarr[] = $v;
+			}
+		}
+		
+		if($hwarr){
+			if($hwpush->sendbool()){
+				$vstr = $this->getVal($alias2019, $hwarr, 3);
+				$msg  = $hwpush->androidsend($vstr, $title, $desc);
+				if($msg)$mymsg.=chr(10).$msg;
+			}else{
+				$vsta = $this->getVala($alias2019, $hwarr);
+				foreach($vsta as $v)$puarr[] = $v;
+			}
+		}
+		
+		if($iosar){
+			if($xmpush->jpushiosbool()){
+				$vstr = $this->getVal($alias2019, $iosar, 0);
+				$msg  = $xmpush->jpushiossend($vstr, $title, $desc);
+				if($msg)$mymsg.=chr(10).$msg;
+			}else{
+				$vsta = $this->getVala($alias2019, $iosar);
+				foreach($vsta as $v)$puarr[] = $v;
+			}
+		}
+		
+		if($getuiand){
+			if($getui->isandroid()){
+				$vstr = $this->getVal($alias2019, $getuiand, 3);
+				$msg  = $getui->push($vstr, $title, $desc);
+				if($msg)$mymsg.=chr(10).$msg;
+			}else{
+				$vsta = $this->getVala($alias2019, $getuiand);
+				foreach($vsta as $v)$puarr[] = $v;
+			}
+		}
+		
+		if($getuiios){
+			if($getui->isios()){
+				$vstr = $this->getVal($alias2019, $getuiios, 3);
+				$msg  = $getui->push($vstr, $title, $desc);
+				if($msg)$mymsg.=chr(10).$msg;
+			}else{
+				$vsta = $this->getVala($alias2019, $getuiios);
+				foreach($vsta as $v)$puarr[] = $v;
+			}
+		}
+		
+		if($mybyarr){
+			if($getui->sendbool()){
+				$vstr = $this->getVal($alias2019, $mybyarr, 3);
+				$msg  = $getui->push($vstr, $title, $desc);
+				if($msg)$mymsg.=chr(10).$msg;
+			}else{
+				$msg  = '自己编译未配置推送';
+				$mymsg.=chr(10).$msg;
+			}
+		}
+		
+		if($mymsg)$this->rock->debugs($mymsg, 'mypush');
+	
+		
+		//需要官网隧道
+		if($puarr){
+			$xharr['alias2019']	= join(',', $puarr);
+			$runurl = c('xinhu')->geturlstr('jpushplat', $xharr);
+			c('curl')->getcurl($runurl);
+		}
+	}
+	
+	
+	private function getVal($alias2019, $new, $oi)
+	{
+		$stv = array();
+		foreach($new as $j){
+			$stra = explode('|', $alias2019[$j]);
+			if(isset($stra[$oi]))$stv[]= $stra[$oi];
+		}
+		return $stv;
+	}
+
+	private function getVala($alias2019, $new)
+	{
+		$stv = array();
+		foreach($new as $j){
+			$stv[] = $alias2019[$j];
+		}
+		return $stv;
+	}
+}

+ 386 - 0
include/chajian/PHPExcelChajian.php

@@ -0,0 +1,386 @@
+<?php 
+/**
+*	PHPExcel类
+*/
+class PHPExcelChajian extends Chajian{
+	
+	public  $excel				= null;
+	public  $sheetObj;
+	public	$headlen			= 0;
+
+	public  $headbgcolor		= 'CDF79E';
+	public  $bordercolor		= '000000';
+	public  $headfontcolor		= '';
+	public	$headfontbold		= false;
+	public 	$borderbool			= true;
+	
+	public 	$title				= '';
+	public 	$titlebool			= true;
+	public 	$titlebgbool		= false;
+	
+	public 	$sheettitle			= '';
+	public 	$headArr			= array();
+	public 	$rows				= array();
+	
+	
+	public 	$titleboolArray		= array();
+	public  $titleArray			= array();
+	public  $headArrArray		= array();
+	public  $rowsArray			= array();
+	
+	public  $pageCode			= 'utf-8';
+	public  $code				= 'utf-8';
+	public 	$createbool			= false;
+	
+	public $A,$headWidth;
+	
+	public function initChajian()
+	{
+		if(version_compare(PHP_VERSION, '7.5.0','>'))return;
+		$this->A	= explode(',','A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BL,BM,BN,BO,BP,BQ,BR,BS,BT,BU,BV,BW,BX,BY,BZ,CA,CB,CC,CD,CE,CF,CG,CH,CI,CJ,CK,CL,CM,CN,CO,CP,CQ,CR,CS,CT,CU,CV,CW,CX,CY,CZ');
+		$this->headWidth= array();
+		$pastr = ROOT_PATH.'/include/PHPExcel.php';
+		if(file_exists($pastr)){
+			include_once($pastr);
+			$this->excel 	= new PHPExcel();
+		}
+	}
+	
+	public function isBool()
+	{
+		if($this->excel==null){
+			return false;
+		}else{
+			return true;
+		}
+	}
+	
+	/**
+		设置表头
+	*/
+	private function setHead($sheet=0)
+	{
+		$arrh	= $this->headArr;
+		$title	= $this->sheettitle;
+		if($title=='')$title = $this->title;
+		$this->headWidth	 = array();
+		if($sheet>0)$this->excel->createSheet();
+
+		$this->excel->setActiveSheetIndex($sheet);//设置当前的sheet工作簿
+		$this->sheetObj	= $this->excel->getActiveSheet();
+		$this->sheetObj->setTitle($title);//设置sheet的工作簿标题
+
+		$k	= 0;
+		if($sheet == 0){
+			$this->excel->getProperties()->setCreator('rock'); 		//创建者
+			$this->excel->getProperties()->setLastModifiedBy('rock');  //最后修改
+			$this->excel->getProperties()->setTitle('rock');  			//设置标题
+			$this->excel->getProperties()->setSubject('rock');  		//设置备注
+			$this->excel->getProperties()->setDescription('rock');  	//设置描述
+			$this->excel->getProperties()->setKeywords('rock');  		//设置关键字 | 标记
+			$this->excel->getProperties()->setCategory('rock');  		//设置类别
+		}
+		
+		$this->headlen	= -1;
+		foreach($arrh as $_arrh)$this->headlen++;
+		$this->rowslen	= 0;
+		if(is_array($this->rows))$this->rowslen=count($this->rows);//长度
+		if($this->headlen==-1)return false;
+
+		//整体添加边框颜色,居中
+		$zta		= ($this->titlebool)?2:1;
+		$getStyle	= $this->sheetObj->getStyle('A1:'.$this->A[$this->headlen].''.($this->rowslen+$zta).'');
+		$getStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);//垂直居中
+		$getStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::VERTICAL_CENTER);//水平居中
+		
+		if($this->borderbool){
+			$getStyle->getBorders()->getAllborders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);//边框
+			if($this->bordercolor!='000000')$getStyle->getBorders()->getAllborders()->getColor()->setARGB('FF'.$this->bordercolor.'');//边框颜色
+		}
+
+		//设置头部标题
+		if($this->titlebool){
+			$this->sheetObj->mergeCells('A1:'.$this->A[$this->headlen].'1');  //合并单元格
+			$this->sheetObj->setCellValue('A1', $title);
+			$this->sheetObj->getRowDimension(1)->setRowHeight(30); //设置行高
+			$getStyle	= $this->sheetObj->getStyle('A1');
+			$getStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+			$getStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);//垂直剧中
+			$getStyle->getFont()->setBold(true);
+			$getStyle->getFont()->setSize(16);
+			//标题背景颜色
+			if($this->titlebgbool){
+				$getStyle->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
+				$getStyle->getFill()->getStartColor()->setARGB('FF'.$this->headbgcolor.'');
+			}
+		}
+		
+		//设置表头列标题
+		if($this->headfontbold)$this->sheetObj->getStyle('A'.$zta.':'.$this->A[$this->headlen].''.$zta.'')->getFont()->setBold(true);//标题是否加粗
+		foreach($arrh as $key=>$_arrh){
+			$name			= $_arrh;
+			$xlsfontcolor	= $this->headfontcolor;
+			$xlsbgcolor		= $this->headbgcolor;
+			$xlsbordercolor	= $this->bordercolor;
+			$xlsfontsize	= '';//字体大小
+			$xlswidth		= 0;		//宽度
+			$xlsalign		= 'center';	//对齐方式
+			$xlsbold		= false;	//是否加粗
+			if(is_array($_arrh)){
+				if(isset($_arrh['xlsfontcolor']))$xlsfontcolor=$_arrh['xlsfontcolor'];
+				if(isset($_arrh['xlsbgcolor']))$xlsbgcolor=$_arrh['xlsbgcolor'];
+				if(isset($_arrh['xlsbordercolor']))$xlsbordercolor=$_arrh['xlsbordercolor'];
+				if(isset($_arrh['xlswidth']))$xlswidth=$_arrh['xlswidth'];
+				if(isset($_arrh['xlsalign']))$xlswidth=$_arrh['xlsalign'];
+				if(isset($_arrh['xlsbold']))$xlsbold=$_arrh['xlsbold'];
+				if(isset($_arrh['xlsfontsize']))$xlsfontsize=$_arrh['xlsfontsize'];
+				$name= $_arrh['name'];
+			}
+			$this->headWidth[$key] = array(strlen($name), $xlswidth);	//设置宽度
+			//设置样式
+			$vk	= ''.$this->A[$k].'2';
+			
+			if(!$this->titlebool)$vk = ''.$this->A[$k].'1';
+			$getStyle	= $this->sheetObj->getStyle($vk);
+			
+			//边框
+			if($xlsbordercolor!='000000')$getStyle->getBorders()->getAllborders()->getColor()->setARGB('FF'.$xlsbordercolor.''); 
+				
+			
+			//设置背景色
+			$getStyle->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
+			$getStyle->getFill()->getStartColor()->setARGB('FF'.$xlsbgcolor.'');
+			
+			//设置字体颜色加粗,大小
+			if($xlsfontcolor!='')$getStyle->getFont()->getColor()->setARGB('FF'.$xlsfontcolor.'');
+			if($xlsbold)$getStyle->getFont()->setBold(true);
+			if($xlsfontsize!='')$getStyle->getFont()->setSize($xlsfontsize);
+			
+			//设置对齐方式
+			if($xlsalign!='center')$getStyle->getAlignment()->setHorizontal($xlsalign);
+			
+			$this->sheetObj->setCellValue($vk, $name);
+			$k++;
+		}
+	}
+	
+	
+	/**
+		添加数据
+	*/
+	private function setData()
+	{
+		$rows	= $this->rows;
+		if(!is_array($rows))return false;
+		$arrh	= $this->headArr;
+		$zta	= ($this->titlebool)?3:2;
+		//添加数据
+		foreach($rows as $r=>$rs){
+			if(!is_array($rs))continue;
+			$k			= 0;
+			$xlsmerge	= '';
+			$xlsbgcolor	= '';
+			$xua		= $r+$zta;
+			if(isset($rs['xlsmerge']))$xlsmerge=$rs['xlsmerge'];
+			if(isset($rs['xlsbgcolor']))$xlsbgcolor=$rs['xlsbgcolor'];
+			
+			//整行背景色
+			if($xlsbgcolor!=''){
+				$this->sheetObj->getStyle('A'.$xua.':'.$this->A[$this->headlen].''.$xua.'')
+				->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
+				->getStartColor()->setARGB('FF'.$xlsbgcolor.'');
+			}
+			
+			//判断是否有合并单元格的(A:D)
+			if($xlsmerge!=''){
+				$ncta	= explode(':',$xlsmerge);
+				$this->sheetObj->mergeCells(''.$ncta[0].''.$xua.':'.$ncta[1].''.$xua.'');
+			}
+			
+			foreach($arrh as $key=>$_arrh){
+				if(!isset($rs[$key])){
+					$k++;
+					continue;
+				}
+				$vk	= ''.$this->A[$k].''.$xua.'';
+				$xlsfontcolor	= $xlsbgcolor = '';
+				$xlsbordercolor	= $this->bordercolor;
+				$xlsunderline	= '';
+				$xlsfontsize	= '';
+				$xlsalign		= 'center';	//对齐方式
+				$xlsbold		= false;	//是否加粗
+				$xlsitalic		= false;	//是否斜体
+				$val			= $rs[$key];
+				$vallen			= strlen(''.$val.'');
+				if($this->headWidth[$key][0]<$vallen)$this->headWidth[$key][0]=$vallen;
+				if(is_array($_arrh)){
+					if(isset($_arrh['xlsfontcolor']))$xlsfontcolor=$_arrh['xlsfontcolor'];
+					if(isset($_arrh['xlsbgcolor']))$xlsbgcolor=$_arrh['xlsbgcolor'];
+					if(isset($_arrh['xlsbordercolor']))$xlsbordercolor=$_arrh['xlsbordercolor'];
+					if(isset($_arrh['xlsalign']))$xlsalign=$_arrh['xlsalign'];
+				}
+				
+				if(isset($rs['xlsfontcolor']))$xlsfontcolor=$rs['xlsfontcolor'];
+				if(isset($rs['xlsbordercolor']))$xlsbordercolor=$rs['xlsbordercolor'];
+				if(isset($rs['xlsalign']))$xlsalign=$rs['xlsalign'];
+				if(isset($rs['xlsbold']))$xlsbold=$rs['xlsbold'];
+				if(isset($rs['xlsfontsize']))$xlsfontsize=$rs['xlsfontsize'];
+				if(isset($rs['xlsunderline']))$xlsunderline=$rs['xlsunderline'];
+				
+				if(isset($rs[''.$key.'xlsfontcolor']))$xlsfontcolor=$rs[''.$key.'xlsfontcolor'];
+				if(isset($rs[''.$key.'xlsbgcolor']))$xlsbgcolor=$rs[''.$key.'xlsbgcolor'];
+				if(isset($rs[''.$key.'xlsbordercolor']))$xlsbordercolor=$rs[''.$key.'xlsbordercolor'];
+				if(isset($rs[''.$key.'xlsalign']))$xlsalign=$rs[''.$key.'xlsalign'];
+				if(isset($rs[''.$key.'xlsbold']))$xlsbold=$rs[''.$key.'xlsbold'];
+				if(isset($rs[''.$key.'xlsfontsize']))$xlsfontsize=$rs[''.$key.'xlsfontsize'];
+				if(isset($rs[''.$key.'xlsitalic']))$xlsitalic=$rs[''.$key.'xlsitalic'];
+				if(isset($rs[''.$key.'xlsunderline']))$xlsunderline=$rs[''.$key.'xlsunderline'];
+				
+				$getStyle	= $this->sheetObj->getStyle($vk);
+				//设置背景色
+				if($xlsbgcolor!=''){
+					$getStyle->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
+					$getStyle->getFill()->getStartColor()->setARGB('FF'.$xlsbgcolor.'');
+				}
+				
+				//字体颜色
+				if($xlsfontcolor!='')$getStyle->getFont()->getColor()->setARGB('FF'.$xlsfontcolor.'');
+				if($xlsbold)$getStyle->getFont()->setBold(true);
+				if($xlsitalic)$getStyle->getFont()->setItalic(true);//斜体
+				if($xlsfontsize!='')$getStyle->getFont()->setSize($xlsfontsize);
+				if($xlsunderline!='')$getStyle->getFont()->setUnderline($xlsunderline);//下划线情况double,双下划线、doubleAccounting,整个单元格双下划线、single,单下划线、singleAccounting,整个单元格单下划线
+				
+				//设置边框颜色
+				if($xlsbordercolor!='000000')$getStyle->getBorders()->getAllborders()->getColor()->setARGB('FF'.$xlsbordercolor.''); 
+				
+				//对齐方式
+				if($xlsalign!='center')$getStyle->getAlignment()->setHorizontal($xlsalign);
+				
+				$this->sheetObj->setCellValue($vk, $val);
+				$k++;
+			}
+			
+			//设置行高
+			$xlsrowheight	= 0;
+			if(isset($rs['xlsrowheight']))$xlsrowheight=$rs['xlsrowheight'];
+			if($xlsrowheight != 0)$this->sheetObj->getRowDimension($r+$zta)->setRowHeight($xlsrowheight); 
+		}
+	}
+	
+	/**
+		设置列宽
+	*/
+	private function setColwidth()
+	{
+		$k=0;
+		foreach($this->headWidth as $key=>$v){
+			$w	= $v[1];
+			if($w<=0){
+				$w= $v[0] * 1.2;
+			}else{
+				$w= $w/70*12;
+			}
+			if($w>0)$this->sheetObj->getColumnDimension($this->A[$k])->setWidth($w);
+			$k++;
+		}		
+	}
+
+	/**
+		创建数据
+	*/
+	public function createData()
+	{
+		$len1	= count($this->titleArray);
+		$len2	= count($this->headArrArray);
+		$len3	= count($this->rowsArray);
+		
+		if($len1==$len2 && $len2==$len3 && $len1>0){
+			for($i=0; $i<$len1; $i++){
+				$this->sheettitle	= $this->titleArray[$i];
+				$this->headArr		= $this->headArrArray[$i];
+				$this->rows			= $this->rowsArray[$i];
+				$this->titlebool	= true;
+				if(isset($this->titleboolArray[$i]))$this->titlebool=$this->titleboolArray[$i];
+				
+				$this->setHead($i);
+				$this->setData();
+				$this->setColwidth();
+			}
+			$this->excel->setActiveSheetIndex(0);
+		}else{
+			$this->setHead(0);
+			$this->setData();
+			$this->setColwidth();
+		}
+		$this->createbool	= true;
+	}
+	
+	/**
+		输出显示
+		@param	string  $ext   	输出类型 xls,xlsx
+		@param	string  $type   是否直接下载
+		@return string 文件名
+	*/
+	public function display($ext='xls', $type='down')
+	{
+		if(!$this->createbool){
+			$this->createData();
+		}
+		
+		$title	= $this->title;
+
+		//有随机数
+		$rand		= '';
+		if(contain($type,'rand'))$rand	= date('YmdHis');
+		$filename	= ''.$title.''.$rand.'.'.$ext.'';
+
+		//输出
+		if($ext!='xlsx'){
+			$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
+		}else{
+			$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel2007'); //保存excel—2007格式或者
+		}
+		$backfile = 'down';
+		
+		//保存文件
+		if(contain($type,'savelogs')){
+			$dir	= 'logs';
+			$path	= ''.ROOT_PATH.'/'.UPDIR.'/'.$dir.'/';
+			if(!is_dir($path))mkdir($path);
+			$savefile	= $path.''.$this->iconvstr($filename).'';
+			$objWriter->save($savefile); //是否保存本地
+			$backfile	= ''.UPDIR.'/'.$dir.'/'.$filename.'';
+		}
+		
+		//下载
+		if(contain($type, 'down')){
+			header('Content-type: application/vnd.ms-excel');
+			header('Content-Disposition: attachment; filename="'.iconv('utf-8', 'gbk', $filename).'"');
+			header('Cache-Control: max-age=0');
+			$objWriter->save('php://output');
+		}
+		
+		return $backfile;
+	}
+	
+	
+	/**
+		编码转化
+	*/	
+	private function iconvstr($str)
+	{
+		if($this->pageCode=='utf-8')$str	= iconv('utf-8', 'gbk', $str);
+		return $str;
+	}
+	
+	
+	/**
+		合并单元格
+	*/
+	public function mergeCells($cel1, $cel2, $val=null, $sheet=-1)
+	{
+		if($sheet != -1)$this->excel->setActiveSheetIndex($sheet);
+		$this->excel->getActiveSheet()->mergeCells(''.$cel1.':'.$cel2.'');
+		if($val != null)$this->sheetObj->setCellValue($cel1, $val);
+	}
+}                         

Разлика између датотеке није приказан због своје велике величине
+ 65 - 0
include/chajian/PHPExcelReaderChajian.php


+ 69 - 0
include/chajian/PHPWordChajian.php

@@ -0,0 +1,69 @@
+<?php 
+/**
+*	PHPWord类
+*/
+
+class PHPWordChajian extends Chajian{
+	
+	private $vendorbool=false;
+	
+	protected function initChajian()
+	{
+		$path = ''.ROOT_PATH.'/include/vendor/autoload.php';
+		if(file_exists($path)){
+			require_once($path);
+			$this->vendorbool = true;
+		}
+	}
+	
+	public function isbool()
+	{
+		return $this->vendorbool;
+	}
+	
+	public function test()
+	{
+		if(!$this->vendorbool)return;
+		
+		\PhpOffice\PhpWord\Settings::loadConfig();
+		
+		\PhpOffice\PhpWord\Settings::setPdfRenderer(\PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF, ''.ROOT_PATH.'/include/vendor/dompdf/dompdf');
+		\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);
+		
+		$languageEnGb = new \PhpOffice\PhpWord\Style\Language(\PhpOffice\PhpWord\Style\Language::EN_GB);
+
+		$phpWord = new \PhpOffice\PhpWord\PhpWord();
+		$phpWord->getSettings()->setThemeFontLang($languageEnGb);
+		
+		
+		$section = $phpWord->addSection();
+		// Adding Text element to the Section having font styled by default...
+		$section->addText(
+			'"Learn from yesterday, live for today, hope for tomorrow. '
+				. 'The important thing is信呼 not to stop questioning." '
+				. '(Albert Einstein)'
+		);
+		//$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
+		//$objWriter->save('wfewew.docx');
+		$phpWord->save('helloWorld'.time().'.pdf','PDF');
+		
+		
+		
+	}
+	
+	/**
+	*	只能替换.docx
+	*/
+	public function replaceWord($path, $data=array(), $npath='')
+	{
+		if(!$this->vendorbool)return returnerror('未安装插件');
+		
+		$PhpWord = new \PhpOffice\PhpWord\TemplateProcessor($path);
+		foreach($data as $k=>$v)$PhpWord->setValue($k, $v);
+
+		if($npath=='')$npath = str_replace('.docx',''.rand(1000,9999).'.docx', $path);
+		$PhpWord->saveAs($npath);
+		
+		return returnsuccess($npath);
+	}
+}                         

+ 88 - 0
include/chajian/aliossChajian.php

@@ -0,0 +1,88 @@
+<?php
+/**
+*	阿里云oss服务
+*/
+class aliossChajian extends Chajian{
+	
+	private $accesskeyid;
+	private $accesskeysecret;
+	
+	private $vendorbool=false;
+	private $ossClient=false;
+	
+	protected function initChajian()
+	{
+		$this->accesskeyid 		= getconfig('alioss_keyid');
+		$this->accesskeysecret 	= getconfig('alioss_keysecret');
+		$this->folder 		= getconfig('alioss_folder');
+		$this->bucket 		= getconfig('alioss_bucket');
+		
+		$path = ''.ROOT_PATH.'/include/vendor/autoload.php';
+		if(file_exists($path) && $this->accesskeysecret){
+			require_once($path);
+			$this->vendorbool = true;
+		}
+	}
+	
+	public function isbool()
+	{
+		return $this->vendorbool;
+	}
+	
+
+	
+	private function getOssClient()
+	{
+		if(!$this->ossClient){
+			$fq 	  = getconfig('alioss_region');
+			$endpoint = 'http://oss-cn-'.$fq.'.aliyuncs.com';
+			$this->ossClient = new \OSS\OssClient($this->accesskeyid, $this->accesskeysecret, $endpoint);
+		}
+		return $this->ossClient;
+	}
+	
+	/**
+	*	上传文件到oss
+	*/
+	public function uploadFile($path)
+	{
+		if(!$this->isbool())return returnerror('no install alioss');
+		try{
+			$ossClient = $this->getOssClient();
+			$barr 	   = $ossClient->uploadFile($this->bucket, $this->folder.'/'.$path, ROOT_PATH.'/'.$path);
+			if(is_array($barr)){
+				$info  = $barr['info'];
+				$carr = returnsuccess($barr);
+				$carr['code']= 0;
+				$carr['url'] = str_replace('http:','https:', $info['url']);
+				$carr['filesize'] = $info['request_size'];
+				return $carr;
+			}else{
+				return returnerror();
+			}
+		} catch(\OSS\Core\OssException $e) {
+			return returnerror($e->getMessage());
+		}
+	}
+	
+	/**
+	*	下载文件
+	*/
+	public function download($path, $dstPath)
+	{
+		if(!$this->isbool())return returnerror('no install alioss');
+		try{
+			$ossClient = $this->getOssClient();
+			$localfile = $dstPath;
+			$options = array(
+				\OSS\OssClient::OSS_FILE_DOWNLOAD => $localfile
+			);
+			$ossClient->getObject($this->bucket, $path, $options);
+			$carr = returnsuccess($barr);
+			$carr['code']= 0;
+			return $carr;
+		} catch(\OSS\Core\OssException $e) {
+			return returnerror($e->getMessage());
+		}
+	}
+}

+ 180 - 0
include/chajian/alismsChajian.php

@@ -0,0 +1,180 @@
+<?php
+/**
+*	阿里云短信服务api
+*/
+class alismsChajian extends Chajian{
+	
+	private $accesskeyid;
+	private $accesskeysecret;
+	
+	protected function initChajian()
+	{
+		$this->accesskeyid 		= getconfig('alisms_keyid');
+		$this->accesskeysecret 	= getconfig('alisms_keysecret');
+	}
+	
+	/**
+	*	批量发送短信
+	*/
+	public function send($mobiles, $qianm, $tplid, $cans=array())
+	{
+		if(isempt($this->accesskeyid) || isempt($this->accesskeysecret))return returnerror('没有设置短信keyid或keysecret');
+		
+		if(isempt($qianm))return returnerror('请设置短信签名');
+		if(isempt($tplid) || substr($tplid,0,4) != 'SMS_')return returnerror('短信模版CODE格式有误');
+		
+		$mbarr = $this->getTplcont($tplid);
+		if(!$mbarr['success'])return $mbarr;
+		$tplcont = $mbarr['data']['TemplateContent'];
+		
+		if(isset($cans['url']))$cans['url'] = c('xinhuapi')->urlsmall($cans['url']); //如果有短域名用这个生成,不要就删掉这行
+		
+		//把没用参数删掉
+		$csarr	= $this->rock->matcharr($tplcont);
+		foreach($csarr as $cs1)if(!isset($cans[$cs1]))return returnerror('模版里有{'.$cs1.'}参数,发送必须传');
+		foreach($cans as $k1=>$v1)if(!in_array($k1, $csarr))unset($cans[$k1]);
+		
+		
+		$params = array();
+		$shoujha= explode(',', $mobiles);
+		$params["PhoneNumberJson"] 	= $shoujha;
+		$params["TemplateCode"] 	=  $tplid;
+		
+		foreach($shoujha as $smid){
+			$params["SignNameJson"][] 		= $qianm;
+			if($cans)$params["TemplateParamJson"][] 	= $cans;
+		}
+	
+		if($cans)$params["TemplateParamJson"]  = json_encode($params["TemplateParamJson"], JSON_UNESCAPED_UNICODE);
+		$params["SignNameJson"] 		= json_encode($params["SignNameJson"], JSON_UNESCAPED_UNICODE);
+		$params["PhoneNumberJson"] 	= json_encode($params["PhoneNumberJson"], JSON_UNESCAPED_UNICODE);
+		
+		$helper 	= new SignatureHelper();
+		$result 	= $helper->request(
+			$this->accesskeyid,
+			$this->accesskeysecret,
+			'dysmsapi.aliyuncs.com',
+			array_merge($params, array(
+				"RegionId" => "cn-hangzhou",
+				"Action" => "SendBatchSms",
+				"Version" => "2017-05-25",
+			))
+		);
+		if(!$result)return returnerror('发送失败');
+		$barr	= json_decode($result, true);
+		if($barr['Code']=='OK')return returnsuccess($barr);
+		return returnerror('发送失败:'.$result.'');
+	}
+	
+	public function getTplcont($tplid)
+	{
+		$num = 'alisms_'.$tplid.'';
+		$val = m('option')->getval($num);
+		if(!isempt($val)){
+			return returnsuccess(array('TemplateContent'=>$val));
+		}
+		if(isempt($this->accesskeyid) || isempt($this->accesskeysecret))return returnerror('没有设置短信keyid或keysecret');
+		$helper 	= new SignatureHelper();
+		$params['TemplateCode'] = $tplid;
+		$result 	= $helper->request(
+			$this->accesskeyid,
+			$this->accesskeysecret,
+			'dysmsapi.aliyuncs.com',
+			array_merge($params, array(
+				"RegionId" => "cn-hangzhou",
+				"Action" => "QuerySmsTemplate",
+				"Version" => "2017-05-25",
+			))
+		);
+		if(!$result)return returnerror('获取模版失败'.$tplid.'');
+		$barr	= json_decode($result, true);
+		if($barr['Code']=='OK'){
+			m('option')->setval($num, $barr['TemplateContent']);
+			return returnsuccess($barr);
+		}
+		return returnerror('获取失败:'.$result.'');
+	}
+}
+
+/**
+ * 签名助手 2017/11/19
+ *
+ * Class SignatureHelper
+ */
+class SignatureHelper {
+
+    /**
+     * 生成签名并发起请求
+     *
+     * @param $accessKeyId string AccessKeyId (https://ak-console.aliyun.com/)
+     * @param $accessKeySecret string AccessKeySecret
+     * @param $domain string API接口所在域名
+     * @param $params array API具体参数
+     * @param $security boolean 使用https
+     * @return bool|\stdClass 返回API接口调用结果,当发生错误时返回false
+     */
+    public function request($accessKeyId, $accessKeySecret, $domain, $params, $security=false) {
+        $apiParams = array_merge(array (
+            "SignatureMethod" => "HMAC-SHA1",
+            "SignatureNonce" => uniqid(mt_rand(0,0xffff), true),
+            "SignatureVersion" => "1.0",
+            "AccessKeyId" => $accessKeyId,
+            "Timestamp" => gmdate("Y-m-d\TH:i:s\Z"),
+            "Format" => "JSON",
+        ), $params);
+        ksort($apiParams);
+
+        $sortedQueryStringTmp = "";
+        foreach ($apiParams as $key => $value) {
+            $sortedQueryStringTmp .= "&" . $this->encode($key) . "=" . $this->encode($value);
+        }
+
+        $stringToSign = "GET&%2F&" . $this->encode(substr($sortedQueryStringTmp, 1));
+
+        $sign = base64_encode(hash_hmac("sha1", $stringToSign, $accessKeySecret . "&",true));
+
+        $signature = $this->encode($sign);
+
+        $url = ($security ? 'https' : 'http')."://{$domain}/?Signature={$signature}{$sortedQueryStringTmp}";
+
+        try {
+            $content = $this->fetchContent($url);
+            return $content;
+        } catch( \Exception $e) {
+            return false;
+        }
+    }
+
+    private function encode($str)
+    {
+        $res = urlencode($str);
+        $res = preg_replace("/\+/", "%20", $res);
+        $res = preg_replace("/\*/", "%2A", $res);
+        $res = preg_replace("/%7E/", "~", $res);
+        return $res;
+    }
+
+    private function fetchContent($url) {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+            "x-sdk-client" => "php/2.0.0"
+        ));
+
+        if(substr($url, 0,5) == 'https') {
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+        }
+
+        $rtn = curl_exec($ch);
+
+        if($rtn === false) {
+            trigger_error("[CURL_" . curl_errno($ch) . "]: " . curl_error($ch), E_USER_ERROR);
+        }
+        curl_close($ch);
+
+        return $rtn;
+    }
+}

+ 95 - 0
include/chajian/arrayChajian.php

@@ -0,0 +1,95 @@
+<?php 
+/**
+	数组操作
+*/
+class arrayChajian extends Chajian{
+	/**
+		二维数组排序
+	*/
+	public function order($arr, $field, $tyee='desc')
+	{
+		$temp_a = array();
+		foreach ($arr as $arrs) {
+			$temp_a[] = $arrs[$field];
+		}
+		$tyee	= strtolower($tyee);
+		if($tyee == 'desc'){
+			array_multisort($temp_a, SORT_DESC, $arr);
+		}else{
+			array_multisort($temp_a, SORT_ASC, $arr);
+		}
+		return $arr;
+	}
+	
+	/**
+		转换为用数字做的键值
+	*/
+	public function tonumarray($arr, $otarr='')
+	{
+		$varr=array();
+		if(is_array($otarr))$varr[]=$otarr;
+		if(is_array($arr)){
+			foreach($arr as $da){
+				$key = array_keys($da);
+				$zarr=array();
+				for($i=0;$i<count($key);$i++)$zarr[$i]=$da[$key[$i]];
+				$varr[]=$zarr;
+			}			
+		}
+		return $varr;
+	}
+	
+	/**
+		$str  转化为 数组 0|昨天,2|d
+	*/
+	public function strtoarray($str)
+	{
+		$a	= explode(',', $str);
+		$arr= array();
+		foreach($a as $a1){
+			$a2	= explode('|', $a1);
+			$k 	= $a2[0];
+			$v 	= $a2[0];
+			$c	= '';
+			if(isset($a2[1]))$v = $a2[1];
+			if(isset($a2[2]))$c = $a2[2];
+			$arr[] = array($k, $v, $c);
+		}
+		return $arr;
+	}
+	
+	/**
+		$str  转化为 数组对象 0|昨天,2|d
+	*/
+	public function strtoobject($str)
+	{
+		$rowa = $this->strtoarray($str);
+		$arr  = array();
+		foreach($rowa as $k=>$rs){
+			$arr[$rs[0]] = $rs[1];
+		}
+		return $arr;
+	}
+	
+	/**
+		[{}]数组转化为{ke1:ke2}
+	*/
+	public function arrrytoobject($arr, $lx=0)
+	{
+		$rows = array();
+		foreach($arr as $k=>$da){
+			$karr 	= array_keys($da);
+			$key	= $da[$karr[0]];
+			$nav	= $key;
+			if(count($karr)>1){
+				$nav = $da[$karr[1]];
+			}
+			if($lx == 1){
+				$rows[$key] = $da;
+			}else{
+				$rows[$key] = $nav;
+			}
+		}
+		return $rows;
+	}
+}                                                                                                                                                            

+ 123 - 0
include/chajian/cacheChajian.php

@@ -0,0 +1,123 @@
+<?php 
+/**
+*	缓存,目前是使用磁盘文件存储
+*/
+class cacheChajian extends Chajian{
+	
+	private $dirvie = 'file'; //redis,file
+	
+	/**
+	*	设置缓存
+	* 	$time 缓存时间(秒)
+	*/
+	public function set($key, $data, $time=0)
+	{
+		$this->del($key); //删除原来的
+		$sarr['key']  = $this->getkey($key);
+		$sarr['data'] = $data;
+		if($time>0){
+			$time = time()+$time;
+		}else{
+			$time = 0;
+		}
+		$sarr['time'] = $time;
+		if($time>0)$sarr['timedt'] = date('Y-m-d H:i:s', $time);
+		$sarr['url']  = $this->rock->nowurl();
+		$this->delexpire();
+		return $this->rock->createtxt($this->getpath($key, $time, 1), json_encode($sarr));
+	}
+	
+	private function getkey($key)
+	{
+		return ''.QOM.''.$key.'';
+	}
+	
+	private function getpath($key, $time=0, $lx=0)
+	{
+		$key = $this->getkey($key);
+		$ske = '';
+		if($time>0)$ske='_'.$time.'';
+		
+		if($lx==0)return ''.ROOT_PATH.'/'.UPDIR.'/cache/'.md5($key).''.$ske.'';
+		return ''.UPDIR.'/cache/'.md5($key).''.$ske.'';
+	}
+	
+	//获取文件名
+	private function getpaths($key)
+	{
+		$key = $this->getkey($key);
+		$file= ''.ROOT_PATH.'/'.UPDIR.'/cache/'.md5($key).'';
+		$bar = glob(''.$file.'*');
+		if(is_array($bar))foreach($bar as $k=>$fil1){
+			if($k==0){
+				$file = $fil1;
+			}else{
+				unlink($fil1);
+			}
+		}
+		return $file;
+	}
+	
+	/**
+	*	获取缓存
+	*/
+	public function get($key, $dev='')
+	{
+		$file= $this->getpaths($key);
+		$data= $dev;
+		if(file_exists($file)){
+			$filea= explode('_', $file);
+			$time = (int)arrvalue($filea, count($filea)-1,'0');
+			if($time==0 || $time>=time()){
+				$cont = file_get_contents($file);
+				if(!isempt($cont)){
+					$sarr = json_decode($cont, true);
+					$data = arrvalue($sarr, 'data');
+				}
+			}else{
+				unlink($file); //已经过期了
+			}
+		}
+		return $data;
+	}
+	
+	/**
+	*	删除缓存
+	*/
+	public function del($key)
+	{
+		$file= $this->getpaths($key);
+		if(file_exists($file))@unlink($file);
+		return true;
+	}
+	
+	/**
+	*	删除所有缓存
+	*/
+	public function delall()
+	{
+		$bar = glob(''.ROOT_PATH.'/'.UPDIR.'/cache/*');
+		foreach($bar as $k=>$fil1){
+			unlink($fil1);
+		}
+	}
+	
+	/**
+	*	删除过期的缓存
+	*/
+	public function delexpire()
+	{
+		$bar = glob(''.ROOT_PATH.'/'.UPDIR.'/cache/*');
+		$time= time();
+		foreach($bar as $k=>$fil1){
+			if(contain($fil1,'_')){
+				$fil11 = substr($fil1, strripos($fil1, '_')+1);
+				if(is_numeric($fil11)){
+					if($fil11<$time){
+						unlink($fil1);
+					}
+				}
+			}
+		}
+	}
+}                               

+ 247 - 0
include/chajian/calendarChajian.php

@@ -0,0 +1,247 @@
+<?php 
+class calendarChajian extends Chajian{
+
+	//农历每月的天数
+    private $everyCMonth=array(
+    0=>array(8,0,0,0,0,0,0,0,0,0,0,0,29,30,7,1),
+    1=>array(0,29,30,29,29,30,29,30,29,30,30,30,29,0,8,2),
+    2=>array(0,30,29,30,29,29,30,29,30,29,30,30,30,0,9,3),
+    3=>array(5,29,30,29,30,29,29,30,29,29,30,30,29,30,10,4),
+    4=>array(0,30,30,29,30,29,29,30,29,29,30,30,29,0,1,5),
+    5=>array(0,30,30,29,30,30,29,29,30,29,30,29,30,0,2,6),
+    6=>array(4,29,30,30,29,30,29,30,29,30,29,30,29,30,3,7),
+    7=>array(0,29,30,29,30,29,30,30,29,30,29,30,29,0,4,8),
+    8=>array(0,30,29,29,30,30,29,30,29,30,30,29,30,0,5,9),
+    9=>array(2,29,30,29,29,30,29,30,29,30,30,30,29,30,6,10),
+    10=>array(0,29,30,29,29,30,29,30,29,30,30,30,29,0,7,11),
+    11=>array(6,30,29,30,29,29,30,29,29,30,30,29,30,30,8,12),
+    12=>array(0,30,29,30,29,29,30,29,29,30,30,29,30,0,9,1),
+    13=>array(0,30,30,29,30,29,29,30,29,29,30,29,30,0,10,2),
+    14=>array(5,30,30,29,30,29,30,29,30,29,30,29,29,30,1,3),
+    15=>array(0,30,29,30,30,29,30,29,30,29,30,29,30,0,2,4),
+    16=>array(0,29,30,29,30,29,30,30,29,30,29,30,29,0,3,5),
+    17=>array(2,30,29,29,30,29,30,30,29,30,30,29,30,29,4,6),
+    18=>array(0,30,29,29,30,29,30,29,30,30,29,30,30,0,5,7),
+    19=>array(7,29,30,29,29,30,29,29,30,30,29,30,30,30,6,8),
+    20=>array(0,29,30,29,29,30,29,29,30,30,29,30,30,0,7,9),
+    21=>array(0,30,29,30,29,29,30,29,29,30,29,30,30,0,8,10),
+    22=>array(5,30,29,30,30,29,29,30,29,29,30,29,30,30,9,11),
+    23=>array(0,29,30,30,29,30,29,30,29,29,30,29,30,0,10,12),
+    24=>array(0,29,30,30,29,30,30,29,30,29,30,29,29,0,1,1),
+    25=>array(4,30,29,30,29,30,30,29,30,30,29,30,29,30,2,2),
+    26=>array(0,29,29,30,29,30,29,30,30,29,30,30,29,0,3,3),
+    27=>array(0,30,29,29,30,29,30,29,30,29,30,30,30,0,4,4),
+    28=>array(2,29,30,29,29,30,29,29,30,29,30,30,30,30,5,5),
+    29=>array(0,29,30,29,29,30,29,29,30,29,30,30,30,0,6,6),
+    30=>array(6,29,30,30,29,29,30,29,29,30,29,30,30,29,7,7),
+    31=>array(0,30,30,29,30,29,30,29,29,30,29,30,29,0,8,8),
+    32=>array(0,30,30,30,29,30,29,30,29,29,30,29,30,0,9,9),
+    33=>array(5,29,30,30,29,30,30,29,30,29,30,29,29,30,10,10),
+    34=>array(0,29,30,29,30,30,29,30,29,30,30,29,30,0,1,11),
+    35=>array(0,29,29,30,29,30,29,30,30,29,30,30,29,0,2,12),
+    36=>array(3,30,29,29,30,29,29,30,30,29,30,30,30,29,3,1),
+    37=>array(0,30,29,29,30,29,29,30,29,30,30,30,29,0,4,2),
+    38=>array(7,30,30,29,29,30,29,29,30,29,30,30,29,30,5,3),
+    39=>array(0,30,30,29,29,30,29,29,30,29,30,29,30,0,6,4),
+    40=>array(0,30,30,29,30,29,30,29,29,30,29,30,29,0,7,5),
+    41=>array(6,30,30,29,30,30,29,30,29,29,30,29,30,29,8,6),
+    42=>array(0,30,29,30,30,29,30,29,30,29,30,29,30,0,9,7),
+    43=>array(0,29,30,29,30,29,30,30,29,30,29,30,29,0,10,8),
+    44=>array(4,30,29,30,29,30,29,30,29,30,30,29,30,30,1,9),
+    45=>array(0,29,29,30,29,29,30,29,30,30,30,29,30,0,2,10),
+    46=>array(0,30,29,29,30,29,29,30,29,30,30,29,30,0,3,11),
+    47=>array(2,30,30,29,29,30,29,29,30,29,30,29,30,30,4,12),
+    48=>array(0,30,29,30,29,30,29,29,30,29,30,29,30,0,5,1),
+    49=>array(7,30,29,30,30,29,30,29,29,30,29,30,29,30,6,2),
+    50=>array(0,29,30,30,29,30,30,29,29,30,29,30,29,0,7,3),
+    51=>array(0,30,29,30,30,29,30,29,30,29,30,29,30,0,8,4),
+    52=>array(5,29,30,29,30,29,30,29,30,30,29,30,29,30,9,5),
+    53=>array(0,29,30,29,29,30,30,29,30,30,29,30,29,0,10,6),
+    54=>array(0,30,29,30,29,29,30,29,30,30,29,30,30,0,1,7),
+    55=>array(3,29,30,29,30,29,29,30,29,30,29,30,30,30,2,8),
+    56=>array(0,29,30,29,30,29,29,30,29,30,29,30,30,0,3,9),
+    57=>array(8,30,29,30,29,30,29,29,30,29,30,29,30,29,4,10),
+    58=>array(0,30,30,30,29,30,29,29,30,29,30,29,30,0,5,11),
+    59=>array(0,29,30,30,29,30,29,30,29,30,29,30,29,0,6,12),
+    60=>array(6,30,29,30,29,30,30,29,30,29,30,29,30,29,7,1),
+    61=>array(0,30,29,30,29,30,29,30,30,29,30,29,30,0,8,2),
+    62=>array(0,29,30,29,29,30,29,30,30,29,30,30,29,0,9,3),
+    63=>array(4,30,29,30,29,29,30,29,30,29,30,30,30,29,10,4),
+    64=>array(0,30,29,30,29,29,30,29,30,29,30,30,30,0,1,5),
+    65=>array(0,29,30,29,30,29,29,30,29,29,30,30,29,0,2,6),
+    66=>array(3,30,30,30,29,30,29,29,30,29,29,30,30,29,3,7),
+    67=>array(0,30,30,29,30,30,29,29,30,29,30,29,30,0,4,8),
+    68=>array(7,29,30,29,30,30,29,30,29,30,29,30,29,30,5,9),
+    69=>array(0,29,30,29,30,29,30,30,29,30,29,30,29,0,6,10),
+    70=>array(0,30,29,29,30,29,30,30,29,30,30,29,30,0,7,11),
+    71=>array(5,29,30,29,29,30,29,30,29,30,30,30,29,30,8,12),
+    72=>array(0,29,30,29,29,30,29,30,29,30,30,29,30,0,9,1),
+    73=>array(0,30,29,30,29,29,30,29,29,30,30,29,30,0,10,2),
+    74=>array(4,30,30,29,30,29,29,30,29,29,30,30,29,30,1,3),
+    75=>array(0,30,30,29,30,29,29,30,29,29,30,29,30,0,2,4),
+    76=>array(8,30,30,29,30,29,30,29,30,29,29,30,29,30,3,5),
+    77=>array(0,30,29,30,30,29,30,29,30,29,30,29,29,0,4,6),
+    78=>array(0,30,29,30,30,29,30,30,29,30,29,30,29,0,5,7),
+    79=>array(6,30,29,29,30,29,30,30,29,30,30,29,30,29,6,8),
+    80=>array(0,30,29,29,30,29,30,29,30,30,29,30,30,0,7,9),
+    81=>array(0,29,30,29,29,30,29,29,30,30,29,30,30,0,8,10),
+    82=>array(4,30,29,30,29,29,30,29,29,30,29,30,30,30,9,11),
+    83=>array(0,30,29,30,29,29,30,29,29,30,29,30,30,0,10,12),
+    84=>array(10,30,29,30,30,29,29,30,29,29,30,29,30,30,1,1),
+    85=>array(0,29,30,30,29,30,29,30,29,29,30,29,30,0,2,2),
+    86=>array(0,29,30,30,29,30,30,29,30,29,30,29,29,0,3,3),
+    87=>array(6,30,29,30,29,30,30,29,30,30,29,30,29,29,4,4),
+    88=>array(0,30,29,30,29,30,29,30,30,29,30,30,29,0,5,5),
+    89=>array(0,30,29,29,30,29,29,30,30,29,30,30,30,0,6,6),
+    90=>array(5,29,30,29,29,30,29,29,30,29,30,30,30,30,7,7),
+    91=>array(0,29,30,29,29,30,29,29,30,29,30,30,30,0,8,8),
+    92=>array(0,29,30,30,29,29,30,29,29,30,29,30,30,0,9,9),
+    93=>array(3,29,30,30,29,30,29,30,29,29,30,29,30,29,10,10),
+    94=>array(0,30,30,30,29,30,29,30,29,29,30,29,30,0,1,11),
+    95=>array(8,29,30,30,29,30,29,30,30,29,29,30,29,30,2,12),
+    96=>array(0,29,30,29,30,30,29,30,29,30,30,29,29,0,3,1),
+    97=>array(0,30,29,30,29,30,29,30,30,29,30,30,29,0,4,2),
+    98=>array(5,30,29,29,30,29,29,30,30,29,30,30,29,30,5,3),
+    99=>array(0,30,29,29,30,29,29,30,29,30,30,30,29,0,6,4),
+    100=>array(0,30,30,29,29,30,29,29,30,29,30,30,29,0,7,5),
+    101=>array(4,30,30,29,30,29,30,29,29,30,29,30,29,30,8,6),
+    102=>array(0,30,30,29,30,29,30,29,29,30,29,30,29,0,9,7),
+    103=>array(0,30,30,29,30,30,29,30,29,29,30,29,30,0,10,8),
+    104=>array(2,29,30,29,30,30,29,30,29,30,29,30,29,30,1,9),
+    105=>array(0,29,30,29,30,29,30,30,29,30,29,30,29,0,2,10),
+    106=>array(7,30,29,30,29,30,29,30,29,30,30,29,30,30,3,11),
+    107=>array(0,29,29,30,29,29,30,29,30,30,30,29,30,0,4,12),
+    108=>array(0,30,29,29,30,29,29,30,29,30,30,29,30,0,5,1),
+    109=>array(5,30,30,29,29,30,29,29,30,29,30,29,30,30,6,2),
+    110=>array(0,30,29,30,29,30,29,29,30,29,30,29,30,0,7,3),
+    111=>array(0,30,29,30,30,29,30,29,29,30,29,30,29,0,8,4),
+    112=>array(4,30,29,30,30,29,30,29,30,29,30,29,30,29,9,5),
+    113=>array(0,30,29,30,29,30,30,29,30,29,30,29,30,0,10,6),
+    114=>array(9,29,30,29,30,29,30,29,30,30,29,30,29,30,1,7),
+    115=>array(0,29,30,29,29,30,29,30,30,30,29,30,29,0,2,8),
+    116=>array(0,30,29,30,29,29,30,29,30,30,29,30,30,0,3,9),
+    117=>array(6,29,30,29,30,29,29,30,29,30,29,30,30,30,4,10),
+    118=>array(0,29,30,29,30,29,29,30,29,30,29,30,30,0,5,11),
+    119=>array(0,30,29,30,29,30,29,29,30,29,29,30,30,0,6,12),
+    120=>array(4,29,30,30,30,29,30,29,29,30,29,30,29,30,7,1)
+    );
+//农历天干
+    private $mten=array("null","甲","乙","丙","丁","戊","己","庚","辛","壬","癸");    //农历地支
+    private $mtwelve=array("null","子(鼠)","丑(牛)","寅(虎)","卯(兔)","辰(龙)",
+                   "巳(蛇)","午(马)","未(羊)","申(猴)","酉(鸡)","戌(狗)","亥(猪)");    //农历月份
+    private $mmonth=array("闰","正","二","三","四","五","六",
+                  "七","八","九","十","十一","十二","月");
+    private $mday=array("null","初一","初二","初三","初四","初五","初六","初七","初八","初九","初十",
+                "十一","十二","十三","十四","十五","十六","十七","十八","十九","二十",
+                "廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十");//农历日
+//赋给初值
+//天干地支
+    private $ten=0;
+    private $twelve=0;
+    private function MyPub($cYear,$cMonth,$cDay)
+    {
+        $total=11;//阳历总天数 至1900年12月21日  
+        $mtotal=0;//阴历总天数
+        for ($y=1901;$y<$cYear;$y++)
+        {
+            $total+=365;
+            if ($y%4==0) $total ++;
+        }
+        //再加当年的几个月
+        switch ($cMonth){
+                 case 12:
+                      $total+=30;
+                 case 11:
+                      $total+=31;
+                 case 10:
+                      $total+=30;
+                 case 9:
+                      $total+=31;
+                 case 8:
+                      $total+=31;
+                 case 7:
+                      $total+=30;
+                 case 6:
+                      $total+=31;
+                 case 5:
+                      $total+=30;
+                 case 4:
+                      $total+=31;
+                 case 3:
+                      $total+=28;
+                 case 2:
+                      $total+=31;
+               }
+ 
+            //如果当年是闰年还要加一天
+            if ($cYear%4==0 and $cMonth>2)
+            {
+                $total++;
+            }
+            $total+=$cDay-1;
+			$flag = 0;
+            //用农历的天数累加来判断是否超过阳历的天数
+            for($j=0;$j<=120;$j++)
+            {
+                $i=1;
+                for($i=1;$i<=13;$i++)
+                {
+                    $mtotal+=$this->everyCMonth[$j][$i];
+                    if ($mtotal>=$total)
+                    {
+                        $flag=1;
+                        break;
+                    }
+                }
+                if ($flag==1)break;
+            }
+                    return array("m"=>$j,"d"=>$i,"t"=>$total,"n"=>$mtotal);
+    }
+    public function Cal($Year,$Month,$Day)
+    {
+        $Par=$this->MyPub($Year,$Month,$Day);
+ 
+        $md=$this->everyCMonth[$Par["m"]][$Par["d"]]-($Par["n"]-$Par["t"]);
+        $week=($Par["t"]+5)%7;
+        if ($this->everyCMonth[$Par["m"]][0]<>0 and $this->everyCMonth[$Par["m"]][0]<$Par["d"])
+        {
+                $mm=$Par["d"]-1;
+        }else{
+                $mm=$Par["d"];
+        }
+        if ($Par["d"]==$this->everyCMonth[$Par["d"]][0]+1 and $this->everyCMonth[$Par["d"]][0]<>0)
+        {
+            $cMonth=$this->mmonth[0].$this->mmonth[$mm];//闰月
+        }else{
+            $cMonth=$this->mmonth[$mm].$this->mmonth[13];
+        }
+		$mmd 	= ($mm<10)?  '0'.$mm.'' : $mm;
+		$mdd 	= ($md<10)?  '0'.$md.'' : $md;
+        return array("year"=>$this->mten[$this->everyCMonth[$Par["m"]][14]].$this->mtwelve[$this->everyCMonth[$Par["m"]][15]],
+                    "month"	=>$cMonth,
+                    "day"	=>$this->mday[$md],
+                    "week"	=>$week,
+                    "m"		=>$mm,
+                    'd'		=>$md,
+					'cal' 	=> ''.$mmd.'-'.$mdd.''
+		);
+    }
+	public function toCalday($dt)
+	{
+		$dts = explode('-', $dt);
+		return $this->Cal((int)$dts[0],(int)$dts[1],(int)$dts[2]);
+	}
+	
+	public function daytocal($dt)
+	{
+		$dts = explode('-', $dt);
+		$mm  = (int)$dts[1];
+		$md  = (int)$dts[2];
+		$my  = (int)$dts[0];
+		return array(
+			'year'	=> $my,
+			'month' => $this->mmonth[$mm],
+			'day' 	=> $this->mday[$md],
+		);
+	}
+}

+ 0 - 0
include/chajian/checkChajian.php


Неке датотеке нису приказане због велике количине промена