Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
holan20180123 committed May 9, 2022
0 parents commit 4f9a36d
Show file tree
Hide file tree
Showing 244 changed files with 46,936 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
config/my.php
www/data/
release/*
tmp/extensions/*
tmp/log/*
tmp/model/*
tmp/cache/*
tmp/extension/*
.gitkeep
27 changes: 27 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Add support for PATH_INFO method.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)$ index.php/$1 [L]
</IfModule>

# Set expires for static files.
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType application/javascript A2592000
ExpiresByType application/x-shockwave-flash A2592000
ExpiresByType text/css A604800
</IfModule>

# Deflate static files.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>

# Turn off FileEtag.
FileEtag none
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
VERSION=$(shell head -n 1 VERSION)

all: zip

clean:
rm -fr *-stamp
rm -fr debian/zentaophp
rm -fr zentaoPHP-*.tgz
rm -fr package.xml
rm -fr ztphp*
rm -fr *.zip
rm -fr zentaophp
rm -fr ztphpapi
pear:
cp app/cli/ztphp.sh ./ztphp
cp app/cli/ztphp.bat ./ztphp.bat
cp package/pear/package.xml .
pear package

pear-install:
sudo pear uninstall zentaophp
sudo pear install zentaoPHP*.tgz

deb:
dpkg-buildpackage -rfakeroot

zip:
mkdir zentaophp
cp -fr {config,db,favicon.ico,framework,index.php,js,lib,module,theme,.htaccess} zentaophp
rm -fr zentaophp/config/my.php
rm -fr zentaophp/framework/tests
rm -fr zentaophp/config/sites/*
rm -fr zentaophp/config/domain.php
mkdir zentaophp/tmp/log -p
chmod 777 -R zentaophp/tmp/log
find zentaophp -name .git |xargs rm -fr
zip -r -9 zentaoPHP.$(VERSION).zip zentaophp
rm -fr zentaophp
ztphpdoc:
phpdoc -d framework,lib -t ztphpapi -o HTML:frames:phphtmllib -ti "zentaophp framework help" -s on -pp on -i *test*
phpdoc -d framework,lib -t ztphpapi.chm -o chm:default:default -ti "zentaophp framework help" -s on -pp on -i *test*
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
117 changes: 117 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php
/**
* ZenTaoPHP的config文件。如果更改配置,不要直接修改该文件,复制到my.php修改相应的值。
* The config file of zentaophp. Don't modify this file directly, copy the item to my.php and change it.
*
* The author disclaims copyright to this source code. In place of
* a legal notice, here is a blessing:
*
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
*/

/* 保证在命令行环境也能运行。Make sure to run in ztcli env. */
if(!class_exists('config')){class config{}}
if(!function_exists('getWebRoot')){function getWebRoot(){}}

/* 基本设置。Basic settings. */
$config->version = '3.1'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it.
$config->charset = 'UTF-8'; // ZenTaoPHP的编码。 The encoding of ZenTaoPHP.
$config->cookieLife = time() + 2592000; // Cookie的生存时间。The cookie life time.
$config->timezone = 'Asia/Shanghai'; // 时区设置。 The time zone setting, for more see http://www.php.net/manual/en/timezones.php.
$config->webRoot = ''; // URL根目录。 The root path of the url.
$config->debug = 2;

/* 框架路由相关设置。Routing settings. */
$config->requestType = 'PATH_INFO'; // 请求类型:PATH_INFO|PATHINFO2|GET。 The request type: PATH_INFO|PATH_INFO2|GET.
$config->requestFix = '-'; // PATH_INFO和PATH_INFO2模式的分隔符。 The divider in the url when PATH_INFO|PATH_INFO2.
$config->moduleVar = 'm'; // 请求类型为GET:模块变量名。 requestType=GET: the module var name.
$config->methodVar = 'f'; // 请求类型为GET:模块变量名。 requestType=GET: the method var name.
$config->viewVar = 't'; // 请求类型为GET:视图变量名。 requestType=GET: the view var name.
$config->sessionVar = 'sid'; // 请求类型为GET:session变量名。 requestType=GET: the session var name.
$config->views = ',html,json,mhtml,'; // 支持的视图类型。 Supported view formats.

/* 支持的主题和语言。Supported thems and languages. */
$config->themes['default'] = 'default';
$config->langs['zh-cn'] = '简体';
$config->langs['zh-tw'] = '繁体';
$config->langs['en'] = 'English';

/* 设备类型视图文件前缀。The prefix for view file for different device. */
$config->devicePrefix['mhtml'] = 'm.';

/* 默认值设置。Default settings. */
$config->default = new stdclass();
$config->default->view = 'html'; //默认视图。 Default view.
$config->default->lang = 'zh-cn'; //默认语言。 Default language.
$config->default->theme = 'default'; //默认主题。 Default theme.
$config->default->module = 'index'; //默认模块。 Default module.
$config->default->method = 'index'; //默认方法。 Default method.

