4
.gitattributes
vendored
|
|
@ -2,7 +2,5 @@
|
|||
.gitignore export-ignore
|
||||
/tools/ export-ignore
|
||||
/tests/ export-ignore
|
||||
/phpDoc/ export-ignore
|
||||
Gruntfile.js export-ignore
|
||||
package.json export-ignore
|
||||
.travis.yml export-ignore
|
||||
.travis.yml export-ignore
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
common/js/jquery*.js
|
||||
common/js/modernizr.js
|
||||
common/js/xe.js
|
||||
common/js/x.js
|
||||
common/js/*.min.js
|
||||
common/js/unittest/*
|
||||
common/js/plugins/*
|
||||
common/js/foggyLayer.js
|
||||
common/js/html5.js
|
||||
68
.jshintrc
|
|
@ -1,68 +0,0 @@
|
|||
{
|
||||
"globalstrict": false,
|
||||
"undef": false,
|
||||
"eqeqeq": false,
|
||||
"browser": true,
|
||||
"devel": true,
|
||||
"jquery": true,
|
||||
"evil": true,
|
||||
"globals": {
|
||||
"window": true,
|
||||
"current_url": true,
|
||||
"exec_json": true,
|
||||
"exec_xml": true,
|
||||
"procFilter": true,
|
||||
"xe": true,
|
||||
"request_uri": true,
|
||||
"xAddEventListener": false,
|
||||
"xResizeEvent": false,
|
||||
"xScrollEvent": false,
|
||||
"xAppendChild": false,
|
||||
"xClientHeight": false,
|
||||
"xClientWidth": false,
|
||||
"xCreateElement": false,
|
||||
"xDef": false,
|
||||
"xDeleteCookie": false,
|
||||
"xDisplay": false,
|
||||
"xEvent": false,
|
||||
"xFirstChild": false,
|
||||
"xGetBodyWidth": false,
|
||||
"xGetBodyHeight": false,
|
||||
"xGetComputedStyle": false,
|
||||
"xGetCookie": false,
|
||||
"xGetElementById": false,
|
||||
"xGetElementsByAttribute": false,
|
||||
"xGetElementsByClassName": false,
|
||||
"xGetElementsByTagName": false,
|
||||
"xGetURLArguments": false,
|
||||
"xHeight": false,
|
||||
"xHex": false,
|
||||
"xHide": false,
|
||||
"xInnerHtml": false,
|
||||
"xLeft": false,
|
||||
"xMoveTo": false,
|
||||
"xName": false,
|
||||
"xNextSib": false,
|
||||
"xNum": false,
|
||||
"xOffsetLeft": false,
|
||||
"xOffsetTop": false,
|
||||
"xPad": false,
|
||||
"xPageX": false,
|
||||
"xPageY": false,
|
||||
"xParent": false,
|
||||
"xPreventDefault": false,
|
||||
"xPrevSib": false,
|
||||
"xRemoveEventListener": false,
|
||||
"xResizeTo": false,
|
||||
"xScrollLeft": false,
|
||||
"xScrollTop": false,
|
||||
"xSetCookie": false,
|
||||
"xShow": false,
|
||||
"xStr": false,
|
||||
"xTop": false,
|
||||
"xVisibility": false,
|
||||
"xWidth": false,
|
||||
"xZIndex": false,
|
||||
"xStopPropagation": false
|
||||
}
|
||||
}
|
||||
10
.travis.yml
|
|
@ -12,18 +12,16 @@ matrix:
|
|||
fast_finish: true
|
||||
sudo: false
|
||||
before_script:
|
||||
- npm install -g grunt-cli
|
||||
- npm install
|
||||
- mysql -e "CREATE DATABASE xe_test;"
|
||||
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('travis') WHERE user='travis';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
||||
- npm install grunt grunt-cli grunt-contrib-jshint grunt-contrib-csslint grunt-phplint --save-dev
|
||||
- mysql -u root -e "CREATE DATABASE rhymix"
|
||||
- mysql -u root -e "SET PASSWORD FOR 'travis'@'localhost' = PASSWORD('travis')"
|
||||
- php -S localhost:8000 &
|
||||
- if [ $(phpenv version-name) == "5.3" ]; then touch codecept.phar; fi
|
||||
- if [ $(phpenv version-name) == "5.4" ]; then wget http://codeception.com/releases/2.0.16/codecept.phar; fi
|
||||
- if [ ! -f codecept.phar ]; then wget http://codeception.com/codecept.phar; fi
|
||||
script:
|
||||
- grunt lint
|
||||
- grunt minify
|
||||
- if [ -f codecept.phar ]; then php codecept.phar build; fi
|
||||
- if [ -f codecept.phar ]; then php codecept.phar run -d --fail-fast --env travis; fi
|
||||
- grunt lint
|
||||
notifications:
|
||||
email: false
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
오래된 이슈라도 메일로 알림이 전달되므로 묻힐 염려가 없습니다.
|
||||
- 무관한 이슈에 댓글을 달지 말아 주십시오. 엉뚱한 사람에게 메일 알림이 전달됩니다.
|
||||
- 2가지 이상 서로 다른 문제가 있는 경우, 각각 이슈를 등록해 주십시오.
|
||||
- 보안 취약점은 공개적으로 언급하지 말고 devops@rhymix.org로 알려 주시면 감사하겠습니다.
|
||||
- **버그 신고 전 자신의 서버가 RhymiX의 실행 환경을 충족하는지 확인해 주십시오.**
|
||||
- PHP 5.3 미만, EUC-KR 환경, 퍼미션 오류 등은 호스팅 업체에 문의하셔야 합니다.
|
||||
- 자신의 서버 환경은 `phpinfo`를 사용하여 확인할 수 있습니다.
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
Copyright (c) RhymiX Developers and Contributors
|
||||
Copyright (c) RhymiX Developers and Contributors <devops@rhymix.org>
|
||||
Copyright (c) NAVER <http://www.navercorp.com>
|
||||
|
|
|
|||
330
Gruntfile.js
|
|
@ -1,160 +1,9 @@
|
|||
module.exports = function(grunt) {
|
||||
"use strict";
|
||||
|
||||
var banner = '/*! Copyright (C) NAVER <http://www.navercorp.com> */\n';
|
||||
var banner_xe_js = banner + '/**!\n * @concat modernizr.js + common.js + js_app.js + xml_handler.js + xml_js_filter.js\n * @brief XE Common JavaScript\n **/\n';
|
||||
|
||||
grunt.file.defaultEncoding = 'utf8';
|
||||
|
||||
grunt.initConfig({
|
||||
clean: {
|
||||
minify: [
|
||||
'common/js/xe.js',
|
||||
'common/js/xe.min.js',
|
||||
'common/css/xe.min.css',
|
||||
'common/css/mobile.min.css'
|
||||
]
|
||||
},
|
||||
concat: {
|
||||
'common-js': {
|
||||
options: {
|
||||
stripBanners: true,
|
||||
banner: banner_xe_js
|
||||
},
|
||||
src: [
|
||||
'common/js/modernizr.js',
|
||||
'common/js/common.js',
|
||||
'common/js/js_app.js',
|
||||
'common/js/xml_handler.js',
|
||||
'common/js/xml_js_filter.js'
|
||||
],
|
||||
dest: 'common/js/xe.js'
|
||||
},
|
||||
'xpresseditor': {
|
||||
options: {
|
||||
stripBanners: true,
|
||||
banner: '/**!\n * @concat Xpress_Editor.js + xe_interface.js \n **/\n'
|
||||
},
|
||||
src: [
|
||||
'modules/editor/skins/xpresseditor/js/Xpress_Editor.js',
|
||||
'modules/editor/skins/xpresseditor/js/xe_interface.js',
|
||||
],
|
||||
dest: 'modules/editor/skins/xpresseditor/js/xpresseditor.js'
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
'common-js': {
|
||||
options: {
|
||||
banner: banner_xe_js
|
||||
},
|
||||
files: {
|
||||
'common/js/xe.min.js': ['common/js/xe.js'],
|
||||
}
|
||||
},
|
||||
'common-js-plugins': {
|
||||
files: {
|
||||
'common/js/plugins/jquery.fileupload/js/main.min.js': ['common/js/plugins/jquery.fileupload/js/main.js'],
|
||||
}
|
||||
},
|
||||
'handlebars': {
|
||||
files: {
|
||||
'common/js/plugins/handlebars/handlebars.min.js': ['common/js/plugins/handlebars/handlebars.js'],
|
||||
'common/js/plugins/handlebars.runtime/handlebars.runtime.min.js': ['common/js/plugins/handlebars.runtime/handlebars.runtime.js'],
|
||||
}
|
||||
},
|
||||
'modules': {
|
||||
files: {
|
||||
'common/js/x.min.js' : ['common/js/x.js'],
|
||||
// addon
|
||||
'addons/captcha/captcha.min.js' : ['addons/captcha/captcha.js'],
|
||||
'addons/captcha_member/captcha.min.js' : ['addons/captcha_member/captcha.js'],
|
||||
'addons/resize_image/js/resize_image.min.js' : ['addons/resize_image/js/resize_image.js'],
|
||||
// module/editor
|
||||
'modules/editor/skins/xpresseditor/js/xpresseditor.min.js': ['modules/editor/skins/xpresseditor/js/xpresseditor.js'],
|
||||
'modules/editor/skins/xpresseditor/js/xe_textarea.min.js': ['modules/editor/skins/xpresseditor/js/xe_textarea.js'],
|
||||
'modules/editor/skins/ckeditor/js/default.min.js': ['modules/editor/skins/ckeditor/js/default.js'],
|
||||
'modules/editor/skins/ckeditor/js/xe_interface.min.js': ['modules/editor/skins/ckeditor/js/xe_interface.js'],
|
||||
'modules/editor/skins/ckeditor/js/xe_textarea.min.js': ['modules/editor/skins/ckeditor/js/xe_textarea.js'],
|
||||
'modules/editor/tpl/js/editor_common.min.js': ['modules/editor/tpl/js/editor_common.js'],
|
||||
'modules/editor/tpl/js/swfupload.min.js': ['modules/editor/tpl/js/swfupload.js'],
|
||||
'modules/editor/tpl/js/uploader.min.js': ['modules/editor/tpl/js/uploader.js'],
|
||||
'modules/editor/tpl/js/editor.min.js': ['modules/editor/tpl/js/editor.js'],
|
||||
'modules/editor/tpl/js/editor_module_config.min.js': ['modules/editor/tpl/js/editor_module_config.js'],
|
||||
'modules/editor/tpl/js/editor.app.min.js': ['modules/editor/tpl/js/editor.app.js'],
|
||||
// module/admin
|
||||
'modules/admin/tpl/js/admin.min.js': ['modules/admin/tpl/js/admin.js'],
|
||||
'modules/admin/tpl/js/config.min.js': ['modules/admin/tpl/js/config.js'],
|
||||
'modules/admin/tpl/js/menu_setup.min.js': ['modules/admin/tpl/js/menu_setup.js'],
|
||||
//module/board
|
||||
'modules/board/tpl/js/board.min.js': ['modules/board/tpl/js/board.js'],
|
||||
'modules/board/tpl/js/board_admin.min.js': ['modules/board/tpl/js/board_admin.js'],
|
||||
'modules/board/skins/default/board.default.min.js': ['modules/board/skins/default/board.default.js'],
|
||||
'modules/board/m.skins/default/js/mboard.min.js': ['modules/board/m.skins/default/js/mboard.js'],
|
||||
'modules/board/m.skins/simpleGray/js/mboard.min.js': ['modules/board/m.skins/simpleGray/js/mboard.js'],
|
||||
'modules/board/skins/xedition/board.default.min.js': ['modules/board/skins/xedition/board.default.js'],
|
||||
// editor-component-image-gallery
|
||||
'modules/editor/components/image_gallery/tpl/gallery.min.js' : ['modules/editor/components/image_gallery/tpl/gallery.js'],
|
||||
'modules/editor/components/image_gallery/tpl/list_gallery.min.js' : ['modules/editor/components/image_gallery/tpl/list_gallery.js'],
|
||||
'modules/editor/components/image_gallery/tpl/popup.min.js' : ['modules/editor/components/image_gallery/tpl/popup.js'],
|
||||
'modules/editor/components/image_gallery/tpl/slide_gallery.min.js' : ['modules/editor/components/image_gallery/tpl/slide_gallery.js'],
|
||||
// module/importer
|
||||
'modules/importer/tpl/js/importer_admin.min.js': ['modules/importer/tpl/js/importer_admin.js'],
|
||||
// modules/widget
|
||||
'modules/widget/tpl/js/generate_code.min.js': ['modules/widget/tpl/js/generate_code.js'],
|
||||
'modules/widget/tpl/js/widget.min.js': ['modules/widget/tpl/js/widget.js'],
|
||||
'modules/widget/tpl/js/widget_admin.min.js': ['modules/widget/tpl/js/widget_admin.js'],
|
||||
// modules/poll
|
||||
'modules/poll/tpl/js/poll_admin.min.js': ['modules/poll/tpl/js/poll_admin.js'],
|
||||
'modules/poll/tpl/js/poll.min.js': ['modules/poll/tpl/js/poll.js'],
|
||||
'addons/oembed/jquery.oembed.min.js': ['addons/oembed/jquery.oembed.js'],
|
||||
'addons/oembed/oembed.min.js': ['addons/oembed/oembed.js'],
|
||||
}
|
||||
},
|
||||
'layout': {
|
||||
files: {
|
||||
'layouts/xedition/js/layout.min.js': ['layouts/xedition/js/layout.js'],
|
||||
'layouts/xedition/js/welcome.min.js': ['layouts/xedition/js/welcome.js'],
|
||||
}
|
||||
},
|
||||
},
|
||||
cssmin: {
|
||||
'common': {
|
||||
files: {
|
||||
'common/css/xe.min.css': ['common/css/xe.css'],
|
||||
'common/css/mobile.min.css': ['common/css/mobile.css']
|
||||
}
|
||||
},
|
||||
'modules': {
|
||||
files: {
|
||||
'modules/admin/tpl/css/admin.min.css': ['modules/admin/tpl/css/admin.css'],
|
||||
'modules/editor/components/image_gallery/tpl/popup.min.css': ['modules/editor/components/image_gallery/tpl/popup.css'],
|
||||
'modules/editor/components/image_gallery/tpl/slide_gallery.min.css': ['modules/editor/components/image_gallery/tpl/slide_gallery.css'],
|
||||
'modules/widget/tpl/css/widget.min.css': ['modules/widget/tpl/css/widget.css'],
|
||||
'modules/poll/tpl/css/poll.min.css': ['modules/poll/tpl/css/poll.css'],
|
||||
'modules/poll/skins/default/css/poll.min.css': ['modules/poll/skins/default/css/poll.css'],
|
||||
'modules/poll/skins/simple/css/poll.min.css': ['modules/poll/skins/simple/css/poll.css'],
|
||||
'modules/editor/skins/xpresseditor/css/default.min.css': ['modules/editor/skins/xpresseditor/css/default.css'],
|
||||
'modules/board/skins/default/board.default.min.css': ['modules/board/skins/default/board.default.css'],
|
||||
'modules/board/m.skins/default/css/mboard.min.css': ['modules/board/m.skins/default/css/mboard.css'],
|
||||
'modules/board/m.skins/simpleGray/css/mboard.min.css': ['modules/board/m.skins/simpleGray/css/mboard.css'],
|
||||
'modules/board/skins/xedition/board.default.min.css': ['modules/board/skins/xedition/board.default.css'],
|
||||
}
|
||||
},
|
||||
'addons': {
|
||||
files: {
|
||||
'addons/oembed/jquery.oembed.min.css': ['addons/oembed/jquery.oembed.css'],
|
||||
}
|
||||
},
|
||||
'layout': {
|
||||
files: {
|
||||
'layouts/xedition/css/layout.min.css': ['layouts/xedition/css/layout.css'],
|
||||
'layouts/xedition/css/webfont.min.css': ['layouts/xedition/css/webfont.css'],
|
||||
'layouts/xedition/css/welcome.min.css': ['layouts/xedition/css/welcome.css'],
|
||||
'layouts/xedition/css/widget.login.min.css': ['layouts/xedition/css/widget.login.css'],
|
||||
'layouts/xedition/css/xeicon.min.css': ['layouts/xedition/css/xeicon.css'],
|
||||
}
|
||||
},
|
||||
},
|
||||
jshint: {
|
||||
files: [
|
||||
'Gruntfile.js',
|
||||
|
|
@ -213,7 +62,6 @@ module.exports = function(grunt) {
|
|||
options: {
|
||||
phpCmd: "php",
|
||||
},
|
||||
|
||||
src: [
|
||||
"**/*.php",
|
||||
"!files/**",
|
||||
|
|
@ -227,184 +75,10 @@ module.exports = function(grunt) {
|
|||
},
|
||||
}
|
||||
});
|
||||
|
||||
function createPackageChecksum(target_file) {
|
||||
/* https://gist.github.com/onelaview/6475037 */
|
||||
var fs = require('fs');
|
||||
var crypto = require('crypto');
|
||||
var md5 = crypto.createHash('md5');
|
||||
var file = grunt.template.process(target_file);
|
||||
var buffer = fs.readFileSync(file);
|
||||
md5.update(buffer);
|
||||
var md5Hash = md5.digest('hex');
|
||||
grunt.verbose.writeln('file md5: ' + md5Hash);
|
||||
|
||||
var md5FileName = file + '.md5';
|
||||
grunt.file.write(md5FileName, md5Hash);
|
||||
grunt.verbose.writeln('File "' + md5FileName + '" created.').writeln('...');
|
||||
}
|
||||
|
||||
grunt.registerTask('build', '', function(A, B) {
|
||||
var _only_export = false;
|
||||
var tasks = ['krzip', 'syndication'];
|
||||
|
||||
if(!A) {
|
||||
grunt.fail.warn('Undefined build target.');
|
||||
} else if(A && !B) {
|
||||
_only_export = true;
|
||||
}
|
||||
|
||||
if(!_only_export) {
|
||||
tasks.push('changed');
|
||||
target = A + '...' + B;
|
||||
version = B;
|
||||
} else {
|
||||
target = A;
|
||||
version = A;
|
||||
}
|
||||
|
||||
var done = this.async();
|
||||
var build_dir = 'build';
|
||||
var archive_full = build_dir + '/xe.' + version + '.tar.gz';
|
||||
var archive_changed = build_dir + '/xe.' + version + '.changed.tar.gz';
|
||||
var diff, target, version;
|
||||
|
||||
var taskDone = function() {
|
||||
tasks.pop();
|
||||
grunt.verbose.writeln('remain tasks : '+tasks.length);
|
||||
|
||||
if(tasks.length === 0) {
|
||||
grunt.util.spawn({
|
||||
cmd: "tar",
|
||||
args: ['cfz', '../xe.'+version+'.tar.gz', './'],
|
||||
opts: {
|
||||
cwd: 'build/xe',
|
||||
cache: false
|
||||
}
|
||||
}, function (error, result, code) {
|
||||
grunt.log.ok('Archived(full) : ' + build_dir + '/xe.'+version+'.tar.gz');
|
||||
createPackageChecksum(build_dir + '/xe.'+version+'.tar.gz');
|
||||
|
||||
grunt.util.spawn({
|
||||
cmd: "zip",
|
||||
args: ['-r', '../xe.'+version+'.zip', './'],
|
||||
opts: {
|
||||
cwd: 'build/xe',
|
||||
cache: false
|
||||
}
|
||||
}, function (error, result, code) {
|
||||
grunt.log.ok('Archived(full) : ' + build_dir + '/xe.'+version+'.zip');
|
||||
createPackageChecksum(build_dir + '/xe.'+version+'.zip');
|
||||
|
||||
grunt.file.delete('build/xe');
|
||||
grunt.file.delete('build/temp.full.tar');
|
||||
|
||||
grunt.util.spawn({
|
||||
cmd: "git",
|
||||
args: ['diff', '--name-status', target]
|
||||
}, function (error, result, code) {
|
||||
var fs = require('fs');
|
||||
result = 'Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R).' + grunt.util.linefeed + result;
|
||||
grunt.file.write(build_dir + '/CHANGED.' + version + '.txt', result);
|
||||
|
||||
grunt.log.ok('Done!');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if(grunt.file.isDir(build_dir)) {
|
||||
grunt.file.delete(build_dir);
|
||||
}
|
||||
grunt.file.mkdir(build_dir);
|
||||
grunt.file.mkdir(build_dir + '/xe');
|
||||
|
||||
grunt.log.subhead('Archiving...');
|
||||
grunt.log.writeln('Target : ' + target);
|
||||
|
||||
grunt.util.spawn({
|
||||
cmd: "git",
|
||||
args: ['archive', '--output=build/temp.full.tar', version, '.']
|
||||
}, function (error, result, code){
|
||||
if(!_only_export) {
|
||||
// changed
|
||||
grunt.util.spawn({
|
||||
cmd: "git",
|
||||
args: ['diff', '--name-only', '--diff-filter' ,'ACM', target]
|
||||
}, function (error, result, code) {
|
||||
diff = result.stdout;
|
||||
|
||||
if(diff) {
|
||||
diff = diff.split(grunt.util.linefeed);
|
||||
}
|
||||
|
||||
// changed
|
||||
if(diff.length) {
|
||||
var args_tar = ['archive', '-o', 'build/xe.'+version+'.changed.tar.gz', version];
|
||||
var args_zip = ['archive', '-o', 'build/xe.'+version+'.changed.zip', version];
|
||||
args_tar = args_tar.concat(diff);
|
||||
args_zip = args_zip.concat(diff);
|
||||
|
||||
grunt.util.spawn({
|
||||
cmd: "git",
|
||||
args: args_tar
|
||||
}, function (error, result, code) {
|
||||
grunt.log.ok('Archived(changed) : ' + build_dir + '/xe.'+version+'.changed.tar.gz');
|
||||
createPackageChecksum(build_dir + '/xe.'+version+'.changed.tar.gz');
|
||||
|
||||
grunt.util.spawn({
|
||||
cmd: "git",
|
||||
args: args_zip
|
||||
}, function (error, result, code) {
|
||||
grunt.log.ok('Archived(changed) : ' + build_dir + '/xe.'+version+'.changed.zip');
|
||||
createPackageChecksum(build_dir + '/xe.'+version+'.changed.zip');
|
||||
|
||||
taskDone();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
taskDone();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// full
|
||||
grunt.util.spawn({
|
||||
cmd: "tar",
|
||||
args: ['xf', 'build/temp.full.tar', '-C', 'build/xe']
|
||||
}, function (error, result, code) {
|
||||
// krzip
|
||||
grunt.util.spawn({
|
||||
cmd: "git",
|
||||
args: ['clone', '-b', 'master', 'git@github.com:xpressengine/xe-module-krzip.git', 'build/xe/modules/krzip']
|
||||
}, function (error, result, code) {
|
||||
grunt.file.delete('build/xe/modules/krzip/.git');
|
||||
taskDone();
|
||||
});
|
||||
|
||||
// syndication
|
||||
grunt.util.spawn({
|
||||
cmd: "git",
|
||||
args: ['clone', '-b', 'master', 'git@github.com:xpressengine/xe-module-syndication.git', 'build/xe/modules/syndication']
|
||||
}, function (error, result, code) {
|
||||
grunt.file.delete('build/xe/modules/syndication/.git');
|
||||
taskDone();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-csslint');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
grunt.loadNpmTasks('grunt-phplint');
|
||||
|
||||
grunt.registerTask('default', ['jshint', 'csslint']);
|
||||
|
||||
grunt.registerTask('lint', ['jshint', 'csslint', 'phplint']);
|
||||
grunt.registerTask('minify', ['jshint', 'csslint', 'clean', 'concat', 'uglify', 'cssmin']);
|
||||
};
|
||||
|
|
|
|||
5
LICENSE
|
|
@ -1,11 +1,12 @@
|
|||
Copyright (c) RhymiX Developers and Contributors <devops@rhymix.org>
|
||||
Copyright (C) NAVER <http://www.navercorp.com>
|
||||
|
||||
XE is an opensource and being developed in the opensource project.
|
||||
RhymiX is an opensource and being developed in the opensource project.
|
||||
For more information, please see the link below.
|
||||
- Official website: http://www.xpressengine.com
|
||||
- Official Repository: http://github.com/xpressengine/
|
||||
|
||||
"XpressEngine (XE)" is free software; you can redistribute it and/or
|
||||
RhymiX is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
RhymiX
|
||||
======
|
||||
[](https://www.rhymix.org)
|
||||
|
||||
RhymiX(라이믹스)는 누구든지 쉽고 자유롭게 독립적인 홈페이지를 만들어
|
||||
자신을 표현하고 커뮤니티를 키워나갈 수 있도록 돕기 위한 CMS(content management system)입니다.
|
||||
|
|
@ -45,6 +44,9 @@ RhymiX는 개발자, 디자이너, 번역가 등의 도움과 일반 사용자
|
|||
참여를 원하시는 분은 질서있고 효율적인 프로젝트 운영을 위해
|
||||
[CONTRIBUTING.md](./CONTRIBUTING.md)를 먼저 읽어 주시기 바랍니다.
|
||||
|
||||
보안 취약점을 발견하셨다면 해커들에게 알려지기 전에 먼저 패치를 작성할 수 있도록
|
||||
devops@rhymix.org로 알려 주시면 감사하겠습니다.
|
||||
|
||||
### 공식 홈페이지
|
||||
|
||||
- XETOWN : https://www.xetown.com
|
||||
|
|
|
|||
|
|
@ -11,11 +11,6 @@ if(!defined('__XE__'))
|
|||
*/
|
||||
if($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML")
|
||||
{
|
||||
if(Mobile::isFromMobilePhone())
|
||||
{
|
||||
Context::addJsFile('./common/js/jquery.min.js', false, '', -1000000);
|
||||
Context::addJsFile('./common/js/xe.min.js', false, '', -1000000);
|
||||
}
|
||||
Context::loadFile(array('./addons/autolink/autolink.js', 'body', '', null), true);
|
||||
}
|
||||
/* End of file autolink.addon.php */
|
||||
|
|
|
|||
|
|
@ -11,13 +11,6 @@ if(!defined("__XE__")) exit();
|
|||
* */
|
||||
if(!class_exists('AddonCaptcha', false))
|
||||
{
|
||||
// On the mobile mode, XE Core does not load jquery and xe.js as normal.
|
||||
if(Mobile::isFromMobilePhone())
|
||||
{
|
||||
Context::loadFile(array('./common/js/jquery.min.js', 'head', NULL, -100000), true);
|
||||
Context::loadFile(array('./common/js/xe.min.js', 'head', NULL, -100000), true);
|
||||
}
|
||||
|
||||
class AddonCaptcha
|
||||
{
|
||||
|
||||
|
|
@ -81,7 +74,7 @@ if(!class_exists('AddonCaptcha', false))
|
|||
if(!captchaTargetAct) {var captchaTargetAct = [];}
|
||||
captchaTargetAct.push("' . implode('","', $this->target_acts) . '");
|
||||
</script>');
|
||||
Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true);
|
||||
Context::loadFile(array('./addons/captcha/captcha.js', 'body', '', null), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -347,7 +340,7 @@ if(!class_exists('AddonCaptcha', false))
|
|||
$this->createKeyword();
|
||||
|
||||
$swfURL = getUrl() . 'addons/captcha/swf/play.swf';
|
||||
Context::unloadFile('./addons/captcha/captcha.min.js');
|
||||
Context::unloadFile('./addons/captcha/captcha.js');
|
||||
Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body'));
|
||||
|
||||
global $lang;
|
||||
|
|
|
|||
1
addons/captcha/captcha.min.js
vendored
1
addons/captcha_member/captcha.min.js
vendored
|
|
@ -11,13 +11,6 @@ if(!defined("__XE__")) exit();
|
|||
* */
|
||||
if(!class_exists('AddonMemberCaptcha', false))
|
||||
{
|
||||
// On the mobile mode, XE Core does not load jquery and xe.js as normal.
|
||||
if(Mobile::isFromMobilePhone())
|
||||
{
|
||||
Context::loadFile(array('./common/js/jquery.min.js', 'head', NULL, -100000), true);
|
||||
Context::loadFile(array('./common/js/xe.min.js', 'head', NULL, -100000), true);
|
||||
}
|
||||
|
||||
class AddonMemberCaptcha
|
||||
{
|
||||
var $addon_info;
|
||||
|
|
@ -92,7 +85,7 @@ if(!class_exists('AddonMemberCaptcha', false))
|
|||
if(!captchaTargetAct) {var captchaTargetAct = [];}
|
||||
captchaTargetAct.push("' . implode('","', $this->target_acts) . '");
|
||||
</script>');
|
||||
Context::loadFile(array('./addons/captcha_member/captcha.min.js', 'body', '', null), true);
|
||||
Context::loadFile(array('./addons/captcha_member/captcha.js', 'body', '', null), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +351,7 @@ if(!class_exists('AddonMemberCaptcha', false))
|
|||
$this->createKeyword();
|
||||
|
||||
$swfURL = getUrl() . 'addons/captcha_member/swf/play.swf';
|
||||
Context::unloadFile('./addons/captcha_member/captcha.min.js');
|
||||
Context::unloadFile('./addons/captcha_member/captcha.js');
|
||||
Context::loadFile(array('./addons/captcha_member/inline_captcha.js', 'body'));
|
||||
|
||||
global $lang;
|
||||
|
|
|
|||
1
addons/oembed/jquery.oembed.min.css
vendored
2
addons/oembed/jquery.oembed.min.js
vendored
1
addons/oembed/oembed.min.js
vendored
|
|
@ -1 +0,0 @@
|
|||
!function(a){var b="(https?|ftp|news|telnet|irc|mms)://",c="(?:[\\w\\-]+\\.)+(?:[a-z]+)",d="(?:1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9]?[0-9])",e="(?:"+d+"\\.){3}"+d,f="(?::([0-9]+))?",g="(?:/~[\\w-]+)?",h='((?:/[\\w!"$-/:-@]+)*)',i="(?:#([\\w!-@]+))?",j=new RegExp("("+b+"("+c+"|"+e+"|localhost)"+f+g+h+i+")","ig"),k=xe.createPlugin("OEmbed",{targets:[],init:function(){this.targets=[],this.enableAutoLink=!1,this.castedOembedA=!1,this.embedSetting=[]},API_ONREADY:function(){var b=this;this.extractTargets(a(".xe_content")),this.oApp.getPlugin("autolink").length&&(this.enableAutoLink=!0),b.cast("OEMBEDA"),this.enableAutoLink||a(this.targets).each(function(){b.cast("OEMBED",[this])})},API_BEFORE_AUTOLINK:function(a,b){var c=this;c.cast("OEMBEDA")},API_AFTER_AUTOLINK:function(a,b){this.oembed(b[0])},API_OEMBED:function(b,c){if(!this.enableAutoLink){var d=c[0];if(!a(d).parent().length||"a"==a(d).parent().get(0).nodeName.toLowerCase())return void this.oembed(a(d));var e=d.nodeValue,f=a("<span>");e=e.replace(/</g,"<").replace(/>/g,">"),e=e.replace(j,'<a href="$1" target="_blank">$1</a>'),a(d).before(f),a(d).replaceWith(e),c[0]=f.next("a"),f.remove(),this.oembed(c[0])}},API_OEMBEDA:function(b,c){if(!this.castedOembedA){var d=this;this.castedOembedA=!0,a(".read_body a").not("_oembed").each(function(){d.oembed(a(this))})}},oembed:function(b){var c=this;this.embedSetting.maxWidth||(this.embedSetting.maxWidth=a(".xe_content").width()),b&&(b&&3==b.nodeType&&(b=a(b)),b.oembed(null,c.embedSetting).addClass("_oembed"))},extractTargets:function(b){var c=this,d=a(".xe_content",b);return d.length?void this.extractTargets(d):void a(b).contents().each(function(){var b=this.nodeName.toLowerCase();if(-1==a.inArray(b,["a","pre","xml","textarea","input","select","option","code","script","style","iframe","button","img","embed","object","ins"]))if(j.exec(""),3==this.nodeType){var d=this.nodeValue;if(d.length<5)return;if(!/(http|https|ftp|news|telnet|irc|mms):\/\//i.test(d))return;c.targets.push(this)}else c.extractTargets(this)})}});xe.registerPlugin(new k)}(jQuery);
|
||||
1
addons/resize_image/js/resize_image.min.js
vendored
|
|
@ -1 +0,0 @@
|
|||
!function(a){function b(){var b,c,e,f,g,h=a(document.body);return d?(b=a("#xe_gallery_controls"),c=a("#xe_gallery_holder"),e=a("#xe_gallery_closebtn"),f=a("#xe_gallery_prevbtn"),g=a("#xe_gallery_nextbtn")):(d=a("<div>").attr("id","xe_gallery_screen").css({position:"fixed",display:"none",backgroundColor:"black",zIndex:500,opacity:.7}),b=a("<div>").attr("id","xe_gallery_controls").css({position:"fixed",display:"none",overflow:"hidden",zIndex:510}),f=a('<button type="button" id="xe_gallery_prevbtn" />').css({left:"10px",backgroundPosition:"0 -64px"}).click(function(){d.xePrev()}).appendTo(b),e=a('<button type="button" id="xe_gallery_closebtn" />').css({top:"10px",backgroundPosition:"0 0"}).click(function(){d.xeHide()}).appendTo(b),g=a('<button type="button" id="xe_gallery_nextbtn" />').attr("id","xe_gallery_nextbtn").css({right:"10px",backgroundPosition:"0 -128px"}).click(function(){d.xeNext()}).appendTo(b),b.find(">button").css({position:"absolute",width:"64px",height:"64px",zIndex:530,cursor:"pointer",border:0,margin:0,padding:0,backgroundColor:"transparent",backgroundImage:"url("+request_uri+"addons/resize_image/btn.png)",backgroundRepeat:"no-repeat",opacity:".5",filter:"alpha(opacity=50)"}).mouseover(function(){a(this).css({opacity:"1",filter:"alpha(opacity=100)"})}).mouseout(function(){a(this).css({opacity:".5",filter:"alpha(opacity=50)"})}).focus(function(){a(this).trigger("mouseover")}).blur(function(){a(this).trigger("mouseout")}),c=a(new Image),c.attr("id","xe_gallery_holder").css({border:"5px solid white",zindex:520,maxWidth:"none",borderRadius:"5px",boxShadow:"0 0 10px #000"}).appendTo(b).draggable(),h.append(d).append(b),c.live("load",function(){var b=a(window).width(),d=a(window).height();c.css({left:b/2-c.width()/2+"px",top:d/2-c.height()/2+"px"})}),d.xeShow=function(){var b=(a(window).width(),a(window).height());a("#xe_gallery_controls,#xe_gallery_screen").show().css({top:0,right:0,bottom:0,left:0}),a("#xe_gallery_prevbtn,#xe_gallery_nextbtn").css("top",Math.round(b/2-32)+"px"),this.xeMove(0)},d.xeHide=function(a){d.hide(),b.hide()},d.xePrev=function(){this.xeMove(-1)},d.xeNext=function(){this.xeMove(1)},d.xeMove=function(b){var d=a(window).width(),h=a(window).height();this.index+=b,f.css("visibility",this.index>0?"visible":"hidden"),g.css("visibility",this.index<this.list.size()-1?"visible":"hidden");var i=this.list.eq(this.index).attr("rawsrc");i||(i=this.list.eq(this.index).attr("src")),c.attr("src",i).removeAttr("width").removeAttr("height"),c.width()>0&&c.css({left:d/2-c.width()/2+"px",top:h/2-c.height()/2+"px"}),e.css({left:d/2-32+"px",top:"10px"}).focus()},a(document).keydown(function(a){return 27==a.which?(d.xeHide(),!1):!0})),d}function c(c){var d=a(this).closest(".xe_content"),e=d.find("img[rel=xe_gallery]"),f=a.inArray(a(this).get(0),e.get()),g=b();g.list=e,g.index=f,g.xeShow()}var d=null;a(window).load(function(){function b(a,c){if(c||(c=0),!(c>=10)){var d=this,e={width:d.width(),height:d.height()};if(!e.width||!e.height)return void setTimeout(function(){b.call(d,a,++c)},200);if(!(e.width<=a)){var f=a/e.width;d.removeAttr("width").removeAttr("height").css({width:a,height:parseInt(e.height*f,10)})}}}var d=/(?:(modules|addons|classes|common|layouts|libs|widgets|widgetstyles)\/)/i,e=/(?:common\/tpl\/images\/blank\.gif$)/i,f=a('<div style="height:1px;overflow:hidden;opacity:0;display:block;clear:both"></div>');a(".xe_content").each(function(){var g=f.appendTo(this).width();f.remove(),g&&(a("img",this).each(function(){var c=a(this),f=c.attr("src");(!d.test(f)||e.test(f))&&(c.attr("rel","xe_gallery"),b.call(c,g))}),a("img[rel=xe_gallery]",this).live("mouseover",function(){var b=a(this);b.parent("a").length||b.attr("onclick")||b.css("cursor","pointer").click(c)}))})})}(jQuery);
|
||||
|
|
@ -20,7 +20,7 @@ if($called_position == 'after_module_proc' && Context::getResponseMethod() == "H
|
|||
else
|
||||
{
|
||||
Context::loadJavascriptPlugin('ui');
|
||||
Context::loadFile(array('./addons/resize_image/js/resize_image.min.js', 'body', '', null), true);
|
||||
Context::loadFile(array('./addons/resize_image/js/resize_image.js', 'body', '', null), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
header('Location: ../index.php?module=admin');
|
||||
|
||||
/* End of file index.php */
|
||||
/* Location: ./admin/index.php */
|
||||
|
|
@ -178,7 +178,7 @@ class DB
|
|||
*/
|
||||
function create()
|
||||
{
|
||||
return new DB;
|
||||
return new static();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@
|
|||
*/
|
||||
class DBMysql extends DB
|
||||
{
|
||||
|
||||
/**
|
||||
* prefix of a tablename (One or more XEs can be installed in a single DB)
|
||||
* @var string
|
||||
*/
|
||||
var $prefix = 'xe_'; // / <
|
||||
var $comment_syntax = '/* %s */';
|
||||
var $charset = 'utf8';
|
||||
|
||||
/**
|
||||
* Column type used in MySQL
|
||||
|
|
@ -49,15 +49,6 @@ class DBMysql extends DB
|
|||
$this->_connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of this class
|
||||
* @return DBMysql return DBMysql object instance
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
return new DBMysql;
|
||||
}
|
||||
|
||||
/**
|
||||
* DB Connect
|
||||
* this method is private
|
||||
|
|
@ -84,12 +75,18 @@ class DBMysql extends DB
|
|||
$this->setError(mysql_errno(), mysql_error());
|
||||
return;
|
||||
}
|
||||
|
||||
// Error appears if the version is lower than 4.1
|
||||
if(version_compare(mysql_get_server_info($result), '4.1', '<'))
|
||||
{
|
||||
$this->setError(-1, 'XE cannot be installed under the version of mysql 4.1. Current mysql version is ' . mysql_get_server_info());
|
||||
return;
|
||||
}
|
||||
|
||||
// Set charset
|
||||
$this->charset = isset($connection["db_charset"]) ? $connection["db_charset"] : 'utf8';
|
||||
mysql_set_charset($this->charset, $result);
|
||||
|
||||
// select db
|
||||
@mysql_select_db($connection["db_database"], $result);
|
||||
if(mysql_error())
|
||||
|
|
@ -101,18 +98,6 @@ class DBMysql extends DB
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* If have a task after connection, add a taks in this method
|
||||
* this method is private
|
||||
* @param resource $connection
|
||||
* @return void
|
||||
*/
|
||||
function _afterConnect($connection)
|
||||
{
|
||||
// Set utf8 if a database is MySQL
|
||||
$this->_query("set names 'utf8'", $connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* DB disconnection
|
||||
* this method is private
|
||||
|
|
@ -186,7 +171,7 @@ class DBMysql extends DB
|
|||
exit('XE cannot handle DB connection.');
|
||||
}
|
||||
// Run the query statement
|
||||
$result = mysql_query($query, $connection);
|
||||
$result = @mysql_query($query, $connection);
|
||||
// Error Check
|
||||
if(mysql_error($connection))
|
||||
{
|
||||
|
|
@ -570,17 +555,16 @@ class DBMysql extends DB
|
|||
*/
|
||||
function _createTable($xml_doc)
|
||||
{
|
||||
// xml parsing
|
||||
// Parse XML
|
||||
$oXml = new XmlParser();
|
||||
$xml_obj = $oXml->parse($xml_doc);
|
||||
// Create a table schema
|
||||
|
||||
// Get table name and column list
|
||||
$table_name = $xml_obj->table->attrs->name;
|
||||
if($this->isTableExists($table_name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
$table_name = $this->prefix . $table_name;
|
||||
|
||||
if(!is_array($xml_obj->table->column))
|
||||
{
|
||||
$columns[] = $xml_obj->table->column;
|
||||
|
|
@ -589,11 +573,14 @@ class DBMysql extends DB
|
|||
{
|
||||
$columns = $xml_obj->table->column;
|
||||
}
|
||||
|
||||
|
||||
// Initialize the list of columns and indexes
|
||||
$column_schema = array();
|
||||
$primary_list = array();
|
||||
$unique_list = array();
|
||||
$index_list = array();
|
||||
|
||||
|
||||
// Process columns
|
||||
foreach($columns as $column)
|
||||
{
|
||||
$name = $column->attrs->name;
|
||||
|
|
@ -605,49 +592,96 @@ class DBMysql extends DB
|
|||
$unique = $column->attrs->unique;
|
||||
$default = $column->attrs->default;
|
||||
$auto_increment = $column->attrs->auto_increment;
|
||||
|
||||
$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : '');
|
||||
|
||||
$column_charset = '';
|
||||
$index_size_limit = '';
|
||||
|
||||
// MySQL only supports 767 bytes for indexed columns.
|
||||
// This is 191 characters in utf8mb4 and 255 characters in utf8.
|
||||
if($column->attrs->utf8mb4 === 'false')
|
||||
{
|
||||
$column_charset = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci';
|
||||
}
|
||||
elseif(($primary_key || $unique || $index) && stripos($type, 'char') !== false)
|
||||
{
|
||||
if($size > 255 || ($size > 191 && $this->charset === 'utf8mb4'))
|
||||
{
|
||||
if($primary_key || $unique)
|
||||
{
|
||||
$size = ($this->charset === 'utf8mb4') ? 191 : 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
$index_size_limit = '(' . (($this->charset === 'utf8mb4') ? 191 : 255) . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$column_schema[$name] = sprintf('`%s` %s%s %s %s %s %s',
|
||||
$name,
|
||||
$this->column_type[$type],
|
||||
$size ? "($size)" : '',
|
||||
$column_charset,
|
||||
isset($default) ? "DEFAULT '$default'" : '',
|
||||
$notnull ? 'NOT NULL' : '',
|
||||
$auto_increment ? 'AUTO_INCREMENT' : ''
|
||||
);
|
||||
|
||||
if($primary_key)
|
||||
{
|
||||
$primary_list[] = $name;
|
||||
$primary_list[] = "`$name`";
|
||||
}
|
||||
else if($unique)
|
||||
{
|
||||
$unique_list[$unique][] = $name;
|
||||
$unique_list[$unique][] = "`$name`" . $index_size_limit;
|
||||
}
|
||||
else if($index)
|
||||
{
|
||||
$index_list[$index][] = $name;
|
||||
$index_list[$index][] = "`$name`" . $index_size_limit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Process
|
||||
|
||||
// Process indexes
|
||||
if(count($primary_list))
|
||||
{
|
||||
$column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`');
|
||||
$column_schema[] = sprintf("PRIMARY KEY (%s)", implode($primary_list, ', '));
|
||||
}
|
||||
|
||||
if(count($unique_list))
|
||||
{
|
||||
foreach($unique_list as $key => $val)
|
||||
{
|
||||
$column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`');
|
||||
$column_schema[] = sprintf("UNIQUE %s (%s)", $key, implode($val, ', '));
|
||||
}
|
||||
}
|
||||
|
||||
if(count($index_list))
|
||||
{
|
||||
foreach($index_list as $key => $val)
|
||||
{
|
||||
$column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`');
|
||||
$column_schema[] = sprintf("INDEX %s (%s)", $key, implode($val, ', '));
|
||||
}
|
||||
}
|
||||
|
||||
$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci");
|
||||
|
||||
|
||||
// Generate table schema
|
||||
$engine = stripos(get_class($this), 'innodb') === false ? 'MYISAM' : 'INNODB';
|
||||
$charset = $this->charset ?: 'utf8';
|
||||
$collation = $charset . '_unicode_ci';
|
||||
$schema = sprintf("CREATE TABLE `%s` (%s) %s",
|
||||
$this->addQuotes($this->prefix . $table_name),
|
||||
"\n" . implode($column_schema, ",\n") . "\n",
|
||||
"ENGINE = $engine CHARACTER SET $charset COLLATE $collation"
|
||||
);
|
||||
|
||||
// Execute the complete query
|
||||
$output = $this->_query($schema);
|
||||
if(!$output)
|
||||
if($output)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -788,7 +822,7 @@ class DBMysql extends DB
|
|||
* @param boolean $force
|
||||
* @return DBParser
|
||||
*/
|
||||
function &getParser($force = FALSE)
|
||||
function getParser($force = FALSE)
|
||||
{
|
||||
$dbParser = new DBParser('`', '`', $this->prefix);
|
||||
return $dbParser;
|
||||
|
|
@ -967,6 +1001,30 @@ class DBMysql extends DB
|
|||
return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out the best supported character set
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getBestSupportedCharset()
|
||||
{
|
||||
if($output = $this->_fetch($this->_query("SHOW CHARACTER SET LIKE 'utf8%'")))
|
||||
{
|
||||
$mb4_support = false;
|
||||
foreach($output as $row)
|
||||
{
|
||||
if($row->Charset === 'utf8mb4')
|
||||
{
|
||||
$mb4_support = true;
|
||||
}
|
||||
}
|
||||
return $mb4_support ? 'utf8mb4' : 'utf8';
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'utf8';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DBMysql::$isSupported = function_exists('mysql_connect');
|
||||
|
|
|
|||
|
|
@ -15,37 +15,6 @@ require_once('DBMysql.class.php');
|
|||
*/
|
||||
class DBMysql_innodb extends DBMysql
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->_setDBInfo();
|
||||
$this->_connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of this class
|
||||
* @return DBMysql_innodb return DBMysql_innodb object instance
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
return new DBMysql_innodb;
|
||||
}
|
||||
|
||||
/**
|
||||
* DB disconnection
|
||||
* this method is private
|
||||
* @param resource $connection
|
||||
* @return void
|
||||
*/
|
||||
function _close($connection)
|
||||
{
|
||||
@mysql_close($connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* DB transaction start
|
||||
* this method is private
|
||||
|
|
@ -96,123 +65,9 @@ class DBMysql_innodb extends DBMysql
|
|||
function _commit()
|
||||
{
|
||||
$connection = $this->_getConnection('master');
|
||||
$this->_query("commit", $connection);
|
||||
$this->_query("COMMIT", $connection);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the query
|
||||
* this method is private
|
||||
* @param string $query
|
||||
* @param resource $connection
|
||||
* @return resource
|
||||
*/
|
||||
function __query($query, $connection)
|
||||
{
|
||||
if(!$connection)
|
||||
{
|
||||
exit('XE cannot handle DB connection.');
|
||||
}
|
||||
// Run the query statement
|
||||
$result = @mysql_query($query, $connection);
|
||||
// Error Check
|
||||
if(mysql_error($connection))
|
||||
{
|
||||
$this->setError(mysql_errno($connection), mysql_error($connection));
|
||||
}
|
||||
// Return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create table by using the schema xml
|
||||
*
|
||||
* type : number, varchar, tinytext, text, bigtext, char, date, \n
|
||||
* opt : notnull, default, size\n
|
||||
* index : primary key, index, unique\n
|
||||
* @param string $xml_doc xml schema contents
|
||||
* @return void|object
|
||||
*/
|
||||
function _createTable($xml_doc)
|
||||
{
|
||||
// xml parsing
|
||||
$oXml = new XmlParser();
|
||||
$xml_obj = $oXml->parse($xml_doc);
|
||||
// Create a table schema
|
||||
$table_name = $xml_obj->table->attrs->name;
|
||||
if($this->isTableExists($table_name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
$table_name = $this->prefix . $table_name;
|
||||
|
||||
if(!is_array($xml_obj->table->column))
|
||||
{
|
||||
$columns[] = $xml_obj->table->column;
|
||||
}
|
||||
else
|
||||
{
|
||||
$columns = $xml_obj->table->column;
|
||||
}
|
||||
|
||||
foreach($columns as $column)
|
||||
{
|
||||
$name = $column->attrs->name;
|
||||
$type = $column->attrs->type;
|
||||
$size = $column->attrs->size;
|
||||
$notnull = $column->attrs->notnull;
|
||||
$primary_key = $column->attrs->primary_key;
|
||||
$index = $column->attrs->index;
|
||||
$unique = $column->attrs->unique;
|
||||
$default = $column->attrs->default;
|
||||
$auto_increment = $column->attrs->auto_increment;
|
||||
|
||||
$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : '');
|
||||
|
||||
if($primary_key)
|
||||
{
|
||||
$primary_list[] = $name;
|
||||
}
|
||||
else if($unique)
|
||||
{
|
||||
$unique_list[$unique][] = $name;
|
||||
}
|
||||
else if($index)
|
||||
{
|
||||
$index_list[$index][] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
if(count($primary_list))
|
||||
{
|
||||
$column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`');
|
||||
}
|
||||
|
||||
if(count($unique_list))
|
||||
{
|
||||
foreach($unique_list as $key => $val)
|
||||
{
|
||||
$column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`');
|
||||
}
|
||||
}
|
||||
|
||||
if(count($index_list))
|
||||
{
|
||||
foreach($index_list as $key => $val)
|
||||
{
|
||||
$column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`');
|
||||
}
|
||||
}
|
||||
|
||||
$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci");
|
||||
|
||||
$output = $this->_query($schema);
|
||||
if(!$output)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DBMysql_innodb::$isSupported = function_exists('mysql_connect');
|
||||
|
|
|
|||
|
|
@ -15,26 +15,6 @@ require_once('DBMysql.class.php');
|
|||
*/
|
||||
class DBMysqli extends DBMysql
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->_setDBInfo();
|
||||
$this->_connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of this class
|
||||
* @return DBMysqli return DBMysqli object instance
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
return new DBMysqli;
|
||||
}
|
||||
|
||||
/**
|
||||
* DB Connect
|
||||
* this method is private
|
||||
|
|
@ -65,7 +45,8 @@ class DBMysqli extends DBMysql
|
|||
$this->setError($error, mysqli_connect_error());
|
||||
return;
|
||||
}
|
||||
mysqli_set_charset($result, 'utf8');
|
||||
$this->charset = isset($connection["db_charset"]) ? $connection["db_charset"] : 'utf8';
|
||||
mysqli_set_charset($result, $this->charset);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
require_once('DBMysql.class.php');
|
||||
require_once('DBMysqli.class.php');
|
||||
|
||||
/**
|
||||
* Class to use MySQLi innoDB DBMS as mysqli_*
|
||||
|
|
@ -13,73 +14,8 @@ require_once('DBMysql.class.php');
|
|||
* @package /classes/db
|
||||
* @version 0.1
|
||||
*/
|
||||
class DBMysqli_innodb extends DBMysql
|
||||
class DBMysqli_innodb extends DBMysqli
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->_setDBInfo();
|
||||
$this->_connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of this class
|
||||
* @return DBMysqli_innodb return DBMysqli_innodb object instance
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
return new DBMysqli_innodb;
|
||||
}
|
||||
|
||||
/**
|
||||
* DB Connect
|
||||
* this method is private
|
||||
* @param array $connection connection's value is db_hostname, db_port, db_database, db_userid, db_password
|
||||
* @return resource
|
||||
*/
|
||||
function __connect($connection)
|
||||
{
|
||||
// Attempt to connect
|
||||
if($connection["db_port"])
|
||||
{
|
||||
$result = @mysqli_connect($connection["db_hostname"]
|
||||
, $connection["db_userid"]
|
||||
, $connection["db_password"]
|
||||
, $connection["db_database"]
|
||||
, $connection["db_port"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = @mysqli_connect($connection["db_hostname"]
|
||||
, $connection["db_userid"]
|
||||
, $connection["db_password"]
|
||||
, $connection["db_database"]);
|
||||
}
|
||||
$error = mysqli_connect_errno();
|
||||
if($error)
|
||||
{
|
||||
$this->setError($error, mysqli_connect_error());
|
||||
return;
|
||||
}
|
||||
mysqli_set_charset($result, 'utf8');
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* DB disconnection
|
||||
* this method is private
|
||||
* @param resource $connection
|
||||
* @return void
|
||||
*/
|
||||
function _close($connection)
|
||||
{
|
||||
mysqli_close($connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* DB transaction start
|
||||
* this method is private
|
||||
|
|
@ -91,7 +27,15 @@ class DBMysqli_innodb extends DBMysql
|
|||
|
||||
if(!$transactionLevel)
|
||||
{
|
||||
$this->_query("begin");
|
||||
if(function_exists('mysqli_begin_transaction'))
|
||||
{
|
||||
mysqli_begin_transaction($connection);
|
||||
$this->setQueryLog(array('query' => 'START TRANSACTION'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_query("START TRANSACTION" . $point, $connection);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -108,7 +52,6 @@ class DBMysqli_innodb extends DBMysql
|
|||
function _rollback($transactionLevel = 0)
|
||||
{
|
||||
$connection = $this->_getConnection('master');
|
||||
|
||||
$point = $transactionLevel - 1;
|
||||
|
||||
if($point)
|
||||
|
|
@ -118,7 +61,7 @@ class DBMysqli_innodb extends DBMysql
|
|||
else
|
||||
{
|
||||
mysqli_rollback($connection);
|
||||
$this->setQueryLog( array("query"=>"rollback") );
|
||||
$this->setQueryLog(array('query' => 'ROLLBACK'));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -132,449 +75,9 @@ class DBMysqli_innodb extends DBMysql
|
|||
{
|
||||
$connection = $this->_getConnection('master');
|
||||
mysqli_commit($connection);
|
||||
$this->setQueryLog( array("query"=>"commit") );
|
||||
$this->setQueryLog(array('query' => 'COMMIT'));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Handles quatation of the string variables from the query
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
function addQuotes($string)
|
||||
{
|
||||
if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
|
||||
{
|
||||
$string = stripslashes(str_replace("\\", "\\\\", $string));
|
||||
}
|
||||
if(!is_numeric($string))
|
||||
{
|
||||
$connection = $this->_getConnection('master');
|
||||
$string = mysqli_escape_string($connection, $string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the query
|
||||
* this method is private
|
||||
* @param string $query
|
||||
* @param resource $connection
|
||||
* @return resource
|
||||
*/
|
||||
function __query($query, $connection)
|
||||
{
|
||||
if($this->use_prepared_statements == 'Y')
|
||||
{
|
||||
// 1. Prepare query
|
||||
$stmt = mysqli_prepare($connection, $query);
|
||||
if($stmt)
|
||||
{
|
||||
$types = '';
|
||||
$params = array();
|
||||
$this->_prepareQueryParameters($types, $params);
|
||||
|
||||
if(!empty($params))
|
||||
{
|
||||
$args[0] = $stmt;
|
||||
$args[1] = $types;
|
||||
|
||||
$i = 2;
|
||||
foreach($params as $key => $param)
|
||||
{
|
||||
$copy[$key] = $param;
|
||||
$args[$i++] = &$copy[$key];
|
||||
}
|
||||
|
||||
// 2. Bind parameters
|
||||
$status = call_user_func_array('mysqli_stmt_bind_param', $args);
|
||||
if(!$status)
|
||||
{
|
||||
$this->setError(-1, "Invalid arguments: $query" . mysqli_error($connection) . PHP_EOL . print_r($args, true));
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Execute query
|
||||
$status = mysqli_stmt_execute($stmt);
|
||||
|
||||
if(!$status)
|
||||
{
|
||||
$this->setError(-1, "Prepared statement failed: $query" . mysqli_error($connection) . PHP_EOL . print_r($args, true));
|
||||
}
|
||||
|
||||
// Return stmt for other processing - like retrieving resultset (_fetch)
|
||||
return $stmt;
|
||||
// mysqli_stmt_close($stmt);
|
||||
}
|
||||
}
|
||||
// Run the query statement
|
||||
$result = mysqli_query($connection, $query);
|
||||
// Error Check
|
||||
$error = mysqli_error($connection);
|
||||
if($error)
|
||||
{
|
||||
$this->setError(mysqli_errno($connection), $error);
|
||||
}
|
||||
// Return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Before execute query, prepare statement
|
||||
* this method is private
|
||||
* @param string $types
|
||||
* @param array $params
|
||||
* @return void
|
||||
*/
|
||||
function _prepareQueryParameters(&$types, &$params)
|
||||
{
|
||||
$types = '';
|
||||
$params = array();
|
||||
if(!$this->param)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach($this->param as $k => $o)
|
||||
{
|
||||
$value = $o->getUnescapedValue();
|
||||
$type = $o->getType();
|
||||
|
||||
// Skip column names -> this should be concatenated to query string
|
||||
if($o->isColumnName())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case 'number' :
|
||||
$type = 'i';
|
||||
break;
|
||||
case 'varchar' :
|
||||
$type = 's';
|
||||
break;
|
||||
default:
|
||||
$type = 's';
|
||||
}
|
||||
|
||||
if(is_array($value))
|
||||
{
|
||||
foreach($value as $v)
|
||||
{
|
||||
$params[] = $v;
|
||||
$types .= $type;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$params[] = $value;
|
||||
$types .= $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the result
|
||||
* @param resource $result
|
||||
* @param int|NULL $arrayIndexEndValue
|
||||
* @return array
|
||||
*/
|
||||
function _fetch($result, $arrayIndexEndValue = NULL)
|
||||
{
|
||||
if($this->use_prepared_statements != 'Y')
|
||||
{
|
||||
return parent::_fetch($result, $arrayIndexEndValue);
|
||||
}
|
||||
$output = array();
|
||||
if(!$this->isConnected() || $this->isError() || !$result)
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Prepared stements: bind result variable and fetch data
|
||||
$stmt = $result;
|
||||
$meta = mysqli_stmt_result_metadata($stmt);
|
||||
$fields = mysqli_fetch_fields($meta);
|
||||
|
||||
/**
|
||||
* Mysqli has a bug that causes LONGTEXT columns not to get loaded
|
||||
* Unless store_result is called before
|
||||
* MYSQLI_TYPE for longtext is 252
|
||||
*/
|
||||
$longtext_exists = false;
|
||||
foreach($fields as $field)
|
||||
{
|
||||
if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails
|
||||
{
|
||||
$field->name = 'repeat_' . $field->name;
|
||||
}
|
||||
|
||||
// Array passed needs to contain references, not values
|
||||
$row[$field->name] = "";
|
||||
$resultArray[$field->name] = &$row[$field->name];
|
||||
|
||||
if($field->type == 252)
|
||||
{
|
||||
$longtext_exists = true;
|
||||
}
|
||||
}
|
||||
$resultArray = array_merge(array($stmt), $resultArray);
|
||||
|
||||
if($longtext_exists)
|
||||
{
|
||||
mysqli_stmt_store_result($stmt);
|
||||
}
|
||||
|
||||
call_user_func_array('mysqli_stmt_bind_result', $resultArray);
|
||||
|
||||
$rows = array();
|
||||
while(mysqli_stmt_fetch($stmt))
|
||||
{
|
||||
$resultObject = new stdClass();
|
||||
|
||||
foreach($resultArray as $key => $value)
|
||||
{
|
||||
if($key === 0)
|
||||
{
|
||||
continue; // Skip stmt object
|
||||
}
|
||||
if(strpos($key, 'repeat_'))
|
||||
{
|
||||
$key = substr($key, 6);
|
||||
}
|
||||
$resultObject->$key = $value;
|
||||
}
|
||||
|
||||
$rows[] = $resultObject;
|
||||
}
|
||||
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
if($arrayIndexEndValue)
|
||||
{
|
||||
foreach($rows as $row)
|
||||
{
|
||||
$output[$arrayIndexEndValue--] = $row;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $rows;
|
||||
}
|
||||
|
||||
if(count($output) == 1)
|
||||
{
|
||||
if(isset($arrayIndexEndValue))
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $output[0];
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles insertAct
|
||||
* @param Object $queryObject
|
||||
* @param boolean $with_values
|
||||
* @return resource
|
||||
*/
|
||||
function _executeInsertAct($queryObject, $with_values = false)
|
||||
{
|
||||
if($this->use_prepared_statements != 'Y')
|
||||
{
|
||||
return parent::_executeInsertAct($queryObject);
|
||||
}
|
||||
$this->param = $queryObject->getArguments();
|
||||
$result = parent::_executeInsertAct($queryObject, $with_values);
|
||||
unset($this->param);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles updateAct
|
||||
* @param Object $queryObject
|
||||
* @param boolean $with_values
|
||||
* @return resource
|
||||
*/
|
||||
function _executeUpdateAct($queryObject, $with_values = false)
|
||||
{
|
||||
if($this->use_prepared_statements != 'Y')
|
||||
{
|
||||
return parent::_executeUpdateAct($queryObject);
|
||||
}
|
||||
$this->param = $queryObject->getArguments();
|
||||
$result = parent::_executeUpdateAct($queryObject, $with_values);
|
||||
unset($this->param);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles deleteAct
|
||||
* @param Object $queryObject
|
||||
* @param boolean $with_values
|
||||
* @return resource
|
||||
*/
|
||||
function _executeDeleteAct($queryObject, $with_values = false)
|
||||
{
|
||||
if($this->use_prepared_statements != 'Y')
|
||||
{
|
||||
return parent::_executeDeleteAct($queryObject);
|
||||
}
|
||||
$this->param = $queryObject->getArguments();
|
||||
$result = parent::_executeDeleteAct($queryObject, $with_values);
|
||||
unset($this->param);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle selectAct
|
||||
* In order to get a list of pages easily when selecting \n
|
||||
* it supports a method as navigation
|
||||
* @param Object $queryObject
|
||||
* @param resource $connection
|
||||
* @param boolean $with_values
|
||||
* @return Object
|
||||
*/
|
||||
function _executeSelectAct($queryObject, $connection = null, $with_values = false)
|
||||
{
|
||||
if($this->use_prepared_statements != 'Y')
|
||||
{
|
||||
return parent::_executeSelectAct($queryObject, $connection);
|
||||
}
|
||||
$this->param = $queryObject->getArguments();
|
||||
$result = parent::_executeSelectAct($queryObject, $connection, $with_values);
|
||||
unset($this->param);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID generated in the last query
|
||||
* Return next sequence from sequence table
|
||||
* This method use only mysql
|
||||
* @return int
|
||||
*/
|
||||
function db_insert_id()
|
||||
{
|
||||
$connection = $this->_getConnection('master');
|
||||
return mysqli_insert_id($connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a result row as an object
|
||||
* @param resource $result
|
||||
* @return object
|
||||
*/
|
||||
function db_fetch_object(&$result)
|
||||
{
|
||||
return mysqli_fetch_object($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Free result memory
|
||||
* @param resource $result
|
||||
* @return boolean Returns TRUE on success or FALSE on failure.
|
||||
*/
|
||||
function db_free_result(&$result)
|
||||
{
|
||||
return mysqli_free_result($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create table by using the schema xml
|
||||
*
|
||||
* type : number, varchar, tinytext, text, bigtext, char, date, \n
|
||||
* opt : notnull, default, size\n
|
||||
* index : primary key, index, unique\n
|
||||
* @param string $xml_doc xml schema contents
|
||||
* @return void|object
|
||||
*/
|
||||
function _createTable($xml_doc)
|
||||
{
|
||||
// xml parsing
|
||||
$oXml = new XmlParser();
|
||||
$xml_obj = $oXml->parse($xml_doc);
|
||||
// Create a table schema
|
||||
$table_name = $xml_obj->table->attrs->name;
|
||||
if($this->isTableExists($table_name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
$table_name = $this->prefix . $table_name;
|
||||
|
||||
if(!is_array($xml_obj->table->column))
|
||||
{
|
||||
$columns[] = $xml_obj->table->column;
|
||||
}
|
||||
else
|
||||
{
|
||||
$columns = $xml_obj->table->column;
|
||||
}
|
||||
|
||||
foreach($columns as $column)
|
||||
{
|
||||
$name = $column->attrs->name;
|
||||
$type = $column->attrs->type;
|
||||
$size = $column->attrs->size;
|
||||
$notnull = $column->attrs->notnull;
|
||||
$primary_key = $column->attrs->primary_key;
|
||||
$index = $column->attrs->index;
|
||||
$unique = $column->attrs->unique;
|
||||
$default = $column->attrs->default;
|
||||
$auto_increment = $column->attrs->auto_increment;
|
||||
|
||||
$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : '');
|
||||
|
||||
if($primary_key)
|
||||
{
|
||||
$primary_list[] = $name;
|
||||
}
|
||||
else if($unique)
|
||||
{
|
||||
$unique_list[$unique][] = $name;
|
||||
}
|
||||
else if($index)
|
||||
{
|
||||
$index_list[$index][] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
if(count($primary_list))
|
||||
{
|
||||
$column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`');
|
||||
}
|
||||
|
||||
if(count($unique_list))
|
||||
{
|
||||
foreach($unique_list as $key => $val)
|
||||
{
|
||||
$column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`');
|
||||
}
|
||||
}
|
||||
|
||||
if(count($index_list))
|
||||
{
|
||||
foreach($index_list as $key => $val)
|
||||
{
|
||||
$column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`');
|
||||
}
|
||||
}
|
||||
|
||||
$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci");
|
||||
|
||||
$output = $this->_query($schema);
|
||||
if(!$output)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DBMysqli_innodb::$isSupported = function_exists('mysqli_connect');
|
||||
|
|
|
|||
|
|
@ -3,6 +3,18 @@
|
|||
|
||||
class HTMLDisplayHandler
|
||||
{
|
||||
/**
|
||||
* Reserved scripts
|
||||
*/
|
||||
public static $reservedCSS = '@\bcommon/css/(?:xe|mobile)\.(?:min\.)?css$@';
|
||||
public static $reservedJS = '@\bcommon/js/(?:jquery(?:-[123]\.x)?|xe?|common|js_app|xml_handler|xml_js_filter)\.(?:min\.)?js$@';
|
||||
|
||||
/**
|
||||
* Replacement table for XE compatibility
|
||||
*/
|
||||
public static $replacements = array(
|
||||
'@\bcommon/xeicon/@' => 'common/css/xeicon/',
|
||||
);
|
||||
|
||||
/**
|
||||
* Produce HTML compliant content given a module object.\n
|
||||
|
|
@ -231,7 +243,7 @@ class HTMLDisplayHandler
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->_loadJSCSS();
|
||||
$this->_loadDesktopJSCSS();
|
||||
$output = $oTemplate->compile('./common/tpl', 'common_layout');
|
||||
}
|
||||
|
||||
|
|
@ -385,56 +397,21 @@ class HTMLDisplayHandler
|
|||
* import basic .js files.
|
||||
* @return void
|
||||
*/
|
||||
function _loadJSCSS()
|
||||
function _loadDesktopJSCSS()
|
||||
{
|
||||
$oContext = Context::getInstance();
|
||||
$lang_type = Context::getLangType();
|
||||
|
||||
// add common JS/CSS files
|
||||
if(__DEBUG__ || !__XE_VERSION_STABLE__)
|
||||
{
|
||||
$oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -111000), true);
|
||||
$oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -110000), true);
|
||||
$oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/x.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/common.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/js_app.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/css/xe.css', '', '', -1000000), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oContext->loadFile(array('./common/js/jquery-1.x.min.js', 'head', 'lt IE 9', -111000), true);
|
||||
$oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -110000), true);
|
||||
$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/css/xe.min.css', '', '', -1000000), true);
|
||||
}
|
||||
|
||||
$this->_loadCommonJSCSS();
|
||||
|
||||
// for admin page, add admin css
|
||||
if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0)
|
||||
{
|
||||
if(__DEBUG__ || !__XE_VERSION_STABLE__)
|
||||
{
|
||||
$oContext->loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true);
|
||||
$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true);
|
||||
$oContext->loadFile(array("./modules/admin/tpl/css/admin.iefix.css", '', 'ie', 10), true);
|
||||
$oContext->loadFile('./modules/admin/tpl/js/admin.js', true);
|
||||
$oContext->loadFile(array('./modules/admin/tpl/css/admin.bootstrap.css', '', '', 1), true);
|
||||
$oContext->loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true);
|
||||
$oContext->loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', '', '', 10), true);
|
||||
$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true);
|
||||
$oContext->loadFile(array("./modules/admin/tpl/css/admin.iefix.css", '', 'ie', 10), true);
|
||||
$oContext->loadFile('./modules/admin/tpl/js/admin.min.js', true);
|
||||
$oContext->loadFile(array('./modules/admin/tpl/css/admin.bootstrap.min.css', '', '', 1), true);
|
||||
$oContext->loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true);
|
||||
$oContext->loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true);
|
||||
}
|
||||
Context::loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true);
|
||||
Context::loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true);
|
||||
Context::loadFile(array("./modules/admin/tpl/css/admin.iefix.css", '', 'ie', 10), true);
|
||||
Context::loadFile('./modules/admin/tpl/js/admin.js', true);
|
||||
Context::loadFile(array('./modules/admin/tpl/css/admin.bootstrap.css', '', '', 1), true);
|
||||
Context::loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true);
|
||||
Context::loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -443,32 +420,56 @@ class HTMLDisplayHandler
|
|||
*/
|
||||
private function _loadMobileJSCSS()
|
||||
{
|
||||
$oContext = Context::getInstance();
|
||||
$lang_type = Context::getLangType();
|
||||
$this->_loadCommonJSCSS();
|
||||
Context::loadFile(array('./common/css/mobile.css', '', '', -1500000), true);
|
||||
}
|
||||
|
||||
// add common JS/CSS files
|
||||
if(__DEBUG__ || !__XE_VERSION_STABLE__)
|
||||
/**
|
||||
* import common .js and .css files for (both desktop and mobile)
|
||||
*/
|
||||
private function _loadCommonJSCSS()
|
||||
{
|
||||
Context::loadFile(array('./common/css/xe.css', '', '', -1600000), true);
|
||||
$original_file_list = array('x', 'common', 'js_app', 'xml_handler', 'xml_js_filter');
|
||||
|
||||
if(Context::getDBInfo()->minify_scripts === 'none')
|
||||
{
|
||||
$oContext->loadFile(array('./common/js/jquery.js', 'head', '', -110000), true);
|
||||
$oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/x.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/common.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/js_app.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/css/xe.css', '', '', -1000000), true);
|
||||
$oContext->loadFile(array('./common/css/mobile.css', '', '', -1000000), true);
|
||||
Context::loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -1730000), true);
|
||||
Context::loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -1720000), true);
|
||||
foreach($original_file_list as $filename)
|
||||
{
|
||||
Context::loadFile(array('./common/js/' . $filename . '.js', 'head', '', -1700000), true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -110000), true);
|
||||
$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/css/xe.min.css', '', '', -1000000), true);
|
||||
$oContext->loadFile(array('./common/css/mobile.min.css', '', '', -1000000), true);
|
||||
Context::loadFile(array('./common/js/jquery-1.x.min.js', 'head', 'lt IE 9', -1730000), true);
|
||||
Context::loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1720000), true);
|
||||
|
||||
$concat_target_filename = 'files/cache/minify/xe.min.js';
|
||||
if(file_exists(_XE_PATH_ . $concat_target_filename))
|
||||
{
|
||||
$concat_target_mtime = filemtime(_XE_PATH_ . $concat_target_filename);
|
||||
$original_mtime = 0;
|
||||
foreach($original_file_list as $filename)
|
||||
{
|
||||
$original_mtime = max($original_mtime, filemtime(_XE_PATH_ . 'common/js/' . $filename . '.js'));
|
||||
}
|
||||
if($concat_target_mtime > $original_mtime)
|
||||
{
|
||||
Context::loadFile(array('./' . $concat_target_filename, 'head', '', -100000), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
$minifier = new MatthiasMullie\Minify\JS();
|
||||
foreach($original_file_list as $filename)
|
||||
{
|
||||
$minifier->add(_XE_PATH_ . 'common/js/' . $filename . '.js');
|
||||
}
|
||||
FileHandler::writeFile(_XE_PATH_ . $concat_target_filename, $minifier->execute());
|
||||
Context::loadFile(array('./' . $concat_target_filename, 'head', '', -100000), true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file HTMLDisplayHandler.class.php */
|
||||
/* Location: ./classes/display/HTMLDisplayHandler.class.php */
|
||||
|
|
|
|||
|
|
@ -14,14 +14,12 @@ class JSCallbackDisplayHandler
|
|||
$variables = $oModule->getVariables();
|
||||
$variables['error'] = $oModule->getError();
|
||||
$variables['message'] = $oModule->getMessage();
|
||||
$json = str_replace(array("\r\n", "\n", "\t"), array('\n', '\n', '\t'), json_encode2($variables));
|
||||
return sprintf('<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
%s(%s);
|
||||
//]]>
|
||||
</script>', Context::getJSCallbackFunc(), $json);
|
||||
</script>', Context::getJSCallbackFunc(), json_encode($variables));
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file JSCallback.class.php */
|
||||
/* Location: ./classes/display/JSCallback.class.php */
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ class JSONDisplayHandler
|
|||
$variables = $oModule->getVariables();
|
||||
$variables['error'] = $oModule->getError();
|
||||
$variables['message'] = $oModule->getMessage();
|
||||
$json = str_replace(array("\r\n", "\n", "\t"), array('\n', '\n', '\t'), json_encode2($variables));
|
||||
return $json;
|
||||
return json_encode($variables);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
class FrontEndFileHandler extends Handler
|
||||
{
|
||||
|
||||
static $isSSL = null;
|
||||
public static $isSSL = null;
|
||||
public static $minify = null;
|
||||
|
||||
/**
|
||||
* Map for css
|
||||
|
|
@ -92,7 +93,14 @@ class FrontEndFileHandler extends Handler
|
|||
{
|
||||
$args = array($args);
|
||||
}
|
||||
$file = $this->getFileInfo($args[0], $args[2], $args[1]);
|
||||
$args[0] = preg_replace(array_keys(HTMLDisplayHandler::$replacements), array_values(HTMLDisplayHandler::$replacements), $args[0]);
|
||||
$isCommon = preg_match(HTMLDisplayHandler::$reservedCSS, $args[0]) || preg_match(HTMLDisplayHandler::$reservedJS, $args[0]);
|
||||
if($args[3] > -1500000 && $isCommon)
|
||||
{
|
||||
return;
|
||||
}
|
||||
$file = $this->getFileInfo($args[0], $args[2], $args[1], $isCommon);
|
||||
$file->index = (int)$args[3];
|
||||
|
||||
$availableExtension = array('css' => 1, 'js' => 1);
|
||||
if(!isset($availableExtension[$file->fileExtension]))
|
||||
|
|
@ -100,8 +108,6 @@ class FrontEndFileHandler extends Handler
|
|||
return;
|
||||
}
|
||||
|
||||
$file->index = (int) $args[3];
|
||||
|
||||
if($file->fileExtension == 'css')
|
||||
{
|
||||
$map = &$this->cssMap;
|
||||
|
|
@ -123,7 +129,6 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
}
|
||||
|
||||
(is_null($file->index)) ? $file->index = 0 : $file->index = $file->index;
|
||||
if(!isset($mapIndex[$file->key]) || $mapIndex[$file->key] > $file->index)
|
||||
{
|
||||
$this->unloadFile($args[0], $args[2], $args[1]);
|
||||
|
|
@ -138,12 +143,18 @@ class FrontEndFileHandler extends Handler
|
|||
* @param string $fileName The file name
|
||||
* @param string $targetIe Target IE of file
|
||||
* @param string $media Media of file
|
||||
* @param bool $forceMinify Whether this file should be minified
|
||||
* @return stdClass The file information
|
||||
*/
|
||||
private function getFileInfo($fileName, $targetIe = '', $media = 'all')
|
||||
private function getFileInfo($fileName, $targetIe = '', $media = 'all', $forceMinify = false)
|
||||
{
|
||||
static $existsInfo = array();
|
||||
|
||||
if(self::$minify === null)
|
||||
{
|
||||
self::$minify = Context::getDBInfo()->minify_scripts ?: 'common';
|
||||
}
|
||||
|
||||
if(isset($existsInfo[$existsKey]))
|
||||
{
|
||||
return $existsInfo[$existsKey];
|
||||
|
|
@ -155,34 +166,83 @@ class FrontEndFileHandler extends Handler
|
|||
$file->filePath = $this->_getAbsFileUrl($pathInfo['dirname']);
|
||||
$file->fileRealPath = FileHandler::getRealPath($pathInfo['dirname']);
|
||||
$file->fileExtension = strtolower($pathInfo['extension']);
|
||||
$file->fileNameNoExt = preg_replace('/\.min$/', '', $pathInfo['filename']);
|
||||
$file->keyName = implode('.', array($file->fileNameNoExt, $file->fileExtension));
|
||||
$file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']);
|
||||
|
||||
if(strpos($file->filePath, '://') === FALSE)
|
||||
if(preg_match('/^(.+)\.min$/', $pathInfo['filename'], $matches))
|
||||
{
|
||||
if(!__DEBUG__ && __XE_VERSION_STABLE__)
|
||||
$file->fileNameNoExt = $matches[1];
|
||||
$file->isMinified = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$file->fileNameNoExt = $pathInfo['filename'];
|
||||
$file->isMinified = false;
|
||||
}
|
||||
$file->isExternalURL = preg_match('@^(https?:)?//@i', $file->filePath) ? true : false;
|
||||
$file->isCachedScript = !$file->isExternalURL && strpos($file->filePath, 'files/cache/') !== false;
|
||||
$file->keyName = $file->fileNameNoExt . '.' . $file->fileExtension;
|
||||
$file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']);
|
||||
$originalFilePath = $file->fileRealPath . '/' . $pathInfo['basename'];
|
||||
|
||||
// Fix incorrectly minified URL
|
||||
if($file->isMinified && !$file->isExternalURL && (!file_exists($originalFilePath) || is_link($originalFilePath) ||
|
||||
(filesize($originalFilePath) < 32 && trim(file_get_contents($originalFilePath)) === $file->keyName)))
|
||||
{
|
||||
if(file_exists($file->fileRealPath . '/' . $file->fileNameNoExt . '.' . $file->fileExtension))
|
||||
{
|
||||
// if no debug mode, load minifed file
|
||||
$minifiedFileName = implode('.', array($file->fileNameNoExt, 'min', $file->fileExtension));
|
||||
$minifiedRealPath = implode('/', array($file->fileRealPath, $minifiedFileName));
|
||||
if(file_exists($minifiedRealPath))
|
||||
{
|
||||
$file->fileName = $minifiedFileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove .min
|
||||
if(file_exists(implode('/', array($file->fileRealPath, $file->keyName))))
|
||||
{
|
||||
$file->fileName = $file->keyName;
|
||||
}
|
||||
$file->fileName = $file->fileNameNoExt . '.' . $file->fileExtension;
|
||||
$file->isMinified = false;
|
||||
$originalFilePath = $file->fileRealPath . '/' . $file->fileNameNoExt . '.' . $file->fileExtension;
|
||||
}
|
||||
}
|
||||
|
||||
$file->targetIe = $targetIe;
|
||||
// Decide whether to minify this file
|
||||
if(self::$minify === 'all')
|
||||
{
|
||||
$minify_enabled = true;
|
||||
}
|
||||
elseif(self::$minify === 'none')
|
||||
{
|
||||
$minify_enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$minify_enabled = $forceMinify;
|
||||
}
|
||||
|
||||
// Minify file
|
||||
if($minify_enabled && !$file->isMinified && !$file->isExternalURL && !$file->isCachedScript && strpos($file->filePath, 'common/js/plugins') === false)
|
||||
{
|
||||
if(($file->fileExtension === 'css' || $file->fileExtension === 'js') && file_exists($originalFilePath))
|
||||
{
|
||||
$minifiedFileName = $file->fileNameNoExt . '.min.' . $file->fileExtension;
|
||||
$minifiedFileHash = ltrim(str_replace(array('/', '\\'), '.', $pathInfo['dirname']), '.');
|
||||
$minifiedFilePath = _XE_PATH_ . 'files/cache/minify/' . $minifiedFileHash . '.' . $minifiedFileName;
|
||||
|
||||
if(!file_exists($minifiedFilePath) || filemtime($minifiedFilePath) < filemtime($originalFilePath))
|
||||
{
|
||||
if($file->fileExtension === 'css')
|
||||
{
|
||||
$minifier = new MatthiasMullie\Minify\CSS($originalFilePath);
|
||||
$content = $minifier->execute($minifiedFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
$minifier = new MatthiasMullie\Minify\JS($originalFilePath);
|
||||
$content = $minifier->execute($minifiedFilePath);
|
||||
}
|
||||
FileHandler::writeFile($minifiedFilePath, $content);
|
||||
}
|
||||
|
||||
$file->fileName = $minifiedFileHash . '.' . $minifiedFileName;
|
||||
$file->filePath = $this->_getAbsFileUrl('./files/cache/minify');
|
||||
$file->fileRealPath = _XE_PATH_ . 'files/cache/minify';
|
||||
$file->keyName = $minifiedFileHash . '.' . $file->fileNameNoExt . '.' . $file->fileExtension;
|
||||
$file->cdnPath = $this->_normalizeFilePath('./files/cache/minify');
|
||||
$file->isMinified = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Process targetIe and media attributes
|
||||
$file->targetIe = $targetIe;
|
||||
if($file->fileExtension == 'css')
|
||||
{
|
||||
$file->media = $media;
|
||||
|
|
|
|||
|
|
@ -26,20 +26,17 @@ class Purifier
|
|||
|
||||
private function _setConfig()
|
||||
{
|
||||
$whiteDomainRegex = $this->_getWhiteDomainRegx();
|
||||
//$allowdClasses = array('emoticon');
|
||||
|
||||
$this->_config = HTMLPurifier_Config::createDefault();
|
||||
$this->_config->set('HTML.TidyLevel', 'light');
|
||||
$this->_config->set('Output.FlashCompat', TRUE);
|
||||
$this->_config->set('HTML.SafeObject', TRUE);
|
||||
$this->_config->set('HTML.SafeEmbed', TRUE);
|
||||
$this->_config->set('HTML.SafeIframe', TRUE);
|
||||
$this->_config->set('URI.SafeIframeRegexp', $whiteDomainRegex);
|
||||
$this->_config->set('URI.SafeIframeRegexp', $this->_getWhiteDomainRegexp());
|
||||
$this->_config->set('Cache.SerializerPath', $this->_cacheDir);
|
||||
$this->_config->set('Attr.AllowedFrameTargets', array('_blank'));
|
||||
//$allowdClasses = array('emoticon');
|
||||
//$this->_config->set('Attr.AllowedClasses', $allowdClasses);
|
||||
|
||||
$this->_def = $this->_config->getHTMLDefinition(TRUE);
|
||||
}
|
||||
|
||||
|
|
@ -135,32 +132,17 @@ class Purifier
|
|||
return array_unique($attributeList);
|
||||
}
|
||||
|
||||
private function _getWhiteDomainRegx()
|
||||
private function _getWhiteDomainRegexp()
|
||||
{
|
||||
require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');
|
||||
$oEmbedFilter = EmbedFilter::getInstance();
|
||||
$whiteIframeUrlList = $oEmbedFilter->getWhiteIframeUrlList();
|
||||
|
||||
$whiteDomainRegex = '%^(';
|
||||
$whiteDomainCount = count($whiteIframeUrlList);
|
||||
|
||||
$i=1;
|
||||
if(is_array($whiteIframeUrlList))
|
||||
$whiteDomains = array();
|
||||
foreach($whiteIframeUrlList as $domain)
|
||||
{
|
||||
foreach($whiteIframeUrlList as $value)
|
||||
{
|
||||
$whiteDomainRegex .= $value;
|
||||
|
||||
if($i < $whiteDomainCount)
|
||||
{
|
||||
$whiteDomainRegex .= '|';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$whiteDomains[] = preg_quote($domain, '%');
|
||||
}
|
||||
$whiteDomainRegex .= ')%';
|
||||
|
||||
return $whiteDomainRegex;
|
||||
return '%^https?://(' . implode('|', $whiteDomains) . ')%';
|
||||
}
|
||||
|
||||
private function _checkCacheDir()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
*/
|
||||
class TemplateHandler
|
||||
{
|
||||
|
||||
private $compiled_path = 'files/cache/template_compiled/'; ///< path of compiled caches files
|
||||
private $path = NULL; ///< target directory
|
||||
private $filename = NULL; ///< target filename
|
||||
|
|
@ -73,11 +72,11 @@ class TemplateHandler
|
|||
protected function init($tpl_path, $tpl_filename, $tpl_file = '')
|
||||
{
|
||||
// verify arguments
|
||||
if(substr($tpl_path, -1) != '/')
|
||||
if(!$tpl_path || substr($tpl_path, -1) != '/')
|
||||
{
|
||||
$tpl_path .= '/';
|
||||
}
|
||||
if(!is_dir($tpl_path))
|
||||
if($tpl_path === '/' || !is_dir($tpl_path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -366,14 +365,9 @@ class TemplateHandler
|
|||
return;
|
||||
}
|
||||
|
||||
$__Context = &$GLOBALS['__Context__'];
|
||||
$__Context = Context::getInstance();
|
||||
$__Context->tpl_path = $this->path;
|
||||
|
||||
if($_SESSION['is_logged'])
|
||||
{
|
||||
$__Context->logged_info = Context::get('logged_info');
|
||||
}
|
||||
|
||||
$level = ob_get_level();
|
||||
ob_start();
|
||||
if(substr($buff, 0, 7) == 'file://')
|
||||
|
|
@ -694,6 +688,8 @@ class TemplateHandler
|
|||
case 'load':
|
||||
case 'unload':
|
||||
$metafile = '';
|
||||
$replacements = HTMLDisplayHandler::$replacements;
|
||||
$attr['target'] = preg_replace(array_keys($replacements), array_values($replacements), $attr['target']);
|
||||
$pathinfo = pathinfo($attr['target']);
|
||||
$doUnload = ($m[3] === 'unload');
|
||||
$isRemote = !!preg_match('@^(https?:)?//@i', $attr['target']);
|
||||
|
|
|
|||
1
common/css/mobile.min.css
vendored
|
|
@ -1 +0,0 @@
|
|||
@charset "utf-8";/*! Copyright (C) NAVER <http://www.navercorp.com> */.message{position:relative;margin:1em 0;padding:0 1em;border:1px solid #ddd;border-radius:4px;line-height:1.4;font-size:13px;text-shadow:0 1px 0 rgba(255,255,255,.5);background-color:#f8f8f8}body>.message{margin:1em}.message p{margin:1em 0!important}.message.info{border-color:#BCE8F1;color:#3A87AD;background-color:#D9EDF7}.message.error{border-color:#EED3D7;color:#B94A48;background-color:#F2DEDE}.message.update{border-color:#D6E9C6;color:#468847;background-color:#DFF0D8}
|
||||
1
common/css/xe.min.css
vendored
|
|
@ -1 +0,0 @@
|
|||
@charset "utf-8";/*! Copyright (C) NAVER <http://www.navercorp.com> */body,button,input,select,table,textarea{font-family:Tahoma,Geneva,sans-serif;font-size:12px}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}body{position:relative;word-wrap:break-word}a img{border:0}[hidden]{display:none}.xe_content img{max-width:100%;height:auto}@media \0screen{img{max-width:none}}.xe-clearfix:after,.xe-clearfix:before{content:" ";display:table}.xe-clearfix:after{clear:both}.xe-clearfix{zoom:1}.xe-widget-wrapper{overflow:hidden}#popup_menu_area{position:absolute;margin:10px 0;padding:10px;border:1px solid #e9e9e9;border-radius:3px;font-size:12px;box-shadow:0 0 6px #666;filter:progid:DXImageTransform.Microsoft.Shadow(color=#999999, direction=135, strength=5);background:#fff}#popup_menu_area ul{margin:0;padding:0;list-style:none}#popup_menu_area li{margin:0;padding:0;line-height:1.25}#popup_menu_area a{display:block;padding:1px 3px;border-radius:2px;text-decoration:none;color:#333}#popup_menu_area a:active,#popup_menu_area a:focus,#popup_menu_area a:hover{color:#fff;background:#666}.message{position:relative;margin:1em 0;padding:0 1em;border:1px solid #ddd;border-radius:4px;line-height:1.4;font-size:13px;text-shadow:0 1px 0 rgba(255,255,255,.5);background-color:#f8f8f8}body>.message{margin:1em}.message p{margin:1em 0!important}.message.info{border-color:#BCE8F1;color:#3A87AD;background-color:#D9EDF7}.message.error{border-color:#EED3D7;color:#B94A48;background-color:#F2DEDE}.message.update{border-color:#D6E9C6;color:#468847;background-color:#DFF0D8}.wfsr{z-index:100;display:none;position:fixed;left:0;top:0;right:0;margin:0;padding:20px 0 0;border-bottom:1px solid #ccc;text-align:center;font:700 16px/60px "Helvetica Neue",Helvetica,Arial,돋움,Dotum,sans-serif;color:#fff;opacity:.8;filter:alpha(opacity=80);box-shadow:0 0 5px #000;background:#333 url(../../common/img/msg.loading.gif) no-repeat center 15px}.btnArea{clear:both;margin:10px 0;padding:0;text-align:right;zoom:1}.btnArea:after{clear:both;display:block;content:""}.btn{display:inline-block;*display:inline;margin:0;padding:0 12px!important;height:24px!important;overflow:visible;border:1px solid #bbb;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);border-bottom-color:#a2a2a2;border-radius:2px;text-decoration:none!important;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,.75);vertical-align:top;line-height:24px!important;font-family:inherit;font-size:12px;color:#333;*zoom:1;cursor:pointer;box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);background-color:#f5f5f5;*background-color:#e6e6e6;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(top,#fff,#e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}button.btn,input.btn{height:26px!important}.btn:active,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn>a,.btn>button,.btn>input,.btn>span{display:inline-block;*zoom:1;margin:0 -12px!important;padding:0 12px!important;overflow:visible;width:auto;height:24px;border:0;vertical-align:top;text-decoration:none!important;line-height:24px;font-family:inherit;font-size:12px;color:#333;cursor:pointer;background:0 0}.btn-group{position:relative;display:inline-block;*display:inline;*margin-left:.3em;white-space:nowrap;vertical-align:middle;font-size:0;*zoom:1}.btn-group:first-child{*margin-left:0}.btn-group+.btn-group{margin-left:5px}.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group>.btn+.btn{margin-left:-1px}.btn-group>.btn:first-child{margin-left:0;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px}.btn-group>.btn:last-child{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px}.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}
|
||||
74
common/css/xeicon/README.md
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# [XEIcon v2.0.0](http://xpressengine.github.io/XEIcon/)
|
||||
[한글 문서 바로가기 →](https://github.com/xpressengine/XEIcon/blob/2.0.0-wip/README_kor.md)
|
||||
|
||||
### The iconic font and CSS toolkit
|
||||
XEIcon is a full shite of 820 pictographic icons for easy scalable vector graphics on websites,
|
||||
created by designer, [Lee Junha](https://github.com/junnaa), and maintained by [XpressEngine](http://www.xpressengine.com).
|
||||
|
||||
To get stared, check out [http://xpressengine.github.io/XEIcon](http://xpressengine.github.io/XEIcon)!
|
||||
|
||||
|
||||
## Getting icons
|
||||
- [Download the latest release](https://github.com/xpressengine/XEIcon/archive/v2.0.0.zip).
|
||||
- Clone the repo:
|
||||
```
|
||||
$ git clone https://github.com/xpressengine/XEIcon.git
|
||||
```
|
||||
|
||||
- Install with [Bower](http://bower.io):
|
||||
```
|
||||
$ bower install XEIcon
|
||||
```
|
||||
|
||||
- CDN by [jsDelivr](http://www.jsdelivr.com/#!xeicon):
|
||||
```html
|
||||
<link href="//cdn.jsdelivr.net/xeicon/2.0.0/xeicon.min.css"
|
||||
rel="stylesheet">
|
||||
```
|
||||
|
||||
Read the [Get started page](http://xpressengine.github.io/XEIcon/started.html) for information on the contents and examples, and more.
|
||||
|
||||
|
||||
## Changelog
|
||||
- v1.0 - Basic icons added, optimized for 24px default.
|
||||
- v1.0.1 - Detail fix.
|
||||
- v1.0.2 - Added 78 icons.
|
||||
- [v1.0.3 GitHub milestone](https://github.com/xpressengine/XEIcon/issues?q=milestone%3A%22XEIcon+1.0.3%22)
|
||||
- [v1.0.4 GitHub milestone](https://github.com/xpressengine/XEIcon/milestones/XEIcon%201.0.4)
|
||||
- [v2.0.0 Github milestone](https://github.com/xpressengine/XEIcon/milestones/XEIcon%202.1) - Change all icons style.
|
||||
|
||||
|
||||
## Contributing
|
||||
Please read through our [contributing guidelines](https://github.com/xpressengine/XEIcon/blob/master/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development.
|
||||
|
||||
|
||||
## Versioning
|
||||
XEIcon library will be maintained under the Semantic Versioning guidelines as much as possible. Releases will be numbered with the following format:
|
||||
|
||||
`<major>.<minor>.<patch>`
|
||||
|
||||
for more information on SemVer, please visit http://semver.org/
|
||||
|
||||
|
||||
## Maintainors
|
||||
[@juna](https://github.com/junnaa), [@gunil](http://github.com/gunil), [@bnu](https://github.com/bnu).
|
||||
|
||||
|
||||
## Contributors
|
||||
[@LeeYoonGu](https://github.com/LeeYoonGu), [@marob](https://www.facebook.com/marob.99).
|
||||
|
||||
|
||||
## Authors
|
||||
- Email : lee_junha@xpressengine.com
|
||||
- Facebook : https://www.facebook.com/juna.junhalee
|
||||
- GitHub : https://github.com/junnaa
|
||||
|
||||
|
||||
## License
|
||||
- The XEIcon font is licensed under SIL OFL 1.1 :
|
||||
- http://scripts.sil.org/OFL
|
||||
- XEIcon CSS, LESS, and SASS files are licensed under the MIT License :
|
||||
- http://opensource.org/licenses/mit-license.html
|
||||
- The XEIcon documentation is licensed under the CC BY 4.0 License :
|
||||
- http://creativecommons.org/licenses/by-sa/4.0
|
||||
- Full detail : http://xpressengine.github.io/XEIcon/xe_icon_license.html
|
||||
0
common/xeicon/fonts/xeicon.eot → common/css/xeicon/fonts/xeicon.eot
Executable file → Normal file
0
common/xeicon/fonts/xeicon.svg → common/css/xeicon/fonts/xeicon.svg
Executable file → Normal file
|
Before Width: | Height: | Size: 775 KiB After Width: | Height: | Size: 775 KiB |
0
common/xeicon/fonts/xeicon.ttf → common/css/xeicon/fonts/xeicon.ttf
Executable file → Normal file
0
common/xeicon/fonts/xeicon.woff → common/css/xeicon/fonts/xeicon.woff
Executable file → Normal file
0
common/xeicon/fonts/xeicon.woff2 → common/css/xeicon/fonts/xeicon.woff2
Executable file → Normal file
2864
common/css/xeicon/xeicon.css
Normal file
1
common/css/xeicon/xeicon.min.css
vendored
Normal file
|
|
@ -21,6 +21,16 @@ if(jQuery) jQuery.noConflict();
|
|||
($.os.Unix) ? 'Unix' :
|
||||
($.os.Mac) ? 'Mac' : '';
|
||||
|
||||
/* Intercept getScript error due to broken minified script URL */
|
||||
$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
|
||||
if(settings.dataType === "script" && (jqxhr.status >= 400 || (jqxhr.responseText && jqxhr.responseText.length < 32))) {
|
||||
var match = /^(.+)\.min\.(css|js)($|\?)/.exec(settings.url);
|
||||
if(match) {
|
||||
$.getScript(match[1] + "." + match[2], settings.success);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @brief XE 공용 유틸리티 함수
|
||||
* @namespace XE
|
||||
|
|
|
|||
1
common/js/plugins/jquery.fileupload/js/main.min.js
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
main.js
|
||||
1
common/js/x.min.js
vendored
3065
common/js/xe.js
7
common/js/xe.min.js
vendored
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 6 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |