diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..f54186e54 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +.gitattributes export-ignore +.gitignore export-ignore +/tools/ export-ignore +/tests/ export-ignore +/phpDoc/ export-ignore +Gruntfile.js export-ignore +package.json export-ignore +.travis.yml export-ignore \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..83b06d623 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +config.user.inc.php +/files/ +/build/ +/node_modules/ +.DS_Srore +Thumbs.db diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..d518a61de --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: php +php: + - 5.2 + - 5.3 + - 5.4 + - 5.5 +before_script: + - npm install -g grunt-cli + - npm install +script: + - grunt lint diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 000000000..f32728bb0 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1 @@ +Copyright (C) NAVER \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 000000000..9d16eb00b --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,381 @@ +module.exports = function(grunt) { + "use strict"; + + var banner = '/*! Copyright (C) NAVER */\n'; + var banner_xe_js = banner + '/**!\n * @file 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/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: banner_xe_js + }, + 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'] + } + }, + '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/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'], + // 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'], + // 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'], + } + }, + }, + cssmin: { + 'common-css': { + files: { + 'common/css/xe.min.css': ['common/css/xe.css'], + 'common/css/mobile.min.css': ['common/css/mobile.css'] + } + }, + 'module-admin-css': { + files: { + 'modules/admin/tpl/css/admin.min.css': ['modules/admin/tpl/css/admin.css'] + } + }, + 'editor-component-image-gallery': { + files: { + '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'], + } + }, + 'moudle-widget-tpl': { + files: { + 'modules/widget/tpl/css/widget.min.css': ['modules/widget/tpl/css/widget.css'], + } + }, + 'moudle-poll': { + files: { + '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'], + } + }, + 'moudle-editor': { + files: { + 'modules/editor/skins/xpresseditor/css/default.min.css': ['modules/editor/skins/xpresseditor/css/default.css'], + } + }, + 'addon-oembed': { + files: { + 'addons/oembed/jquery.oembed.min.css': ['addons/oembed/jquery.oembed.css'], + } + }, + 'module-board': { + files: { + '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'] + } + } + }, + jshint: { + files: [ + 'Gruntfile.js', + 'common/js/*.js', '!common/js/html5.js', '!common/js/jquery.js', '!common/js/x.js', '!common/js/xe.js', + 'modules/admin/tpl/js/*.js', + 'modules/board/tpl/js/*.js', + 'modules/editor/tpl/js/*.js', + 'modules/menu/tpl/js/*.js', + 'modules/widget/tpl/js/*.js', + ], + options : { + globalstrict: false, + undef : false, + eqeqeq: false, + browser : true, + globals: { + "jQuery" : true, + "console" : true, + "window" : true + }, + ignores : [ + '**/jquery*.js', + '**/swfupload.js', + '**/*.min.js', + '**/*-packed.js', + '**/*.compressed.js' + ] + } + }, + csslint: { + 'common-css': { + options: { + import : 2, + 'adjoining-classes' : false, + 'box-model' : false, + 'duplicate-background-images' : false, + 'ids' : false, + 'important' : false, + 'overqualified-elements' : false, + 'qualified-headings' : false, + 'star-property-hack' : false, + 'underscore-property-hack' : false, + }, + src: [ + 'common/css/*.css', + '!common/css/bootstrap.css', + '!common/css/bootstrap-responsive.css', + '!**/*.min.css', + ] + } + }, + phplint: { + default : { + options: { + phpCmd: "php", + }, + + src: [ + "**/*.php", + "!files/**", + "!tests/**", + "!tools/**", + "!node_modules/**", + "!libs/**" + ], + }, + } + }); + + 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', 'xe/'], + opts: { + cwd: 'build' + } + }, 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', 'xe/'], + opts: { + cwd: 'build' + } + }, 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.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', target] + }, function (error, result, code) { + diff = result.stdout; + + if(diff) { + diff = diff.split(grunt.util.linefeed); + } + + // changed + if(diff.length) { + var args_tar = ['archive', '--prefix=xe/', '-o', 'build/xe.'+version+'.changed.tar.gz', version]; + var args_zip = ['archive', '--prefix=xe/', '-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']); +}; diff --git a/LICENSE b/LICENSE index 602bfc946..57ec76612 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,28 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 +Copyright (C) NAVER + +XE 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 +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. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + ------- + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -10,7 +33,7 @@ as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -112,7 +135,7 @@ modification follow. Pay close attention to the difference between a former contains code derived from the library, whereas the latter must be combined with the library in order to run. - GNU LESSER GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other @@ -432,7 +455,7 @@ decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. @@ -455,50 +478,4 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library 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. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - + END OF TERMS AND CONDITIONS diff --git a/README.md b/README.md new file mode 100644 index 000000000..d82a721ce --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# XpressEngine + +## Authors +adrian.vasile.constantin, aerofleet, @akasima, @andreimarin, araste, @bnu, bradly1, buffkj, c2joy, @canto, cbrghost, @ccata17, @ChanMyeong, chinaskyking, chschy, clench, @devjin, @dionisrom, @dorami, @dragan-dan, ducduydaovn, duvent, @Eundong, @florinutz, @flourscent, @flyskyko, @ForPeople, FruitsHake, guny, @haneul, hankm2004, haojilin, heemin, ikko, johnsonshu, juanlee0, k10206, kagami, @khongchi, @lansi951, @largeden, liahona, lickawtl, mayoojin, mglclub, @misol, mmx900, mooo, mosmartin, @nagoon97, @ngleader, nicetwo, ovclas, risapapa, rokmcssu, royallin, rubyeye, ryin005, sanghunjun, @sejin7940, @SMaker, sspa3141, @stellar12, supershop, @taggon, @ucorina, unryong, venister, wdlee91, welcomeju, @YJSoft, ysnglee2000, zero + +## License +Copyright (C) NAVER + +This library 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. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/addons/adminlogging/adminlogging.addon.php b/addons/adminlogging/adminlogging.addon.php index 6253d12fd..bedc80195 100644 --- a/addons/adminlogging/adminlogging.addon.php +++ b/addons/adminlogging/adminlogging.addon.php @@ -1,18 +1,16 @@ */ if(!defined('__XE__')) exit(); /** * @file adminlogging.addon.php - * @author NHN (developers@xpressengine.com) - * @brief Automatic link add-on + * @author NAVER (developers@xpressengine.com) + * @brief admin log */ $logged_info = Context::get('logged_info'); -$act = Context::get('act'); -$kind = strpos(strtolower($act), 'admin') !== false ? 'admin' : ''; - -if($called_position == 'before_module_proc' && $kind == 'admin' && $logged_info->is_admin == 'Y') +if($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') { $oAdminloggingController = getController('adminlogging'); $oAdminloggingController->insertLog($this->module, $this->act); diff --git a/addons/adminlogging/conf/info.xml b/addons/adminlogging/conf/info.xml index b27e706ab..0cb06b920 100644 --- a/addons/adminlogging/conf/info.xml +++ b/addons/adminlogging/conf/info.xml @@ -13,18 +13,18 @@ 管理選單訪問紀錄及登入日誌。 - 0.1 - 2011-09-28 + 1.7 + 2013-11-27 - NHN - NHN - NHN - NHN - NHN - NHN - NHN - NHN - NHN + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER diff --git a/addons/autolink/autolink.addon.php b/addons/autolink/autolink.addon.php index 7d1a38743..9339fafec 100644 --- a/addons/autolink/autolink.addon.php +++ b/addons/autolink/autolink.addon.php @@ -1,14 +1,15 @@ */ if(!defined('__XE__')) exit(); /** * @file autolink.addon.php - * @author NHN (developers@xpressengine.com) + * @author NAVER (developers@xpressengine.com) * @brief Automatic link add-on */ -if($called_position == 'after_module_proc' && Context::getResponseMethod() != "XMLRPC") +if($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML") { if(Mobile::isFromMobilePhone()) { diff --git a/addons/autolink/autolink.js b/addons/autolink/autolink.js index ad2dcecf6..8b9973c82 100644 --- a/addons/autolink/autolink.js +++ b/addons/autolink/autolink.js @@ -1,7 +1,7 @@ /** * @file autolink.js * @brief javascript code for autolink addon - * @author NHN (developers@xpressengine.com) + * @author NAVER (developers@xpressengine.com) */ (function($){ var protocol_re = '(https?|ftp|news|telnet|irc|mms)://'; diff --git a/addons/autolink/conf/info.xml b/addons/autolink/conf/info.xml index 62bad172d..fb22d052d 100644 --- a/addons/autolink/conf/info.xml +++ b/addons/autolink/conf/info.xml @@ -36,18 +36,18 @@ 是種可將文章及回覆內容中的 URL 網址字串自動轉換成連結的附加元件。 - 0.1 - 2008-04-22 + 1.7 + 2013-11-27 - NHN - NHN - NHN - NHN - NHN - NHN - NHN - NHN - NHN + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER diff --git a/addons/blogapi/blogapi.addon.php b/addons/blogapi/blogapi.addon.php index e1126450d..2fe2de290 100644 --- a/addons/blogapi/blogapi.addon.php +++ b/addons/blogapi/blogapi.addon.php @@ -1,11 +1,12 @@ */ if(!defined('__XE__')) exit(); /** * @file blogapicounter.addon.php - * @author NHN (developers@xpressengine.com) + * @author NAVER (developers@xpressengine.com) * @brief Add blogAPI * * It enables to write a post by using an external tool such as ms live writer, firefox performancing, zoundry and so on. @@ -27,7 +28,7 @@ if($_REQUEST['act'] != 'api') } // Read func file -require_once('./addons/blogapi/blogapi.func.php'); +require_once(_XE_PATH_ . 'addons/blogapi/blogapi.func.php'); // xmlprc parsing // Parse the requested xmlrpc @@ -82,8 +83,8 @@ if($called_position == 'before_module_proc') $category_list = $oDocumentModel->getCategoryList($this->module_srl); // Specifies a temporary file storage - $tmp_uploaded_path = sprintf('./files/cache/blogapi/%s/%s/', $this->mid, $user_id); - $uploaded_target_path = sprintf('/files/cache/blogapi/%s/%s/', $this->mid, $user_id); + $tmp_uploaded_path = sprintf(_XE_PATH_ . 'files/cache/blogapi/%s/%s/', $this->mid, $user_id); + $uploaded_target_path = sprintf(_XE_PATH_ . 'files/cache/blogapi/%s/%s/', $this->mid, $user_id); switch($method_name) { @@ -159,10 +160,7 @@ if($called_position == 'before_module_proc') $tmp_arr = explode('/', $filename); $filename = array_pop($tmp_arr); - if(!is_dir($tmp_uploaded_path)) - { - FileHandler::makeDir($tmp_uploaded_path); - } + FileHandler::makeDir($tmp_uploaded_path); $target_filename = sprintf('%s%s', $tmp_uploaded_path, $filename); FileHandler::writeFile($target_filename, $filedata); @@ -193,7 +191,7 @@ if($called_position == 'before_module_proc') $category = ""; if($oDocument->get('category_srl')) { - $oDocumentModel = &getModel('document'); + $oDocumentModel = getModel('document'); $category_list = $oDocumentModel->getCategoryList($oDocument->get('module_srl')); if($category_list[$oDocument->get('category_srl')]) { @@ -283,7 +281,7 @@ if($called_position == 'before_module_proc') $file_count = count($file_list); if($file_count) { - $oFileController = &getController('file'); + $oFileController = getController('file'); for($i = 0; $i < $file_count; $i++) { $file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]); @@ -397,7 +395,7 @@ if($called_position == 'before_module_proc') $file_count = count($file_list); if($file_count) { - $oFileController = &getController('file'); + $oFileController = getController('file'); for($i = 0; $i < $file_count; $i++) { $file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]); @@ -416,7 +414,7 @@ if($called_position == 'before_module_proc') } } - $oDocumentController = &getController('document'); + $oDocumentController = getController('document'); $output = $oDocumentController->updateDocument($oDocument, $obj, TRUE); if(!$output->toBool()) @@ -489,10 +487,10 @@ if($called_position == 'before_module_proc') $post = new stdClass(); $post->categories = array(); $post->dateCreated = date("Ymd", $oDocument->getRegdateTime()) . 'T' . date("H:i:s", $oDocument->getRegdateTime()); - $post->description = htmlspecialchars($oEditorController->transComponent($oDocument->getContent(false, false, true, false))); + $post->description = htmlspecialchars($oEditorController->transComponent($oDocument->getContent(false, false, true, false)), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); $post->link = $post->permaLink = getFullUrl('', 'document_srl', $oDocument->document_srl); $post->postid = $oDocument->document_srl; - $post->title = htmlspecialchars($oDocument->get('title')); + $post->title = htmlspecialchars($oDocument->get('title'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); $post->publish = 1; $post->userid = $oDocument->get('user_id'); $post->mt_allow_pings = 0; diff --git a/addons/blogapi/blogapi.func.php b/addons/blogapi/blogapi.func.php index 338282a8e..adc3c66f6 100644 --- a/addons/blogapi/blogapi.func.php +++ b/addons/blogapi/blogapi.func.php @@ -1,11 +1,12 @@ */ if(!defined('__XE__')) exit(); /** * @file ./addons/blogapi/blogapi.func.php - * @author NHN (developers@xpressengine.com) + * @author NAVER (developers@xpressengine.com) * @brief Function collections for the implementation of blogapi * */ // Error messages @@ -13,7 +14,7 @@ function getXmlRpcFailure($error, $message) { return sprintf( - "\n\n\nfaultCode\n%d\n\n\nfaultString\n%s\n\n\n\n", $error, htmlspecialchars($message) + "\n\n\nfaultCode\n%d\n\n\nfaultString\n%s\n\n\n\n", $error, htmlspecialchars($message, ENT_COMPAT | ENT_HTML401, 'UTF-8', false) ); } @@ -53,7 +54,7 @@ function _getEncodedVal($val, $is_sub_set = false) $buff = ""; foreach($values as $k => $v) { - $buff .= sprintf("\n%s\n%s\n", htmlspecialchars($k), _getEncodedVal($v, true)); + $buff .= sprintf("\n%s\n%s\n", htmlspecialchars($k, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), _getEncodedVal($v, true)); } $buff .= "\n"; } diff --git a/addons/blogapi/conf/info.xml b/addons/blogapi/conf/info.xml index 631184856..408cf8ffa 100644 --- a/addons/blogapi/conf/info.xml +++ b/addons/blogapi/conf/info.xml @@ -63,18 +63,18 @@ API網址是 http://安裝位置/模組名稱/api。 將狀態設置成"啟用"時,才可使用 RSD 和 API - 1.0 - 2012-02-22 + 1.7 + 2013-11-27 - NHN - NHN - NHN - NHN - NHN - NHN - NHN - NHN - NHN + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER diff --git a/addons/captcha/captcha.addon.php b/addons/captcha/captcha.addon.php index f061488bd..433adf527 100644 --- a/addons/captcha/captcha.addon.php +++ b/addons/captcha/captcha.addon.php @@ -1,9 +1,11 @@ */ + if(!defined("__XE__")) exit(); /** * @file captcha.addon.php - * @author NHN (developers@xpressengine.com) + * @author NAVER (developers@xpressengine.com) * @brief Captcha for a particular action * English alphabets and voice verification added * */ @@ -17,6 +19,7 @@ if(!class_exists('AddonCaptcha')) { var $addon_info; + var $target_acts = NULL; function setInfo(&$addon_info) { @@ -53,19 +56,7 @@ if(!class_exists('AddonCaptcha')) $type = Context::get('captchaType'); - $target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment'); - if($this->addon_info->apply_find_account == 'apply') - { - $target_acts[] = 'procMemberFindAccount'; - } - if($this->addon_info->apply_resend_auth_mail == 'apply') - { - $target_acts[] = 'procMemberResendAuthMail'; - } - if($this->addon_info->apply_signup == 'apply') - { - $target_acts[] = 'procMemberInsert'; - } + $this->target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment'); if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') { @@ -73,7 +64,7 @@ if(!class_exists('AddonCaptcha')) { if(!$this->compareCaptcha()) { - Context::loadLang('./addons/captcha/lang'); + Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); $_SESSION['XE_VALIDATOR_ERROR'] = -1; $_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied'); $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; @@ -83,15 +74,18 @@ if(!class_exists('AddonCaptcha')) } else { - Context::addHtmlHeader(''); + Context::addHtmlHeader(''); Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true); } } // compare session when calling actions such as writing a post or a comment on the board/issue tracker module - if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $target_acts)) + if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) { - Context::loadLang('./addons/captcha/lang'); + Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); $ModuleHandler->error = "captcha_denied"; } @@ -216,7 +210,7 @@ if(!class_exists('AddonCaptcha')) } // Combine images of each character - for($i = 1; $i < count($im); $i++) + for($i = 1, $c = count($im); $i<$c; $i++) { imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h); imagedestroy($im[$i]); @@ -307,6 +301,8 @@ if(!class_exists('AddonCaptcha')) function compareCaptcha() { + if(!in_array(Context::get('act'), $this->target_acts)) return true; + if($_SESSION['captcha_authed']) { return true; diff --git a/addons/captcha/captcha.js b/addons/captcha/captcha.js index e7ce7591b..8be891b75 100644 --- a/addons/captcha/captcha.js +++ b/addons/captcha/captcha.js @@ -1,12 +1,10 @@ /* procFilter 함수를 가로채서 captcha 이미지 및 폼을 출력 */ -var oldExecXml = null; var calledArgs = null; (function($){ - $(function() { - - var captchaXE = null; + $(function() { + var captchaXE = null; - function xeCaptcha() { + function xeCaptcha() { $('form').each(function(i) { var isSubmitHook = false; @@ -21,7 +19,6 @@ var calledArgs = null; break; } } - } if (isSubmitHook) @@ -49,17 +46,17 @@ var calledArgs = null; $(self).append(''); $(self).submit(); }); - var params = new Array(); - params['captcha_action'] = 'setCaptchaSession'; - params['mid'] = current_mid; - oldExecXml('', '', params, captchaXE.show,new Array('error','message','about_captcha','captcha_reload','captcha_play','cmd_input','cmd_cancel')); + var params = new Array(); + params['captcha_action'] = 'setCaptchaSession'; + params['mid'] = current_mid; + window.oldExecXml('', '', params, captchaXE.show,new Array('error','message','about_captcha','captcha_reload','captcha_play','cmd_input','cmd_cancel')); }); } }); - var body = $(document.body); - var captchaIma; - - if (!captchaXE) { + var body = $(document.body); + var captchaIma; + + if (!captchaXE) { var fc_isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var fc_isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var fc_isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; @@ -68,14 +65,14 @@ var calledArgs = null; if(fc_isIE && fc_isWin && !fc_isOpera){ _object_ =''; _object_ += ''; - _object_ += ''; + _object_ += ''; _object_ += ''; - _object_ += ''; + _object_ += ''; _object_ += ''; - _object_ += ''; + _object_ += ''; _object_ += ''; }else{ - _object_ = ''; + _object_ = ''; } captchaXE = $('').appendTo(captchaXE); - $div.find('button.cancel') + $div.find('button.cancel') .click(function(){ $('#captcha_layer').hide(); }); - + $div.find('button.play') .click(function(){ var swf = window['captcha_audio'] || document['captcha_audio']; @@ -114,15 +111,15 @@ var calledArgs = null; var params = new Array(); params['captcha_action'] = 'setCaptchaSession'; params['mid'] = current_mid; - oldExecXml('','',params, function() { + window.oldExecXml('','',params, function() { $("#captcha_image").attr("src", current_url.setQuery('captcha_action','captchaImage').setQuery('rnd', (new Date).getTime())); }); }); - captchaXE.exec = function(module, act, params, callback_func, response_tags, callback_func_arg, fo_obj) { - var doCheck = false; + captchaXE.exec = function(module, act, params, callback_func, response_tags, callback_func_arg, fo_obj) { + var doCheck = false; - $.each(captchaTargetAct || {}, function(key,val){ if (val == act){ doCheck = true; return false; } }); + $.each(captchaTargetAct || {}, function(key,val){ if (val == act){ doCheck = true; return false; } }); if (doCheck) { /* captcha 를 사용하는 경우 */ @@ -133,49 +130,51 @@ var calledArgs = null; $(this).find('input[type=text]').val('').focus(); return false; } - captchaXE.compare(); return false; + captchaXE.compare(); return false; }); - calledArgs = {'module':module,'act':act,'params':params,'callback_func':callback_func,'response_tags':response_tags,'callback_func_arg':callback_func_arg,'fo_obj':fo_obj}; - var params = new Array(); - params['captcha_action'] = 'setCaptchaSession'; - params['mid'] = current_mid; - oldExecXml(module, act, params, captchaXE.show,new Array('error','message','about_captcha','captcha_reload','captcha_play','cmd_input','cmd_cancel')); + calledArgs = {'module':module,'act':act,'params':params,'callback_func':callback_func,'response_tags':response_tags,'callback_func_arg':callback_func_arg,'fo_obj':fo_obj}; + var params = new Array(); + params['captcha_action'] = 'setCaptchaSession'; + params['mid'] = current_mid; + window.oldExecXml(module, act, params, captchaXE.show,new Array('error','message','about_captcha','captcha_reload','captcha_play','cmd_input','cmd_cancel')); } else { - oldExecXml(module, act, params, callback_func, response_tags, callback_func_arg, fo_obj); + window.oldExecXml(module, act, params, callback_func, response_tags, callback_func_arg, fo_obj); } - return true; - }; + return true; + }; - captchaXE.show = function(ret_obj) { + captchaXE.show = function(ret_obj) { $('#captcha_layer').show(); $("#captchaAbout").html(ret_obj['about_captcha']); $("#captcha_layer .reload").attr('title',ret_obj['captcha_reload']); - $("#captcha_layer .play").attr('title',ret_obj['captcha_play']); + $("#captcha_layer .play").attr('title',ret_obj['captcha_play']); $("#captcha_layer button[type=submit]").html(ret_obj['cmd_input']); $("#captcha_layer button.cancel").html(ret_obj['cmd_cancel']); $("#captcha_image").attr("src", current_url.setQuery('captcha_action','captchaImage').setQuery('rnd', (new Date).getTime())); $div.find('input[type=text]').val('').focus(); $('html, body').css('height','100%'); - }; + }; - captchaXE.compare = function(e) { - var params = new Array(); - params['captcha_action'] = 'captchaCompare'; - params['mid'] = current_mid; - params['secret_text'] = $('#secret_text').val(); - oldExecXml(calledArgs.module,calledArgs.act,params, function() { - $("#captcha_layer").hide(); - oldExecXml(calledArgs.module, calledArgs.act, calledArgs.params, calledArgs.callback_func, calledArgs.response_tags, calledArgs.callback_func_arg, calledArgs.fo_obj); - } ); - }; - } - return captchaXE; - } + captchaXE.compare = function(e) { + var params = new Array(); + params['captcha_action'] = 'captchaCompare'; + params['mid'] = current_mid; + params['secret_text'] = $('#secret_text').val(); + window.oldExecXml(calledArgs.module,calledArgs.act,params, function() { + $("#captcha_layer").hide(); + window.oldExecXml(calledArgs.module, calledArgs.act, calledArgs.params, calledArgs.callback_func, calledArgs.response_tags, calledArgs.callback_func_arg, calledArgs.fo_obj); + } ); + }; + } + return captchaXE; + } - $(window).ready(function(){ - oldExecXml = exec_xml; - exec_xml = xeCaptcha().exec; - }); - }); + $(window).ready(function(){ + if(!window.oldExecXml) { + window.oldExecXml = window.exec_xml; + window.exec_xml = xeCaptcha().exec; + } + }); + }); })(jQuery); diff --git a/addons/captcha/captcha.min.js b/addons/captcha/captcha.min.js index da4a0eee5..b22dc0a66 100644 --- a/addons/captcha/captcha.min.js +++ b/addons/captcha/captcha.min.js @@ -1,2 +1 @@ -var oldExecXml=null,calledArgs=null;(function($){$(function(){var captchaXE=null -function xeCaptcha(){$('form').each(function(i){var isSubmitHook=false;if(!$(this).attr('onsubmit')||$(this).attr('onsubmit').indexOf('procFilter')<0){var act=$(this).find('input[name=act]').val();for(var i=0;i');if(!$(this).find('input[name=error_return_url]'))$(this).append('');$(this).submit(function(event){if($(this).find('input[name=secret_text]').val())return true;event.preventDefault();var self=this;$('#captcha_layer form').submit(function(e){e.preventDefault();if(!$('#secret_text').val()){$(this).find('input[type=text]').val('').focus();return false};$(self).append('');$(self).submit()});var params=new Array();params.captcha_action='setCaptchaSession';params.mid=current_mid;oldExecXml('','',params,captchaXE.show,new Array('error','message','about_captcha','captcha_reload','captcha_play','cmd_input','cmd_cancel'))})}});var body=$(document.body),captchaIma;if(!captchaXE){var fc_isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false,fc_isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false,fc_isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false,_swfURL_=request_uri+'addons/captcha/swf/play.swf';if(fc_isIE&&fc_isWin&&!fc_isOpera){_object_='';_object_+='';_object_+='';_object_+='';_object_+='';_object_+='';_object_+='';_object_+=''}else _object_='';captchaXE=$('