/* 数据库设置。Database settings. */
$config->db = new stdclass();
$config->slaveDB = new stdclass();
$config->db->persistant = false; // 是否为持续连接。 Pconnect or not.
$config->db->driver = 'mysql'; // 目前只支持MySQL数据库。Must be MySQL. Don't support other database server yet.
$config->db->encoding = 'UTF8'; // 数据库编码。 Encoding of database.
$config->db->strictMode = false; // 关闭MySQL的严格模式。 Turn off the strict mode of MySQL.
$config->db->prefix = ''; // 数据库表名前缀。 The prefix of the table name.
$config->slaveDB->persistant = false;
$config->slaveDB->driver = 'mysql';
$config->slaveDB->encoding = 'UTF8';
$config->slaveDB->strictMode = false;

/* 可用域名后缀列表。Domain postfix lists. */
$config->domainPostfix = "|com|com.cn|com.hk|com.tw|com.vc|edu.cn|es|";
$config->domainPostfix .= "|eu|fm|gov.cn|gs|hk|im|in|info|jp|kr|la|me|";
$config->domainPostfix .= "|mobi|my|name|net|net.cn|org|org.cn|pk|pro|";
$config->domainPostfix .= "|sg|so|tel|tk|to|travel|tv|tw|uk|us|ws|";
$config->domainPostfix .= "|ac.cn|bj.cn|sh.cn|tj.cn|cq.cn|he.cn|sn.cn|";
$config->domainPostfix .= "|sx.cn|nm.cn|ln.cn|jl.cn|hl.cn|js.cn|zj.cn|";
$config->domainPostfix .= "|ah.cn|fj.cn|jx.cn|sd.cn|ha.cn|hb.cn|hn.cn|";
$config->domainPostfix .= "|gd.cn|gx.cn|hi.cn|sc.cn|gz.cn|yn.cn|gs.cn|pub|pw|";
$config->domainPostfix .= "|qh.cn|nx.cn|xj.cn|tw.cn|hk.cn|mo.cn|xz.cn|xyz|wang|";
$config->domainPostfix .= "|ae|asia|biz|cc|cd|cm|cn|co|co.jp|co.kr|co.uk|";
$config->domainPostfix .= "|top|ren|club|space|tm|website|cool|company|city|email|";
$config->domainPostfix .= "|market|software|ninja|bike|today|life|co.il|io|";
$config->domainPostfix .= "|mn|ph|ps|tl|uz|vn|co.nz|cz|gg|gl|gr|je|md|me.uk|org.uk|pl|si|sx|vg|ag|";
$config->domainPostfix .= "|bz|cl|ec|gd|gy|ht|lc|ms|mx|pe|tc|vc|ac|bi|mg|mu|sc|as|com.sb|cx|ki|nf|sh|";
$config->domainPostfix .= "|rocks|social|co.com|bio|reviews|link|sexy|us.com|consulting|moda|desi|";
$config->domainPostfix .= "|menu|info|events|webcam|dating|vacations|flights|cruises|global|ca|guru|";
$config->domainPostfix .= "|futbol|rentals|dance|lawyer|attorney|democrat|republican|actor|condos|immobilien|";
$config->domainPostfix .= "|villas|foundation|expert|works|tools|watch|zone|bargains|agency|best|solar|";
$config->domainPostfix .= "|farm|pics|photo|marketing|holiday|gift|buzz|guitars|trade|construction|";
$config->domainPostfix .= "|international|house|coffee|florist|rich|ceo|camp|education|repair|win|site|";

/* 系统框架配置。Framework settings. */
$config->framework = new stdclass();
$config->framework->autoConnectDB = true; // 是否自动连接数据库。 Whether auto connect database or not.
$config->framework->multiLanguage = true; // 是否启用多语言功能。 Whether enable multi lanuage or not.
$config->framework->multiTheme = false; // 是否启用多风格功能。 Whether enable multi theme or not.
$config->framework->multiSite = false; // 是否启用多站点模式。 Whether enable multi site mode or not.
$config->framework->extensionLevel = 0; // 0=>无扩展,1=>公共扩展,2=>站点扩展 0=>no extension, 1=> common extension, 2=> every site has it's extension.
$config->framework->jsWithPrefix = true; // js::set()输出的时候是否增加前缀。 When us js::set(), add prefix or not.
$config->framework->filterBadKeys = true; // 是否过滤不合要求的键值。 Whether filter bad keys or not.
$config->framework->filterTrojan = true; // 是否过滤木马攻击代码。 Whether strip trojan code or not.
$config->framework->filterXSS = true; // 是否过滤XSS攻击代码。 Whether strip xss code or not.
$config->framework->filterParam = 2; // 1=>默认过滤,2=>开启过滤参数功能。0=>default filter 2=>Whether strip param.
$config->framework->purifier = true; // 是否对数据做purifier处理。 Whether purifier data or not.
$config->framework->logDays = 14; // 日志文件保存的天数。 The days to save log files.

$config->framework->detectDevice['zh-cn'] = false; // 在zh-cn语言情况下,是否启用设备检测功能。 Whether enable device detect or not.
$config->framework->detectDevice['zh-tw'] = false; // 在zh-tw语言情况下,是否启用设备检测功能。 Whether enable device detect or not.
$config->framework->detectDevice['en'] = false; // 在en语言情况下,是否启用设备检测功能。 Whether enable device detect or not.

/* 文件上传设置。 Upload settings. */
$config->file = new stdclass();
$config->file->dangers = 'php,php3,php4,phtml,php5,jsp,py,rb,asp,aspx,ashx,asa,cer,cdx,aspl,shtm,shtml,html,htm';
$config->file->allowed = 'txt,doc,docx,dot,wps,wri,pdf,ppt,xls,xlsx,ett,xlt,xlsm,csv,jpg,jpeg,png,psd,gif,ico,bmp,swf,avi,rmvb,rm,mp3,mp4,3gp,flv,mov,movie,rar,zip,bz,bz2,tar,gz';

/* 配置参数过滤。Filter param settings. */
$filterConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'filter.php';
if(file_exists($filterConfig)) include $filterConfig;

/* 引用自定义的配置。 Include the custom config file. */
$myConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'my.php';
if(file_exists($myConfig)) include $myConfig;
23 changes: 23 additions & 0 deletions config/filter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
$filter = new stdclass();
$filter->rules = new stdclass();
$filter->rules->md5 = '/^[a-z0-9]{32}$/';
$filter->rules->base64 = '/^[a-zA-Z0-9\+\/\=]+$/';
$filter->rules->checked = '/^[0-9,]+$/';
$filter->rules->idList = '/^[0-9\|]+$/';
$filter->rules->lang = '/^[a-zA-Z_\-]+$/';
$filter->rules->any = '/./';
$filter->rules->number = '/^[0-9]+$/';
$filter->rules->orderBy = '/^\w+_(desc|asc)$/i';
$filter->rules->word = '/^\w+$/';
$filter->rules->paramName = '/^[a-zA-Z0-9_\.]+$/';
$filter->rules->paramValue = '/^[a-zA-Z0-9=_\-]+$/';

$filter->default = new stdclass();
$filter->default->moduleName = 'code';
$filter->default->methodName = 'code';
$filter->default->paramName = 'reg::paramName';
$filter->default->paramValue = 'reg::paramValue';

$filter->default->get['onlybody'] = 'equal::yes';
$filter->default->get['HTTP_X_REQUESTED_WITH'] = 'equal::XMLHttpRequest';
34 changes: 34 additions & 0 deletions config/my.example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
$config->installed = true;
$config->debug = true;
$config->requestType = 'GET';
$config->requestFix = '-';
$config->webRoot = '/';

$config->db->host = 'localhost';
$config->db->port = '3306';
$config->db->name = 'demo';
$config->db->user = 'root';
$config->db->password = '';

/* 如果需要配置主从数据库,取消注释即可。To use master and slave database feature, uncomment this. */

//$config->slaveDB->host = 'localhost';
//$config->slaveDB->port = '3306';
//$config->slaveDB->name = 'demo';
//$config->slaveDB->user = 'root';
//$config->slaveDB->password = '';

/* 框架功能开关参数。Use these params to enable or disable some features of framework. */
$config->framework->autoConnectDB = true; // 是否自动连接数据库。 Whether auto connect database or not.
$config->framework->multiLanguage = true; // 是否启用多语言功能。 Whether enable multi lanuage or not.
$config->framework->multiTheme = false; // 是否启用多风格功能。 Whether enable multi theme or not.
$config->framework->detectDevice = false; // 是否启用设备检测功能。 Whether enable device detect or not.
$config->framework->multiSite = false; // 是否启用多站点模式。 Whether enable multi site mode or not.
$config->framework->extensionLevel= 0; // 0=>无扩展,1=>公共扩展,2=>站点扩展 0=>no extension, 1=> common extension, 2=> every site has it's extension.
$config->framework->jsWithPrefix = true; // js::set()输出的时候是否增加前缀。 When us js::set(), add prefix or not.
$config->framework->filterBadKeys = true; // 是否过滤不合要求的键值。 Whether filter bad keys or not.
$config->framework->filterTrojan = true; // 是否过滤木马攻击代码。 Whether strip trojan code or not.
$config->framework->filterXSS = true; // 是否过滤XSS攻击代码。 Whether strip xss code or not.
$config->framework->purifier = true; // 是否对数据做purifier处理。 Whether purifier data or not.
$config->framework->logDays = 14; // 日志文件保存的天数。 The days to save log files.
7 changes: 7 additions & 0 deletions db/blog.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS `blog` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`title` char(120) NOT NULL,
`content` text NOT NULL,
`date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Binary file added favicon.ico
Binary file not shown.
Loading

0 comments on commit 4f9a36d

Please sign in to comment.