diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..719153d4b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = true +indent_style = tab +indent_size = 4 diff --git a/.travis.yml b/.travis.yml index 23ccb125a..eb62f813c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: php php: -- 5.3 - 5.4 - 5.5 - 5.6 @@ -11,14 +10,14 @@ before_script: - 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')" -- if [[ $TRAVIS_PHP_VERSION != "hhvm" ]]; then php -S localhost:8000 & fi -- if [[ $TRAVIS_PHP_VERSION == "5.3" ]]; then touch codecept.phar; fi +- if [[ $TRAVIS_PHP_VERSION != "5.4" && $TRAVIS_PHP_VERSION != "hhvm" ]]; then php -S localhost:8000 & fi - if [[ $TRAVIS_PHP_VERSION == "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 +- if [[ ! -f codecept.phar ]]; then wget http://codeception.com/releases/2.1.6/codecept.phar; fi script: -- if [[ -f codecept.phar ]]; then php codecept.phar build; fi -- if [[ $TRAVIS_PHP_VERSION == "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis --skip install; fi -- if [[ $TRAVIS_PHP_VERSION != "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis; fi +- if [[ -s codecept.phar ]]; then php codecept.phar build; fi +- if [[ -s codecept.phar && $TRAVIS_PHP_VERSION == "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis --skip install; fi +- if [[ -s codecept.phar && $TRAVIS_PHP_VERSION == "5.4" ]]; then php codecept.phar run -d --fail-fast --env travis --skip install; fi +- if [[ -s codecept.phar && $TRAVIS_PHP_VERSION != "5.4" && $TRAVIS_PHP_VERSION != "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis; fi - grunt lint notifications: email: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e482d998..fd98ea028 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -58,6 +58,8 @@ PHP, HTML, XML, CSS, JS 등 모든 텍스트 파일의 문자셋은 BOM이 없 들여쓰기는 1개의 탭으로 합니다. 단, 탭 대신 공백을 사용하는 파일에서는 일관성 유지를 위해 4칸의 공백을 사용할 수 있습니다. +들여쓴 줄들 사이의 빈 줄도 들여씁니다. (에디터에서 후행 공백을 제거하지 않도록 설정하십시오.) + PHP 코드만으로 이루어진 파일은 맨 끝에 `?>` 태그를 사용하지 않습니다. ### 공백 및 줄바꿈 규칙 @@ -155,5 +157,8 @@ Rhymix에서 정한 `error_reporting` 설정 하에서 어떤 에러도 발생 문자열과 문자열, 정수와 정수를 비교할 때는 가능하면 `==` 대신 `===`을 사용합니다. 실제 자료형이 다를 가능성이 있는 경우 `intval()`, `strval()` 등의 함수와 함께 사용합니다. +PHP 5.4 이상에서 지원하는 간단한 배열 문법(`[1, 2, 3]`)을 사용할 수 있으나, +복잡한 구조의 배열을 선언할 때는 이 문법이 오히려 가독성을 해칠 수 있으니 주의하시기 바랍니다. + 여기에서 규정하지 않은 내용은 [PSR-1](http://www.php-fig.org/psr/psr-1/)과 [PSR-2](http://www.php-fig.org/psr/psr-2/)를 따릅니다. diff --git a/README.md b/README.md index 7c3975e43..83fc1d487 100644 --- a/README.md +++ b/README.md @@ -32,18 +32,23 @@ Rhymix는 개발자와 사용자가 서로의 권리와 책임을 존중하는 ### 설치 환경 -- PHP 5.3.3 이상 (PHP 5.5.9 이상 권장, PHP 7 지원) -- MySQL 4.1.13 이상 (MySQL 5.0.7 이상 또는 MariaDB 권장) -- CUBRID 또는 MS SQL을 DB로 사용할 수도 있으나, 권장하지는 않습니다. +Rhymix를 사용하려면 아래의 조건을 충족하는 웹호스팅이나 서버를 마련하셔야 합니다. + + +- PHP 5.5.9 이상 (PHP 7 권장) +- MySQL 5.0.7 이상 (MariaDB 권장) - 필수 PHP 모듈 - curl - gd - iconv 또는 mbstring - json - mcrypt 또는 openssl - - xml 및 simplexml + - simplexml - php.ini에서 session.auto_start = Off로 설정되어 있어야 합니다. - 설치 폴더 또는 files 폴더에 쓰기 권한이 주어져야 합니다. +- MySQL/MariaDB 외에도 아래의 DB를 사용할 수 있습니다. + - CUBRID 9.0 이상 + - Microsoft SQL Server 2008 이상 ### 개발 참여 diff --git a/addons/oembed/jquery.oembed.js b/addons/oembed/jquery.oembed.js index dd17f4841..1bafb620e 100755 --- a/addons/oembed/jquery.oembed.js +++ b/addons/oembed/jquery.oembed.js @@ -5,1054 +5,952 @@ * Licensed under the MIT license * * Orignal Author: Richard Chamorro - * Forked by Andrew Mee to Provide a slightly diffent kind of embedding - * experience - * - * Modified : NAVER Corp. + * Forked by Andrew Mee to Provide a slightly diffent kind of embedding experience */ (function ($) { - $.fn.oembed = function (url, options, embedAction) { - settings = $.extend(true, $.fn.oembed.defaults, options); - var shortURLList = ["0rz.tw", "1link.in", "1url.com", "2.gp", "2big.at", "2tu.us", "3.ly", "307.to", "4ms.me", "4sq.com", "4url.cc", "6url.com", "7.ly", "a.gg", "a.nf", "aa.cx", "abcurl.net", - "ad.vu", "adf.ly", "adjix.com", "afx.cc", "all.fuseurl.com", "alturl.com", "amzn.to", "ar.gy", "arst.ch", "atu.ca", "azc.cc", "b23.ru", "b2l.me", "bacn.me", "bcool.bz", "binged.it", - "bit.ly", "bizj.us", "bloat.me", "bravo.ly", "bsa.ly", "budurl.com", "canurl.com", "chilp.it", "chzb.gr", "cl.lk", "cl.ly", "clck.ru", "cli.gs", "cliccami.info", - "clickthru.ca", "clop.in", "conta.cc", "cort.as", "cot.ag", "crks.me", "ctvr.us", "cutt.us", "dai.ly", "decenturl.com", "dfl8.me", "digbig.com", - "http:\/\/digg\.com\/[^\/]+$", "disq.us", "dld.bz", "dlvr.it", "do.my", "doiop.com", "dopen.us", "easyuri.com", "easyurl.net", "eepurl.com", "eweri.com", - "fa.by", "fav.me", "fb.me", "fbshare.me", "ff.im", "fff.to", "fire.to", "firsturl.de", "firsturl.net", "flic.kr", "flq.us", "fly2.ws", "fon.gs", "freak.to", - "fuseurl.com", "fuzzy.to", "fwd4.me", "fwib.net", "g.ro.lt", "gizmo.do", "gl.am", "go.9nl.com", "go.ign.com", "go.usa.gov", "goo.gl", "goshrink.com", "gurl.es", - "hex.io", "hiderefer.com", "hmm.ph", "href.in", "hsblinks.com", "htxt.it", "huff.to", "hulu.com", "hurl.me", "hurl.ws", "icanhaz.com", "idek.net", "ilix.in", "is.gd", - "its.my", "ix.lt", "j.mp", "jijr.com", "kl.am", "klck.me", "korta.nu", "krunchd.com", "l9k.net", "lat.ms", "liip.to", "liltext.com", "linkbee.com", "linkbun.ch", - "liurl.cn", "ln-s.net", "ln-s.ru", "lnk.gd", "lnk.ms", "lnkd.in", "lnkurl.com", "lru.jp", "lt.tl", "lurl.no", "macte.ch", "mash.to", "merky.de", "migre.me", "miniurl.com", - "minurl.fr", "mke.me", "moby.to", "moourl.com", "mrte.ch", "myloc.me", "myurl.in", "n.pr", "nbc.co", "nblo.gs", "nn.nf", "not.my", "notlong.com", "nsfw.in", - "nutshellurl.com", "nxy.in", "nyti.ms", "o-x.fr", "oc1.us", "om.ly", "omf.gd", "omoikane.net", "on.cnn.com", "on.mktw.net", "onforb.es", "orz.se", "ow.ly", "ping.fm", - "pli.gs", "pnt.me", "politi.co", "post.ly", "pp.gg", "profile.to", "ptiturl.com", "pub.vitrue.com", "qlnk.net", "qte.me", "qu.tc", "qy.fi", "r.ebay.com", "r.im", "rb6.me", "read.bi", - "readthis.ca", "reallytinyurl.com", "redir.ec", "redirects.ca", "redirx.com", "retwt.me", "ri.ms", "rickroll.it", "riz.gd", "rt.nu", "ru.ly", "rubyurl.com", "rurl.org", - "rww.tw", "s4c.in", "s7y.us", "safe.mn", "sameurl.com", "sdut.us", "shar.es", "shink.de", "shorl.com", "short.ie", "short.to", "shortlinks.co.uk", "shorturl.com", - "shout.to", "show.my", "shrinkify.com", "shrinkr.com", "shrt.fr", "shrt.st", "shrten.com", "shrunkin.com", "simurl.com", "slate.me", "smallr.com", "smsh.me", "smurl.name", - "sn.im", "snipr.com", "snipurl.com", "snurl.com", "sp2.ro", "spedr.com", "srnk.net", "srs.li", "starturl.com", "stks.co", "su.pr", "surl.co.uk", "surl.hu", "t.cn", "t.co", "t.lh.com", - "ta.gd", "tbd.ly", "tcrn.ch", "tgr.me", "tgr.ph", "tighturl.com", "tiniuri.com", "tiny.cc", "tiny.ly", "tiny.pl", "tinylink.in", "tinyuri.ca", "tinyurl.com", "tk.", "tl.gd", - "tmi.me", "tnij.org", "tnw.to", "tny.com", "to.ly", "togoto.us", "totc.us", "toysr.us", "tpm.ly", "tr.im", "tra.kz", "trunc.it", "twhub.com", "twirl.at", - "twitclicks.com", "twitterurl.net", "twitterurl.org", "twiturl.de", "twurl.cc", "twurl.nl", "u.mavrev.com", "u.nu", "u76.org", "ub0.cc", "ulu.lu", "updating.me", "ur1.ca", - "url.az", "url.co.uk", "url.ie", "url360.me", "url4.eu", "urlborg.com", "urlbrief.com", "urlcover.com", "urlcut.com", "urlenco.de", "urli.nl", "urls.im", - "urlshorteningservicefortwitter.com", "urlx.ie", "urlzen.com", "usat.ly", "use.my", "vb.ly", "vevo.ly", "vgn.am", "vl.am", "vm.lc", "w55.de", "wapo.st", "wapurl.co.uk", "wipi.es", - "wp.me", "x.vu", "xr.com", "xrl.in", "xrl.us", "xurl.es", "xurl.jp", "y.ahoo.it", "yatuc.com", "ye.pe", "yep.it", "yfrog.com", "yhoo.it", "yiyd.com", "youtu.be", "yuarel.com", - "z0p.de", "zi.ma", "zi.mu", "zipmyurl.com", "zud.me", "zurl.ws", "zz.gd", "zzang.kr", "›.ws", "✩.ws", "✿.ws", "❥.ws", "➔.ws", "➞.ws", "➡.ws", "➨.ws", "➯.ws", "➹.ws", "➽.ws" - ]; + $.fn.oembed = function (url, options, embedAction) { - if($('#jqoembeddata').length === 0) $('').appendTo('body'); + settings = $.extend(true, $.fn.oembed.defaults, options); + var shortURLList = ["0rz.tw", "1link.in", "1url.com", "2.gp", "2big.at", "2tu.us", "3.ly", "307.to", "4ms.me", "4sq.com", "4url.cc", "6url.com", "7.ly", "a.gg", "a.nf", "aa.cx", "abcurl.net", + "ad.vu", "adf.ly", "adjix.com", "afx.cc", "all.fuseurl.com", "alturl.com", "amzn.to", "ar.gy", "arst.ch", "atu.ca", "azc.cc", "b23.ru", "b2l.me", "bacn.me", "bcool.bz", "binged.it", + "bit.ly", "bizj.us", "bloat.me", "bravo.ly", "bsa.ly", "budurl.com", "canurl.com", "chilp.it", "chzb.gr", "cl.lk", "cl.ly", "clck.ru", "cli.gs", "cliccami.info", + "clickthru.ca", "clop.in", "conta.cc", "cort.as", "cot.ag", "crks.me", "ctvr.us", "cutt.us", "dai.ly", "decenturl.com", "dfl8.me", "digbig.com", + "http:\/\/digg\.com\/[^\/]+$", "disq.us", "dld.bz", "dlvr.it", "do.my", "doiop.com", "dopen.us", "easyuri.com", "easyurl.net", "eepurl.com", "eweri.com", + "fa.by", "fav.me", "fb.me", "fbshare.me", "ff.im", "fff.to", "fire.to", "firsturl.de", "firsturl.net", "flic.kr", "flq.us", "fly2.ws", "fon.gs", "freak.to", + "fuseurl.com", "fuzzy.to", "fwd4.me", "fwib.net", "g.ro.lt", "gizmo.do", "gl.am", "go.9nl.com", "go.ign.com", "go.usa.gov", "goo.gl", "goshrink.com", "gurl.es", + "hex.io", "hiderefer.com", "hmm.ph", "href.in", "hsblinks.com", "htxt.it", "huff.to", "hulu.com", "hurl.me", "hurl.ws", "icanhaz.com", "idek.net", "ilix.in", "is.gd", + "its.my", "ix.lt", "j.mp", "jijr.com", "kl.am", "klck.me", "korta.nu", "krunchd.com", "l9k.net", "lat.ms", "liip.to", "liltext.com", "linkbee.com", "linkbun.ch", + "liurl.cn", "ln-s.net", "ln-s.ru", "lnk.gd", "lnk.ms", "lnkd.in", "lnkurl.com", "lru.jp", "lt.tl", "lurl.no", "macte.ch", "mash.to", "merky.de", "migre.me", "miniurl.com", + "minurl.fr", "mke.me", "moby.to", "moourl.com", "mrte.ch", "myloc.me", "myurl.in", "n.pr", "nbc.co", "nblo.gs", "nn.nf", "not.my", "notlong.com", "nsfw.in", + "nutshellurl.com", "nxy.in", "nyti.ms", "o-x.fr", "oc1.us", "om.ly", "omf.gd", "omoikane.net", "on.cnn.com", "on.mktw.net", "onforb.es", "orz.se", "ow.ly", "ping.fm", + "pli.gs", "pnt.me", "politi.co", "post.ly", "pp.gg", "profile.to", "ptiturl.com", "pub.vitrue.com", "qlnk.net", "qte.me", "qu.tc", "qy.fi", "r.ebay.com", "r.im", "rb6.me", "read.bi", + "readthis.ca", "reallytinyurl.com", "redir.ec", "redirects.ca", "redirx.com", "retwt.me", "ri.ms", "rickroll.it", "riz.gd", "rt.nu", "ru.ly", "rubyurl.com", "rurl.org", + "rww.tw", "s4c.in", "s7y.us", "safe.mn", "sameurl.com", "sdut.us", "shar.es", "shink.de", "shorl.com", "short.ie", "short.to", "shortlinks.co.uk", "shorturl.com", + "shout.to", "show.my", "shrinkify.com", "shrinkr.com", "shrt.fr", "shrt.st", "shrten.com", "shrunkin.com", "simurl.com", "slate.me", "smallr.com", "smsh.me", "smurl.name", + "sn.im", "snipr.com", "snipurl.com", "snurl.com", "sp2.ro", "spedr.com", "srnk.net", "srs.li", "starturl.com", "stks.co", "su.pr", "surl.co.uk", "surl.hu", "t.cn", "t.co", "t.lh.com", + "ta.gd", "tbd.ly", "tcrn.ch", "tgr.me", "tgr.ph", "tighturl.com", "tiniuri.com", "tiny.cc", "tiny.ly", "tiny.pl", "tinylink.in", "tinyuri.ca", "tinyurl.com", "tk.", "tl.gd", + "tmi.me", "tnij.org", "tnw.to", "tny.com", "to.ly", "togoto.us", "totc.us", "toysr.us", "tpm.ly", "tr.im", "tra.kz", "trunc.it", "twhub.com", "twirl.at", + "twitclicks.com", "twitterurl.net", "twitterurl.org", "twiturl.de", "twurl.cc", "twurl.nl", "u.mavrev.com", "u.nu", "u76.org", "ub0.cc", "ulu.lu", "updating.me", "ur1.ca", + "url.az", "url.co.uk", "url.ie", "url360.me", "url4.eu", "urlborg.com", "urlbrief.com", "urlcover.com", "urlcut.com", "urlenco.de", "urli.nl", "urls.im", + "urlshorteningservicefortwitter.com", "urlx.ie", "urlzen.com", "usat.ly", "use.my", "vb.ly", "vevo.ly", "vgn.am", "vl.am", "vm.lc", "w55.de", "wapo.st", "wapurl.co.uk", "wipi.es", + "wp.me", "x.vu", "xr.com", "xrl.in", "xrl.us", "xurl.es", "xurl.jp", "y.ahoo.it", "yatuc.com", "ye.pe", "yep.it", "yfrog.com", "yhoo.it", "yiyd.com", "youtu.be", "yuarel.com", + "z0p.de", "zi.ma", "zi.mu", "zipmyurl.com", "zud.me", "zurl.ws", "zz.gd", "zzang.kr", "›.ws", "✩.ws", "✿.ws", "❥.ws", "➔.ws", "➞.ws", "➡.ws", "➨.ws", "➯.ws", "➹.ws", "➽.ws"]; - return this.each(function () { - var container = $(this), - resourceURL = (url && (!url.indexOf('http://') || !url.indexOf('https://'))) ? url : container.attr("href"), - provider; + if ($('#jqoembeddata').length === 0) $('').appendTo('body'); - if(embedAction) { - settings.onEmbed = embedAction; - } else if(!settings.onEmbed) { - settings.onEmbed = function (oembedData) { - $.fn.oembed.insertCode(this, settings.embedMethod, oembedData); - }; - } + return this.each(function () { + var container = $(this), + resourceURL = (url && (!url.indexOf('http://') || !url.indexOf('https://'))) ? url : container.attr("href"), + provider; - if(resourceURL !== null && resourceURL !== undefined) { - //Check if shorten URL - for(var j = 0, l = shortURLList.length; j < l; j++) { - var regExp = new RegExp('://' + shortURLList[j] + '/', "i"); - if(resourceURL.match(regExp) !== null) { - //AJAX to http://api.longurl.org/v2/expand?url=http://bit.ly/JATvIs&format=json&callback=hhh - var ajaxopts = $.extend({ - url: "http://api.longurl.org/v2/expand", - dataType: 'jsonp', - data: { - url: resourceURL, - format: "json" - //callback: "?" - }, - success: function (data) { - //this = $.fn.oembed; - resourceURL = data['long-url']; - provider = $.fn.oembed.getOEmbedProvider(data['long-url']); + if (embedAction) { + settings.onEmbed = embedAction; + } + else if (!settings.onEmbed) { + settings.onEmbed = function (oembedData) { + $.fn.oembed.insertCode(this, settings.embedMethod, oembedData); + }; + } - if(provider !== null) { - provider.params = getNormalizedParams(settings[provider.name]) || {}; - provider.maxWidth = settings.maxWidth; - provider.maxHeight = settings.maxHeight; - embedCode(container, resourceURL, provider); - } else { - settings.onProviderNotFound.call(container, resourceURL); - } - } - }, settings.ajaxOptions || {}); + if (resourceURL !== null && resourceURL !== undefined) { + //Check if shorten URL + for (var j = 0, l = shortURLList.length; j < l; j++) { + var regExp = new RegExp('://' + shortURLList[j] + '/', "i"); + + provider = $.fn.oembed.getOEmbedProvider(resourceURL); - $.ajax(ajaxopts); + if (!provider && window.location.protocol !== "https:" && resourceURL.match(regExp) !== null) { + //AJAX to http://api.longurl.org/v2/expand?url=http://bit.ly/JATvIs&format=json&callback=hhh + var ajaxopts = $.extend({ + url: "http://api.longurl.org/v2/expand", + dataType: 'jsonp', + data: { + url: resourceURL, + format: "json" + //callback: "?" + }, + success: function (data) { + //this = $.fn.oembed; + resourceURL = data['long-url']; + provider = $.fn.oembed.getOEmbedProvider(data['long-url']); - return container; - } - } - provider = $.fn.oembed.getOEmbedProvider(resourceURL); + //remove fallback + if (!!settings.fallback === false) { + provider = provider.name.toLowerCase() === 'opengraph' ? null : provider; + } - if(provider !== null) { - provider.params = getNormalizedParams(settings[provider.name]) || {}; - provider.maxWidth = settings.maxWidth; - provider.maxHeight = settings.maxHeight; - embedCode(container, resourceURL, provider); - } else { - settings.onProviderNotFound.call(container, resourceURL); - } - } + if (provider !== null) { + provider.params = getNormalizedParams(settings[provider.name]) || {}; + provider.maxWidth = settings.maxWidth; + provider.maxHeight = settings.maxHeight; + embedCode(container, resourceURL, provider); + } else { + settings.onProviderNotFound.call(container, resourceURL); + } + }, + error: function () { + settings.onError.call(container, resourceURL) + } + }, settings.longUrlAjaxOptions || settings.ajaxOptions || {}); - return container; - }); + $.ajax(ajaxopts); + + return container; + } + } + + //remove fallback + if (!!settings.fallback === false) { + provider = provider.name.toLowerCase() === 'opengraph' ? null : provider; + } + if (provider !== null) { + provider.params = getNormalizedParams(settings[provider.name]) || {}; + provider.maxWidth = settings.maxWidth; + provider.maxHeight = settings.maxHeight; + embedCode(container, resourceURL, provider); + } else { + settings.onProviderNotFound.call(container, resourceURL); + } + } + return container; + }); + }; + + var settings; + + // Plugin defaults + $.fn.oembed.defaults = { + fallback: true, + maxWidth: null, + maxHeight: null, + includeHandle: true, + embedMethod: 'auto', + // "auto", "append", "fill" + onProviderNotFound: function () { + }, + beforeEmbed: function () { + }, + afterEmbed: function () { + }, + onEmbed: false, + onError: function (a, b, c, d) { + console.log('err:', a, b, c, d) + }, + ajaxOptions: {}, + longUrlAjaxOptions: {} + }; + + /* Private functions */ + function rand(length, current) { //Found on http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript + current = current ? current : ''; + return length ? rand(--length, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".charAt(Math.floor(Math.random() * 60)) + current) : current; + } + + function getRequestUrl(provider, externalUrl) { + var url = provider.apiendpoint, + qs = "", + i; + url += (url.indexOf("?") <= 0) ? "?" : "&"; + url = url.replace('#', '%23'); + + if (provider.maxWidth !== null && (typeof provider.params.maxwidth === 'undefined' || provider.params.maxwidth === null)) { + provider.params.maxwidth = provider.maxWidth; + } + + if (provider.maxHeight !== null && (typeof provider.params.maxheight === 'undefined' || provider.params.maxheight === null)) { + provider.params.maxheight = provider.maxHeight; + } + + for (i in provider.params) { + // We don't want them to jack everything up by changing the callback parameter + if (i == provider.callbackparameter) + continue; + + // allows the options to be set to null, don't send null values to the server as parameters + if (provider.params[i] !== null) + qs += "&" + escape(i) + "=" + provider.params[i]; + } + + url += "format=" + provider.format + "&url=" + escape(externalUrl) + qs; + if (provider.dataType != 'json') + url += "&" + provider.callbackparameter + "=?"; + + return url; + } + + function success(oembedData, externalUrl, container) { + $('#jqoembeddata').data(externalUrl, oembedData.code); + settings.beforeEmbed.call(container, oembedData); + settings.onEmbed.call(container, oembedData); + settings.afterEmbed.call(container, oembedData); + } + + function embedCode(container, externalUrl, embedProvider) { + if ($('#jqoembeddata').data(externalUrl) != undefined && embedProvider.embedtag.tag != 'iframe') { + var oembedData = {code: $('#jqoembeddata').data(externalUrl)}; + success(oembedData, externalUrl, container); + } else if (embedProvider.yql) { + var from = embedProvider.yql.from || 'htmlstring'; + var url = embedProvider.yql.url ? embedProvider.yql.url(externalUrl) : externalUrl; + var query = 'SELECT * FROM ' + from + + ' WHERE url="' + (url) + '"' + + " and " + (/html/.test(from) ? 'xpath' : 'itemPath') + "='" + (embedProvider.yql.xpath || '/') + "'"; + if (from == 'html') + query += " and compat='html5'"; + var ajaxopts = $.extend({ + url: "//query.yahooapis.com/v1/public/yql", + dataType: 'jsonp', + data: { + q: query, + format: "json", + env: 'store://datatables.org/alltableswithkeys', + callback: "?" + }, + success: function (data) { + var result; + + if (embedProvider.yql.xpath && embedProvider.yql.xpath == '//meta|//title|//link') { + var meta = {}; + + if (data.query == null) { + data.query = {}; + } + if (data.query.results == null) { + data.query.results = {"meta": []}; + } + for (var i = 0, l = data.query.results.meta.length; i < l; i++) { + var name = data.query.results.meta[i].name || data.query.results.meta[i].property || null; + if (name == null)continue; + meta[name.toLowerCase()] = data.query.results.meta[i].content; + } + if (!meta.hasOwnProperty("title") || !meta.hasOwnProperty("og:title")) { + if (data.query.results.title != null) { + meta.title = data.query.results.title; + } + } + if (!meta.hasOwnProperty("og:image") && data.query.results.hasOwnProperty("link")) { + for (var i = 0, l = data.query.results.link.length; i < l; i++) { + if (data.query.results.link[i].hasOwnProperty("rel")) { + if (data.query.results.link[i].rel == "apple-touch-icon") { + if (data.query.results.link[i].href.charAt(0) == "/") { + meta["og:image"] = url.match(/^(([a-z]+:)?(\/\/)?[^\/]+\/).*$/)[1] + data.query.results.link[i].href; + } else { + meta["og:image"] = data.query.results.link[i].href; + } + } + } + } + } + result = embedProvider.yql.datareturn(meta); + } else { + result = embedProvider.yql.datareturn ? embedProvider.yql.datareturn(data.query.results) : data.query.results.result; + } + if (result === false)return; + var oembedData = $.extend({}, result); + oembedData.code = result; + success(oembedData, externalUrl, container); + }, + error: settings.onError.call(container, externalUrl, embedProvider) + }, settings.ajaxOptions || {}); + $.ajax(ajaxopts); + } else if (embedProvider.templateRegex) { + if (embedProvider.embedtag.tag !== '') { + var flashvars = embedProvider.embedtag.flashvars || ''; + var tag = embedProvider.embedtag.tag || 'embed'; + var width = embedProvider.embedtag.width || 'auto'; + var height = embedProvider.embedtag.height || 'auto'; + var src = externalUrl.replace(embedProvider.templateRegex, embedProvider.apiendpoint); + + if (!embedProvider.nocache) { + src += '&jqoemcache=' + rand(5); + } + + if (embedProvider.apikey) { + src = src.replace('_APIKEY_', settings.apikeys[embedProvider.name]); + } + + var code = $('<' + tag + '/>').attr('src', src).attr('width', width) + .attr('height', height) + .attr('allowfullscreen', embedProvider.embedtag.allowfullscreen || 'true') + .attr('allowscriptaccess', embedProvider.embedtag.allowfullscreen || 'always') + .css('max-height', settings.maxHeight || 'auto') + .css('max-width', settings.maxWidth || 'auto'); + + if (tag == 'embed') { + code.attr('type', embedProvider.embedtag.type || "application/x-shockwave-flash") + .attr('flashvars', externalUrl.replace(embedProvider.templateRegex, flashvars)); + } + + if (tag == 'iframe') { + code.attr('scrolling', embedProvider.embedtag.scrolling || "no") + .attr('frameborder', embedProvider.embedtag.frameborder || "0"); + + } + + success({code: code}, externalUrl, container); + } else if (embedProvider.apiendpoint) { + //Add APIkey if true + if (embedProvider.apikey) + embedProvider.apiendpoint = embedProvider.apiendpoint.replace('_APIKEY_', settings.apikeys[embedProvider.name]); + + ajaxopts = $.extend({ + url: externalUrl.replace(embedProvider.templateRegex, embedProvider.apiendpoint), + dataType: 'jsonp', + success: function (data) { + var oembedData = $.extend({}, data); + oembedData.code = embedProvider.templateData(data); + success(oembedData, externalUrl, container); + }, + error: settings.onError.call(container, externalUrl, embedProvider) + }, settings.ajaxOptions || {}); + $.ajax(ajaxopts); + } else { + success({code: externalUrl.replace(embedProvider.templateRegex, embedProvider.template)}, externalUrl, container); + } + } else { + + var requestUrl = getRequestUrl(embedProvider, externalUrl); + ajaxopts = $.extend({ + url: requestUrl, + dataType: embedProvider.dataType || 'jsonp', + success: function (data) { + var oembedData = $.extend({}, data); + switch (oembedData.type) { + case "file": //Deviant Art has this + case "photo": + oembedData.code = $.fn.oembed.getPhotoCode(externalUrl, oembedData); + break; + case "video": + case "rich": + oembedData.code = $.fn.oembed.getRichCode(externalUrl, oembedData); + break; + default: + oembedData.code = $.fn.oembed.getGenericCode(externalUrl, oembedData); + break; + } + success(oembedData, externalUrl, container); + }, + error: settings.onError.call(container, externalUrl, embedProvider) + }, settings.ajaxOptions || {}); + $.ajax(ajaxopts); + } + } + + function getNormalizedParams(params) { + if (params === null) return null; + var key, normalizedParams = {}; + for (key in params) { + if (key !== null) normalizedParams[key.toLowerCase()] = params[key]; + } + return normalizedParams; + } + + /* Public functions */ + $.fn.oembed.insertCode = function (container, embedMethod, oembedData) { + if (oembedData === null) + return; + + if (embedMethod === 'auto' && container.attr('href') !== null) { + embedMethod = 'append'; + } else if (embedMethod == 'auto') { + embedMethod = 'replace'; + } + + switch (embedMethod) { + case "replace": + container.replaceWith(oembedData.code); + break; + case "fill": + container.html(oembedData.code); + break; + case "append": + container.wrap('
'); + var oembedContainer = container.parent(); + if (settings.includeHandle) { + $('').insertBefore(container).click(function () { + var encodedString = encodeURIComponent($(this).text()); + $(this).html((encodedString == '%E2%86%91') ? '↓' : '↑'); + $(this).parent().children().last().toggle(); + }); + } + oembedContainer.append('
'); + try { + oembedData.code.clone().appendTo(oembedContainer); + } catch (e) { + oembedContainer.append(oembedData.code); + } + /* Make videos semi-responsive + * If parent div width less than embeded iframe video then iframe gets shrunk to fit smaller width + * If parent div width greater thans embed iframe use the max widht + * - works on youtubes and vimeo + */ + if (settings.maxWidth) { + var post_width = oembedContainer.parent().width(); + if (post_width < settings.maxWidth) { + var iframe_width_orig = $('iframe', oembedContainer).width(); + var iframe_height_orig = $('iframe', oembedContainer).height(); + var ratio = iframe_width_orig / post_width; + $('iframe', oembedContainer).width(iframe_width_orig / ratio); + $('iframe', oembedContainer).height(iframe_height_orig / ratio); + } else { + if (settings.maxWidth) { + $('iframe', oembedContainer).width(settings.maxWidth); + } + if (settings.maxHeight) { + $('iframe', oembedContainer).height(settings.maxHeight); + } + } + } + break; + } + }; + + $.fn.oembed.getPhotoCode = function (url, oembedData) { + var code; + var alt = oembedData.title ? oembedData.title : ''; + alt += oembedData.author_name ? ' - ' + oembedData.author_name : ''; + alt += oembedData.provider_name ? ' - ' + oembedData.provider_name : ''; + + if (oembedData.url) { + code = '
' + alt + '
'; + } else if (oembedData.thumbnail_url) { + var newURL = oembedData.thumbnail_url.replace('_s', '_b'); + code = '
' + alt + '
'; + } else { + code = '
Error loading this picture
'; + } + + if (oembedData.html) { + code += "
" + oembedData.html + "
"; + } + + return code; + }; + + $.fn.oembed.getRichCode = function (url, oembedData) { + return oembedData.html; + }; + + $.fn.oembed.getGenericCode = function (url, oembedData) { + var title = ((oembedData.title) && (oembedData.title !== null)) ? oembedData.title : url; + var code = '' + title + ''; + + if (oembedData.html) { + code += "
" + oembedData.html + "
"; + } + + return code; + }; + + $.fn.oembed.getOEmbedProvider = function (url) { + for (var i = 0; i < $.fn.oembed.providers.length; i++) { + for (var j = 0, l = $.fn.oembed.providers[i].urlschemes.length; j < l; j++) { + var regExp = new RegExp($.fn.oembed.providers[i].urlschemes[j], "i"); + + if (url.match(regExp) !== null) + return $.fn.oembed.providers[i]; + } + } + return null; + }; + + // Constructor Function for OEmbedProvider Class. + $.fn.oembed.OEmbedProvider = function (name, type, urlschemesarray, apiendpoint, extraSettings) { + this.name = name; + this.type = type; // "photo", "video", "link", "rich", null + this.urlschemes = urlschemesarray; + this.apiendpoint = apiendpoint; + this.maxWidth = 500; + this.maxHeight = 400; + extraSettings = extraSettings || {}; + + if (extraSettings.useYQL) { + + if (extraSettings.useYQL == 'xml') { + extraSettings.yql = { + xpath: "//oembed/html", + from: 'xml', + apiendpoint: this.apiendpoint, + url: function (externalurl) { + return this.apiendpoint + '?format=xml&url=' + externalurl + }, + datareturn: function (results) { + return results.html.replace(/.*\[CDATA\[(.*)\]\]>$/, '$1') || '' + } + }; + } else { + extraSettings.yql = { + from: 'json', + apiendpoint: this.apiendpoint, + url: function (externalurl) { + return this.apiendpoint + '?format=json&url=' + externalurl + }, + datareturn: function (results) { + if (results.json.type != 'video' && (results.json.url || results.json.thumbnail_url)) { + return ''; + } + return results.json.html || '' + } + }; + } + this.apiendpoint = null; + } - }; + for (var property in extraSettings) { + this[property] = extraSettings[property]; + } - var settings; + this.format = this.format || 'json'; + this.callbackparameter = this.callbackparameter || "callback"; + this.embedtag = this.embedtag || {tag: ""}; - // Plugin defaults - $.fn.oembed.defaults = { - maxWidth: null, - maxHeight: null, - includeHandle: true, - embedMethod: 'auto', - // "auto", "append", "fill" - onProviderNotFound: function () {}, - beforeEmbed: function () {}, - afterEmbed: function () {}, - onEmbed: false, - onError: function () {}, - ajaxOptions: {} - }; - /* Private functions */ - function rand(length, current) { //Found on http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript - current = current ? current : ''; - return length ? rand(--length, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".charAt(Math.floor(Math.random() * 60)) + current) : current; - } + }; - function getRequestUrl(provider, externalUrl) { - var url = provider.apiendpoint, - qs = "", - i; - url += (url.indexOf("?") <= 0) ? "?" : "&"; - url = url.replace('#', '%23'); + /* + * Function to update existing providers + * + * @param {String} name The name of the provider + * @param {String} type The type of the provider can be "file", "photo", "video", "rich" + * @param {String} urlshemesarray Array of url of the provider + * @param {String} apiendpoint The endpoint of the provider + * @param {String} extraSettings Extra settings of the provider + */ + $.fn.updateOEmbedProvider = function (name, type, urlschemesarray, apiendpoint, extraSettings) { + for (var i = 0; i < $.fn.oembed.providers.length; i++) { + if ($.fn.oembed.providers[i].name === name) { + if (type !== null) { + $.fn.oembed.providers[i].type = type; + } + if (urlschemesarray !== null) { + $.fn.oembed.providers[i].urlschemes = urlschemesarray; + } + if (apiendpoint !== null) { + $.fn.oembed.providers[i].apiendpoint = apiendpoint; + } + if (extraSettings !== null) { + $.fn.oembed.providers[i].extraSettings = extraSettings; + for (var property in extraSettings) { + if (property !== null && extraSettings[property] !== null) { + $.fn.oembed.providers[i][property] = extraSettings[property]; + } + } + } + } + } + }; - if(provider.maxWidth !== null && (typeof provider.params.maxwidth === 'undefined' || provider.params.maxwidth === null)) { - provider.params.maxwidth = provider.maxWidth; - } + /* Native & common providers */ + $.fn.oembed.providers = [ - if(provider.maxHeight !== null && (typeof provider.params.maxheight === 'undefined' || provider.params.maxheight === null)) { - provider.params.maxheight = provider.maxHeight; - } + //Video + new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+", "youtube.com/embed"], '//www.youtube.com/embed/$1?wmode=transparent', { + templateRegex: /.*(?:v\=|be\/|embed\/)([\w\-]+)&?.*/, embedtag: {tag: 'iframe', width: '425', height: '349'} + }), - for(i in provider.params) { - // We don't want them to jack everything up by changing the callback parameter - if(i == provider.callbackparameter) continue; + //new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+"], 'http://www.youtube.com/oembed', {useYQL:'json'}), + //new $.fn.oembed.OEmbedProvider("youtubeiframe", "video", ["youtube.com/embed"], "$1?wmode=transparent", + // {templateRegex:/(.*)/,embedtag : {tag: 'iframe', width:'425',height: '349'}}), + new $.fn.oembed.OEmbedProvider("wistia", "video", ["wistia.com/medias/.+", "wistia.com/m/.+", "wistia.com/embed/.+", "wi.st/m/.+", "wi.st/embed/.+"], 'http://fast.wistia.com/oembed', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("xtranormal", "video", ["xtranormal\\.com/watch/.+"], "http://www.xtranormal.com/xtraplayr/$1/$2", { + templateRegex: /.*com\/watch\/([\w\-]+)\/([\w\-]+).*/, embedtag: {tag: 'iframe', width: '320', height: '269'}}), + new $.fn.oembed.OEmbedProvider("scivee", "video", ["scivee.tv/node/.+"], "http://www.scivee.tv/flash/embedCast.swf?", { + templateRegex: /.*tv\/node\/(.+)/, embedtag: {width: '480', height: '400', flashvars: "id=$1&type=3"}}), + new $.fn.oembed.OEmbedProvider("veoh", "video", ["veoh.com/watch/.+"], "http://www.veoh.com/swf/webplayer/WebPlayer.swf?version=AFrontend.5.7.0.1337&permalinkId=$1&player=videodetailsembedded&videoAutoPlay=0&id=anonymous", { + templateRegex: /.*watch\/([^\?]+).*/, embedtag: {width: '410', height: '341'}}), + new $.fn.oembed.OEmbedProvider("gametrailers", "video", ["gametrailers\\.com/video/.+"], "http://media.mtvnservices.com/mgid:moses:video:gametrailers.com:$2", { + templateRegex: /.*com\/video\/([\w\-]+)\/([\w\-]+).*/, embedtag: {width: '512', height: '288' }}), + new $.fn.oembed.OEmbedProvider("funnyordie", "video", ["funnyordie\\.com/videos/.+"], "http://player.ordienetworks.com/flash/fodplayer.swf?", { + templateRegex: /.*videos\/([^\/]+)\/([^\/]+)?/, embedtag: {width: 512, height: 328, flashvars: "key=$1"}}), + new $.fn.oembed.OEmbedProvider("colledgehumour", "video", ["collegehumor\\.com/video/.+"], "http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=$1&use_node_id=true&fullscreen=1", + {templateRegex: /.*video\/([^\/]+).*/, embedtag: {width: 600, height: 338}}), + new $.fn.oembed.OEmbedProvider("metacafe", "video", ["metacafe\\.com/watch/.+"], "http://www.metacafe.com/fplayer/$1/$2.swf", + {templateRegex: /.*watch\/(\d+)\/(\w+)\/.*/, embedtag: {width: 400, height: 345}}), + new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser\\.com\/channel\/.*\/broadcast\/.*"], "http://static.bambuser.com/r/player.swf?vid=$1", + {templateRegex: /.*bambuser\.com\/channel\/.*\/broadcast\/(\w+).*/, embedtag: {width: 512, height: 339 }}), + new $.fn.oembed.OEmbedProvider("twitvid", "video", ["twitvid\\.com/.+"], "http://www.twitvid.com/embed.php?guid=$1&autoplay=0", + {templateRegex: /.*twitvid\.com\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }}), + new $.fn.oembed.OEmbedProvider("aniboom", "video", ["aniboom\\.com/animation-video/.+"], "http://api.aniboom.com/e/$1", + {templateRegex: /.*animation-video\/(\d+).*/, embedtag: {width: 594, height: 334}}), + new $.fn.oembed.OEmbedProvider("vzaar", "video", ["vzaar\\.com/videos/.+", "vzaar.tv/.+"], "http://view.vzaar.com/$1/player?", + {templateRegex: /.*\/(\d+).*/, embedtag: {tag: 'iframe', width: 576, height: 324 }}), + new $.fn.oembed.OEmbedProvider("snotr", "video", ["snotr\\.com/video/.+"], "http://www.snotr.com/embed/$1", + {templateRegex: /.*\/(\d+).*/, embedtag: {tag: 'iframe', width: 400, height: 330}, nocache: 1 }), + new $.fn.oembed.OEmbedProvider("youku", "video", ["v.youku.com/v_show/id_.+"], "http://player.youku.com/player.php/sid/$1/v.swf", + {templateRegex: /.*id_(.+)\.html.*/, embedtag: {width: 480, height: 400}, nocache: 1 }), + new $.fn.oembed.OEmbedProvider("tudou", "video", ["tudou.com/programs/view/.+\/"], "http://www.tudou.com/v/$1/v.swf", + {templateRegex: /.*view\/(.+)\//, embedtag: {width: 480, height: 400}, nocache: 1 }), + new $.fn.oembed.OEmbedProvider("embedr", "video", ["embedr\\.com/playlist/.+"], "http://embedr.com/swf/slider/$1/425/520/default/false/std?", + {templateRegex: /.*playlist\/([^\/]+).*/, embedtag: {width: 425, height: 520}}), + new $.fn.oembed.OEmbedProvider("blip", "video", ["blip\\.tv/.+"], "//blip.tv/oembed/"), + new $.fn.oembed.OEmbedProvider("minoto-video", "video", ["http://api.minoto-video.com/publishers/.+/videos/.+", "http://dashboard.minoto-video.com/main/video/details/.+", "http://embed.minoto-video.com/.+"], "http://api.minoto-video.com/services/oembed.json", {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("animoto", "video", ["animoto.com/play/.+"], "http://animoto.com/services/oembed"), + new $.fn.oembed.OEmbedProvider("hulu", "video", ["hulu\\.com/watch/.*"], "//www.hulu.com/api/oembed.json"), + new $.fn.oembed.OEmbedProvider("ustream", "video", ["ustream\\.tv/recorded/.*"], "http://www.ustream.tv/oembed", {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("videojug", "video", ["videojug\\.com/(film|payer|interview).*"], "http://www.videojug.com/oembed.json", {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("sapo", "video", ["videos\\.sapo\\.pt/.*"], "http://videos.sapo.pt/oembed", {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("vodpod", "video", ["vodpod.com/watch/.*"], "http://vodpod.com/oembed.js", {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("vimeo", "video", ["www\.vimeo\.com\/groups\/.*\/videos\/.*", "www\.vimeo\.com\/.*", "vimeo\.com\/groups\/.*\/videos\/.*", "vimeo\.com\/.*"], "//vimeo.com/api/oembed.json"), + new $.fn.oembed.OEmbedProvider("dailymotion", "video", ["dailymotion\\.com/.+"], '//www.dailymotion.com/services/oembed'), + new $.fn.oembed.OEmbedProvider("5min", "video", ["www\\.5min\\.com/.+"], 'http://api.5min.com/oembed.xml', {useYQL: 'xml'}), + new $.fn.oembed.OEmbedProvider("National Film Board of Canada", "video", ["nfb\\.ca/film/.+"], 'http://www.nfb.ca/remote/services/oembed/', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("qik", "video", ["qik\\.com/\\w+"], 'http://qik.com/api/oembed.json', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("revision3", "video", ["revision3\\.com"], "http://revision3.com/api/oembed/"), + new $.fn.oembed.OEmbedProvider("dotsub", "video", ["dotsub\\.com/view/.+"], "http://dotsub.com/services/oembed", {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("clikthrough", "video", ["clikthrough\\.com/theater/video/\\d+"], "http://clikthrough.com/services/oembed"), + new $.fn.oembed.OEmbedProvider("Kinomap", "video", ["kinomap\\.com/.+"], "http://www.kinomap.com/oembed"), + new $.fn.oembed.OEmbedProvider("VHX", "video", ["vhx.tv/.+"], "http://vhx.tv/services/oembed.json"), + new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser.com/.+"], "http://api.bambuser.com/oembed/iframe.json"), + new $.fn.oembed.OEmbedProvider("justin.tv", "video", ["justin.tv/.+"], 'http://api.justin.tv/api/embed/from_url.json', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("vine", "video", ["vine.co/v/.*"], null, + { + templateRegex: /https?:\/\/w?w?w?.?vine\.co\/v\/([a-zA-Z0-9]*).*/, + template: '' + + '', + nocache: 1 + }), + new $.fn.oembed.OEmbedProvider("boxofficebuz", "video", ["boxofficebuz\\.com\\/embed/.+"], "http://boxofficebuz.com/embed/$1/$2", {templateRegex: [/.*boxofficebuz\.com\/embed\/(\w+)\/([\w*\-*]+)/], embedtag: {tag: 'iframe', width: 480, height: 360 }}), + new $.fn.oembed.OEmbedProvider("clipsyndicate", "video", ["clipsyndicate\\.com/video/play/.+", "clipsyndicate\\.com/embed/iframe\?.+"], "http://eplayer.clipsyndicate.com/embed/iframe?pf_id=1&show_title=0&va_id=$1&windows=1", {templateRegex: [/.*www\.clipsyndicate\.com\/video\/play\/(\w+)\/.*/, /.*eplayer\.clipsyndicate\.com\/embed\/iframe\?.*va_id=(\w+).*.*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("coub", "video", ["coub\\.com/.+"], "http://www.coub.com/embed/$1?muted=false&autostart=false&originalSize=false&hideTopBar=false&noSiteButtons=false&startWithHD=false", {templateRegex: [/.*coub\.com\/embed\/(\w+)\?*.*/, /.*coub\.com\/view\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("discoverychannel", "video", ["snagplayer\\.video\\.dp\\.discovery\\.com/.+"], "http://snagplayer.video.dp.discovery.com/$1/snag-it-player.htm?auto=no", {templateRegex: [/.*snagplayer\.video\.dp\.discovery\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }}), + new $.fn.oembed.OEmbedProvider("telly", "video", ["telly\\.com/.+"], "http://www.telly.com/embed.php?guid=$1&autoplay=0", {templateRegex: [/.*telly\.com\/embed\.php\?guid=(\w+).*/, /.*telly\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }}), + new $.fn.oembed.OEmbedProvider("minilogs", "video", ["minilogs\\.com/.+"], "http://www.minilogs.com/e/$1", {templateRegex: [/.*minilogs\.com\/e\/(\w+).*/, /.*minilogs\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("viddy", "video", ["viddy\\.com/.+"], "http://www.viddy.com/embed/video/$1", {templateRegex: [/.*viddy\.com\/embed\/video\/(\.*)/, /.*viddy\.com\/video\/(\.*)/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("worldstarhiphop", "video", ["worldstarhiphop\\.com\/embed/.+"], "http://www.worldstarhiphop.com/embed/$1", {templateRegex: /.*worldstarhiphop\.com\/embed\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("zapiks", "video", ["zapiks\\.fr\/.+"], "http://www.zapiks.fr/index.php?action=playerIframe&media_id=$1&autoStart=fals", {templateRegex: /.*zapiks\.fr\/index.php\?[\w\=\&]*media_id=(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), - // allows the options to be set to null, don't send null values to the server as parameters - if(provider.params[i] !== null) qs += "&" + escape(i) + "=" + provider.params[i]; - } + //Audio + new $.fn.oembed.OEmbedProvider("official.fm", "rich", ["official.fm/.+"], 'http://official.fm/services/oembed', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("chirbit", "rich", ["chirb.it/.+"], 'http://chirb.it/oembed.json', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("chirbit", "audio", ["chirb\\.it/.+"], "http://chirb.it/wp/$1", {templateRegex: [/.*chirb\.it\/wp\/(\w+).*/, /.*chirb\.it\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("Huffduffer", "rich", ["huffduffer.com/[-.\\w@]+/\\d+"], "http://huffduffer.com/oembed"), + new $.fn.oembed.OEmbedProvider("Spotify", "rich", ["open.spotify.com/(track|album|user)/"], "https://embed.spotify.com/oembed/"), + new $.fn.oembed.OEmbedProvider("shoudio", "rich", ["shoudio.com/.+", "shoud.io/.+"], "http://shoudio.com/api/oembed"), + new $.fn.oembed.OEmbedProvider("mixcloud", "rich", ["mixcloud.com/.+"], 'http://www.mixcloud.com/oembed/', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("rdio.com", "rich", ["rd.io/.+", "rdio.com"], "http://www.rdio.com/api/oembed/"), + new $.fn.oembed.OEmbedProvider("Soundcloud", "rich", ["soundcloud.com/.+", "snd.sc/.+"], "//soundcloud.com/oembed", {format: 'js'}), + new $.fn.oembed.OEmbedProvider("bandcamp", "rich", ["bandcamp\\.com/album/.+"], null, + { + yql: { + xpath: "//meta[contains(@content, \\'EmbeddedPlayer\\')]", + from: 'html', + datareturn: function (results) { + return results.meta ? '' : false; + } + } + }), - url += "format=" + provider.format + "&url=" + escape(externalUrl) + qs; - if(provider.dataType != 'json') url += "&" + provider.callbackparameter + "=?"; + //Photo + new $.fn.oembed.OEmbedProvider("deviantart", "photo", ["deviantart.com/.+", "fav.me/.+", "deviantart.com/.+"], "//backend.deviantart.com/oembed", {format: 'jsonp'}), + new $.fn.oembed.OEmbedProvider("skitch", "photo", ["skitch.com/.+"], null, + { + yql: { + xpath: "json", + from: 'json', + url: function (externalurl) { + return 'http://skitch.com/oembed/?format=json&url=' + externalurl + }, + datareturn: function (data) { + return $.fn.oembed.getPhotoCode(data.json.url, data.json); + } + } + }), + new $.fn.oembed.OEmbedProvider("mobypicture", "photo", ["mobypicture.com/user/.+/view/.+", "moby.to/.+"], "http://api.mobypicture.com/oEmbed"), + new $.fn.oembed.OEmbedProvider("flickr", "photo", ["flickr\\.com/photos/.+"], "//flickr.com/services/oembed", {callbackparameter: 'jsoncallback'}), + new $.fn.oembed.OEmbedProvider("photobucket", "photo", ["photobucket\\.com/(albums|groups)/.+"], "http://photobucket.com/oembed/"), + new $.fn.oembed.OEmbedProvider("instagram", "photo", ["instagr\\.?am(\\.com)?/.+"], "//api.instagram.com/oembed"), + //new $.fn.oembed.OEmbedProvider("yfrog", "photo", ["yfrog\\.(com|ru|com\\.tr|it|fr|co\\.il|co\\.uk|com\\.pl|pl|eu|us)/.+"], "http://www.yfrog.com/api/oembed",{useYQL:"json"}), + new $.fn.oembed.OEmbedProvider("SmugMug", "photo", ["smugmug.com/[-.\\w@]+/.+"], "http://api.smugmug.com/services/oembed/"), + new $.fn.oembed.OEmbedProvider("dribbble", "photo", ["dribbble.com/shots/.+"], "http://api.dribbble.com/shots/$1?callback=?", + { + templateRegex: /.*shots\/([\d]+).*/, + templateData: function (data) { + if (!data.image_teaser_url) { + return false; + } + return ''; + } + }), + new $.fn.oembed.OEmbedProvider("chart.ly", "photo", ["chart\\.ly/[a-z0-9]{6,8}"], "http://chart.ly/uploads/large_$1.png", + {templateRegex: /.*ly\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), + //new $.fn.oembed.OEmbedProvider("stocktwits.com", "photo", ["stocktwits\\.com/message/.+"], "http://charts.stocktwits.com/production/original_$1.png?", + // { templateRegex: /.*message\/([^\/]+).*/, embedtag: { tag: 'img'},nocache:1 }), + new $.fn.oembed.OEmbedProvider("circuitlab", "photo", ["circuitlab.com/circuit/.+"], "https://www.circuitlab.com/circuit/$1/screenshot/540x405/", + {templateRegex: /.*circuit\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), + new $.fn.oembed.OEmbedProvider("23hq", "photo", ["23hq.com/[-.\\w@]+/photo/.+"], "http://www.23hq.com/23/oembed", {useYQL: "json"}), + new $.fn.oembed.OEmbedProvider("img.ly", "photo", ["img\\.ly/.+"], "//img.ly/show/thumb/$1", + {templateRegex: /.*ly\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), + new $.fn.oembed.OEmbedProvider("twitgoo.com", "photo", ["twitgoo\\.com/.+"], "http://twitgoo.com/show/thumb/$1", + {templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), + new $.fn.oembed.OEmbedProvider("imgur.com", "photo", ["imgur\\.com/gallery/.+"], "http://imgur.com/$1l.jpg", + {templateRegex: /.*gallery\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), + new $.fn.oembed.OEmbedProvider("visual.ly", "rich", ["visual\\.ly/.+"], null, + { + yql: { + xpath: "//a[@id=\\'gc_article_graphic_image\\']/img", + from: 'htmlstring' + } + }), + new $.fn.oembed.OEmbedProvider("achewood", "photo", ["achewood\\.com\\/index.php\\?date=.+"], "http://www.achewood.com/comic.php?date=$1", {templateRegex: /.*achewood\.com\/index.php\?date=(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("fotokritik", "photo", ["fotokritik\\.com/.+"], "http://www.fotokritik.com/embed/$1", {templateRegex: [/.*fotokritik\.com\/embed\/(\w+).*/, /.*fotokritik\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("giflike", "photo", ["giflike\\.com/.+"], "http://www.giflike.com/embed/$1", {templateRegex: [/.*giflike\.com\/embed\/(\w+).*/, /.*giflike\.com\/a\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), - return url; - } + //Rich + new $.fn.oembed.OEmbedProvider("twitter", "rich", ["twitter.com/.+"], "https://api.twitter.com/1/statuses/oembed.json"), + new $.fn.oembed.OEmbedProvider("gmep", "rich", ["gmep.imeducate.com/.*", "gmep.org/.*"], "http://gmep.org/oembed.json"), + new $.fn.oembed.OEmbedProvider("urtak", "rich", ["urtak.com/(u|clr)/.+"], "http://oembed.urtak.com/1/oembed"), + new $.fn.oembed.OEmbedProvider("cacoo", "rich", ["cacoo.com/.+"], "http://cacoo.com/oembed.json"), + new $.fn.oembed.OEmbedProvider("dailymile", "rich", ["dailymile.com/people/.*/entries/.*"], "http://api.dailymile.com/oembed"), + new $.fn.oembed.OEmbedProvider("documentcloud", "rich", ["documentcloud.org/documents/.+"], "https://www.documentcloud.org/api/oembed.json"), + new $.fn.oembed.OEmbedProvider("dipity", "rich", ["dipity.com/timeline/.+"], 'http://www.dipity.com/oembed/timeline/', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("sketchfab", "rich", ["sketchfab.com/show/.+"], 'http://sketchfab.com/oembed', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("speakerdeck", "rich", ["speakerdeck.com/.+"], 'http://speakerdeck.com/oembed.json', {useYQL: 'json'}), + new $.fn.oembed.OEmbedProvider("popplet", "rich", ["popplet.com/app/.*"], "http://popplet.com/app/Popplet_Alpha.swf?page_id=$1&em=1", + { + templateRegex: /.*#\/([^\/]+).*/, + embedtag: { + width: 460, + height: 460 + } + }), - function success(oembedData, externalUrl, container) { - $('#jqoembeddata').data(externalUrl, oembedData.code); - settings.beforeEmbed.call(container, oembedData); - settings.onEmbed.call(container, oembedData); - settings.afterEmbed.call(container, oembedData); - } + new $.fn.oembed.OEmbedProvider("pearltrees", "rich", ["pearltrees.com/.*"], "http://cdn.pearltrees.com/s/embed/getApp?", + { + templateRegex: /.*N-f=1_(\d+).*N-p=(\d+).*/, + embedtag: { + width: 460, + height: 460, + flashvars: "lang=en_US&embedId=pt-embed-$1-693&treeId=$1&pearlId=$2&treeTitle=Diagrams%2FVisualization&site=www.pearltrees.com%2FF" + } + }), - function embedCode(container, externalUrl, embedProvider) { - if($('#jqoembeddata').data(externalUrl) != undefined && embedProvider.embedtag.tag != 'iframe') { - var oembedData = { - code: $('#jqoembeddata').data(externalUrl) - }; - success(oembedData, externalUrl, container); - } else if(embedProvider.yql) { - var from = embedProvider.yql.from || 'htmlstring'; - var url = embedProvider.yql.url ? embedProvider.yql.url(externalUrl) : externalUrl; - var query = 'SELECT * FROM ' + from + ' WHERE url="' + (url) + '"' + " and " + (/html/.test(from) ? 'xpath' : 'itemPath') + "='" + (embedProvider.yql.xpath || '/') + "'"; - if(from == 'html') query += " and compat='html5'"; - var ajaxopts = $.extend({ - url: "http://query.yahooapis.com/v1/public/yql", - dataType: 'jsonp', - data: { - q: query, - format: "json", - env: 'store://datatables.org/alltableswithkeys', - callback: "?" - }, - success: function (data) { - var result; - if(embedProvider.yql.xpath && embedProvider.yql.xpath == '//meta|//title|//link') { - var meta = {}; - if(data.query.results == null) { - data.query.results = { - "meta": [] - }; - } - for(var i = 0, l = data.query.results.meta.length; i < l; i++) { - var name = data.query.results.meta[i].name || data.query.results.meta[i].property || null; - if(name == null) continue; - meta[name.toLowerCase()] = data.query.results.meta[i].content; - } - if(!meta.hasOwnProperty("title") || !meta.hasOwnProperty("og:title")) { - if(data.query.results.title != null) { - meta.title = data.query.results.title; - } - } - result = embedProvider.yql.datareturn(meta); - } else { - result = embedProvider.yql.datareturn ? embedProvider.yql.datareturn(data.query.results) : data.query.results.result; - } - if(result === false) return; - var oembedData = $.extend({}, result); - oembedData.code = result; - success(oembedData, externalUrl, container); - }, - error: settings.onError.call(container, externalUrl, embedProvider) - }, settings.ajaxOptions || {}); + new $.fn.oembed.OEmbedProvider("prezi", "rich", ["prezi.com/.*"], "//prezi.com/bin/preziloader.swf?", + { + templateRegex: /.*com\/([^\/]+)\/.*/, + embedtag: { + width: 550, + height: 400, + flashvars: "prezi_id=$1&lock_to_path=0&color=ffffff&autoplay=no&autohide_ctrls=0" + } + }), - $.ajax(ajaxopts); - } else if(embedProvider.templateRegex) { - if(embedProvider.embedtag.tag !== '') { - var flashvars = embedProvider.embedtag.flashvars || ''; - var tag = embedProvider.embedtag.tag || 'embed'; - var width = embedProvider.embedtag.width || 'auto'; - var nocache = embedProvider.embedtag.nocache || 0; - var height = embedProvider.embedtag.height || 'auto'; - var src = externalUrl.replace(embedProvider.templateRegex, embedProvider.apiendpoint); - if(!embedProvider.nocache) src += '&jqoemcache=' + rand(5); - if(embedProvider.apikey) src = src.replace('_APIKEY_', settings.apikeys[embedProvider.name]); + new $.fn.oembed.OEmbedProvider("tourwrist", "rich", ["tourwrist.com/tours/.+"], null, + { + templateRegex: /.*tours.([\d]+).*/, + template: function (wm, tourid) { + setTimeout(function () { + if (loadEmbeds)loadEmbeds(); + }, 2000); + return "
"; + } + }), - var code = $('<' + tag + '/>') - .attr('src', src) - .attr('width', width) - .attr('height', height) - .attr('allowfullscreen', embedProvider.embedtag.allowfullscreen || 'true') - .attr('allowscriptaccess', embedProvider.embedtag.allowfullscreen || 'always') - .css('max-height', settings.maxHeight || 'auto') - .css('max-width', settings.maxWidth || 'auto'); - if(tag == 'embed') { - code - .attr('type', embedProvider.embedtag.type || "application/x-shockwave-flash") - .attr('flashvars', externalUrl.replace(embedProvider.templateRegex, flashvars)); - } - if(tag == 'iframe'){ - code - .attr('scrolling', embedProvider.embedtag.scrolling || "no") - .attr('frameborder', embedProvider.embedtag.frameborder || "0"); - } + new $.fn.oembed.OEmbedProvider("meetup", "rich", ["meetup\\.(com|ps)/.+"], "http://api.meetup.com/oembed"), + new $.fn.oembed.OEmbedProvider("ebay", "rich", ["ebay\\.*"], "http://togo.ebay.com/togo/togo.swf?2008013100", + { + templateRegex: /.*\/([^\/]+)\/(\d{10,13}).*/, + embedtag: { + width: 355, + height: 300, + flashvars: "base=http://togo.ebay.com/togo/&lang=en-us&mode=normal&itemid=$2&query=$1" + } + }), + new $.fn.oembed.OEmbedProvider("wikipedia", "rich", ["wikipedia.org/wiki/.+"], "http://$1.wikipedia.org/w/api.php?action=parse&page=$2&format=json§ion=0&callback=?", { + templateRegex: /.*\/\/([\w]+).*\/wiki\/([^\/]+).*/, + templateData: function (data) { + if (!data.parse) + return false; + var text = data.parse['text']['*'].replace(/href="\/wiki/g, 'href="http://en.wikipedia.org/wiki'); + return '

' + data.parse['displaytitle'] + '

' + text + '
'; + } + }), + new $.fn.oembed.OEmbedProvider("imdb", "rich", ["imdb.com/title/.+"], "http://www.imdbapi.com/?i=$1&callback=?", + { + templateRegex: /.*\/title\/([^\/]+).*/, + templateData: function (data) { + if (!data.Title) + return false; + return '

' + data.Title + ' (' + data.Year + ')

Rating: ' + data.imdbRating + '
Genre: ' + data.Genre + '
Starring: ' + data.Actors + '

' + data.Plot + '
'; + } + }), + new $.fn.oembed.OEmbedProvider("livejournal", "rich", ["livejournal.com/"], "http://ljpic.seacrow.com/json/$2$4?jsonp=?" + , { + templateRegex: /(http:\/\/(((?!users).)+)\.livejournal\.com|.*users\.livejournal\.com\/([^\/]+)).*/, + templateData: function (data) { + if (!data.username) + return false; + return '
[info]' + data.username + '
' + data.name + '
'; + } + }), + new $.fn.oembed.OEmbedProvider("circuitbee", "rich", ["circuitbee\\.com/circuit/view/.+"], "http://c.circuitbee.com/build/r/schematic-embed.html?id=$1", + { + templateRegex: /.*circuit\/view\/(\d+).*/, + embedtag: { + tag: 'iframe', + width: '500', + height: '350' + } + }), - var oembedData = { - code: code - }; - success(oembedData, externalUrl, container); - } else if(embedProvider.apiendpoint) { - //Add APIkey if true - if(embedProvider.apikey) embedProvider.apiendpoint = embedProvider.apiendpoint.replace('_APIKEY_', settings.apikeys[embedProvider.name]); - ajaxopts = $.extend({ - url: externalUrl.replace(embedProvider.templateRegex, embedProvider.apiendpoint), - dataType: 'jsonp', - success: function (data) { - var oembedData = $.extend({}, data); - oembedData.code = embedProvider.templateData(data); - if(oembedData.code) success(oembedData, externalUrl, container); - }, - error: settings.onError.call(container, externalUrl, embedProvider) - }, settings.ajaxOptions || {}); + new $.fn.oembed.OEmbedProvider("googlecalendar", "rich", ["www.google.com/calendar/embed?.+"], "$1", + {templateRegex: /(.*)/, embedtag: {tag: 'iframe', width: '800', height: '600' }}), + new $.fn.oembed.OEmbedProvider("jsfiddle", "rich", ["jsfiddle.net/[^/]+/?"], "http://jsfiddle.net/$1/embedded/result,js,resources,html,css/?", + {templateRegex: /.*net\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: '300' }}), + new $.fn.oembed.OEmbedProvider("jsbin", "rich", ["jsbin.com/.+"], "http://jsbin.com/$1/?", + {templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: '300' }}), + new $.fn.oembed.OEmbedProvider("jotform", "rich", ["form.jotform.co/form/.+"], "$1?", + {templateRegex: /(.*)/, embedtag: {tag: 'iframe', width: '100%', height: '507' }}), + new $.fn.oembed.OEmbedProvider("reelapp", "rich", ["reelapp\\.com/.+"], "http://www.reelapp.com/$1/embed", + {templateRegex: /.*com\/(\S{6}).*/, embedtag: {tag: 'iframe', width: '400', height: '338'}}), + new $.fn.oembed.OEmbedProvider("linkedin", "rich", ["linkedin.com/pub/.+"], "https://www.linkedin.com/cws/member/public_profile?public_profile_url=$1&format=inline&isFramed=true", + {templateRegex: /(.*)/, embedtag: {tag: 'iframe', width: '368px', height: 'auto'}}), + new $.fn.oembed.OEmbedProvider("timetoast", "rich", ["timetoast.com/timelines/[0-9]+"], "http://www.timetoast.com/flash/TimelineViewer.swf?passedTimelines=$1", + {templateRegex: /.*timelines\/([0-9]*)/, embedtag: { width: 550, height: 400}, nocache: 1}), + new $.fn.oembed.OEmbedProvider("pastebin", "rich", ["pastebin\\.com/[\\S]{8}"], "http://pastebin.com/embed_iframe.php?i=$1", + {templateRegex: /.*\/(\S{8}).*/, embedtag: {tag: 'iframe', width: '100%', height: 'auto'}}), + new $.fn.oembed.OEmbedProvider("mixlr", "rich", ["mixlr.com/.+"], "http://mixlr.com/embed/$1?autoplay=ae", + {templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: 'auto' }}), + new $.fn.oembed.OEmbedProvider("pastie", "rich", ["pastie\\.org/pastes/.+"], null, {yql: {xpath: '//pre[@class="textmate-source"]'}}), + new $.fn.oembed.OEmbedProvider("github", "rich", ["gist.github.com/.+"], "https://github.com/api/oembed"), + new $.fn.oembed.OEmbedProvider("github", "rich", ["github.com/[-.\\w@]+/[-.\\w@]+"], "https://api.github.com/repos/$1/$2?callback=?" + , {templateRegex: /.*\/([^\/]+)\/([^\/]+).*/, + templateData: function (data) { + if (!data.data.html_url)return false; + return '

' + data.data.name + '

' + data.data.description + '

' + + '

Last updated: ' + data.data.pushed_at + '

'; + } + }), + new $.fn.oembed.OEmbedProvider("facebook", "rich", ["facebook.com"], null + , {templateRegex: /.*\/([^\/]+)\/([^\/]+).*/, + template: function (url) { + // adding script directly to DOM to make sure that it is loaded correctly. + if (!$.fn.oembed.facebokScriptHasBeenAdded) { + $('
').appendTo('body'); + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.text = '(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));'; + document.body.appendChild(script); + $.fn.oembed.facebokScriptHasBeenAdded = true; + } - $.ajax(ajaxopts); - } else { - var oembedData = { - code: externalUrl.replace(embedProvider.templateRegex, embedProvider.template) - }; - success(oembedData, externalUrl, container); - } - } else { + // returning template with url of facebook post. + return '
'; - var requestUrl = getRequestUrl(embedProvider, externalUrl), - ajaxopts = $.extend({ - url: requestUrl, - dataType: embedProvider.dataType || 'jsonp', - success: function (data) { - var oembedData = $.extend({}, data); - switch(oembedData.type) { - case "file": //Deviant Art has this - case "photo": - oembedData.code = $.fn.oembed.getPhotoCode(externalUrl, oembedData); - break; - case "video": - case "rich": - oembedData.code = $.fn.oembed.getRichCode(externalUrl, oembedData); - break; - default: - oembedData.code = $.fn.oembed.getGenericCode(externalUrl, oembedData); - break; - } - success(oembedData, externalUrl, container); - }, - error: settings.onError.call(container, externalUrl, embedProvider) - }, settings.ajaxOptions || {}); + } + }), + /* + // Saving old implementation of Facebook in case we will need it as example in the future. + new $.fn.oembed.OEmbedProvider("facebook", "rich", ["facebook.com/(people/[^\\/]+/\\d+|[^\\/]+$)"], "https://graph.facebook.com/$2$3/?callback=?" + ,{templateRegex:/.*facebook.com\/(people\/[^\/]+\/(\d+).*|([^\/]+$))/, + templateData : function(data){ if(!data.id)return false; + var out = '
facebook '; + if(data.from) out += ''+data.from.name+''; + else if(data.link) out += ''+data.name+''; + else if(data.username) out += ''+data.name+''; + else out += ''+data.name+''; + out += '
'; + if(data.picture) out += ''; + else out += ''; + if(data.from) out += ''+data.name+''; + if(data.founded) out += 'Founded: '+data.founded+'
'; + if(data.category) out += 'Category: '+data.category+'
'; + if(data.website) out += 'Website: '+data.website+'
'; + if(data.gender) out += 'Gender: '+data.gender+'
'; + if(data.description) out += data.description + '
'; + out += '
'; + return out; + } + }), + */ + new $.fn.oembed.OEmbedProvider("stackoverflow", "rich", ["stackoverflow.com/questions/[\\d]+"], "http://api.stackoverflow.com/1.1/questions/$1?body=true&jsonp=?" + , {templateRegex: /.*questions\/([\d]+).*/, + templateData: function (data) { + if (!data.questions) + return false; + var q = data.questions[0]; + var body = $(q.body).text(); + var out = '
' + + '' + (q.up_vote_count - q.down_vote_count) + '
vote(s)
' + + '
' + q.answer_count + 'answer
' + q.view_count + ' view(s)
' + + '

' + q.title + '

' + + '
' + body.substring(0, 100) + '...
'; + for (i in q.tags) { + out += ''; + } - $.ajax(ajaxopts); - } - }; + out += '
'; + return out; + } + }), + new $.fn.oembed.OEmbedProvider("wordpress", "rich", ["wordpress\\.com/.+", "blogs\\.cnn\\.com/.+", "techcrunch\\.com/.+", "wp\\.me/.+"], "http://public-api.wordpress.com/oembed/1.0/?for=jquery-oembed-all"), + new $.fn.oembed.OEmbedProvider("screenr", "rich", ["screenr\.com"], "http://www.screenr.com/embed/$1", + {templateRegex: /.*\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '650', height: 396}}) , + new $.fn.oembed.OEmbedProvider("gigpans", "rich", ["gigapan\\.org/[-.\\w@]+/\\d+"], "http://gigapan.org/gigapans/$1/options/nosnapshots/iframe/flash.html", + {templateRegex: /.*\/(\d+)\/?.*/, embedtag: {tag: 'iframe', width: '100%', height: 400 }}), + new $.fn.oembed.OEmbedProvider("scribd", "rich", ["scribd\\.com/.+"], "http://www.scribd.com/embeds/$1/content?start_page=1&view_mode=list", + {templateRegex: /.*doc\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: 600}}), + new $.fn.oembed.OEmbedProvider("kickstarter", "rich", ["kickstarter\\.com/projects/.+"], "$1/widget/card.html", + {templateRegex: /([^\?]+).*/, embedtag: {tag: 'iframe', width: '220', height: 380}}), + new $.fn.oembed.OEmbedProvider("amazon", "rich", ["amzn.com/B+", "amazon.com.*/(B\\S+)($|\\/.*)"], "http://rcm.amazon.com/e/cm?t=_APIKEY_&o=1&p=8&l=as1&asins=$1&ref=qf_br_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr", + { + apikey: true, + templateRegex: /.*\/(B[0-9A-Z]+)($|\/.*)/, + embedtag: { + tag: 'iframe', + width: '120px', + height: '240px'} + }), + new $.fn.oembed.OEmbedProvider("slideshare", "rich", ["slideshare\.net"], "//www.slideshare.net/api/oembed/2", {format: 'jsonp'}), + new $.fn.oembed.OEmbedProvider("roomsharejp", "rich", ["roomshare\\.jp/(en/)?post/.*"], "http://roomshare.jp/oembed.json"), + new $.fn.oembed.OEmbedProvider("lanyard", "rich", ["lanyrd.com/\\d+/.+"], null, + { + yql: { + xpath: '(//div[@class="primary"])[1]', + from: 'htmlstring', + datareturn: function (results) { + if (!results.result) + return false; + return '
' + results.result + '
'; + } + } + }), + new $.fn.oembed.OEmbedProvider("asciiartfarts", "rich", ["asciiartfarts.com/\\d+.html"], null, + { + yql: { + xpath: '//pre/font', + from: 'htmlstring', + datareturn: function (results) { + if (!results.result) + return false; + return '
' + results.result + '
'; + } + } + }), + new $.fn.oembed.OEmbedProvider("coveritlive", "rich", ["coveritlive.com/"], null, { + templateRegex: /(.*)/, + template: ''}), + new $.fn.oembed.OEmbedProvider("polldaddy", "rich", ["polldaddy.com/"], null, { + templateRegex: /(?:https?:\/\/w?w?w?.?polldaddy.com\/poll\/)([0-9]*)\//, + template: '', + nocache: 1 + }), + new $.fn.oembed.OEmbedProvider("360io", "rich", ["360\\.io/.+"], "http://360.io/$1", {templateRegex: /.*360\.io\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("bubbli", "rich", ["on\\.bubb\\.li/.+"], "http://on.bubb.li/$1", {templateRegex: /.*on\.bubb\.li\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360}, nocache: 1 }), + new $.fn.oembed.OEmbedProvider("cloudup", "rich", ["cloudup\\.com/.+"], "http://cloudup.com/$1?chromeless", {templateRegex: [/.*cloudup\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }}), + new $.fn.oembed.OEmbedProvider("codepen", "rich", ["codepen.io/.+"], "http://codepen.io/$1/embed/$2", {templateRegex: [/.*io\/(\w+)\/pen\/(\w+).*/, /.*io\/(\w+)\/full\/(\w+).*/], embedtag: {tag: 'iframe', width: '100%', height: '300'}, nocache: 1 }), + new $.fn.oembed.OEmbedProvider("googleviews", "rich", ["(.*maps\\.google\\.com\\/maps\\?).+(output=svembed).+(cbp=(.*)).*"], "https://maps.google.com/maps?layer=c&panoid=$3&ie=UTF8&source=embed&output=svembed&cbp=$5", {templateRegex: /(.*maps\.google\.com\/maps\?).+(panoid=(\w+)&).*(cbp=(.*)).*/, embedtag: {tag: 'iframe', width: 480, height: 360}, nocache: 1 }), + new $.fn.oembed.OEmbedProvider("googlemaps", "rich", ["google\\.com\/maps\/place/.+"], "http://maps.google.com/maps?t=m&q=$1&output=embed", {templateRegex: /.*google\.com\/maps\/place\/([\w\+]*)\/.*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("imajize", "rich", ["embed\\.imajize\\.com/.+"], "http://embed.imajize.com/$1", {templateRegex: /.*embed\.imajize\.com\/(.*)/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("mapjam", "rich", ["mapjam\\.com/.+"], "http://www.mapjam.com/$1", {templateRegex: /.*mapjam\.com\/(.*)/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("polar", "rich", ["polarb\\.com/.+"], "http://assets-polarb-com.a.ssl.fastly.net/api/v4/publishers/unknown/embedded_polls/iframe?poll_id=$1", {templateRegex: /.*polarb\.com\/polls\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), + new $.fn.oembed.OEmbedProvider("ponga", "rich", ["ponga\\.com/.+"], "https://www.ponga.com/embedded?id=$1", {templateRegex: [/.*ponga\.com\/embedded\?id=(\w+).*/, /.*ponga\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), - function getNormalizedParams(params) { - if(params === null) return null; - var key, normalizedParams = {}; - for(key in params) { - if(key !== null) normalizedParams[key.toLowerCase()] = params[key]; - } - return normalizedParams; - } - - /* Public functions */ - $.fn.oembed.insertCode = function (container, embedMethod, oembedData) { - if(oembedData === null) return; - if(embedMethod == 'auto' && container.attr("href") !== null) embedMethod = 'append'; - else if(embedMethod == 'auto') embedMethod = 'replace'; - switch(embedMethod) { - case "replace": - container.replaceWith(oembedData.code); - break; - case "fill": - container.html(oembedData.code); - break; - case "append": - container.wrap('
'); - var oembedContainer = container.parent(); - if(settings.includeHandle) { - $('').insertBefore(container).click(function () { - var encodedString = encodeURIComponent($(this).text()); - $(this).html((encodedString == '%E2%86%91') ? '↓' : '↑'); - $(this).parent().children().last().toggle(); - }); - } - oembedContainer.append('
'); - try { - oembedData.code.clone().appendTo(oembedContainer); - } catch(e) { - oembedContainer.append(oembedData.code); - } - /* Make videos semi-responsive - * If parent div width less than embeded iframe video then iframe gets shrunk to fit smaller width - * If parent div width greater thans embed iframe use the max widht - * - works on youtubes and vimeo - */ - if(settings.maxWidth) { - var post_width = oembedContainer.parent().width(); - if(post_width < settings.maxWidth) { - var iframe_width_orig = $('iframe', oembedContainer).width(); - var iframe_height_orig = $('iframe', oembedContainer).height(); - var ratio = iframe_width_orig / post_width; - $('iframe', oembedContainer).width(iframe_width_orig / ratio); - $('iframe', oembedContainer).height(iframe_height_orig / ratio); - } else { - if(settings.maxWidth) { - $('iframe', oembedContainer).width(settings.maxWidth); - } - if(settings.maxHeight) { - $('iframe', oembedContainer).height(settings.maxHeight); - } - } - } - break; - } - }; - - $.fn.oembed.getPhotoCode = function (url, oembedData) { - var code, alt = oembedData.title ? oembedData.title : ''; - alt += oembedData.author_name ? ' - ' + oembedData.author_name : ''; - alt += oembedData.provider_name ? ' - ' + oembedData.provider_name : ''; - if(oembedData.url) { - code = '
' + alt + '
'; - } else if(oembedData.thumbnail_url) { - var newURL = oembedData.thumbnail_url.replace('_s', '_b'); - code = '
' + alt + '
'; - } else { - code = '
Error loading this picture
'; - } - if(oembedData.html) code += "
" + oembedData.html + "
"; - return code; - }; - - $.fn.oembed.getRichCode = function (url, oembedData) { - var code = oembedData.html; - return code; - }; - - $.fn.oembed.getGenericCode = function (url, oembedData) { - var title = (oembedData.title !== null) ? oembedData.title : url, - code = ''; - if(oembedData.html) code += '
' + title + '
' + jQuery(oembedData.html).text().substring(0,200) + '... more
'; - return code; - }; - - $.fn.oembed.getOEmbedProvider = function (url) { - for(var i = 0; i < $.fn.oembed.providers.length; i++) { - for(var j = 0, l = $.fn.oembed.providers[i].urlschemes.length; j < l; j++) { - var regExp = new RegExp($.fn.oembed.providers[i].urlschemes[j], "i"); - if(url.match(regExp) !== null) return $.fn.oembed.providers[i]; - } - } - return null; - }; - - $.fn.oembed.OEmbedProvider = function (name, type, urlschemesarray, apiendpoint, extraSettings) { - this.name = name; - this.type = type; // "photo", "video", "link", "rich", null - this.urlschemes = urlschemesarray; - this.apiendpoint = apiendpoint; - this.maxWidth = 500; - this.maxHeight = 400; - extraSettings = extraSettings || {}; - - if(extraSettings.useYQL) { - if(extraSettings.useYQL == 'xml') { - extraSettings.yql = { - xpath: "//oembed/html", - from: 'xml', - apiendpoint: this.apiendpoint, - url: function (externalurl) { - return this.apiendpoint + '?format=xml&url=' + externalurl - }, - datareturn: function (results) { - return results.html.replace(/.*\[CDATA\[(.*)\]\]>$/, '$1') || '' - } - }; - } else { - extraSettings.yql = { - from: 'json', - apiendpoint: this.apiendpoint, - url: function (externalurl) { - return this.apiendpoint + '?format=json&url=' + externalurl - }, - datareturn: function (results) { - if(results.json.type != 'video' && (results.json.url || results.json.thumbnail_url)) { - return ''; - } - return results.json.html || '' - } - }; - } - this.apiendpoint = null; - } - - for(var property in extraSettings) { - this[property] = extraSettings[property]; - } - - this.format = this.format || 'json'; - this.callbackparameter = this.callbackparameter || "callback"; - this.embedtag = this.embedtag || { - tag: "" - }; - }; - - /* - * Function to update existing providers - * - * @param {String} name The name of the provider - * @param {String} type The type of the provider can be "file", "photo", "video", "rich" - * @param {String} urlshemesarray Array of url of the provider - * @param {String} apiendpoint The endpoint of the provider - * @param {String} extraSettings Extra settings of the provider - */ - $.fn.updateOEmbedProvider = function (name, type, urlschemesarray, apiendpoint, extraSettings) { - for(var i = 0; i < $.fn.oembed.providers.length; i++) { - if($.fn.oembed.providers[i].name === name) { - if(type !== null) { - $.fn.oembed.providers[i].type = type; - } - if(urlschemesarray !== null) { - $.fn.oembed.providers[i].urlschemes = urlschemesarray; - } - if(apiendpoint !== null) { - $.fn.oembed.providers[i].apiendpoint = apiendpoint; - } - if(extraSettings !== null) { - $.fn.oembed.providers[i].extraSettings = extraSettings; - for(var property in extraSettings) { - if(property !== null && extraSettings[property] !== null) { - $.fn.oembed.providers[i][property] = extraSettings[property]; - } - } - } - } - } - }; - - /* Native & common providers */ - $.fn.oembed.providers = [ - //Video - new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+", "youtube.com/embed"], 'http://www.youtube.com/embed/$1?wmode=transparent', { - templateRegex: /.*(?:v\=|be\/|embed\/)([\w\-]+)&?.*/, - embedtag: { - tag: 'iframe', - width: '425', - height: '349' - } - }), - - // new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+"], 'http://www.youtube.com/oembed', { - // useYQL: 'json' - // }), - // new $.fn.oembed.OEmbedProvider("youtubeiframe", "video", ["youtube.com/embed"], "$1?wmode=transparent", { - // templateRegex: /(.*)/, - // embedtag: { - // tag: 'iframe', - // width: '425', - // height: '349' - // } - // }), - new $.fn.oembed.OEmbedProvider("wistia", "video", ["wistia.com/m/.+", "wistia.com/embed/.+", "wi.st/m/.+", "wi.st/embed/.+"], 'http://fast.wistia.com/oembed', { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("xtranormal", "video", ["xtranormal\\.com/watch/.+"], "http://www.xtranormal.com/xtraplayr/$1/$2", { - templateRegex: /.*com\/watch\/([\w\-]+)\/([\w\-]+).*/, - embedtag: { - tag: 'iframe', - width: '320', - height: '269' - } - }), - new $.fn.oembed.OEmbedProvider("scivee", "video", ["scivee.tv/node/.+"], "http://www.scivee.tv/flash/embedCast.swf?", { - templateRegex: /.*tv\/node\/(.+)/, - embedtag: { - width: '480', - height: '400', - flashvars: "id=$1&type=3" - } - }), - new $.fn.oembed.OEmbedProvider("veoh", "video", ["veoh.com/watch/.+"], "http://www.veoh.com/swf/webplayer/WebPlayer.swf?version=AFrontend.5.7.0.1337&permalinkId=$1&player=videodetailsembedded&videoAutoPlay=0&id=anonymous", { - templateRegex: /.*watch\/([^\?]+).*/, - embedtag: { - width: '410', - height: '341' - } - }), - new $.fn.oembed.OEmbedProvider("gametrailers", "video", ["gametrailers\\.com/video/.+"], "http://media.mtvnservices.com/mgid:moses:video:gametrailers.com:$2", { - templateRegex: /.*com\/video\/([\w\-]+)\/([\w\-]+).*/, - embedtag: { - width: '512', - height: '288' - } - }), - new $.fn.oembed.OEmbedProvider("funnyordie", "video", ["funnyordie\\.com/videos/.+"], "http://player.ordienetworks.com/flash/fodplayer.swf?", { - templateRegex: /.*videos\/([^\/]+)\/([^\/]+)?/, - embedtag: { - width: 512, - height: 328, - flashvars: "key=$1" - } - }), - new $.fn.oembed.OEmbedProvider("colledgehumour", "video", ["collegehumor\\.com/video/.+"], "http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=$1&use_node_id=true&fullscreen=1", { - templateRegex: /.*video\/([^\/]+).*/, - embedtag: { - width: 600, - height: 338 - } - }), - new $.fn.oembed.OEmbedProvider("metacafe", "video", ["metacafe\\.com/watch/.+"], "http://www.metacafe.com/fplayer/$1/$2.swf", { - templateRegex: /.*watch\/(\d+)\/(\w+)\/.*/, - embedtag: { - width: 400, - height: 345 - } - }), - new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser\\.com\/channel\/.*\/broadcast\/.*"], "http://static.bambuser.com/r/player.swf?vid=$1", { - templateRegex: /.*bambuser\.com\/channel\/.*\/broadcast\/(\w+).*/, - embedtag: { - width: 512, - height: 339 - } - }), - new $.fn.oembed.OEmbedProvider("twitvid", "video", ["twitvid\\.com/.+"], "http://www.twitvid.com/embed.php?guid=$1&autoplay=0", { - templateRegex: /.*twitvid\.com\/(\w+).*/, - embedtag: { - tag: 'iframe', - width: 480, - height: 360 - } - }), - new $.fn.oembed.OEmbedProvider("aniboom", "video", ["aniboom\\.com/animation-video/.+"], "http://api.aniboom.com/e/$1", { - templateRegex: /.*animation-video\/(\d+).*/, - embedtag: { - width: 594, - height: 334 - } - }), - new $.fn.oembed.OEmbedProvider("vzaar", "video", ["vzaar\\.com/videos/.+", "vzaar.tv/.+"], "http://view.vzaar.com/$1/player?", { - templateRegex: /.*\/(\d+).*/, - embedtag: { - tag: 'iframe', - width: 576, - height: 324 - } - }), - new $.fn.oembed.OEmbedProvider("snotr", "video", ["snotr\\.com/video/.+"], "http://www.snotr.com/embed/$1", { - templateRegex: /.*\/(\d+).*/, - embedtag: { - tag: 'iframe', - width: 400, - height: 330, - nocache: 1 - } - }), - new $.fn.oembed.OEmbedProvider("youku", "video", ["v.youku.com/v_show/id_.+"], "http://player.youku.com/player.php/sid/$1/v.swf", { - templateRegex: /.*id_(.+)\.html.*/, - embedtag: { - width: 480, - height: 400, - nocache: 1 - } - }), - new $.fn.oembed.OEmbedProvider("tudou", "video", ["tudou.com/programs/view/.+\/"], "http://www.tudou.com/v/$1/v.swf", { - templateRegex: /.*view\/(.+)\//, - embedtag: { - width: 480, - height: 400, - nocache: 1 - } - }), - new $.fn.oembed.OEmbedProvider("embedr", "video", ["embedr\\.com/playlist/.+"], "http://embedr.com/swf/slider/$1/425/520/default/false/std?", { - templateRegex: /.*playlist\/([^\/]+).*/, - embedtag: { - width: 425, - height: 520 - } - }), - new $.fn.oembed.OEmbedProvider("blip", "video", ["blip\\.tv/.+"], "http://blip.tv/oembed/"), - new $.fn.oembed.OEmbedProvider("minoto-video", "video", ["http://api.minoto-video.com/publishers/.+/videos/.+", "http://dashboard.minoto-video.com/main/video/details/.+", "http://embed.minoto-video.com/.+"], "http://api.minoto-video.com/services/oembed.json", { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("animoto", "video", ["animoto.com/play/.+"], "http://animoto.com/services/oembed"), - new $.fn.oembed.OEmbedProvider("hulu", "video", ["hulu\\.com/watch/.*"], "http://www.hulu.com/api/oembed.json"), - new $.fn.oembed.OEmbedProvider("ustream", "video", ["ustream\\.tv/recorded/.*"], "http://www.ustream.tv/oembed", { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("videojug", "video", ["videojug\\.com/(film|payer|interview).*"], "http://www.videojug.com/oembed.json", { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("sapo", "video", ["videos\\.sapo\\.pt/.*"], "http://videos.sapo.pt/oembed", { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("vodpod", "video", ["vodpod.com/watch/.*"], "http://vodpod.com/oembed.js", { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("vimeo", "video", ["www\.vimeo\.com\/groups\/.*\/videos\/.*", "www\.vimeo\.com\/.*", "vimeo\.com\/groups\/.*\/videos\/.*", "vimeo\.com\/.*"], "//vimeo.com/api/oembed.json"), - new $.fn.oembed.OEmbedProvider("dailymotion", "video", ["dailymotion\\.com/.+"], 'http://www.dailymotion.com/services/oembed'), - new $.fn.oembed.OEmbedProvider("5min", "video", ["www\\.5min\\.com/.+"], 'http://api.5min.com/oembed.xml', { - useYQL: 'xml' - }), - new $.fn.oembed.OEmbedProvider("National Film Board of Canada", "video", ["nfb\\.ca/film/.+"], 'http://www.nfb.ca/remote/services/oembed/', { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("qik", "video", ["qik\\.com/\\w+"], 'http://qik.com/api/oembed.json', { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("revision3", "video", ["revision3\\.com"], "http://revision3.com/api/oembed/"), - new $.fn.oembed.OEmbedProvider("dotsub", "video", ["dotsub\\.com/view/.+"], "http://dotsub.com/services/oembed", { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("clikthrough", "video", ["clikthrough\\.com/theater/video/\\d+"], "http://clikthrough.com/services/oembed"), - new $.fn.oembed.OEmbedProvider("Kinomap", "video", ["kinomap\\.com/.+"], "http://www.kinomap.com/oembed"), - new $.fn.oembed.OEmbedProvider("VHX", "video", ["vhx.tv/.+"], "http://vhx.tv/services/oembed.json"), - new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser.com/.+"], "http://api.bambuser.com/oembed/iframe.json"), - new $.fn.oembed.OEmbedProvider("justin.tv", "video", ["justin.tv/.+"], 'http://api.justin.tv/api/embed/from_url.json', { - useYQL: 'json' - }), - - //Audio - new $.fn.oembed.OEmbedProvider("official.fm", "rich", ["official.fm/.+"], 'http://official.fm/services/oembed', { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("chirbit", "rich", ["chirb.it/.+"], 'http://chirb.it/oembed.json', { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("Huffduffer", "rich", ["huffduffer.com/[-.\\w@]+/\\d+"], "http://huffduffer.com/oembed"), - new $.fn.oembed.OEmbedProvider("Spotify", "rich", ["open.spotify.com/(track|album|user)/"], "https://embed.spotify.com/oembed/"), - new $.fn.oembed.OEmbedProvider("shoudio", "rich", ["shoudio.com/.+", "shoud.io/.+"], "http://shoudio.com/api/oembed"), - new $.fn.oembed.OEmbedProvider("mixcloud", "rich", ["mixcloud.com/.+"], 'http://www.mixcloud.com/oembed/', { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("rdio.com", "rich", ["rd.io/.+", "rdio.com"], "http://www.rdio.com/api/oembed/"), - new $.fn.oembed.OEmbedProvider("Soundcloud", "rich", ["soundcloud.com/.+", "snd.sc/.+"], "http://soundcloud.com/oembed", { - format: 'js' - }), - new $.fn.oembed.OEmbedProvider("bandcamp", "rich", ["bandcamp\\.com/album/.+"], null, { - yql: { - xpath: "//meta[contains(@content, \\'EmbeddedPlayer\\')]", - from: 'html', - datareturn: function (results) { - return results.meta ? '' : false; - } - } - }), - - //Photo - new $.fn.oembed.OEmbedProvider("deviantart", "photo", ["deviantart.com/.+", "fav.me/.+", "deviantart.com/.+"], "http://backend.deviantart.com/oembed", { - format: 'jsonp' - }), - new $.fn.oembed.OEmbedProvider("skitch", "photo", ["skitch.com/.+"], null, { - yql: { - xpath: "json", - from: 'json', - url: function (externalurl) { - return 'http://skitch.com/oembed/?format=json&url=' + externalurl - }, - datareturn: function (data) { - return $.fn.oembed.getPhotoCode(data.json.url, data.json); - } - } - }), - new $.fn.oembed.OEmbedProvider("mobypicture", "photo", ["mobypicture.com/user/.+/view/.+", "moby.to/.+"], "http://api.mobypicture.com/oEmbed"), - new $.fn.oembed.OEmbedProvider("flickr", "photo", ["flickr\\.com/photos/.+"], "http://flickr.com/services/oembed", { - callbackparameter: 'jsoncallback' - }), - new $.fn.oembed.OEmbedProvider("photobucket", "photo", ["photobucket\\.com/(albums|groups)/.+"], "http://photobucket.com/oembed/"), - new $.fn.oembed.OEmbedProvider("instagram", "photo", ["instagr\\.?am(\\.com)?/.+"], "http://api.instagram.com/oembed"), - // new $.fn.oembed.OEmbedProvider("yfrog", "photo", ["yfrog\\.(com|ru|com\\.tr|it|fr|co\\.il|co\\.uk|com\\.pl|pl|eu|us)/.+"], "http://www.yfrog.com/api/oembed", { - // useYQL: "json" - // }), - new $.fn.oembed.OEmbedProvider("SmugMug", "photo", ["smugmug.com/[-.\\w@]+/.+"], "http://api.smugmug.com/services/oembed/"), - - new $.fn.oembed.OEmbedProvider("dribbble", "photo", ["dribbble.com/shots/.+"], "http://api.dribbble.com/shots/$1?callback=?", { - templateRegex: /.*shots\/([\d]+).*/, - templateData: function (data) { - if(!data.image_teaser_url) return false; - return ''; - } - }), - new $.fn.oembed.OEmbedProvider("chart.ly", "photo", ["chart\\.ly/[a-z0-9]{6,8}"], "http://chart.ly/uploads/large_$1.png", { - templateRegex: /.*ly\/([^\/]+).*/, - embedtag: { - tag: 'img' - }, - nocache: 1 - }), - // new $.fn.oembed.OEmbedProvider("stocktwits.com", "photo", ["stocktwits\\.com/message/.+"], "http://charts.stocktwits.com/production/original_$1.png?", { - // templateRegex: /.*message\/([^\/]+).*/, - // embedtag: { - // tag: 'img' - // }, - // nocache: 1 - // }), - new $.fn.oembed.OEmbedProvider("circuitlab", "photo", ["circuitlab.com/circuit/.+"], "https://www.circuitlab.com/circuit/$1/screenshot/540x405/", { - templateRegex: /.*circuit\/([^\/]+).*/, - embedtag: { - tag: 'img' - }, - nocache: 1 - }), - new $.fn.oembed.OEmbedProvider("23hq", "photo", ["23hq.com/[-.\\w@]+/photo/.+"], "http://www.23hq.com/23/oembed", { - useYQL: "json" - }), - new $.fn.oembed.OEmbedProvider("img.ly", "photo", ["img\\.ly/.+"], "http://img.ly/show/thumb/$1", { - templateRegex: /.*ly\/([^\/]+).*/, - embedtag: { - tag: 'img' - }, - nocache: 1 - }), - new $.fn.oembed.OEmbedProvider("twitgoo.com", "photo", ["twitgoo\\.com/.+"], "http://twitgoo.com/show/thumb/$1", { - templateRegex: /.*com\/([^\/]+).*/, - embedtag: { - tag: 'img' - }, - nocache: 1 - }), - new $.fn.oembed.OEmbedProvider("imgur.com", "photo", ["imgur\\.com/gallery/.+"], "http://imgur.com/$1l.jpg", { - templateRegex: /.*gallery\/([^\/]+).*/, - embedtag: { - tag: 'img' - }, - nocache: 1 - }), - new $.fn.oembed.OEmbedProvider("visual.ly", "rich", ["visual\\.ly/.+"], null, { - yql: { - xpath: "//a[@id=\\'gc_article_graphic_image\\']/img", - from: 'htmlstring' - } - }), - - //Rich - new $.fn.oembed.OEmbedProvider("twitter", "rich", ["twitter.com/.+"], "https://api.twitter.com/1/statuses/oembed.json"), - new $.fn.oembed.OEmbedProvider("gmep", "rich", ["gmep.imeducate.com/.*", "gmep.org/.*"], "http://gmep.org/oembed.json"), - new $.fn.oembed.OEmbedProvider("urtak", "rich", ["urtak.com/(u|clr)/.+"], "http://oembed.urtak.com/1/oembed"), - new $.fn.oembed.OEmbedProvider("cacoo", "rich", ["cacoo.com/.+"], "http://cacoo.com/oembed.json"), - new $.fn.oembed.OEmbedProvider("dailymile", "rich", ["dailymile.com/people/.*/entries/.*"], "http://api.dailymile.com/oembed"), - new $.fn.oembed.OEmbedProvider("dipity", "rich", ["dipity.com/timeline/.+"], 'http://www.dipity.com/oembed/timeline/', { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("sketchfab", "rich", ["sketchfab.com/show/.+"], 'http://sketchfab.com/oembed', { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("speakerdeck", "rich", ["speakerdeck.com/.+"], 'http://speakerdeck.com/oembed.json', { - useYQL: 'json' - }), - new $.fn.oembed.OEmbedProvider("popplet", "rich", ["popplet.com/app/.*"], "http://popplet.com/app/Popplet_Alpha.swf?page_id=$1&em=1", { - templateRegex: /.*#\/([^\/]+).*/, - embedtag: { - width: 460, - height: 460 - } - }), - new $.fn.oembed.OEmbedProvider("pearltrees", "rich", ["pearltrees.com/.*"], "http://cdn.pearltrees.com/s/embed/getApp?", { - templateRegex: /.*N-f=1_(\d+).*N-p=(\d+).*/, - embedtag: { - width: 460, - height: 460, - flashvars: "lang=en_US&embedId=pt-embed-$1-693&treeId=$1&pearlId=$2&treeTitle=Diagrams%2FVisualization&site=www.pearltrees.com%2FF" - } - }), - new $.fn.oembed.OEmbedProvider("prezi", "rich", ["prezi.com/.*"], "http://prezi.com/bin/preziloader.swf?", { - templateRegex: /.*com\/([^\/]+)\/.*/, - embedtag: { - width: 550, - height: 400, - flashvars: "prezi_id=$1&lock_to_path=0&color=ffffff&autoplay=no&autohide_ctrls=0" - } - }), - new $.fn.oembed.OEmbedProvider("tourwrist", "rich", ["tourwrist.com/tours/.+"], null, { - templateRegex: /.*tours.([\d]+).*/, - template: function (wm, tourid) { - setTimeout(function () { - if(loadEmbeds) loadEmbeds(); - }, 2000); - return "
"; - } - }), - new $.fn.oembed.OEmbedProvider("meetup", "rich", ["meetup\\.(com|ps)/.+"], "http://api.meetup.com/oembed"), - new $.fn.oembed.OEmbedProvider("ebay", "rich", ["ebay\\.*"], "http://togo.ebay.com/togo/togo.swf?2008013100", { - templateRegex: /.*\/([^\/]+)\/(\d{10,13}).*/, - embedtag: { - width: 355, - height: 300, - flashvars: "base=http://togo.ebay.com/togo/&lang=en-us&mode=normal&itemid=$2&query=$1" - } - }), - new $.fn.oembed.OEmbedProvider("wikipedia", "rich", ["wikipedia.org/wiki/.+"], "http://$1.wikipedia.org/w/api.php?action=parse&page=$2&format=json§ion=0&callback=?", { - templateRegex: /.*\/\/([\w]+).*\/wiki\/([^\/]+).*/, - templateData: function (data) { - if(!data.parse) return false; - var text = data.parse['text']['*'].replace(/href="\/wiki/g, 'href="http://en.wikipedia.org/wiki'); - return '
' + data.parse['displaytitle'] + '
' +jQuery(text).text().substring(0,200) + '...
'; - } - }), - new $.fn.oembed.OEmbedProvider("imdb", "rich", ["imdb.com/title/.+"], "http://www.imdbapi.com/?i=$1&callback=?", { - templateRegex: /.*\/title\/([^\/]+).*/, - templateData: function (data) { - if(!data.Title) return false; - return '

' + data.Title + ' (' + data.Year + ')

Rating: ' + data.imdbRating + '
Genre: ' + data.Genre + '
Starring: ' + data.Actors + '

' + data.Plot + '
'; - } - }), - new $.fn.oembed.OEmbedProvider("livejournal", "rich", ["livejournal.com/"], "http://ljpic.seacrow.com/json/$2$4?jsonp=?", { - templateRegex: /(http:\/\/(((?!users).)+)\.livejournal\.com|.*users\.livejournal\.com\/([^\/]+)).*/, - templateData: function (data) { - if(!data.username) return false; - return '
[info]' + data.username + '
' + data.name + '
'; - } - }), - new $.fn.oembed.OEmbedProvider("circuitbee", "rich", ["circuitbee\\.com/circuit/view/.+"], "http://c.circuitbee.com/build/r/schematic-embed.html?id=$1", { - templateRegex: /.*circuit\/view\/(\d+).*/, - embedtag: { - tag: 'iframe', - width: '500', - height: '350' - } - }), - new $.fn.oembed.OEmbedProvider("googlecalendar", "rich", ["www.google.com/calendar/embed?.+"], "$1", { - templateRegex: /(.*)/, - embedtag: { - tag: 'iframe', - width: '800', - height: '600' - } - }), - new $.fn.oembed.OEmbedProvider("jsfiddle", "rich", ["jsfiddle.net/[^/]+/?"], "http://jsfiddle.net/$1/embedded/result,js,resources,html,css/?", { - templateRegex: /.*net\/([^\/]+).*/, - embedtag: { - tag: 'iframe', - width: '100%', - height: '300' - } - }), - new $.fn.oembed.OEmbedProvider("jsbin", "rich", ["jsbin.com/.+"], "http://jsbin.com/$1/?", { - templateRegex: /.*com\/([^\/]+).*/, - embedtag: { - tag: 'iframe', - width: '100%', - height: '300' - } - }), - new $.fn.oembed.OEmbedProvider("jotform", "rich", ["form.jotform.co/form/.+"], "$1?", { - templateRegex: /(.*)/, - embedtag: { - tag: 'iframe', - width: '100%', - height: '507' - } - }), - new $.fn.oembed.OEmbedProvider("reelapp", "rich", ["reelapp\\.com/.+"], "http://www.reelapp.com/$1/embed", { - templateRegex: /.*com\/(\S{6}).*/, - embedtag: { - tag: 'iframe', - width: '400', - height: '338' - } - }), - new $.fn.oembed.OEmbedProvider("linkedin", "rich", ["linkedin.com/pub/.+"], "https://www.linkedin.com/cws/member/public_profile?public_profile_url=$1&format=inline&isFramed=true", { - templateRegex: /(.*)/, - embedtag: { - tag: 'iframe', - width: '368px', - height: 'auto' - } - }), - new $.fn.oembed.OEmbedProvider("timetoast", "rich", ["timetoast.com/timelines/[0-9]+"], "http://www.timetoast.com/flash/TimelineViewer.swf?passedTimelines=$1", { - templateRegex: /.*timelines\/([0-9]*)/, - embedtag: { - width: 550, - height: 400, - nocache: 1 - } - }), - new $.fn.oembed.OEmbedProvider("pastebin", "rich", ["pastebin\\.com/[\\S]{8}"], "http://pastebin.com/embed_iframe.php?i=$1", { - templateRegex: /.*\/(\S{8}).*/, - embedtag: { - tag: 'iframe', - width: '100%', - height: 'auto' - } - }), - new $.fn.oembed.OEmbedProvider("mixlr", "rich", ["mixlr.com/.+"], "http://mixlr.com/embed/$1?autoplay=ae", { - templateRegex: /.*com\/([^\/]+).*/, - embedtag: { - tag: 'iframe', - width: '100%', - height: 'auto' - } - }), - new $.fn.oembed.OEmbedProvider("pastie", "rich", ["pastie\\.org/pastes/.+"], null, { - yql: { - xpath: '//pre[@class="textmate-source"]' - } - }), - new $.fn.oembed.OEmbedProvider("github", "rich", ["gist.github.com/.+"], "https://github.com/api/oembed"), - new $.fn.oembed.OEmbedProvider("github", "rich", ["github.com/[-.\\w@]+/[-.\\w@]+"], "https://api.github.com/repos/$1/$2?callback=?", { - templateRegex: /.*\/([^\/]+)\/([^\/]+).*/, - templateData: function (data) { - if(!data.data.html_url) return false; - return '

' + data.data.name + '

' + data.data.description + '

' + '

Last updated: ' + data.data.pushed_at + '

'; - } - }), - new $.fn.oembed.OEmbedProvider("facebook", "rich", ["facebook.com/(people/[^\\/]+/\\d+|[^\\/]+$)"], "https://graph.facebook.com/$2$3/?callback=?", { - templateRegex: /.*facebook.com\/(people\/[^\/]+\/(\d+).*|([^\/]+$))/, - templateData: function (data) { - if(!data.id) return false; - var out = '
facebook '; - if(data.from) out += '' + data.from.name + ''; - else if(data.link) out += '' + data.name + ''; - else if(data.username) out += '' + data.name + ''; - else out += '' + data.name + ''; - out += '
'; - if(data.picture) out += ''; - else out += ''; - if(data.from) out += '' + data.name + ''; - if(data.founded) out += 'Founded: ' + data.founded + '
' - if(data.category) out += 'Category: ' + data.category + '
'; - if(data.website) out += 'Website: ' + data.website + '
'; - if(data.gender) out += 'Gender: ' + data.gender + '
'; - if(data.description) out += data.description + '
'; - out += '
'; - return out; - } - }), - new $.fn.oembed.OEmbedProvider("stackoverflow", "rich", ["stackoverflow.com/questions/[\\d]+"], "http://api.stackoverflow.com/1.1/questions/$1?body=true&jsonp=?", { - templateRegex: /.*questions\/([\d]+).*/, - templateData: function (data) { - if(!data.questions) return false; - var q = data.questions[0]; - var body = $(q.body).text(); - var out = '
' + '' + (q.up_vote_count - q.down_vote_count) + '
vote(s)
' + '
' + q.answer_count + 'answer
' + q.view_count + ' view(s)
' + '

' + q.title + '

' + '
' + body.substring(0, 100) + '...
'; - for(i in q.tags) - out += ''; - out += '
'; - return out; - } - }), - new $.fn.oembed.OEmbedProvider("wordpress", "rich", ["wordpress\\.com/.+", "blogs\\.cnn\\.com/.+", "techcrunch\\.com/.+", "wp\\.me/.+"], "http://public-api.wordpress.com/oembed/1.0/?for=jquery-oembed-all"), - new $.fn.oembed.OEmbedProvider("screenr", "rich", ["screenr\.com"], "http://www.screenr.com/embed/$1", { - templateRegex: /.*\/([^\/]+).*/, - embedtag: { - tag: 'iframe', - width: '650', - height: 396 - } - }), - new $.fn.oembed.OEmbedProvider("gigpans", "rich", ["gigapan\\.org/[-.\\w@]+/\\d+"], "http://gigapan.org/gigapans/$1/options/nosnapshots/iframe/flash.html", { - templateRegex: /.*\/(\d+)\/?.*/, - embedtag: { - tag: 'iframe', - width: '100%', - height: 400 - } - }), - new $.fn.oembed.OEmbedProvider("scribd", "rich", ["scribd\\.com/.+"], "http://www.scribd.com/embeds/$1/content?start_page=1&view_mode=list", { - templateRegex: /.*doc\/([^\/]+).*/, - embedtag: { - tag: 'iframe', - width: '100%', - height: 600 - } - }), - new $.fn.oembed.OEmbedProvider("kickstarter", "rich", ["kickstarter\\.com/projects/.+"], "$1/widget/card.html", { - templateRegex: /([^\?]+).*/, - embedtag: { - tag: 'iframe', - width: '220', - height: 380 - } - }), - new $.fn.oembed.OEmbedProvider("amazon", "rich", ["amzn.com/B+", "amazon.com.*/(B\\S+)($|\\/.*)"], "http://rcm.amazon.com/e/cm?t=_APIKEY_&o=1&p=8&l=as1&asins=$1&ref=qf_br_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr", { - apikey: true, - templateRegex: /.*\/(B[0-9A-Z]+)($|\/.*)/, - embedtag: { - tag: 'iframe', - width: '120px', - height: '240px' - } - }), - new $.fn.oembed.OEmbedProvider("slideshare", "rich", ["slideshare\.net"], "http://www.slideshare.net/api/oembed/2", { - format: 'jsonp' - }), - new $.fn.oembed.OEmbedProvider("roomsharejp", "rich", ["roomshare\\.jp/(en/)?post/.*"], "http://roomshare.jp/oembed.json"), - new $.fn.oembed.OEmbedProvider("lanyard", "rich", ["lanyrd.com/\\d+/.+"], null, { - yql: { - xpath: '(//div[@class="primary"])[1]', - from: 'htmlstring', - datareturn: function (results) { - if(!results.result) return false; - return '
' + results.result + '
'; - } - } - }), - new $.fn.oembed.OEmbedProvider("asciiartfarts", "rich", ["asciiartfarts.com/\\d+.html"], null, { - yql: { - xpath: '//pre/font', - from: 'htmlstring', - datareturn: function (results) { - if(!results.result) return false; - return '
' + results.result + '
'; - } - } - }) - ]; + ]; })(jQuery); +//This is needed for gravatar :( +String.prototype.md5=function(){var a=function(a,b){var c=(a&65535)+(b&65535);var d=(a>>16)+(b>>16)+(c>>16);return d<<16|c&65535};var b=function(a,b){return a<>>32-b};var c=function(c,d,e,f,g,h){return a(b(a(a(d,c),a(f,h)),g),e)};var d=function(a,b,d,e,f,g,h){return c(b&d|~b&e,a,b,f,g,h)};var e=function(a,b,d,e,f,g,h){return c(b&e|d&~e,a,b,f,g,h)};var f=function(a,b,d,e,f,g,h){return c(b^d^e,a,b,f,g,h)};var g=function(a,b,d,e,f,g,h){return c(d^(b|~e),a,b,f,g,h)};var h=function(b){var c,h,i,j,k,l=b.length;var m=1732584193;var n=-271733879;var o=-1732584194;var p=271733878;for(k=0;k>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15)}return c};var j=function(a){var b=(a.length+8>>6)+1;var c=[],d,e=b*16,f,g=a.length;for(d=0;d>2]|=(a.charCodeAt(f)&255)<>2]|=128<sitelock_title = $config['lock']['title']; $db_info->sitelock_message = $config['lock']['message']; $db_info->sitelock_whitelist = count($config['lock']['allow']) ? $config['lock']['allow'] : array('127.0.0.1'); - $db_info->embed_white_iframe = $config['embedfilter']['iframe']; - $db_info->embed_white_object = $config['embedfilter']['object']; + $db_info->embed_white_iframe = $config['mediafilter']['iframe'] ?: $config['embedfilter']['iframe']; + $db_info->embed_white_object = $config['mediafilter']['object'] ?: $config['embedfilter']['object']; $db_info->use_mobile_view = $config['use_mobile_view'] ? 'Y' : 'N'; $db_info->use_prepared_statements = $config['use_prepared_statements'] ? 'Y' : 'N'; $db_info->use_rewrite = $config['use_rewrite'] ? 'Y' : 'N'; @@ -686,7 +691,7 @@ class Context public function checkSSO() { // pass if it's not GET request or XE is not yet installed - if(!config('use_sso') || isCrawler()) + if(!config('use_sso') || Rhymix\Framework\UA::isRobot()) { return TRUE; } @@ -712,61 +717,66 @@ class Context $current_site = self::getRequestUri(); // Step 1: if the current site is not the default site, send SSO validation request to the default site - if($default_url !== $current_site && !self::get('SSOID') && $_COOKIE['sso'] !== md5($current_site)) + if($default_url !== $current_site && !self::get('sso_response') && $_COOKIE['sso'] !== md5($current_site)) { // Set sso cookie to prevent multiple simultaneous SSO validation requests setcookie('sso', md5($current_site), 0, '/'); // Redirect to the default site - $redirect_url = sprintf('%s?return_url=%s', $default_url, urlencode(base64_encode($current_site))); + $sso_request = Rhymix\Framework\Security::encrypt(Rhymix\Framework\URL::getCurrentURL()); + $redirect_url = $default_url . '?sso_request=' . urlencode($sso_request); header('Location:' . $redirect_url); - return FALSE; + return false; } // Step 2: receive and process SSO validation request at the default site - if($default_url === $current_site && self::get('return_url')) + if($default_url === $current_site && self::get('sso_request')) { // Get the URL of the origin site - $url = base64_decode(self::get('return_url')); - $url_info = parse_url($url); + $sso_request = Rhymix\Framework\Security::decrypt(self::get('sso_request')); + if (!$sso_request || !preg_match('!^https?://!', $sso_request)) + { + self::displayErrorPage('SSO Error', 'Invalid SSO Request', 400); + return false; + } // Check that the origin site is a valid site in this XE installation (to prevent open redirect vuln) if(!getModel('module')->getSiteInfoByDomain(rtrim($url, '/'))->site_srl) { - htmlHeader(); - echo self::getLang("msg_invalid_request"); - htmlFooter(); - return FALSE; + self::displayErrorPage('SSO Error', 'Invalid SSO Request', 400); + return false; } // Redirect back to the origin site - $url_info['query'] .= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id(); - $redirect_url = sprintf('%s://%s%s%s%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? (':' . $url_info['port']) : '', $url_info['path'], ($url_info['query'] ? ('?' . $url_info['query']) : '')); - header('Location:' . $redirect_url); - return FALSE; + $sso_response = Rhymix\Framework\Security::encrypt(session_id()); + header('Location: ' . Rhymix\Framework\URL::modifyURL($sso_request, array('sso_response' => $sso_response))); + return false; } // Step 3: back at the origin site, set session ID to be the same as the default site - if($default_url !== $current_site && self::get('SSOID')) + if($default_url !== $current_site && self::get('sso_response')) { - // Check that the session ID was given by the default site (to prevent session fixation CSRF) + // Check SSO response + $sso_response = Rhymix\Framework\Security::decrypt(self::get('sso_response')); + if ($sso_response === false) + { + self::displayErrorPage('SSO Error', 'Invalid SSO Response', 400); + return false; + } + + // Check that the response was given by the default site (to prevent session fixation CSRF) if(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $default_url) !== 0) { - htmlHeader(); - echo self::getLang("msg_invalid_request"); - htmlFooter(); - return FALSE; + self::displayErrorPage('SSO Error', 'Invalid SSO Response', 400); + return false; } // Set session ID - setcookie(session_name(), self::get('SSOID')); + setcookie(session_name(), $sso_response); // Finally, redirect to the originally requested URL - $url_info = parse_url(self::getRequestUrl()); - $url_info['query'] = preg_replace('/(^|\b)SSOID=([^&?]+)/', '', $url_info['query']); - $redirect_url = sprintf('%s://%s%s%s%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? (':' . $url_info['port']) : '', $url_info['path'], ($url_info['query'] ? ('?' . $url_info['query']) : '')); - header('Location:' . $redirect_url); - return FALSE; + header('Location: ' . Rhymix\Framework\URL::getCurrentURL(array('sso_response' => null))); + return false; } // If none of the conditions above apply, proceed normally @@ -1058,7 +1068,11 @@ class Context */ public static function convertEncodingStr($str) { - if(!$str) return null; + if (!$str || utf8_check($str)) + { + return $str; + } + $obj = new stdClass; $obj->str = $str; $obj = self::convertEncoding($obj); @@ -1073,15 +1087,7 @@ class Context */ public static function encodeIdna($domain) { - if(function_exists('idn_to_ascii')) - { - return idn_to_ascii($domain); - } - else - { - $encoder = new TrueBV\Punycode(); - return $encoder->encode($domain); - } + return Rhymix\Framework\URL::encodeIdna($domain); } /** @@ -1092,15 +1098,7 @@ class Context */ public static function decodeIdna($domain) { - if(function_exists('idn_to_utf8')) - { - return idn_to_utf8($domain); - } - else - { - $decoder = new TrueBV\Punycode(); - return $decoder->decode($domain); - } + return Rhymix\Framework\URL::decodeIdna($domain); } /** @@ -1283,11 +1281,15 @@ class Context } $xml = $GLOBALS['HTTP_RAW_POST_DATA']; - if(Security::detectingXEE($xml)) + if(!Rhymix\Framework\Security::checkXEE($xml)) { header("HTTP/1.0 400 Bad Request"); exit; } + if(function_exists('libxml_disable_entity_loader')) + { + libxml_disable_entity_loader(true); + } $oXml = new XmlParser(); $xml_obj = $oXml->parse($xml); @@ -1363,10 +1365,9 @@ class Context * @see Cast variables, such as _srl, page, and cpage, into interger * @param string $key Variable key * @param string $val Variable value - * @param string $do_stripslashes Whether to strip slashes * @return mixed filtered value. Type are string or array */ - public function _filterRequestVar($key, $val, $do_stripslashes = 1) + public function _filterRequestVar($key, $val) { if(!($isArray = is_array($val))) { @@ -1392,19 +1393,6 @@ class Context else { $result[$k] = $v; - - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) - { - if (is_array($result[$k])) - { - array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); }); - } - else - { - $result[$k] = stripslashes($result[$k]); - } - } - if(is_array($result[$k])) { array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); @@ -1490,13 +1478,9 @@ class Context } // Allow if the current user is in the list of allowed IPs. - $allowed_list = config('lock.allow'); - foreach ($allowed_list as $allowed_ip) + if (Rhymix\Framework\Filters\IpFilter::inRanges(RX_CLIENT_IP, config('lock.allow'))) { - if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $allowed_ip)) - { - return; - } + return; } // Set headers and constants for backward compatibility. diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index fbc205adc..e9f75a05f 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -24,7 +24,6 @@ class DB */ protected static $priority_dbms = array( 'mysqli' => 6, - 'mysql' => 4, 'cubrid' => 2, 'mssql' => 1 ); @@ -271,9 +270,13 @@ class DB // after creating instance of class, check is supported foreach ($supported_list as $db_type) { + if (strncasecmp($db_type, 'mysql', 5) === 0 && strtolower($db_type) !== 'mysqli') + { + continue; + } $class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1))); $class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name); - if(!file_exists($class_file) || stripos($class_file, '_innodb') !== false) + if (!file_exists($class_file)) { continue; } diff --git a/classes/db/DBCubrid.class.php b/classes/db/DBCubrid.class.php index 9059b99ce..1491eb73b 100644 --- a/classes/db/DBCubrid.class.php +++ b/classes/db/DBCubrid.class.php @@ -81,9 +81,14 @@ class DBCubrid extends DB define('__CUBRID_VERSION__', $cubrid_version); } - if(__CUBRID_VERSION__ >= '8.4.0') - cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE); - + if(version_compare(__CUBRID_VERSION__, '9.0', '<')) + { + $this->setError(-1, 'Rhymix requires CUBRID 9.0 or later. Current CUBRID version is ' . __CUBRID_VERSION__); + return; + } + + cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE); + return $result; } diff --git a/classes/db/DBMssql.class.php b/classes/db/DBMssql.class.php index c6d150b8c..a1473ac73 100644 --- a/classes/db/DBMssql.class.php +++ b/classes/db/DBMssql.class.php @@ -71,6 +71,16 @@ class DBMssql extends DB $this->setError(-1, 'database connect fail' . PHP_EOL . $errors); return; } + + $server_info = sqlsrv_server_info($result); + $server_version = $server_info['SQLServerVersion']; + if ($server_version && version_compare($server_version, '10', '<')) + { + $this->setError(-1, 'Rhymix requires Microsoft SQL Server 2008 or later. Current version is ' . $server_version); + return; + } + + return $result; } diff --git a/classes/db/DBMysql.class.php b/classes/db/DBMysql.class.php index 1b5264ed8..27e16b315 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -67,7 +67,8 @@ class DBMysql extends DB $result = @mysql_connect($connection['host'], $connection['user'], $connection['pass']); if(!$result) { - exit('Unable to connect to DB.'); + $this->setError(-1, 'Unable to connect to DB.'); + return; } if(mysql_error()) @@ -76,10 +77,10 @@ class DBMysql extends DB return; } - // Error appears if the version is lower than 4.1.13 - if(version_compare(mysql_get_server_info($result), '4.1.13', '<')) + // Error appears if the version is lower than 5.0.7 + if(version_compare(mysql_get_server_info($result), '5.0.7', '<')) { - $this->setError(-1, 'Rhymix requires MySQL 4.1.13 or later. Current MySQL version is ' . mysql_get_server_info()); + $this->setError(-1, 'Rhymix requires MySQL 5.0.7 or later. Current MySQL version is ' . mysql_get_server_info()); return; } @@ -164,7 +165,8 @@ class DBMysql extends DB { if(!$connection) { - exit('Rhymix cannot handle DB connection.'); + $this->setError(-1, 'Unable to connect to DB.'); + return false; } // Run the query statement $result = @mysql_query($query, $connection); diff --git a/classes/db/DBMysqli.class.php b/classes/db/DBMysqli.class.php index 8c425be45..ef8f845ba 100644 --- a/classes/db/DBMysqli.class.php +++ b/classes/db/DBMysqli.class.php @@ -80,8 +80,8 @@ class DBMysqli extends DBMysql { if ($connection === null) { - debug_print_backtrace(); - exit; + $this->setError(-1, 'Unable to connect to DB.'); + return false; } if($this->use_prepared_statements == 'Y') { diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 8ed67bf13..ebbdbb3e4 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -12,6 +12,7 @@ class DisplayHandler extends Handler { public static $response_size = 0; + public static $debug_printed = 0; var $content_size = 0; // /< The size of displaying contents var $gz_enabled = FALSE; // / = 2 && substr_compare($source, './', 0, 2) === 0) - { - return _XE_PATH_ . substr($source, 2); - } - - return $source; + return (strncmp($source, './', 2) === 0) ? (\RX_BASEDIR . substr($source, 2)) : $source; } /** @@ -33,64 +27,11 @@ class FileHandler * @param string $source_dir Path of source directory * @param string $target_dir Path of target dir * @param string $filter Regex to filter files. If file matches this regex, the file is not copied. - * @param string $type If set as 'force'. Even if the file exists in target, the file is copied. * @return void */ - public static function copyDir($source_dir, $target_dir, $filter = null, $type = null) + public static function copyDir($source_dir, $target_dir, $filter = null) { - $source_dir = self::getRealPath($source_dir); - $target_dir = self::getRealPath($target_dir); - if(!is_dir($source_dir)) - { - return FALSE; - } - - // generate when no target exists - self::makeDir($target_dir); - - if(substr($source_dir, -1) != DIRECTORY_SEPARATOR) - { - $source_dir .= DIRECTORY_SEPARATOR; - } - - if(substr($target_dir, -1) != DIRECTORY_SEPARATOR) - { - $target_dir .= DIRECTORY_SEPARATOR; - } - - $oDir = dir($source_dir); - while($file = $oDir->read()) - { - if($file{0} == '.') - { - continue; - } - - if($filter && preg_match($filter, $file)) - { - continue; - } - - if(is_dir($source_dir . $file)) - { - self::copyDir($source_dir . $file, $target_dir . $file, $type); - } - else - { - if($type == 'force') - { - @unlink($target_dir . $file); - } - else - { - if(!file_exists($target_dir . $file)) - { - @copy($source_dir . $file, $target_dir . $file); - } - } - } - } - $oDir->close(); + return Rhymix\Framework\Storage::copyDirectory(self::getRealPath($source_dir), self::getRealPath($target_dir), $filter); } /** @@ -104,18 +45,7 @@ class FileHandler public static function copyFile($source, $target, $force = 'Y') { setlocale(LC_CTYPE, 'en_US.UTF8', 'ko_KR.UTF8'); - $source = self::getRealPath($source); - $target_dir = self::getRealPath(dirname($target)); - $target = basename($target); - - self::makeDir($target_dir); - - if($force == 'Y') - { - @unlink($target_dir . DIRECTORY_SEPARATOR . $target); - } - - @copy($source, $target_dir . DIRECTORY_SEPARATOR . $target); + return Rhymix\Framework\Storage::copy(self::getRealPath($source), self::getRealPath($target)); } /** @@ -126,12 +56,7 @@ class FileHandler */ public static function readFile($filename) { - if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1) - { - return; - } - - return @file_get_contents($filename); + return Rhymix\Framework\Storage::read(self::getRealPath($filename)); } /** @@ -144,22 +69,7 @@ class FileHandler */ public static function writeFile($filename, $buff, $mode = "w") { - $filename = self::getRealPath($filename); - $pathinfo = pathinfo($filename); - self::makeDir($pathinfo['dirname']); - - $flags = 0; - if(strtolower($mode) == 'a') - { - $flags = FILE_APPEND; - } - - @file_put_contents($filename, $buff, $flags|LOCK_EX); - @chmod($filename, 0644); - if(function_exists('opcache_invalidate') && substr($filename, -4) === '.php') - { - @opcache_invalidate($filename, true); - } + return Rhymix\Framework\Storage::write(self::getRealPath($filename), $buff, $mode); } /** @@ -170,16 +80,7 @@ class FileHandler */ public static function removeFile($filename) { - if(($filename = self::exists($filename)) === false) - { - return false; - } - $status = @unlink($filename); - if(function_exists('opcache_invalidate') && substr($filename, -4) === '.php') - { - @opcache_invalidate($filename, true); - } - return $status; + return Rhymix\Framework\Storage::delete(self::getRealPath($filename)); } /** @@ -193,7 +94,7 @@ class FileHandler */ public static function rename($source, $target) { - return @rename(self::getRealPath($source), self::getRealPath($target)); + return Rhymix\Framework\Storage::move(self::getRealPath($source), self::getRealPath($target)); } /** @@ -205,12 +106,7 @@ class FileHandler */ public static function moveFile($source, $target) { - if(($source = self::exists($source)) !== FALSE) - { - self::removeFile($target); - return self::rename($source, $target); - } - return FALSE; + return Rhymix\Framework\Storage::move(self::getRealPath($source), self::getRealPath($target)); } /** @@ -224,7 +120,7 @@ class FileHandler */ public static function moveDir($source_dir, $target_dir) { - self::rename($source_dir, $target_dir); + return Rhymix\Framework\Storage::move(self::getRealPath($source_dir), self::getRealPath($target_dir)); } /** @@ -240,45 +136,31 @@ class FileHandler */ public static function readDir($path, $filter = '', $to_lower = FALSE, $concat_prefix = FALSE) { - $path = self::getRealPath($path); + $list = Rhymix\Framework\Storage::readDirectory(self::getRealPath($path), $concat_prefix, true, false); + if (!$list) + { + return array(); + } + $output = array(); - - if(substr($path, -1) != '/') + foreach ($list as $filename) { - $path .= '/'; - } - - if(!is_dir($path)) - { - return $output; - } - - $files = scandir($path); - foreach($files as $file) - { - if($file{0} == '.' || ($filter && !preg_match($filter, $file))) + $filename = str_replace(array('/\\', '//'), '/', $filename); + $basename = $concat_prefix ? basename($filename) : $filename; + if ($basename[0] === '.' || ($filter && !preg_match($filter, $basename))) { continue; } - - if($to_lower) + if ($to_lower) { - $file = strtolower($file); + $filename = strtolower($filename); } - if($filter) { - $file = preg_replace($filter, '$1', $file); + $filename = preg_replace($filter, '$1', $filename); } - - if($concat_prefix) - { - $file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file); - } - - $output[] = str_replace(array('/\\', '//'), '/', $file); + $output[] = $filename; } - return $output; } @@ -292,16 +174,12 @@ class FileHandler */ public static function makeDir($path_string) { - if(self::exists($path_string) !== FALSE) + if (!ini_get('safe_mode')) { - return TRUE; - } - - if(!ini_get('safe_mode')) - { - @mkdir($path_string, 0755, TRUE); - @chmod($path_string, 0755); + $path = self::getRealPath($path_string); + return Rhymix\Framework\Storage::isDirectory($path) || Rhymix\Framework\Storage::createDirectory($path); } + // if safe_mode is on, use FTP else { @@ -372,37 +250,7 @@ class FileHandler */ public static function removeDir($path) { - if(($path = self::isDir($path)) === FALSE) - { - return; - } - - if(self::isDir($path)) - { - $files = array_diff(scandir($path), array('..', '.')); - - foreach($files as $file) - { - if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE) - { - continue; - } - - if(is_dir($target)) - { - self::removeDir($target); - } - else - { - unlink($target); - } - } - rmdir($path); - } - else - { - unlink($path); - } + return Rhymix\Framework\Storage::deleteDirectory(self::getRealPath($path)); } /** @@ -413,27 +261,14 @@ class FileHandler */ public static function removeBlankDir($path) { - if(($path = self::isDir($path)) === FALSE) + $path = self::getRealPath($path); + if (Rhymix\Framework\Storage::isEmptyDirectory($path)) { - return; + return Rhymix\Framework\Storage::deleteDirectory($path); } - - $files = array_diff(scandir($path), array('..', '.')); - - if(count($files) < 1) + else { - rmdir($path); - return; - } - - foreach($files as $file) - { - if(($target = self::isDir($path . DIRECTORY_SEPARATOR . $file)) === FALSE) - { - continue; - } - - self::removeBlankDir($target); + return false; } } @@ -447,37 +282,7 @@ class FileHandler */ public static function removeFilesInDir($path) { - if(($path = self::getRealPath($path)) === FALSE) - { - return; - } - - if(is_dir($path)) - { - $files = array_diff(scandir($path), array('..', '.')); - - foreach($files as $file) - { - if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE) - { - continue; - } - - if(is_dir($target)) - { - self::removeFilesInDir($target); - } - else - { - unlink($target); - } - } - } - else - { - if(self::exists($path)) unlink($path); - } - + return Rhymix\Framework\Storage::deleteDirectory(self::getRealPath($path), false); } /** @@ -584,7 +389,14 @@ class FileHandler if($response->success) { - return $response->body; + if (isset($request_config['filename'])) + { + return true; + } + else + { + return $response->body; + } } else { @@ -611,13 +423,9 @@ class FileHandler */ public static function getRemoteFile($url, $target_filename, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array()) { - if(!($body = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers,$cookies,$post_data,$request_config))) - { - return FALSE; - } - - self::writeFile($target_filename, $body); - return TRUE; + $request_config['filename'] = $target_filename; + $success = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config); + return $success ? true : false; } /** @@ -658,12 +466,17 @@ class FileHandler $channels = 6; //for png } $memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR); - $availableMemory = self::returnBytes(ini_get('memory_limit')) - memory_get_usage(); + $memoryLimit = self::returnBytes(ini_get('memory_limit')); + if($memoryLimit < 0) + { + return true; + } + $availableMemory = $memoryLimit - memory_get_usage(); if($availableMemory < $memoryNeeded) { - return FALSE; + return false; } - return TRUE; + return true; } /** @@ -882,19 +695,13 @@ class FileHandler */ public static function readIniFile($filename) { - if(($filename = self::exists($filename)) === FALSE) + if(!Rhymix\Framework\Storage::isReadable($filename)) { - return FALSE; - } - $arr = parse_ini_file($filename, TRUE); - if(is_array($arr) && count($arr) > 0) - { - return $arr; - } - else - { - return array(); + return false; } + + $arr = parse_ini_file($filename, true); + return is_array($arr) ? $arr : array(); } /** @@ -966,11 +773,9 @@ class FileHandler */ public static function openFile($filename, $mode) { - $pathinfo = pathinfo($filename); - self::makeDir($pathinfo['dirname']); - - require_once("FileObject.class.php"); - return new FileObject($filename, $mode); + $filename = self::getRealPath($filename); + Rhymix\Framework\Storage::createDirectory(dirname($filename)); + return new FileObject($filename, $mode); } /** @@ -981,7 +786,7 @@ class FileHandler */ public static function hasContent($filename) { - return (is_readable($filename) && (filesize($filename) > 0)); + return Rhymix\Framework\Storage::getSize(self::getRealPath($filename)) > 0; } /** @@ -993,7 +798,7 @@ class FileHandler public static function exists($filename) { $filename = self::getRealPath($filename); - return file_exists($filename) ? $filename : FALSE; + return Rhymix\Framework\Storage::exists($filename) ? $filename : false; } /** @@ -1005,7 +810,7 @@ class FileHandler public static function isDir($path) { $path = self::getRealPath($path); - return is_dir($path) ? $path : FALSE; + return Rhymix\Framework\Storage::isDirectory($path) ? $path : false; } /** @@ -1017,22 +822,7 @@ class FileHandler public static function isWritableDir($path) { $path = self::getRealPath($path); - if(is_dir($path)==FALSE) - { - return FALSE; - } - - $checkFile = $path . '/_CheckWritableDir'; - - $fp = fopen($checkFile, 'w'); - if(!is_resource($fp)) - { - return FALSE; - } - fclose($fp); - - self::removeFile($checkFile); - return TRUE; + return Rhymix\Framework\Storage::isDirectory($path) && Rhymix\Framework\Storage::isWritable($path); } } diff --git a/classes/mail/Mail.class.php b/classes/mail/Mail.class.php index c2d9725db..465e623be 100644 --- a/classes/mail/Mail.class.php +++ b/classes/mail/Mail.class.php @@ -460,81 +460,7 @@ class Mail */ function returnMIMEType($filename) { - preg_match("|\.([a-z0-9]{2,4})$|i", $filename, $fileSuffix); - switch(strtolower($fileSuffix[1])) - { - case "js" : - return "application/x-javascript"; - case "json" : - return "application/json"; - case "jpg" : - case "jpeg" : - case "jpe" : - return "image/jpg"; - case "png" : - case "gif" : - case "bmp" : - case "tiff" : - return "image/" . strtolower($fileSuffix[1]); - case "css" : - return "text/css"; - case "xml" : - return "application/xml"; - case "doc" : - case "docx" : - return "application/msword"; - case "xls" : - case "xlt" : - case "xlm" : - case "xld" : - case "xla" : - case "xlc" : - case "xlw" : - case "xll" : - return "application/vnd.ms-excel"; - case "ppt" : - case "pps" : - return "application/vnd.ms-powerpoint"; - case "rtf" : - return "application/rtf"; - case "pdf" : - return "application/pdf"; - case "html" : - case "htm" : - case "php" : - return "text/html"; - case "txt" : - return "text/plain"; - case "mpeg" : - case "mpg" : - case "mpe" : - return "video/mpeg"; - case "mp3" : - return "audio/mpeg3"; - case "wav" : - return "audio/wav"; - case "aiff" : - case "aif" : - return "audio/aiff"; - case "avi" : - return "video/msvideo"; - case "wmv" : - return "video/x-ms-wmv"; - case "mov" : - return "video/quicktime"; - case "zip" : - return "application/zip"; - case "tar" : - return "application/x-tar"; - case "swf" : - return "application/x-shockwave-flash"; - default : - if(function_exists("mime_content_type")) - { - $fileSuffix = mime_content_type($filename); - } - return "unknown/" . trim($fileSuffix[0], "."); - } + return Rhymix\Framework\MIME::getTypeByFilename($filename); } } diff --git a/classes/mobile/Mobile.class.php b/classes/mobile/Mobile.class.php index 5b3528621..65b4276e3 100644 --- a/classes/mobile/Mobile.class.php +++ b/classes/mobile/Mobile.class.php @@ -55,9 +55,6 @@ class Mobile return $this->ismobile = false; } - $xe_web_path = Context::pathToUrl(_XE_PATH_); - - // default setting. if there is cookie for a device, XE do not have to check if it is mobile or not and it will enhance performace of the server. $this->ismobile = FALSE; $m = Context::get('m'); @@ -87,28 +84,14 @@ class Mobile } else { - $this->ismobile = FALSE; - setcookie("mobile", FALSE, 0, $xe_web_path); - setcookie("user-agent", FALSE, 0, $xe_web_path); - if(!self::isMobilePadCheckByAgent() && self::isMobileCheckByAgent()) - { - $this->ismobile = TRUE; - } + setcookie("mobile", FALSE, 0, RX_BASEURL); + setcookie("user-agent", FALSE, 0, RX_BASEURL); + $this->ismobile = Rhymix\Framework\UA::isMobile() && !Rhymix\Framework\UA::isTablet(); } } else { - if(self::isMobilePadCheckByAgent()) - { - $this->ismobile = FALSE; - } - else - { - if(self::isMobileCheckByAgent()) - { - $this->ismobile = TRUE; - } - } + $this->ismobile = Rhymix\Framework\UA::isMobile() && !Rhymix\Framework\UA::isTablet(); } if($this->ismobile !== NULL) @@ -118,18 +101,18 @@ class Mobile if($_COOKIE['mobile'] != 'true') { $_COOKIE['mobile'] = 'true'; - setcookie("mobile", 'true', 0, $xe_web_path); + setcookie("mobile", 'true', 0, RX_BASEURL); } } elseif(isset($_COOKIE['mobile']) && $_COOKIE['mobile'] != 'false') { $_COOKIE['mobile'] = 'false'; - setcookie("mobile", 'false', 0, $xe_web_path); + setcookie("mobile", 'false', 0, RX_BASEURL); } if(isset($_COOKIE['mobile']) && $_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT'])) { - setcookie("user-agent", md5($_SERVER['HTTP_USER_AGENT']), 0, $xe_web_path); + setcookie("user-agent", md5($_SERVER['HTTP_USER_AGENT']), 0, RX_BASEURL); } } @@ -143,31 +126,7 @@ class Mobile */ public static function isMobileCheckByAgent() { - static $UACheck; - if(isset($UACheck)) - { - return $UACheck; - } - - $oMobile = Mobile::getInstance(); - $mobileAgent = array('iPod', 'iPhone', 'Android', 'BlackBerry', 'SymbianOS', 'Bada', 'Tizen', 'Kindle', 'Wii', 'SCH-', 'SPH-', 'CANU-', 'Windows Phone', 'Windows CE', 'POLARIS', 'Palm', 'Dorothy Browser', 'Mobile', 'Opera Mobi', 'Opera Mini', 'Minimo', 'AvantGo', 'NetFront', 'Nokia', 'LGPlayer', 'SonyEricsson', 'HTC'); - - if($oMobile->isMobilePadCheckByAgent()) - { - $UACheck = TRUE; - return TRUE; - } - - foreach($mobileAgent as $agent) - { - if(stripos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE) - { - $UACheck = TRUE; - return TRUE; - } - } - $UACheck = FALSE; - return FALSE; + return Rhymix\Framework\UA::isMobile(); } /** @@ -177,45 +136,7 @@ class Mobile */ public static function isMobilePadCheckByAgent() { - static $UACheck; - if(isset($UACheck)) - { - return $UACheck; - } - $padAgent = array('iPad', 'Android', 'webOS', 'hp-tablet', 'PlayBook'); - - // Android with 'Mobile' string is not a tablet-like device, and 'Andoroid' without 'Mobile' string is a tablet-like device. - // $exceptionAgent[0] contains exception agents for all exceptions. - $exceptionAgent = array(0 => array('Opera Mini', 'Opera Mobi'), 'Android' => 'Mobile'); - - foreach($padAgent as $agent) - { - if(strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE) - { - if(!isset($exceptionAgent[$agent])) - { - $UACheck = TRUE; - return TRUE; - } - elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE) - { - // If the agent is the Android, that can be either tablet and mobile phone. - foreach($exceptionAgent[0] as $val) - { - if(strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE) - { - $UACheck = FALSE; - return FALSE; - } - } - $UACheck = TRUE; - return TRUE; - } - } - } - - $UACheck = FALSE; - return FALSE; + return Rhymix\Framework\UA::isTablet(); } /** diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 0dafb4390..c433ccbf3 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -96,10 +96,13 @@ class ModuleHandler extends Handler { if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && !RX_SSL) { - if(Context::get('_https_port')!=null) { - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); - } else { - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + if(Context::get('_https_port') != null) + { + header('location: https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); + } + else + { + header('location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); } return; } @@ -165,12 +168,21 @@ class ModuleHandler extends Handler // Get module's information based on document_srl, if it's specified if($this->document_srl) { - $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); + // If the document does not exist, remove document_srl if(!$module_info) { - unset($this->document_srl); + if(Context::getRequestMethod() == 'GET') + { + $this->error = 'The document does not exist'; + $this->httpStatusCode = '404'; + return true; + } + else + { + unset($this->document_srl); + } } else { @@ -178,19 +190,17 @@ class ModuleHandler extends Handler // if mids are not matching, set it as the document's mid if(!$this->mid || ($this->mid != $module_info->mid)) { - if(Context::getRequestMethod() == 'GET') { - $this->mid = $module_info->mid; - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); - return FALSE; + Context::setCacheControl(0); + header('location: ' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $module_info->mid, 'document_srl', $this->document_srl), true, 301); + return false; } else { $this->mid = $module_info->mid; Context::set('mid', $this->mid); } - } // if requested module is different from one of the document, remove the module information retrieved based on the document number if($this->module && $module_info->module != $this->module) @@ -198,7 +208,6 @@ class ModuleHandler extends Handler unset($module_info); } } - } // If module_info is not set yet, and there exists mid information, get module information based on the mid @@ -211,9 +220,10 @@ class ModuleHandler extends Handler // redirect, if module_site_srl and site_srl are different if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) { + Context::setCacheControl(0); $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); - return FALSE; + header('location: ' . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid), true, 301); + return false; } // If module_info is not set still, and $module does not exist, find the default module @@ -228,7 +238,7 @@ class ModuleHandler extends Handler } // redirect, if site_srl of module_info is different from one of site's module_info - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) + if($module_info && $module_info->site_srl != $site_module_info->site_srl && !Rhymix\Framework\UA::isRobot()) { // If the module is of virtual site if($module_info->site_srl) @@ -241,10 +251,20 @@ class ModuleHandler extends Handler { $redirect_url = getNotEncodedSiteUrl(Context::getDefaultUrl(), 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); } - header("Location: $redirect_url"); - return FALSE; + + Context::setCacheControl(0); + header("Location: $redirect_url", true, 301); + return false; } - + + // redirect, if site start module + if(isset($_GET['mid']) && $_GET['mid'] === $site_module_info->mid && !$this->act && !$this->module && !$this->document_srl) + { + Context::setCacheControl(0); + header('location: ' . getNotEncodedSiteUrl($site_module_info->domain), true, 301); + return false; + } + // If module info was set, retrieve variables from the module information if($module_info) { @@ -290,6 +310,7 @@ class ModuleHandler extends Handler { $this->error = 'msg_module_is_not_exists'; $this->httpStatusCode = '404'; + return true; } // If mid exists, set mid into context @@ -303,13 +324,13 @@ class ModuleHandler extends Handler if(!$output->toBool()) { $this->error = $output->getMessage(); - return TRUE; + return true; } // Set current module info into context Context::set('current_module_info', $this->module_info); - return TRUE; + return true; } /** @@ -465,7 +486,6 @@ class ModuleHandler extends Handler // If there is no such action in the module object if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) { - if(!Context::isInstalled()) { self::_setInputErrorToContext(); @@ -760,10 +780,6 @@ class ModuleHandler extends Handler } self::_setInputValueToSession(); } - else - { - - } if($error != 0) { @@ -884,7 +900,7 @@ class ModuleHandler extends Handler if($_SESSION['XE_VALIDATOR_RETURN_URL']) { - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); + header('location: ' . $_SESSION['XE_VALIDATOR_RETURN_URL']); return; } @@ -939,13 +955,11 @@ class ModuleHandler extends Handler if($layout_srl && !$oModule->getLayoutFile()) { - // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file $oLayoutModel = getModel('layout'); $layout_info = $oLayoutModel->getLayout($layout_srl); if($layout_info) { - // Input extra_vars into $layout_info if($layout_info->extra_var_count) { @@ -1283,6 +1297,8 @@ class ModuleHandler extends Handler $statusMessageList = array( '100' => 'Continue', '101' => 'Switching Protocols', + '102' => 'Processing', + '103' => 'Checkpoint', '200' => 'OK', '201' => 'Created', '202' => 'Accepted', @@ -1290,13 +1306,18 @@ class ModuleHandler extends Handler '204' => 'No Content', '205' => 'Reset Content', '206' => 'Partial Content', + '207' => 'Multi-Status', + '208' => 'Already Reported', + '226' => 'IM Used', '300' => 'Multiple Choices', '301' => 'Moved Permanently', '302' => 'Found', '303' => 'See Other', '304' => 'Not Modified', '305' => 'Use Proxy', + '306' => 'Switch Proxy', '307' => 'Temporary Redirect', + '308' => 'Permanent Redirect', '400' => 'Bad Request', '401' => 'Unauthorized', '402' => 'Payment Required', @@ -1310,19 +1331,39 @@ class ModuleHandler extends Handler '410' => 'Gone', '411' => 'Length Required', '412' => 'Precondition Failed', - '413' => 'Request Entity Too Large', - '414' => 'Request-URI Too Long', + '413' => 'Payload Too Large', + '414' => 'URI Too Long', '415' => 'Unsupported Media Type', - '416' => 'Requested Range Not Satisfiable', + '416' => 'Range Not Satisfiable', '417' => 'Expectation Failed', + '418' => 'I\'m a teapot', + '420' => 'Enhance Your Calm', + '421' => 'Misdirected Request', + '422' => 'Unprocessable Entity', + '423' => 'Locked', + '424' => 'Failed Dependency', + '425' => 'Unordered Collection', + '426' => 'Upgrade Required', + '428' => 'Precondition Required', + '429' => 'Too Many Requests', + '431' => 'Request Header Fields Too Large', + '444' => 'No Response', + '449' => 'Retry With', + '451' => 'Unavailable For Legal Reasons', '500' => 'Internal Server Error', '501' => 'Not Implemented', '502' => 'Bad Gateway', '503' => 'Service Unavailable', '504' => 'Gateway Timeout', '505' => 'HTTP Version Not Supported', + '506' => 'Variant Also Negotiates', + '507' => 'Insufficient Storage', + '508' => 'Loop Detected', + '509' => 'Bandwidth Limit Exceeded', + '510' => 'Not Extended', + '511' => 'Network Authentication Required', ); - $statusMessage = $statusMessageList[$code]; + $statusMessage = $statusMessageList[strval($code)]; if(!$statusMessage) { $statusMessage = 'OK'; diff --git a/classes/security/EmbedFilter.class.php b/classes/security/EmbedFilter.class.php index 2f90a753e..47d529b9f 100644 --- a/classes/security/EmbedFilter.class.php +++ b/classes/security/EmbedFilter.class.php @@ -3,313 +3,78 @@ class EmbedFilter { - /** - * allow script access list + * Deprecated properties * @var array */ - var $allowscriptaccessList = array(); - - /** - * allow script access key - * @var int - */ - var $allowscriptaccessKey = 0; - var $whiteUrlList = array(); - var $whiteIframeUrlList = array(); - var $mimeTypeList = array(); - var $extList = array(); - var $parser = NULL; - - /** - * @constructor - * @return void - */ - function __construct() - { - $this->_makeWhiteDomainList(); - } + public $whiteUrlList = array(); + public $whiteIframeUrlList = array(); + public $mimeTypeList = array(); + public $extList = array(); /** * Return EmbedFilter object - * This method for singleton + * * @return EmbedFilter */ function getInstance() { - if(!isset($GLOBALS['__EMBEDFILTER_INSTANCE__'])) - { - $GLOBALS['__EMBEDFILTER_INSTANCE__'] = new EmbedFilter(); - } - return $GLOBALS['__EMBEDFILTER_INSTANCE__']; + return new self(); } - + public function getWhiteUrlList() { - return $this->whiteUrlList; + return Rhymix\Framework\Filters\MediaFilter::getObjectWhitelist(); } - + public function getWhiteIframeUrlList() { - return $this->whiteIframeUrlList; + return Rhymix\Framework\Filters\MediaFilter::getIframeWhitelist(); } - - /** - * Check the content. - * @return void - */ - function check(&$content) - { - $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); - $content = preg_replace_callback('/]*>/is', array($this, '_addAllowScriptAccess'), $content); - - $this->checkObjectTag($content); - $this->checkEmbedTag($content); - $this->checkParamTag($content); - } - - /** - * Check iframe tag in the content. - * @return void - */ - function checkIframeTag(&$content) - { - // check in Purifier class - return; - } - - /** - * Check object tag in the content. - * @return void - */ - function checkObjectTag(&$content) - { - $content = preg_replace_callback('/<\s*object\s*[^>]+(?:\/?>?)/is', function($m) { - $html = Sunra\PhpSimple\HtmlDomParser::str_get_html($m[0]); - foreach ($html->find('object') as $element) - { - if ($element->data && !$this->isWhiteDomain($element->data)) - { - return escape($m[0], false); - } - if ($element->type && !$this->isWhiteMimetype($element->type)) - { - return escape($m[0], false); - } - } - return $m[0]; - }, $content); - } - - /** - * Check embed tag in the content. - * @return void - */ - function checkEmbedTag(&$content) - { - $content = preg_replace_callback('/<\s*embed\s*[^>]+(?:\/?>?)/is', function($m) { - $html = Sunra\PhpSimple\HtmlDomParser::str_get_html($m[0]); - foreach ($html->find('embed') as $element) - { - if ($element->src && !$this->isWhiteDomain($element->src)) - { - return escape($m[0], false); - } - if ($element->type && !$this->isWhiteMimetype($element->type)) - { - return escape($m[0], false); - } - } - return $m[0]; - }, $content); - } - - /** - * Check param tag in the content. - * @return void - */ - function checkParamTag(&$content) - { - $content = preg_replace_callback('/<\s*param\s*[^>]+(?:\/?>?)/is', function($m) { - $html = Sunra\PhpSimple\HtmlDomParser::str_get_html($m[0]); - foreach ($html->find('param') as $element) - { - foreach (array('movie', 'src', 'href', 'url', 'source') as $attr) - { - if ($element->$attr && !$this->isWhiteDomain($element->$attr)) - { - return escape($m[0], false); - } - } - } - return $m[0]; - }, $content); - } - - /** - * Check white domain in object data attribute or embed src attribute. - * @return string - */ + function isWhiteDomain($urlAttribute) { - if(is_array($this->whiteUrlList)) - { - foreach($this->whiteUrlList AS $key => $value) - { - if(preg_match('@^https?://' . preg_quote($value, '@') . '@i', $urlAttribute)) - { - return TRUE; - } - } - } - return FALSE; + return Rhymix\Framework\Filters\MediaFilter::matchObjectWhitelist($urlAttribute); } - - /** - * Check white domain in iframe src attribute. - * @return string - */ + function isWhiteIframeDomain($urlAttribute) { - if(is_array($this->whiteIframeUrlList)) - { - foreach($this->whiteIframeUrlList AS $key => $value) - { - if(preg_match('@^https?://' . preg_quote($value, '@') . '@i', $urlAttribute)) - { - return TRUE; - } - } - } - return FALSE; + return Rhymix\Framework\Filters\MediaFilter::matchIframeWhitelist($urlAttribute); } - - /** - * Check white mime type in object type attribute or embed type attribute. - * @return string - */ + function isWhiteMimetype($mimeType) { - if(isset($this->mimeTypeList[$mimeType])) - { - return TRUE; - } - return FALSE; + return true; } - + function isWhiteExt($ext) { - if(isset($this->extList[$ext])) - { - return TRUE; - } - return FALSE; + return true; } - - function _checkAllowScriptAccess($m) + + function check(&$content) { - if($m[1] == 'object') - { - $this->allowscriptaccessList[] = 1; - } - - if($m[1] == 'param') - { - if(stripos($m[0], 'allowscriptaccess')) - { - $m[0] = 'allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; - } - } - else if($m[1] == 'embed') - { - if(stripos($m[0], 'allowscriptaccess')) - { - $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); - } - else - { - $m[0] = preg_replace('/\allowscriptaccessList[$this->allowscriptaccessKey] == 1) - { - $m[0] = $m[0] . ''; - } - $this->allowscriptaccessKey++; - return $m[0]; + // This functionality has been moved to the HTMLFilter class. } - - /** - * Make white domain list cache file from xml config file. - * @param $whitelist array - * @return void - */ - function _makeWhiteDomainList($whitelist = NULL) + + function checkObjectTag(&$content) { - $whiteUrlDefaultList = (include RX_BASEDIR . 'common/defaults/whitelist.php'); - $this->extList = $whiteUrlDefaultList['extensions']; - $this->mimeTypeList = $whiteUrlDefaultList['mime']; - $this->whiteUrlList = array(); - $this->whiteIframeUrlList = array(); - - if($whitelist !== NULL) - { - if(!is_array($whitelist) || !isset($whitelist['object']) || !isset($whitelist['iframe'])) - { - $whitelist = array( - 'object' => isset($whitelist->object) ? $whitelist->object : array(), - 'iframe' => isset($whitelist->iframe) ? $whitelist->iframe : array(), - ); - } - foreach ($whitelist['object'] as $prefix) - { - $this->whiteUrlList[] = preg_match('@^https?://(.*)$@i', $prefix, $matches) ? $matches[1] : $prefix; - } - foreach ($whitelist['iframe'] as $prefix) - { - $this->whiteIframeUrlList[] = preg_match('@^https?://(.*)$@i', $prefix, $matches) ? $matches[1] : $prefix; - } - } - else - { - foreach ($whiteUrlDefaultList['object'] as $prefix) - { - $this->whiteUrlList[] = $prefix; - } - foreach ($whiteUrlDefaultList['iframe'] as $prefix) - { - $this->whiteIframeUrlList[] = $prefix; - } - if ($embedfilter_object = config('embedfilter.object')) - { - foreach ($embedfilter_object as $prefix) - { - $this->whiteUrlList[] = preg_match('@^https?://(.*)$@i', $prefix, $matches) ? $matches[1] : $prefix; - } - } - if ($embedfilter_iframe = config('embedfilter.iframe')) - { - foreach ($embedfilter_iframe as $prefix) - { - $this->whiteIframeUrlList[] = preg_match('@^https?://(.*)$@i', $prefix, $matches) ? $matches[1] : $prefix; - } - } - } - - $this->whiteUrlList = array_unique($this->whiteUrlList); - $this->whiteIframeUrlList = array_unique($this->whiteIframeUrlList); - natcasesort($this->whiteUrlList); - natcasesort($this->whiteIframeUrlList); + // This functionality has been moved to the HTMLFilter class. + } + + function checkEmbedTag(&$content) + { + // This functionality has been moved to the HTMLFilter class. + } + + function checkParamTag(&$content) + { + // This functionality has been moved to the HTMLFilter class. } } /* End of file : EmbedFilter.class.php */ diff --git a/classes/security/IpFilter.class.php b/classes/security/IpFilter.class.php index ea49b8195..8536949ab 100644 --- a/classes/security/IpFilter.class.php +++ b/classes/security/IpFilter.class.php @@ -6,26 +6,12 @@ class IpFilter public function filter($ip_list, $ip = NULL) { if(!$ip) $ip = $_SERVER['REMOTE_ADDR']; - foreach($ip_list as $filter) - { - if(Rhymix\Framework\IpFilter::inRange($ip, $filter)) - { - return true; - } - } - return false; + return Rhymix\Framework\Filters\IpFilter::inRanges($ip, $ip_list); } public function validate($ip_list = array()) { - foreach($ip_list as $filter) - { - if(!Rhymix\Framework\IpFilter::validateRange($filter)) - { - return false; - } - } - return true; + return Rhymix\Framework\Filters\IpFilter::validateRanges($ip_list); } } diff --git a/classes/security/Password.class.php b/classes/security/Password.class.php index 93e87f0e1..c0a1da502 100644 --- a/classes/security/Password.class.php +++ b/classes/security/Password.class.php @@ -1,458 +1,79 @@ */ -/** - * This class can be used to hash passwords using various algorithms and check their validity. - * It is fully compatible with previous defaults, while also supporting bcrypt and pbkdf2. - * - * @file Password.class.php - * @author Kijin Sung (kijin@kijinsung.com) - * @package /classes/security - * @version 1.1 - */ class Password { - /** - * @brief Custom algorithms are stored here - * @var array - */ - protected static $_custom = array(); - - /** - * @brief Register a custom algorithm for password checking - * @param string $name The name of the algorithm - * @param string $regexp The regular expression to detect the algorithm - * @param callable $callback The function to call to regenerate the hash - * @return void - */ public static function registerCustomAlgorithm($name, $regexp, $callback) { - self::$_custom[$name] = array('regexp' => $regexp, 'callback' => $callback); + Rhymix\Framework\Password::addAlgorithm($name, $regexp, $callback); } - /** - * @brief Return the list of hashing algorithms supported by this server - * @return array - */ public function getSupportedAlgorithms() { - $retval = array(); - if(function_exists('hash_hmac') && in_array('sha256', hash_algos())) - { - $retval['pbkdf2'] = 'pbkdf2'; - } - if(version_compare(PHP_VERSION, '5.3.7', '>=') && defined('CRYPT_BLOWFISH')) - { - $retval['bcrypt'] = 'bcrypt'; - } - $retval['md5'] = 'md5'; - return $retval; + return Rhymix\Framework\Password::getSupportedAlgorithms(); } - /** - * @brief Return the best hashing algorithm supported by this server - * @return string - */ public function getBestAlgorithm() { - $algos = $this->getSupportedAlgorithms(); - return key($algos); + return Rhymix\Framework\Password::getBestSupportedAlgorithm(); } - /** - * @brief Return the currently selected hashing algorithm - * @return string - */ public function getCurrentlySelectedAlgorithm() { - if(function_exists('getModel')) - { - $config = getModel('member')->getMemberConfig(); - $algorithm = $config->password_hashing_algorithm; - if(strval($algorithm) === '') - { - $algorithm = 'md5'; // Historical default for XE - } - } - else - { - $algorithm = 'md5'; - } - return $algorithm; + return Rhymix\Framework\Password::getDefaultAlgorithm(); } - /** - * @brief Return the currently configured work factor for bcrypt and other adjustable algorithms - * @return int - */ public function getWorkFactor() { - if(function_exists('getModel')) - { - $config = getModel('member')->getMemberConfig(); - $work_factor = $config->password_hashing_work_factor; - if(!$work_factor || $work_factor < 4 || $work_factor > 31) - { - $work_factor = 8; // Reasonable default - } - } - else - { - $work_factor = 8; - } - return $work_factor; + return Rhymix\Framework\Password::getWorkFactor(); } - /** - * @brief Create a hash using the specified algorithm - * @param string $password The password - * @param string $algorithm The algorithm (optional) - * @return string - */ public function createHash($password, $algorithm = null) { - if($algorithm === null) - { - $algorithm = $this->getCurrentlySelectedAlgorithm(); - } - if(!array_key_exists($algorithm, $this->getSupportedAlgorithms())) - { - return false; - } - - $password = trim($password); - - switch($algorithm) - { - case 'md5': - return md5($password); - - case 'pbkdf2': - $iterations = pow(2, $this->getWorkFactor() + 5); - $salt = $this->createSecureSalt(12, 'alnum'); - $hash = base64_encode($this->pbkdf2($password, $salt, 'sha256', $iterations, 24)); - return 'sha256:'.sprintf('%07d', $iterations).':'.$salt.':'.$hash; - - case 'bcrypt': - return $this->bcrypt($password); - - default: - return false; - } + return Rhymix\Framework\Password::hashPassword($password, $algorithm); } - /** - * @brief Check if a password matches a hash - * @param string $password The password - * @param string $hash The hash - * @param string $algorithm The algorithm (optional) - * @return bool - */ public function checkPassword($password, $hash, $algorithm = null) { - if($algorithm === null) - { - $algorithm = $this->checkAlgorithm($hash); - } - - $password = trim($password); - - switch($algorithm) - { - case 'md5': - return md5($password) === $hash || md5(sha1(md5($password))) === $hash; - - case 'mysql_old_password': - return (class_exists('Context') && substr(Context::getDBType(), 0, 5) === 'mysql') ? - DB::getInstance()->isValidOldPassword($password, $hash) : false; - - case 'mysql_password': - return $hash[0] === '*' && substr($hash, 1) === strtoupper(sha1(sha1($password, true))); - - case 'pbkdf2': - $hash = explode(':', $hash); - $hash[3] = base64_decode($hash[3]); - $hash_to_compare = $this->pbkdf2($password, $hash[2], $hash[0], intval($hash[1], 10), strlen($hash[3])); - return $this->strcmpConstantTime($hash_to_compare, $hash[3]); - - case 'bcrypt': - $hash_to_compare = $this->bcrypt($password, $hash); - return $this->strcmpConstantTime($hash_to_compare, $hash); - - default: - if($algorithm && isset(self::$_custom[$algorithm])) - { - $hash_callback = self::$_custom[$algorithm]['callback']; - $hash_to_compare = $hash_callback($password, $hash); - return $this->strcmpConstantTime($hash_to_compare, $hash); - } - if(in_array($algorithm, hash_algos())) - { - return $this->strcmpConstantTime(hash($algorithm, $password), $hash); - } - return false; - } + return Rhymix\Framework\Password::checkPassword($password, $hash, $algorithm); } - /** - * @brief Check the algorithm used to create a hash - * @param string $hash The hash - * @return string - */ function checkAlgorithm($hash) { - foreach(self::$_custom as $name => $definition) - { - if(preg_match($definition['regexp'], $hash)) - { - return $name; - } - } - - if(preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches)) - { - return 'bcrypt'; - } - elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches)) - { - return 'pbkdf2'; - } - elseif(strlen($hash) === 32 && ctype_xdigit($hash)) - { - return 'md5'; - } - elseif(strlen($hash) === 40 && ctype_xdigit($hash)) - { - return 'sha1'; - } - elseif(strlen($hash) === 64 && ctype_xdigit($hash)) - { - return 'sha256'; - } - elseif(strlen($hash) === 96 && ctype_xdigit($hash)) - { - return 'sha384'; - } - elseif(strlen($hash) === 128 && ctype_xdigit($hash)) - { - return 'sha512'; - } - elseif(strlen($hash) === 16 && ctype_xdigit($hash)) - { - return 'mysql_old_password'; - } - elseif(strlen($hash) === 41 && $hash[0] === '*') - { - return 'mysql_password'; - } - else - { - return false; - } + $algos = Rhymix\Framework\Password::checkAlgorithm($hash); + return count($algos) ? $algos[0] : false; } - /** - * @brief Check the work factor of a hash - * @param string $hash The hash - * @return int - */ function checkWorkFactor($hash) { - if(preg_match('/^\$2[axy]\$([0-9]{2})\$/', $hash, $matches)) - { - return intval($matches[1], 10); - } - elseif(preg_match('/^sha[0-9]+:([0-9]+):/', $hash, $matches)) - { - return max(0, round(log($matches[1], 2)) - 5); - } - else - { - return false; - } + return Rhymix\Framework\Password::checkWorkFactor($hash); } - /** - * @brief Generate a cryptographically secure random string to use as a salt - * @param int $length The number of bytes to return - * @param string $format hex or alnum - * @return string - */ public function createSecureSalt($length, $format = 'hex') { - // Find out how many bytes of entropy we really need - switch($format) - { - case 'hex': - $entropy_required_bytes = ceil($length / 2); - break; - case 'alnum': - case 'printable': - $entropy_required_bytes = ceil($length * 3 / 4); - break; - default: - $entropy_required_bytes = $length; - } - - // Cap entropy to 256 bits from any one source, because anything more is meaningless - $entropy_capped_bytes = min(32, $entropy_required_bytes); - - // Find and use the most secure way to generate a random string - $entropy = false; - $is_windows = (defined('PHP_OS') && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); - if(function_exists('random_bytes')) // PHP 7 - { - $entropy = random_bytes($entropy_capped_bytes); - } - elseif(function_exists('openssl_random_pseudo_bytes') && (!$is_windows || version_compare(PHP_VERSION, '5.4', '>='))) - { - $entropy = openssl_random_pseudo_bytes($entropy_capped_bytes); - } - elseif(function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(PHP_VERSION, '5.3.7', '>='))) - { - $entropy = mcrypt_create_iv($entropy_capped_bytes, MCRYPT_DEV_URANDOM); - } - elseif(function_exists('mcrypt_create_iv') && $is_windows) - { - $entropy = mcrypt_create_iv($entropy_capped_bytes, MCRYPT_RAND); - } - elseif(!$is_windows && @is_readable('/dev/urandom')) - { - $fp = fopen('/dev/urandom', 'rb'); - if (function_exists('stream_set_read_buffer')) // This function does not exist in HHVM - { - stream_set_read_buffer($fp, 0); // Prevent reading several KB of unnecessary data from urandom - } - $entropy = fread($fp, $entropy_capped_bytes); - fclose($fp); - } - - // Use built-in source of entropy if an error occurs while using other functions - if($entropy === false || strlen($entropy) < $entropy_capped_bytes) - { - $entropy = ''; - for($i = 0; $i < $entropy_capped_bytes; $i += 2) - { - $entropy .= pack('S', rand(0, 65536) ^ mt_rand(0, 65535)); - } - } - - // Mixing (see RFC 4086 section 5) - $output = ''; - for($i = 0; $i < $entropy_required_bytes; $i += 32) - { - $output .= hash('sha256', $entropy . $i . rand(), true); - } - - // Encode and return the random string - switch($format) - { - case 'hex': - return substr(bin2hex($output), 0, $length); - case 'binary': - return substr($output, 0, $length); - case 'printable': - $salt = ''; - for($i = 0; $i < $length; $i++) - { - $salt .= chr(33 + (crc32(sha1($i . $output)) % 94)); - } - return $salt; - case 'alnum': - default: - $salt = substr(base64_encode($output), 0, $length); - $replacements = chr(rand(65, 90)) . chr(rand(97, 122)) . rand(0, 9); - return strtr($salt, '+/=', $replacements); - } + return Rhymix\Framework\Security::getRandom($length, $format); } - /** - * @brief Generate a temporary password using the secure salt generator - * @param int $length The number of bytes to return - * @return string - */ public function createTemporaryPassword($length = 16) { - while(true) - { - $source = base64_encode($this->createSecureSalt(64, 'binary')); - $source = strtr($source, 'iIoOjl10/', '@#$%&*-!?'); - $source_length = strlen($source); - for($i = 0; $i < $source_length - $length; $i++) - { - $candidate = substr($source, $i, $length); - if(preg_match('/[a-z]/', $candidate) && preg_match('/[A-Z]/', $candidate) && - preg_match('/[0-9]/', $candidate) && preg_match('/[^a-zA-Z0-9]/', $candidate)) - { - return $candidate; - } - } - } + return Rhymix\Framework\Password::getRandomPassword($length); } - /** - * @brief Generate the PBKDF2 hash of a string using a salt - * @param string $password The password - * @param string $salt The salt - * @param string $algorithm The algorithm (optional, default is sha256) - * @param int $iterations Iteration count (optional, default is 8192) - * @param int $length The length of the hash (optional, default is 32) - * @return string - */ public function pbkdf2($password, $salt, $algorithm = 'sha256', $iterations = 8192, $length = 24) { - if(function_exists('hash_pbkdf2')) - { - return hash_pbkdf2($algorithm, $password, $salt, $iterations, $length, true); - } - else - { - $output = ''; - $block_count = ceil($length / strlen(hash($algorithm, '', true))); // key length divided by the length of one hash - for($i = 1; $i <= $block_count; $i++) - { - $last = $salt . pack('N', $i); // $i encoded as 4 bytes, big endian - $last = $xorsum = hash_hmac($algorithm, $last, $password, true); // first iteration - for($j = 1; $j < $iterations; $j++) // The other $count - 1 iterations - { - $xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true)); - } - $output .= $xorsum; - } - return substr($output, 0, $length); - } + $hash = Rhymix\Framework\Security::pbkdf2($password, $salt, $algorithm, $iterations, $length); + $hash = explode(':', $hash); + return base64_decode($hash[3]); } - /** - * @brief Generate the bcrypt hash of a string using a salt - * @param string $password The password - * @param string $salt The salt (optional, auto-generated if empty) - * @return string - */ public function bcrypt($password, $salt = null) { - if($salt === null) - { - $salt = '$2y$'.sprintf('%02d', $this->getWorkFactor()).'$'.$this->createSecureSalt(22, 'alnum'); - } - return crypt($password, $salt); + return Rhymix\Framework\Security::bcrypt($password, $salt); } - /** - * @brief Compare two strings in constant time - * @param string $a The first string - * @param string $b The second string - * @return bool - */ function strcmpConstantTime($a, $b) { - $diff = strlen($a) ^ strlen($b); - $maxlen = min(strlen($a), strlen($b)); - for($i = 0; $i < $maxlen; $i++) - { - $diff |= ord($a[$i]) ^ ord($b[$i]); - } - return $diff === 0; + return Rhymix\Framework\Security::compareStrings($a, $b); } } /* End of file : Password.class.php */ diff --git a/classes/security/Purifier.class.php b/classes/security/Purifier.class.php index 6923e8cde..9a17d5294 100644 --- a/classes/security/Purifier.class.php +++ b/classes/security/Purifier.class.php @@ -3,161 +3,14 @@ class Purifier { - - private $_cacheDir; - private $_htmlPurifier; - private $_config; - private $_def; - - public function __construct() + public static function getInstance() { - $this->_checkCacheDir(); - $this->_setConfig(); + return new self(); } - - public function getInstance() - { - if(!isset($GLOBALS['__PURIFIER_INSTANCE__'])) - { - $GLOBALS['__PURIFIER_INSTANCE__'] = new Purifier(); - } - return $GLOBALS['__PURIFIER_INSTANCE__']; - } - - private function _setConfig() - { - $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', $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); - } - - private function _setDefinition(&$content) - { - // add attribute for edit component - $editComponentAttrs = $this->_searchEditComponent($content); - if(is_array($editComponentAttrs)) - { - foreach($editComponentAttrs AS $k => $v) - { - $this->_def->addAttribute('img', $v, 'CDATA'); - $this->_def->addAttribute('div', $v, 'CDATA'); - } - } - - // add attribute for widget component - $widgetAttrs = $this->_searchWidget($content); - if(is_array($widgetAttrs)) - { - foreach($widgetAttrs AS $k => $v) - { - $this->_def->addAttribute('img', $v, 'CDATA'); - } - } - } - - /** - * Search attribute of edit component tag - * @param string $content - * @return array - */ - private function _searchEditComponent($content) - { - preg_match_all('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?))!is', $content, $m); - - $attributeList = array(); - if(is_array($m[2])) - { - foreach($m[2] as $key => $value) - { - unset($script, $m2); - $script = " {$m[2][$key]} editor_component={$m[3][$key]}"; - - if(preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2)) - { - foreach($m2[1] as $value2) - { - //SECISSUE check style attr - if($value2 == 'style') - { - continue; - } - $attributeList[] = $value2; - } - } - } - } - - return array_unique($attributeList); - } - - /** - * Search edit component tag - * @param string $content - * @return array - */ - private function _searchWidget(&$content) - { - preg_match_all('!<(?:(div)|img)([^>]*)class="zbxe_widget_output"([^>]*)>(?(1)(.*?))!is', $content, $m); - - $attributeList = array(); - if(is_array($m[3])) - { - $content = str_replace(' $value) - { - if (preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $m[3][$key], $m2)) - { - foreach($m2[1] as $value2) - { - //SECISSUE check style attr - if($value2 == 'style') - { - continue; - } - $attributeList[] = $value2; - } - } - } - } - return array_unique($attributeList); - } - - private function _getWhiteDomainRegexp() - { - $oEmbedFilter = EmbedFilter::getInstance(); - $whiteIframeUrlList = $oEmbedFilter->getWhiteIframeUrlList(); - - $whiteDomains = array(); - foreach($whiteIframeUrlList as $domain) - { - $whiteDomains[] = preg_quote($domain, '%'); - } - return '%^https?://(' . implode('|', $whiteDomains) . ')%'; - } - - private function _checkCacheDir() - { - // check htmlpurifier cache directory - $this->_cacheDir = _XE_PATH_ . 'files/cache/htmlpurifier'; - FileHandler::makeDir($this->_cacheDir); - } - + public function purify(&$content) { - $this->_setDefinition($content); - $this->_htmlPurifier = new HTMLPurifier($this->_config); - - $content = $this->_htmlPurifier->purify($content); + $content = Rhymix\Framework\Filters\HTMLFilter::clean($content); } } diff --git a/classes/security/Security.class.php b/classes/security/Security.class.php index 9b5669131..092c92c30 100644 --- a/classes/security/Security.class.php +++ b/classes/security/Security.class.php @@ -15,14 +15,14 @@ class Security * Action target variable. If this value is null, the method will use Context variables * @var mixed */ - var $_targetVar = NULL; + public $_targetVar = NULL; /** * @constructor * @param mixed $var Target context * @return void */ - function __construct($var = NULL) + public function __construct($var = NULL) { $this->_targetVar = $var; } @@ -34,7 +34,7 @@ class Security * separate the owner(object or array) and the item(property or element) using a dot(.) * @return mixed */ - function encodeHTML(/* , $varName1, $varName2, ... */) + public function encodeHTML(/* , $varName1, $varName2, ... */) { $varNames = func_get_args(); if(count($varNames) < 0) @@ -109,7 +109,7 @@ class Security * @param array $name * @return mixed */ - function _encodeHTML($var, $name = array()) + protected function _encodeHTML($var, $name = array()) { if(is_string($var)) { @@ -183,46 +183,9 @@ class Security * @param string $xml * @return bool */ - static function detectingXEE($xml) + public static function detectingXEE($xml) { - if(!$xml) return FALSE; - - if(strpos($xml, '/s', '', substr($xml, 0, 100), 1); - $xml = trim(substr_replace($xml, $header, 0, 100)); - if($xml == '') - { - return TRUE; - } - - // Strip DTD. - $header = preg_replace('/^]*+>/i', '', substr($xml, 0, 200), 1); - $xml = trim(substr_replace($xml, $header, 0, 200)); - if($xml == '') - { - return TRUE; - } - - // Confirm the XML now starts with a valid root tag. A root tag can end in [> \t\r\n] - $root_tag = substr($xml, 0, strcspn(substr($xml, 0, 20), "> \t\r\n")); - - // Reject a second DTD. - if(strtoupper($root_tag) == ' 'admin', 'allow' => array(), ), - 'embedfilter' => array( + 'mediafilter' => array( 'iframe' => array(), 'object' => array(), ), diff --git a/common/defaults/countries.php b/common/defaults/countries.php new file mode 100644 index 000000000..b84843d13 --- /dev/null +++ b/common/defaults/countries.php @@ -0,0 +1,2259 @@ + 'AF', + 'iso_3166_1_alpha3' => 'AFG', + 'iso_3166_1_numeric' => '004', + 'cctld' => 'af', + 'name_english' => 'Afghanistan', + 'name_korean' => '아프가니스탄', + 'name_native' => 'افغانستان', + ), + array( + 'iso_3166_1_alpha2' => 'AL', + 'iso_3166_1_alpha3' => 'ALB', + 'iso_3166_1_numeric' => '008', + 'cctld' => 'al', + 'name_english' => 'Albania', + 'name_korean' => '알바니아', + 'name_native' => 'Shqipëria', + ), + array( + 'iso_3166_1_alpha2' => 'AQ', + 'iso_3166_1_alpha3' => 'ATA', + 'iso_3166_1_numeric' => '010', + 'cctld' => 'aq', + 'name_english' => 'Antarctica', + 'name_korean' => '남극', + 'name_native' => 'Antarctica', + ), + array( + 'iso_3166_1_alpha2' => 'DZ', + 'iso_3166_1_alpha3' => 'DZA', + 'iso_3166_1_numeric' => '012', + 'cctld' => 'dz', + 'name_english' => 'Algeria', + 'name_korean' => '알제리', + 'name_native' => 'الجزائر', + ), + array( + 'iso_3166_1_alpha2' => 'AS', + 'iso_3166_1_alpha3' => 'ASM', + 'iso_3166_1_numeric' => '016', + 'cctld' => 'as', + 'name_english' => 'American Samoa', + 'name_korean' => '아메리칸 사모아', + 'name_native' => 'Amerika Sāmoa', + ), + array( + 'iso_3166_1_alpha2' => 'AD', + 'iso_3166_1_alpha3' => 'AND', + 'iso_3166_1_numeric' => '020', + 'cctld' => 'ad', + 'name_english' => 'Andorra', + 'name_korean' => '안도라', + 'name_native' => 'Andorra', + ), + array( + 'iso_3166_1_alpha2' => 'AO', + 'iso_3166_1_alpha3' => 'AGO', + 'iso_3166_1_numeric' => '024', + 'cctld' => 'ao', + 'name_english' => 'Angola', + 'name_korean' => '앙골라', + 'name_native' => 'Angola', + ), + array( + 'iso_3166_1_alpha2' => 'AG', + 'iso_3166_1_alpha3' => 'ATG', + 'iso_3166_1_numeric' => '028', + 'cctld' => 'ag', + 'name_english' => 'Antigua and Barbuda', + 'name_korean' => '앤티가 바부다', + 'name_native' => 'Antigua and Barbuda', + ), + array( + 'iso_3166_1_alpha2' => 'AZ', + 'iso_3166_1_alpha3' => 'AZE', + 'iso_3166_1_numeric' => '031', + 'cctld' => 'az', + 'name_english' => 'Azerbaijan', + 'name_korean' => '아제르바이잔', + 'name_native' => 'Azərbaycan', + ), + array( + 'iso_3166_1_alpha2' => 'AR', + 'iso_3166_1_alpha3' => 'ARG', + 'iso_3166_1_numeric' => '032', + 'cctld' => 'ar', + 'name_english' => 'Argentina', + 'name_korean' => '아르헨티나', + 'name_native' => 'Argentina', + ), + array( + 'iso_3166_1_alpha2' => 'AU', + 'iso_3166_1_alpha3' => 'AUS', + 'iso_3166_1_numeric' => '036', + 'cctld' => 'au', + 'name_english' => 'Australia', + 'name_korean' => '호주', + 'name_native' => 'Australia', + ), + array( + 'iso_3166_1_alpha2' => 'AT', + 'iso_3166_1_alpha3' => 'AUT', + 'iso_3166_1_numeric' => '040', + 'cctld' => 'at', + 'name_english' => 'Austria', + 'name_korean' => '오스트리아', + 'name_native' => 'Österreich', + ), + array( + 'iso_3166_1_alpha2' => 'BS', + 'iso_3166_1_alpha3' => 'BHS', + 'iso_3166_1_numeric' => '044', + 'cctld' => 'bs', + 'name_english' => 'Bahamas', + 'name_korean' => '바하마', + 'name_native' => 'Bahamas', + ), + array( + 'iso_3166_1_alpha2' => 'BH', + 'iso_3166_1_alpha3' => 'BHR', + 'iso_3166_1_numeric' => '048', + 'cctld' => 'bh', + 'name_english' => 'Bahrain', + 'name_korean' => '바레인', + 'name_native' => 'البحرين', + ), + array( + 'iso_3166_1_alpha2' => 'BD', + 'iso_3166_1_alpha3' => 'BGD', + 'iso_3166_1_numeric' => '050', + 'cctld' => 'bd', + 'name_english' => 'Bangladesh', + 'name_korean' => '방글라데시', + 'name_native' => 'বাংলাদেশ', + ), + array( + 'iso_3166_1_alpha2' => 'AM', + 'iso_3166_1_alpha3' => 'ARM', + 'iso_3166_1_numeric' => '051', + 'cctld' => 'am', + 'name_english' => 'Armenia', + 'name_korean' => '아르메니아', + 'name_native' => 'Հայաստան', + ), + array( + 'iso_3166_1_alpha2' => 'BB', + 'iso_3166_1_alpha3' => 'BRB', + 'iso_3166_1_numeric' => '052', + 'cctld' => 'bb', + 'name_english' => 'Barbados', + 'name_korean' => '바베이도스', + 'name_native' => 'Barbados', + ), + array( + 'iso_3166_1_alpha2' => 'BE', + 'iso_3166_1_alpha3' => 'BEL', + 'iso_3166_1_numeric' => '056', + 'cctld' => 'be', + 'name_english' => 'Belgium', + 'name_korean' => '벨기에', + 'name_native' => 'België, Belgique, Belgien', + ), + array( + 'iso_3166_1_alpha2' => 'BM', + 'iso_3166_1_alpha3' => 'BMU', + 'iso_3166_1_numeric' => '060', + 'cctld' => 'bm', + 'name_english' => 'Bermuda', + 'name_korean' => '버뮤다', + 'name_native' => 'Bermuda', + ), + array( + 'iso_3166_1_alpha2' => 'BT', + 'iso_3166_1_alpha3' => 'BTN', + 'iso_3166_1_numeric' => '064', + 'cctld' => 'bt', + 'name_english' => 'Bhutan', + 'name_korean' => '부탄', + 'name_native' => 'འབྲུག་ཡུལ', + ), + array( + 'iso_3166_1_alpha2' => 'BO', + 'iso_3166_1_alpha3' => 'BOL', + 'iso_3166_1_numeric' => '068', + 'cctld' => 'bo', + 'name_english' => 'Bolivia (Plurinational State of)', + 'name_korean' => '볼리비아', + 'name_native' => 'Bolivia', + ), + array( + 'iso_3166_1_alpha2' => 'BA', + 'iso_3166_1_alpha3' => 'BIH', + 'iso_3166_1_numeric' => '070', + 'cctld' => 'ba', + 'name_english' => 'Bosnia and Herzegovina', + 'name_korean' => '보스니아 헤르체고비나', + 'name_native' => 'Bosna i Hercegovina', + ), + array( + 'iso_3166_1_alpha2' => 'BW', + 'iso_3166_1_alpha3' => 'BWA', + 'iso_3166_1_numeric' => '072', + 'cctld' => 'bw', + 'name_english' => 'Botswana', + 'name_korean' => '보츠와나', + 'name_native' => 'Botswana', + ), + array( + 'iso_3166_1_alpha2' => 'BV', + 'iso_3166_1_alpha3' => 'BVT', + 'iso_3166_1_numeric' => '074', + 'cctld' => 'bv', + 'name_english' => 'Bouvet Island', + 'name_korean' => '부베 섬', + 'name_native' => 'Bouvet Island', + ), + array( + 'iso_3166_1_alpha2' => 'BR', + 'iso_3166_1_alpha3' => 'BRA', + 'iso_3166_1_numeric' => '076', + 'cctld' => 'br', + 'name_english' => 'Brazil', + 'name_korean' => '브라질', + 'name_native' => 'Brasil', + ), + array( + 'iso_3166_1_alpha2' => 'BZ', + 'iso_3166_1_alpha3' => 'BLZ', + 'iso_3166_1_numeric' => '084', + 'cctld' => 'bz', + 'name_english' => 'Belize', + 'name_korean' => '벨리즈', + 'name_native' => 'Belize', + ), + array( + 'iso_3166_1_alpha2' => 'IO', + 'iso_3166_1_alpha3' => 'IOT', + 'iso_3166_1_numeric' => '086', + 'cctld' => 'io', + 'name_english' => 'British Indian Ocean Territory', + 'name_korean' => '영국령 인도양 지역', + 'name_native' => 'British Indian Ocean Territory', + ), + array( + 'iso_3166_1_alpha2' => 'SB', + 'iso_3166_1_alpha3' => 'SLB', + 'iso_3166_1_numeric' => '090', + 'cctld' => 'sb', + 'name_english' => 'Solomon Islands', + 'name_korean' => '솔로몬 제도', + 'name_native' => 'Solomon Islands', + ), + array( + 'iso_3166_1_alpha2' => 'VG', + 'iso_3166_1_alpha3' => 'VGB', + 'iso_3166_1_numeric' => '092', + 'cctld' => 'vg', + 'name_english' => 'Virgin Islands (British)', + 'name_korean' => '영국령 버진아일랜드', + 'name_native' => 'Virgin Islands (British)', + ), + array( + 'iso_3166_1_alpha2' => 'BN', + 'iso_3166_1_alpha3' => 'BRN', + 'iso_3166_1_numeric' => '096', + 'cctld' => 'bn', + 'name_english' => 'Brunei', + 'name_korean' => '브루나이', + 'name_native' => 'بروني', + ), + array( + 'iso_3166_1_alpha2' => 'BG', + 'iso_3166_1_alpha3' => 'BGR', + 'iso_3166_1_numeric' => '100', + 'cctld' => 'bg', + 'name_english' => 'Bulgaria', + 'name_korean' => '불가리아', + 'name_native' => 'Bulgariya', + ), + array( + 'iso_3166_1_alpha2' => 'MM', + 'iso_3166_1_alpha3' => 'MMR', + 'iso_3166_1_numeric' => '104', + 'cctld' => 'mm', + 'name_english' => 'Myanmar', + 'name_korean' => '미얀마 (버마)', + 'name_native' => 'Myanma', + ), + array( + 'iso_3166_1_alpha2' => 'BI', + 'iso_3166_1_alpha3' => 'BDI', + 'iso_3166_1_numeric' => '108', + 'cctld' => 'bi', + 'name_english' => 'Burundi', + 'name_korean' => '부룬디', + 'name_native' => 'Burundi', + ), + array( + 'iso_3166_1_alpha2' => 'BY', + 'iso_3166_1_alpha3' => 'BLR', + 'iso_3166_1_numeric' => '112', + 'cctld' => 'by', + 'name_english' => 'Belarus', + 'name_korean' => '벨라루스', + 'name_native' => 'Беларусь', + ), + array( + 'iso_3166_1_alpha2' => 'KH', + 'iso_3166_1_alpha3' => 'KHM', + 'iso_3166_1_numeric' => '116', + 'cctld' => 'kh', + 'name_english' => 'Cambodia', + 'name_korean' => '캄보디아', + 'name_native' => 'កម្ពុជា', + ), + array( + 'iso_3166_1_alpha2' => 'CM', + 'iso_3166_1_alpha3' => 'CMR', + 'iso_3166_1_numeric' => '120', + 'cctld' => 'cm', + 'name_english' => 'Cameroon', + 'name_korean' => '카메룬', + 'name_native' => 'Cameroun', + ), + array( + 'iso_3166_1_alpha2' => 'CA', + 'iso_3166_1_alpha3' => 'CAN', + 'iso_3166_1_numeric' => '124', + 'cctld' => 'ca', + 'name_english' => 'Canada', + 'name_korean' => '캐나다', + 'name_native' => 'Canada', + ), + array( + 'iso_3166_1_alpha2' => 'CV', + 'iso_3166_1_alpha3' => 'CPV', + 'iso_3166_1_numeric' => '132', + 'cctld' => 'cv', + 'name_english' => 'Cabo Verde', + 'name_korean' => '카보베르데', + 'name_native' => 'Cabo Verde', + ), + array( + 'iso_3166_1_alpha2' => 'KY', + 'iso_3166_1_alpha3' => 'CYM', + 'iso_3166_1_numeric' => '136', + 'cctld' => 'ky', + 'name_english' => 'Cayman Islands', + 'name_korean' => '케이맨 제도', + 'name_native' => 'Cayman Islands', + ), + array( + 'iso_3166_1_alpha2' => 'CF', + 'iso_3166_1_alpha3' => 'CAF', + 'iso_3166_1_numeric' => '140', + 'cctld' => 'cf', + 'name_english' => 'Central African Republic', + 'name_korean' => '중앙아프리카 공화국', + 'name_native' => 'République Centrafricaine', + ), + array( + 'iso_3166_1_alpha2' => 'LK', + 'iso_3166_1_alpha3' => 'LKA', + 'iso_3166_1_numeric' => '144', + 'cctld' => 'lk', + 'name_english' => 'Sri Lanka', + 'name_korean' => '스리랑카', + 'name_native' => 'ශ්‍රී ලංකාව, இலங்கை', + ), + array( + 'iso_3166_1_alpha2' => 'TD', + 'iso_3166_1_alpha3' => 'TCD', + 'iso_3166_1_numeric' => '148', + 'cctld' => 'td', + 'name_english' => 'Chad', + 'name_korean' => '차드', + 'name_native' => 'Tchad', + ), + array( + 'iso_3166_1_alpha2' => 'CL', + 'iso_3166_1_alpha3' => 'CHL', + 'iso_3166_1_numeric' => '152', + 'cctld' => 'cl', + 'name_english' => 'Chile', + 'name_korean' => '칠레', + 'name_native' => 'Chile', + ), + array( + 'iso_3166_1_alpha2' => 'CN', + 'iso_3166_1_alpha3' => 'CHN', + 'iso_3166_1_numeric' => '156', + 'cctld' => 'cn', + 'name_english' => 'China', + 'name_korean' => '중국', + 'name_native' => '中国', + ), + array( + 'iso_3166_1_alpha2' => 'TW', + 'iso_3166_1_alpha3' => 'TWN', + 'iso_3166_1_numeric' => '158', + 'cctld' => 'tw', + 'name_english' => 'Taiwan (Republic of China)', + 'name_korean' => '대만', + 'name_native' => '臺灣 (中華民國)', + ), + array( + 'iso_3166_1_alpha2' => 'CX', + 'iso_3166_1_alpha3' => 'CXR', + 'iso_3166_1_numeric' => '162', + 'cctld' => 'cx', + 'name_english' => 'Christmas Island', + 'name_korean' => '크리스마스 섬', + 'name_native' => 'Christmas Island', + ), + array( + 'iso_3166_1_alpha2' => 'CC', + 'iso_3166_1_alpha3' => 'CCK', + 'iso_3166_1_numeric' => '166', + 'cctld' => 'cc', + 'name_english' => 'Cocos (Keeling) Islands', + 'name_korean' => '코코스 제도', + 'name_native' => 'Cocos (Keeling) Islands', + ), + array( + 'iso_3166_1_alpha2' => 'CO', + 'iso_3166_1_alpha3' => 'COL', + 'iso_3166_1_numeric' => '170', + 'cctld' => 'co', + 'name_english' => 'Colombia', + 'name_korean' => '콜롬비아', + 'name_native' => 'Colombia', + ), + array( + 'iso_3166_1_alpha2' => 'KM', + 'iso_3166_1_alpha3' => 'COM', + 'iso_3166_1_numeric' => '174', + 'cctld' => 'km', + 'name_english' => 'Comoros', + 'name_korean' => '코모로', + 'name_native' => 'Komori', + ), + array( + 'iso_3166_1_alpha2' => 'YT', + 'iso_3166_1_alpha3' => 'MYT', + 'iso_3166_1_numeric' => '175', + 'cctld' => 'yt', + 'name_english' => 'Mayotte', + 'name_korean' => '마요트', + 'name_native' => 'Mayotte', + ), + array( + 'iso_3166_1_alpha2' => 'CG', + 'iso_3166_1_alpha3' => 'COG', + 'iso_3166_1_numeric' => '178', + 'cctld' => 'cg', + 'name_english' => 'Congo (Republic of)', + 'name_korean' => '콩고', + 'name_native' => 'République du Congo', + ), + array( + 'iso_3166_1_alpha2' => 'CD', + 'iso_3166_1_alpha3' => 'COD', + 'iso_3166_1_numeric' => '180', + 'cctld' => 'cd', + 'name_english' => 'Congo (Democratic Republic of the)', + 'name_korean' => '콩고 민주 공화국', + 'name_native' => 'République démocratique du Congo', + ), + array( + 'iso_3166_1_alpha2' => 'CK', + 'iso_3166_1_alpha3' => 'COK', + 'iso_3166_1_numeric' => '184', + 'cctld' => 'ck', + 'name_english' => 'Cook Islands', + 'name_korean' => '쿡 제도', + 'name_native' => 'Cook Islands', + ), + array( + 'iso_3166_1_alpha2' => 'CR', + 'iso_3166_1_alpha3' => 'CRI', + 'iso_3166_1_numeric' => '188', + 'cctld' => 'cr', + 'name_english' => 'Costa Rica', + 'name_korean' => '코스타리카', + 'name_native' => 'Costa Rica', + ), + array( + 'iso_3166_1_alpha2' => 'HR', + 'iso_3166_1_alpha3' => 'HRV', + 'iso_3166_1_numeric' => '191', + 'cctld' => 'hr', + 'name_english' => 'Croatia', + 'name_korean' => '크로아티아', + 'name_native' => 'Hrvatska', + ), + array( + 'iso_3166_1_alpha2' => 'CU', + 'iso_3166_1_alpha3' => 'CUB', + 'iso_3166_1_numeric' => '192', + 'cctld' => 'cu', + 'name_english' => 'Cuba', + 'name_korean' => '쿠바', + 'name_native' => 'Cuba', + ), + array( + 'iso_3166_1_alpha2' => 'CY', + 'iso_3166_1_alpha3' => 'CYP', + 'iso_3166_1_numeric' => '196', + 'cctld' => 'cy', + 'name_english' => 'Cyprus', + 'name_korean' => '키프로스', + 'name_native' => 'Κύπρος', + ), + array( + 'iso_3166_1_alpha2' => 'CZ', + 'iso_3166_1_alpha3' => 'CZE', + 'iso_3166_1_numeric' => '203', + 'cctld' => 'cz', + 'name_english' => 'Czech Republic', + 'name_korean' => '체코', + 'name_native' => 'Česká republika', + ), + array( + 'iso_3166_1_alpha2' => 'BJ', + 'iso_3166_1_alpha3' => 'BEN', + 'iso_3166_1_numeric' => '204', + 'cctld' => 'bj', + 'name_english' => 'Benin', + 'name_korean' => '베냉', + 'name_native' => 'Bénin', + ), + array( + 'iso_3166_1_alpha2' => 'DK', + 'iso_3166_1_alpha3' => 'DNK', + 'iso_3166_1_numeric' => '208', + 'cctld' => 'dk', + 'name_english' => 'Denmark', + 'name_korean' => '덴마크', + 'name_native' => 'Danmark', + ), + array( + 'iso_3166_1_alpha2' => 'DM', + 'iso_3166_1_alpha3' => 'DMA', + 'iso_3166_1_numeric' => '212', + 'cctld' => 'dm', + 'name_english' => 'Dominica', + 'name_korean' => '도미니카 연방', + 'name_native' => 'Dominica', + ), + array( + 'iso_3166_1_alpha2' => 'DO', + 'iso_3166_1_alpha3' => 'DOM', + 'iso_3166_1_numeric' => '214', + 'cctld' => 'do', + 'name_english' => 'Dominican Republic', + 'name_korean' => '도미니카 공화국', + 'name_native' => 'República Dominicana', + ), + array( + 'iso_3166_1_alpha2' => 'EC', + 'iso_3166_1_alpha3' => 'ECU', + 'iso_3166_1_numeric' => '218', + 'cctld' => 'ec', + 'name_english' => 'Ecuador', + 'name_korean' => '에콰도르', + 'name_native' => 'Ecuador', + ), + array( + 'iso_3166_1_alpha2' => 'SV', + 'iso_3166_1_alpha3' => 'SLV', + 'iso_3166_1_numeric' => '222', + 'cctld' => 'sv', + 'name_english' => 'El Salvador', + 'name_korean' => '엘살바도르', + 'name_native' => 'El Salvador', + ), + array( + 'iso_3166_1_alpha2' => 'GQ', + 'iso_3166_1_alpha3' => 'GNQ', + 'iso_3166_1_numeric' => '226', + 'cctld' => 'gq', + 'name_english' => 'Equatorial Guinea', + 'name_korean' => '적도기니', + 'name_native' => 'Guinea Ecuatorial', + ), + array( + 'iso_3166_1_alpha2' => 'ET', + 'iso_3166_1_alpha3' => 'ETH', + 'iso_3166_1_numeric' => '231', + 'cctld' => 'et', + 'name_english' => 'Ethiopia', + 'name_korean' => '에티오피아', + 'name_native' => 'ኢትዮጵያ', + ), + array( + 'iso_3166_1_alpha2' => 'ER', + 'iso_3166_1_alpha3' => 'ERI', + 'iso_3166_1_numeric' => '232', + 'cctld' => 'er', + 'name_english' => 'Eritrea', + 'name_korean' => '에리트레아', + 'name_native' => 'إرتريا', + ), + array( + 'iso_3166_1_alpha2' => 'EE', + 'iso_3166_1_alpha3' => 'EST', + 'iso_3166_1_numeric' => '233', + 'cctld' => 'ee', + 'name_english' => 'Estonia', + 'name_korean' => '에스토니아', + 'name_native' => 'Eesti', + ), + array( + 'iso_3166_1_alpha2' => 'FO', + 'iso_3166_1_alpha3' => 'FRO', + 'iso_3166_1_numeric' => '234', + 'cctld' => 'fo', + 'name_english' => 'Faroe Islands', + 'name_korean' => '페로 제도', + 'name_native' => 'Føroyar', + ), + array( + 'iso_3166_1_alpha2' => 'FK', + 'iso_3166_1_alpha3' => 'FLK', + 'iso_3166_1_numeric' => '238', + 'cctld' => 'fk', + 'name_english' => 'Falkland Islands (Malvinas)', + 'name_korean' => '포클랜드 제도', + 'name_native' => 'Falkland Islands (Malvinas)', + ), + array( + 'iso_3166_1_alpha2' => 'GS', + 'iso_3166_1_alpha3' => 'SGS', + 'iso_3166_1_numeric' => '239', + 'cctld' => 'gs', + 'name_english' => 'South Georgia and the South Sandwich Islands', + 'name_korean' => '사우스조지아 사우스샌드위치 제도', + 'name_native' => 'South Georgia and the South Sandwich Islands', + ), + array( + 'iso_3166_1_alpha2' => 'FJ', + 'iso_3166_1_alpha3' => 'FJI', + 'iso_3166_1_numeric' => '242', + 'cctld' => 'fj', + 'name_english' => 'Fiji', + 'name_korean' => '피지', + 'name_native' => 'Fiji', + ), + array( + 'iso_3166_1_alpha2' => 'FI', + 'iso_3166_1_alpha3' => 'FIN', + 'iso_3166_1_numeric' => '246', + 'cctld' => 'fi', + 'name_english' => 'Finland', + 'name_korean' => '핀란드', + 'name_native' => 'Suomi', + ), + array( + 'iso_3166_1_alpha2' => 'AX', + 'iso_3166_1_alpha3' => 'ALA', + 'iso_3166_1_numeric' => '248', + 'cctld' => 'ax', + 'name_english' => 'Åland Islands', + 'name_korean' => '올란드 제도', + 'name_native' => 'Åland Islands', + ), + array( + 'iso_3166_1_alpha2' => 'FR', + 'iso_3166_1_alpha3' => 'FRA', + 'iso_3166_1_numeric' => '250', + 'cctld' => 'fr', + 'name_english' => 'France', + 'name_korean' => '프랑스', + 'name_native' => 'France', + ), + array( + 'iso_3166_1_alpha2' => 'GF', + 'iso_3166_1_alpha3' => 'GUF', + 'iso_3166_1_numeric' => '254', + 'cctld' => 'gf', + 'name_english' => 'French Guiana', + 'name_korean' => '프랑스령 기아나', + 'name_native' => 'Guyane', + ), + array( + 'iso_3166_1_alpha2' => 'PF', + 'iso_3166_1_alpha3' => 'PYF', + 'iso_3166_1_numeric' => '258', + 'cctld' => 'pf', + 'name_english' => 'French Polynesia', + 'name_korean' => '프랑스령 폴리네시아', + 'name_native' => 'Polynésie française', + ), + array( + 'iso_3166_1_alpha2' => 'TF', + 'iso_3166_1_alpha3' => 'ATF', + 'iso_3166_1_numeric' => '260', + 'cctld' => 'tf', + 'name_english' => 'French Southern and Antarctic Lands', + 'name_korean' => '프랑스령 남방 및 남극 지역', + 'name_native' => 'Terres australes et antarctiques françaises', + ), + array( + 'iso_3166_1_alpha2' => 'DJ', + 'iso_3166_1_alpha3' => 'DJI', + 'iso_3166_1_numeric' => '262', + 'cctld' => 'dj', + 'name_english' => 'Djibouti', + 'name_korean' => '지부티', + 'name_native' => 'جيبوتي', + ), + array( + 'iso_3166_1_alpha2' => 'GA', + 'iso_3166_1_alpha3' => 'GAB', + 'iso_3166_1_numeric' => '266', + 'cctld' => 'ga', + 'name_english' => 'Gabon', + 'name_korean' => '가봉', + 'name_native' => 'Gabon', + ), + array( + 'iso_3166_1_alpha2' => 'GE', + 'iso_3166_1_alpha3' => 'GEO', + 'iso_3166_1_numeric' => '268', + 'cctld' => 'ge', + 'name_english' => 'Georgia', + 'name_korean' => '그루지아', + 'name_native' => 'საქართველო', + ), + array( + 'iso_3166_1_alpha2' => 'GM', + 'iso_3166_1_alpha3' => 'GMB', + 'iso_3166_1_numeric' => '270', + 'cctld' => 'gm', + 'name_english' => 'Gambia', + 'name_korean' => '감비아', + 'name_native' => 'Gambia', + ), + array( + 'iso_3166_1_alpha2' => 'PS', + 'iso_3166_1_alpha3' => 'PSE', + 'iso_3166_1_numeric' => '275', + 'cctld' => 'ps', + 'name_english' => 'Palestine', + 'name_korean' => '팔레스타인', + 'name_native' => 'فلسطين', + ), + array( + 'iso_3166_1_alpha2' => 'DE', + 'iso_3166_1_alpha3' => 'DEU', + 'iso_3166_1_numeric' => '276', + 'cctld' => 'de', + 'name_english' => 'Germany', + 'name_korean' => '독일', + 'name_native' => 'Deutschland', + ), + array( + 'iso_3166_1_alpha2' => 'GH', + 'iso_3166_1_alpha3' => 'GHA', + 'iso_3166_1_numeric' => '288', + 'cctld' => 'gh', + 'name_english' => 'Ghana', + 'name_korean' => '가나', + 'name_native' => 'Ghana', + ), + array( + 'iso_3166_1_alpha2' => 'GI', + 'iso_3166_1_alpha3' => 'GIB', + 'iso_3166_1_numeric' => '292', + 'cctld' => 'gi', + 'name_english' => 'Gibraltar', + 'name_korean' => '지브롤터', + 'name_native' => 'Gibraltar', + ), + array( + 'iso_3166_1_alpha2' => 'KI', + 'iso_3166_1_alpha3' => 'KIR', + 'iso_3166_1_numeric' => '296', + 'cctld' => 'ki', + 'name_english' => 'Kiribati', + 'name_korean' => '키리바시', + 'name_native' => 'Kiribati', + ), + array( + 'iso_3166_1_alpha2' => 'GR', + 'iso_3166_1_alpha3' => 'GRC', + 'iso_3166_1_numeric' => '300', + 'cctld' => 'gr', + 'name_english' => 'Greece', + 'name_korean' => '그리스', + 'name_native' => 'Ελλάς', + ), + array( + 'iso_3166_1_alpha2' => 'GL', + 'iso_3166_1_alpha3' => 'GRL', + 'iso_3166_1_numeric' => '304', + 'cctld' => 'gl', + 'name_english' => 'Greenland', + 'name_korean' => '그린란드', + 'name_native' => 'Grønland, Kalaallit Nunaat', + ), + array( + 'iso_3166_1_alpha2' => 'GD', + 'iso_3166_1_alpha3' => 'GRD', + 'iso_3166_1_numeric' => '308', + 'cctld' => 'gd', + 'name_english' => 'Grenada', + 'name_korean' => '그레나다', + 'name_native' => 'Grenada', + ), + array( + 'iso_3166_1_alpha2' => 'GP', + 'iso_3166_1_alpha3' => 'GLP', + 'iso_3166_1_numeric' => '312', + 'cctld' => 'gp', + 'name_english' => 'Guadeloupe', + 'name_korean' => '과들루프', + 'name_native' => 'Guadeloupe', + ), + array( + 'iso_3166_1_alpha2' => 'GU', + 'iso_3166_1_alpha3' => 'GUM', + 'iso_3166_1_numeric' => '316', + 'cctld' => 'gu', + 'name_english' => 'Guam', + 'name_korean' => '괌', + 'name_native' => 'Guam, Guåhån', + ), + array( + 'iso_3166_1_alpha2' => 'GT', + 'iso_3166_1_alpha3' => 'GTM', + 'iso_3166_1_numeric' => '320', + 'cctld' => 'gt', + 'name_english' => 'Guatemala', + 'name_korean' => '과테말라', + 'name_native' => 'Guatemala', + ), + array( + 'iso_3166_1_alpha2' => 'GN', + 'iso_3166_1_alpha3' => 'GIN', + 'iso_3166_1_numeric' => '324', + 'cctld' => 'gn', + 'name_english' => 'Guinea', + 'name_korean' => '기니', + 'name_native' => 'Guinée, Gine', + ), + array( + 'iso_3166_1_alpha2' => 'GY', + 'iso_3166_1_alpha3' => 'GUY', + 'iso_3166_1_numeric' => '328', + 'cctld' => 'gy', + 'name_english' => 'Guyana', + 'name_korean' => '가이아나', + 'name_native' => 'Guyana', + ), + array( + 'iso_3166_1_alpha2' => 'HT', + 'iso_3166_1_alpha3' => 'HTI', + 'iso_3166_1_numeric' => '332', + 'cctld' => 'ht', + 'name_english' => 'Haiti', + 'name_korean' => '아이티', + 'name_native' => 'Haïti, Ayiti', + ), + array( + 'iso_3166_1_alpha2' => 'HM', + 'iso_3166_1_alpha3' => 'HMD', + 'iso_3166_1_numeric' => '334', + 'cctld' => 'hm', + 'name_english' => 'Heard Island and McDonald Islands', + 'name_korean' => '허드 맥도널드 제도', + 'name_native' => 'Heard Island and McDonald Islands', + ), + array( + 'iso_3166_1_alpha2' => 'VA', + 'iso_3166_1_alpha3' => 'VAT', + 'iso_3166_1_numeric' => '336', + 'cctld' => 'va', + 'name_english' => 'Vatican City', + 'name_korean' => '바티칸', + 'name_native' => 'E Civitate Vaticana', + ), + array( + 'iso_3166_1_alpha2' => 'HN', + 'iso_3166_1_alpha3' => 'HND', + 'iso_3166_1_numeric' => '340', + 'cctld' => 'hn', + 'name_english' => 'Honduras', + 'name_korean' => '온두라스', + 'name_native' => 'Honduras', + ), + array( + 'iso_3166_1_alpha2' => 'HK', + 'iso_3166_1_alpha3' => 'HKG', + 'iso_3166_1_numeric' => '344', + 'cctld' => 'hk', + 'name_english' => 'Hong Kong', + 'name_korean' => '홍콩', + 'name_native' => '香港', + ), + array( + 'iso_3166_1_alpha2' => 'HU', + 'iso_3166_1_alpha3' => 'HUN', + 'iso_3166_1_numeric' => '348', + 'cctld' => 'hu', + 'name_english' => 'Hungary', + 'name_korean' => '헝가리', + 'name_native' => 'Magyarország', + ), + array( + 'iso_3166_1_alpha2' => 'IS', + 'iso_3166_1_alpha3' => 'ISL', + 'iso_3166_1_numeric' => '352', + 'cctld' => 'is', + 'name_english' => 'Iceland', + 'name_korean' => '아이슬란드', + 'name_native' => 'Ísland', + ), + array( + 'iso_3166_1_alpha2' => 'IN', + 'iso_3166_1_alpha3' => 'IND', + 'iso_3166_1_numeric' => '356', + 'cctld' => 'in', + 'name_english' => 'India', + 'name_korean' => '인도', + 'name_native' => 'Bhārat Gaṇarājya, भारत, ভারত', + ), + array( + 'iso_3166_1_alpha2' => 'ID', + 'iso_3166_1_alpha3' => 'IDN', + 'iso_3166_1_numeric' => '360', + 'cctld' => 'id', + 'name_english' => 'Indonesia', + 'name_korean' => '인도네시아', + 'name_native' => 'Indonesia', + ), + array( + 'iso_3166_1_alpha2' => 'IR', + 'iso_3166_1_alpha3' => 'IRN', + 'iso_3166_1_numeric' => '364', + 'cctld' => 'ir', + 'name_english' => 'Iran', + 'name_korean' => '이란', + 'name_native' => 'ایران', + ), + array( + 'iso_3166_1_alpha2' => 'IQ', + 'iso_3166_1_alpha3' => 'IRQ', + 'iso_3166_1_numeric' => '368', + 'cctld' => 'iq', + 'name_english' => 'Iraq', + 'name_korean' => '이라크', + 'name_native' => 'العراق', + ), + array( + 'iso_3166_1_alpha2' => 'IE', + 'iso_3166_1_alpha3' => 'IRL', + 'iso_3166_1_numeric' => '372', + 'cctld' => 'ie', + 'name_english' => 'Ireland', + 'name_korean' => '아일랜드', + 'name_native' => 'Éire', + ), + array( + 'iso_3166_1_alpha2' => 'IL', + 'iso_3166_1_alpha3' => 'ISR', + 'iso_3166_1_numeric' => '376', + 'cctld' => 'il', + 'name_english' => 'Israel', + 'name_korean' => '이스라엘', + 'name_native' => 'ישראל', + ), + array( + 'iso_3166_1_alpha2' => 'IT', + 'iso_3166_1_alpha3' => 'ITA', + 'iso_3166_1_numeric' => '380', + 'cctld' => 'it', + 'name_english' => 'Italy', + 'name_korean' => '이탈리아', + 'name_native' => 'Italia', + ), + array( + 'iso_3166_1_alpha2' => 'CI', + 'iso_3166_1_alpha3' => 'CIV', + 'iso_3166_1_numeric' => '384', + 'cctld' => 'ci', + 'name_english' => 'Côte d\'Ivoire', + 'name_korean' => '코트디부아르', + 'name_native' => 'Côte d\'Ivoire', + ), + array( + 'iso_3166_1_alpha2' => 'JM', + 'iso_3166_1_alpha3' => 'JAM', + 'iso_3166_1_numeric' => '388', + 'cctld' => 'jm', + 'name_english' => 'Jamaica', + 'name_korean' => '자메이카', + 'name_native' => 'Jamaica', + ), + array( + 'iso_3166_1_alpha2' => 'JP', + 'iso_3166_1_alpha3' => 'JPN', + 'iso_3166_1_numeric' => '392', + 'cctld' => 'jp', + 'name_english' => 'Japan', + 'name_korean' => '일본', + 'name_native' => '日本', + ), + array( + 'iso_3166_1_alpha2' => 'KZ', + 'iso_3166_1_alpha3' => 'KAZ', + 'iso_3166_1_numeric' => '398', + 'cctld' => 'kz', + 'name_english' => 'Kazakhstan', + 'name_korean' => '카자흐스탄', + 'name_native' => 'Қазақстан', + ), + array( + 'iso_3166_1_alpha2' => 'JO', + 'iso_3166_1_alpha3' => 'JOR', + 'iso_3166_1_numeric' => '400', + 'cctld' => 'jo', + 'name_english' => 'Jordan', + 'name_korean' => '요르단', + 'name_native' => 'الأردن', + ), + array( + 'iso_3166_1_alpha2' => 'KE', + 'iso_3166_1_alpha3' => 'KEN', + 'iso_3166_1_numeric' => '404', + 'cctld' => 'ke', + 'name_english' => 'Kenya', + 'name_korean' => '케냐', + 'name_native' => 'Kenya', + ), + array( + 'iso_3166_1_alpha2' => 'KP', + 'iso_3166_1_alpha3' => 'PRK', + 'iso_3166_1_numeric' => '408', + 'cctld' => 'kp', + 'name_english' => 'Korea (Democratic People\'s Republic of)', + 'name_korean' => '북한', + 'name_native' => '조선민주주의인민공화국', + ), + array( + 'iso_3166_1_alpha2' => 'KR', + 'iso_3166_1_alpha3' => 'KOR', + 'iso_3166_1_numeric' => '410', + 'cctld' => 'kr', + 'name_english' => 'Korea (Republic of)', + 'name_korean' => '대한민국', + 'name_native' => '대한민국', + ), + array( + 'iso_3166_1_alpha2' => 'KW', + 'iso_3166_1_alpha3' => 'KWT', + 'iso_3166_1_numeric' => '414', + 'cctld' => 'kw', + 'name_english' => 'Kuwait', + 'name_korean' => '쿠웨이트', + 'name_native' => 'دولة الكويت', + ), + array( + 'iso_3166_1_alpha2' => 'KG', + 'iso_3166_1_alpha3' => 'KGZ', + 'iso_3166_1_numeric' => '417', + 'cctld' => 'kg', + 'name_english' => 'Kyrgyzstan', + 'name_korean' => '키르기스스탄', + 'name_native' => 'Кыргызстан', + ), + array( + 'iso_3166_1_alpha2' => 'LA', + 'iso_3166_1_alpha3' => 'LAO', + 'iso_3166_1_numeric' => '418', + 'cctld' => 'la', + 'name_english' => 'Laos', + 'name_korean' => '라오스', + 'name_native' => 'ປະເທດລາວ', + ), + array( + 'iso_3166_1_alpha2' => 'LB', + 'iso_3166_1_alpha3' => 'LBN', + 'iso_3166_1_numeric' => '422', + 'cctld' => 'lb', + 'name_english' => 'Lebanon', + 'name_korean' => '레바논', + 'name_native' => 'لبنان', + ), + array( + 'iso_3166_1_alpha2' => 'LS', + 'iso_3166_1_alpha3' => 'LSO', + 'iso_3166_1_numeric' => '426', + 'cctld' => 'ls', + 'name_english' => 'Lesotho', + 'name_korean' => '레소토', + 'name_native' => 'Lesotho', + ), + array( + 'iso_3166_1_alpha2' => 'LV', + 'iso_3166_1_alpha3' => 'LVA', + 'iso_3166_1_numeric' => '428', + 'cctld' => 'lv', + 'name_english' => 'Latvia', + 'name_korean' => '라트비아', + 'name_native' => 'Latvija', + ), + array( + 'iso_3166_1_alpha2' => 'LR', + 'iso_3166_1_alpha3' => 'LBR', + 'iso_3166_1_numeric' => '430', + 'cctld' => 'lr', + 'name_english' => 'Liberia', + 'name_korean' => '라이베리아', + 'name_native' => 'Liberia', + ), + array( + 'iso_3166_1_alpha2' => 'LY', + 'iso_3166_1_alpha3' => 'LBY', + 'iso_3166_1_numeric' => '434', + 'cctld' => 'ly', + 'name_english' => 'Libya', + 'name_korean' => '리비아', + 'name_native' => 'ليبيا', + ), + array( + 'iso_3166_1_alpha2' => 'LI', + 'iso_3166_1_alpha3' => 'LIE', + 'iso_3166_1_numeric' => '438', + 'cctld' => 'li', + 'name_english' => 'Liechtenstein', + 'name_korean' => '리히텐슈타인', + 'name_native' => 'Liechtenstein', + ), + array( + 'iso_3166_1_alpha2' => 'LT', + 'iso_3166_1_alpha3' => 'LTU', + 'iso_3166_1_numeric' => '440', + 'cctld' => 'lt', + 'name_english' => 'Lithuania', + 'name_korean' => '리투아니아', + 'name_native' => 'Lietuva', + ), + array( + 'iso_3166_1_alpha2' => 'LU', + 'iso_3166_1_alpha3' => 'LUX', + 'iso_3166_1_numeric' => '442', + 'cctld' => 'lu', + 'name_english' => 'Luxembourg', + 'name_korean' => '룩셈부르크', + 'name_native' => 'Lëtzebuerg', + ), + array( + 'iso_3166_1_alpha2' => 'MO', + 'iso_3166_1_alpha3' => 'MAC', + 'iso_3166_1_numeric' => '446', + 'cctld' => 'mo', + 'name_english' => 'Macau', + 'name_korean' => '마카오', + 'name_native' => '澳門', + ), + array( + 'iso_3166_1_alpha2' => 'MG', + 'iso_3166_1_alpha3' => 'MDG', + 'iso_3166_1_numeric' => '450', + 'cctld' => 'mg', + 'name_english' => 'Madagascar', + 'name_korean' => '마다가스카', + 'name_native' => 'Madagasikara', + ), + array( + 'iso_3166_1_alpha2' => 'MW', + 'iso_3166_1_alpha3' => 'MWI', + 'iso_3166_1_numeric' => '454', + 'cctld' => 'mw', + 'name_english' => 'Malawi', + 'name_korean' => '말라위', + 'name_native' => 'Malawi', + ), + array( + 'iso_3166_1_alpha2' => 'MY', + 'iso_3166_1_alpha3' => 'MYS', + 'iso_3166_1_numeric' => '458', + 'cctld' => 'my', + 'name_english' => 'Malaysia', + 'name_korean' => '말레이시아', + 'name_native' => 'Malaysia', + ), + array( + 'iso_3166_1_alpha2' => 'MV', + 'iso_3166_1_alpha3' => 'MDV', + 'iso_3166_1_numeric' => '462', + 'cctld' => 'mv', + 'name_english' => 'Maldives', + 'name_korean' => '몰디브', + 'name_native' => 'ދިވެހިރާއްޖެ', + ), + array( + 'iso_3166_1_alpha2' => 'ML', + 'iso_3166_1_alpha3' => 'MLI', + 'iso_3166_1_numeric' => '466', + 'cctld' => 'ml', + 'name_english' => 'Mali', + 'name_korean' => '말리', + 'name_native' => 'Mali', + ), + array( + 'iso_3166_1_alpha2' => 'MT', + 'iso_3166_1_alpha3' => 'MLT', + 'iso_3166_1_numeric' => '470', + 'cctld' => 'mt', + 'name_english' => 'Malta', + 'name_korean' => '몰타', + 'name_native' => 'Malta', + ), + array( + 'iso_3166_1_alpha2' => 'MQ', + 'iso_3166_1_alpha3' => 'MTQ', + 'iso_3166_1_numeric' => '474', + 'cctld' => 'mq', + 'name_english' => 'Martinique', + 'name_korean' => '마르티니크', + 'name_native' => 'Martinique', + ), + array( + 'iso_3166_1_alpha2' => 'MR', + 'iso_3166_1_alpha3' => 'MRT', + 'iso_3166_1_numeric' => '478', + 'cctld' => 'mr', + 'name_english' => 'Mauritania', + 'name_korean' => '모리타니', + 'name_native' => 'موريتانيا', + ), + array( + 'iso_3166_1_alpha2' => 'MU', + 'iso_3166_1_alpha3' => 'MUS', + 'iso_3166_1_numeric' => '480', + 'cctld' => 'mu', + 'name_english' => 'Mauritius', + 'name_korean' => '모리셔스', + 'name_native' => 'Maurice', + ), + array( + 'iso_3166_1_alpha2' => 'MX', + 'iso_3166_1_alpha3' => 'MEX', + 'iso_3166_1_numeric' => '484', + 'cctld' => 'mx', + 'name_english' => 'Mexico', + 'name_korean' => '멕시코', + 'name_native' => 'México', + ), + array( + 'iso_3166_1_alpha2' => 'MC', + 'iso_3166_1_alpha3' => 'MCO', + 'iso_3166_1_numeric' => '492', + 'cctld' => 'mc', + 'name_english' => 'Monaco', + 'name_korean' => '모나코', + 'name_native' => 'Monaco', + ), + array( + 'iso_3166_1_alpha2' => 'MN', + 'iso_3166_1_alpha3' => 'MNG', + 'iso_3166_1_numeric' => '496', + 'cctld' => 'mn', + 'name_english' => 'Mongolia', + 'name_korean' => '몽골', + 'name_native' => 'Монгол Улс', + ), + array( + 'iso_3166_1_alpha2' => 'MD', + 'iso_3166_1_alpha3' => 'MDA', + 'iso_3166_1_numeric' => '498', + 'cctld' => 'md', + 'name_english' => 'Moldova (Republic of)', + 'name_korean' => '몰도바', + 'name_native' => 'Moldova', + ), + array( + 'iso_3166_1_alpha2' => 'ME', + 'iso_3166_1_alpha3' => 'MNE', + 'iso_3166_1_numeric' => '499', + 'cctld' => 'me', + 'name_english' => 'Montenegro', + 'name_korean' => '몬테네그로', + 'name_native' => 'Црна Гора', + ), + array( + 'iso_3166_1_alpha2' => 'MS', + 'iso_3166_1_alpha3' => 'MSR', + 'iso_3166_1_numeric' => '500', + 'cctld' => 'ms', + 'name_english' => 'Montserrat', + 'name_korean' => '몬트세랫', + 'name_native' => 'Montserrat', + ), + array( + 'iso_3166_1_alpha2' => 'MA', + 'iso_3166_1_alpha3' => 'MAR', + 'iso_3166_1_numeric' => '504', + 'cctld' => 'ma', + 'name_english' => 'Morocco', + 'name_korean' => '모로코', + 'name_native' => 'المغرب', + ), + array( + 'iso_3166_1_alpha2' => 'MZ', + 'iso_3166_1_alpha3' => 'MOZ', + 'iso_3166_1_numeric' => '508', + 'cctld' => 'mz', + 'name_english' => 'Mozambique', + 'name_korean' => '모잠비크', + 'name_native' => 'Moçambique', + ), + array( + 'iso_3166_1_alpha2' => 'OM', + 'iso_3166_1_alpha3' => 'OMN', + 'iso_3166_1_numeric' => '512', + 'cctld' => 'om', + 'name_english' => 'Oman', + 'name_korean' => '오만', + 'name_native' => 'عُمان', + ), + array( + 'iso_3166_1_alpha2' => 'NA', + 'iso_3166_1_alpha3' => 'NAM', + 'iso_3166_1_numeric' => '516', + 'cctld' => 'na', + 'name_english' => 'Namibia', + 'name_korean' => '나미비아', + 'name_native' => 'Namibia', + ), + array( + 'iso_3166_1_alpha2' => 'NR', + 'iso_3166_1_alpha3' => 'NRU', + 'iso_3166_1_numeric' => '520', + 'cctld' => 'nr', + 'name_english' => 'Nauru', + 'name_korean' => '나우루', + 'name_native' => 'Naoero', + ), + array( + 'iso_3166_1_alpha2' => 'NP', + 'iso_3166_1_alpha3' => 'NPL', + 'iso_3166_1_numeric' => '524', + 'cctld' => 'np', + 'name_english' => 'Nepal', + 'name_korean' => '네팔', + 'name_native' => 'नेपाल', + ), + array( + 'iso_3166_1_alpha2' => 'NL', + 'iso_3166_1_alpha3' => 'NLD', + 'iso_3166_1_numeric' => '528', + 'cctld' => 'nl', + 'name_english' => 'Netherlands', + 'name_korean' => '네덜란드', + 'name_native' => 'Nederland', + ), + array( + 'iso_3166_1_alpha2' => 'AN', + 'iso_3166_1_alpha3' => 'ANT', + 'iso_3166_1_numeric' => '530', + 'cctld' => 'an', + 'name_english' => 'Netherlands Antilles', + 'name_korean' => '네덜란드령 안틸레스', + 'name_native' => 'Nederlandse Antillen', + ), + array( + 'iso_3166_1_alpha2' => 'CW', + 'iso_3166_1_alpha3' => 'CUW', + 'iso_3166_1_numeric' => '531', + 'cctld' => 'cw', + 'name_english' => 'Curaçao', + 'name_korean' => '퀴라소', + 'name_native' => 'Curaçao', + ), + array( + 'iso_3166_1_alpha2' => 'AW', + 'iso_3166_1_alpha3' => 'ABW', + 'iso_3166_1_numeric' => '533', + 'cctld' => 'aw', + 'name_english' => 'Aruba', + 'name_korean' => '아루바', + 'name_native' => 'Aruba', + ), + array( + 'iso_3166_1_alpha2' => 'SX', + 'iso_3166_1_alpha3' => 'SXM', + 'iso_3166_1_numeric' => '534', + 'cctld' => 'sx', + 'name_english' => 'Sint Maarten (Dutch)', + 'name_korean' => '신트마르턴 (네덜란드령)', + 'name_native' => 'Sint Maarten', + ), + array( + 'iso_3166_1_alpha2' => 'BQ', + 'iso_3166_1_alpha3' => 'BES', + 'iso_3166_1_numeric' => '535', + 'cctld' => 'bq', + 'name_english' => 'Caribbean Netherlands', + 'name_korean' => '네덜란드령 카리브', + 'name_native' => 'Caribisch Nederland', + ), + array( + 'iso_3166_1_alpha2' => 'NC', + 'iso_3166_1_alpha3' => 'NCL', + 'iso_3166_1_numeric' => '540', + 'cctld' => 'nc', + 'name_english' => 'New Caledonia', + 'name_korean' => '누벨칼레도니', + 'name_native' => 'Nouvelle-Calédonie', + ), + array( + 'iso_3166_1_alpha2' => 'VU', + 'iso_3166_1_alpha3' => 'VUT', + 'iso_3166_1_numeric' => '548', + 'cctld' => 'vu', + 'name_english' => 'Vanuatu', + 'name_korean' => '바누아투', + 'name_native' => 'Vanuatu', + ), + array( + 'iso_3166_1_alpha2' => 'NZ', + 'iso_3166_1_alpha3' => 'NZL', + 'iso_3166_1_numeric' => '554', + 'cctld' => 'nz', + 'name_english' => 'New Zealand', + 'name_korean' => '뉴질랜드', + 'name_native' => 'New Zealand', + ), + array( + 'iso_3166_1_alpha2' => 'NI', + 'iso_3166_1_alpha3' => 'NIC', + 'iso_3166_1_numeric' => '558', + 'cctld' => 'ni', + 'name_english' => 'Nicaragua', + 'name_korean' => '니카라과', + 'name_native' => 'Nicaragua', + ), + array( + 'iso_3166_1_alpha2' => 'NE', + 'iso_3166_1_alpha3' => 'NER', + 'iso_3166_1_numeric' => '562', + 'cctld' => 'ne', + 'name_english' => 'Niger', + 'name_korean' => '니제르', + 'name_native' => 'Niger', + ), + array( + 'iso_3166_1_alpha2' => 'NG', + 'iso_3166_1_alpha3' => 'NGA', + 'iso_3166_1_numeric' => '566', + 'cctld' => 'ng', + 'name_english' => 'Nigeria', + 'name_korean' => '나이지리아', + 'name_native' => 'Nigeria', + ), + array( + 'iso_3166_1_alpha2' => 'NU', + 'iso_3166_1_alpha3' => 'NIU', + 'iso_3166_1_numeric' => '570', + 'cctld' => 'nu', + 'name_english' => 'Niue', + 'name_korean' => '니우에', + 'name_native' => 'Niuē', + ), + array( + 'iso_3166_1_alpha2' => 'NF', + 'iso_3166_1_alpha3' => 'NFK', + 'iso_3166_1_numeric' => '574', + 'cctld' => 'nf', + 'name_english' => 'Norfolk Island', + 'name_korean' => '노퍽 섬', + 'name_native' => 'Norfolk Island', + ), + array( + 'iso_3166_1_alpha2' => 'NO', + 'iso_3166_1_alpha3' => 'NOR', + 'iso_3166_1_numeric' => '578', + 'cctld' => 'no', + 'name_english' => 'Norway', + 'name_korean' => '노르웨이', + 'name_native' => 'Norge', + ), + array( + 'iso_3166_1_alpha2' => 'MP', + 'iso_3166_1_alpha3' => 'MNP', + 'iso_3166_1_numeric' => '580', + 'cctld' => 'mp', + 'name_english' => 'Northern Mariana Islands', + 'name_korean' => '북마리아나 제도', + 'name_native' => 'Northern Mariana Islands', + ), + array( + 'iso_3166_1_alpha2' => 'UM', + 'iso_3166_1_alpha3' => 'UMI', + 'iso_3166_1_numeric' => '581', + 'cctld' => 'um', + 'name_english' => 'United States Minor Outlying Islands', + 'name_korean' => '미국령 군소 제도', + 'name_native' => 'United States Minor Outlying Islands', + ), + array( + 'iso_3166_1_alpha2' => 'FM', + 'iso_3166_1_alpha3' => 'FSM', + 'iso_3166_1_numeric' => '583', + 'cctld' => 'fm', + 'name_english' => 'Federated States of Micronesia', + 'name_korean' => '미크로네시아 연방', + 'name_native' => 'Federated States of Micronesia', + ), + array( + 'iso_3166_1_alpha2' => 'MH', + 'iso_3166_1_alpha3' => 'MHL', + 'iso_3166_1_numeric' => '584', + 'cctld' => 'mh', + 'name_english' => 'Marshall Islands', + 'name_korean' => '마셜 제도', + 'name_native' => 'Marshall Islands', + ), + array( + 'iso_3166_1_alpha2' => 'PW', + 'iso_3166_1_alpha3' => 'PLW', + 'iso_3166_1_numeric' => '585', + 'cctld' => 'pw', + 'name_english' => 'Palau', + 'name_korean' => '팔라우', + 'name_native' => 'Belau', + ), + array( + 'iso_3166_1_alpha2' => 'PK', + 'iso_3166_1_alpha3' => 'PAK', + 'iso_3166_1_numeric' => '586', + 'cctld' => 'pk', + 'name_english' => 'Pakistan', + 'name_korean' => '파키스탄', + 'name_native' => 'پاکستان', + ), + array( + 'iso_3166_1_alpha2' => 'PA', + 'iso_3166_1_alpha3' => 'PAN', + 'iso_3166_1_numeric' => '591', + 'cctld' => 'pa', + 'name_english' => 'Panama', + 'name_korean' => '파나마', + 'name_native' => 'Panamá', + ), + array( + 'iso_3166_1_alpha2' => 'PG', + 'iso_3166_1_alpha3' => 'PNG', + 'iso_3166_1_numeric' => '598', + 'cctld' => 'pg', + 'name_english' => 'Papua New Guinea', + 'name_korean' => '파푸아 뉴기니', + 'name_native' => 'Papua New Guinea', + ), + array( + 'iso_3166_1_alpha2' => 'PY', + 'iso_3166_1_alpha3' => 'PRY', + 'iso_3166_1_numeric' => '600', + 'cctld' => 'py', + 'name_english' => 'Paraguay', + 'name_korean' => '파라과이', + 'name_native' => 'Paraguay', + ), + array( + 'iso_3166_1_alpha2' => 'PE', + 'iso_3166_1_alpha3' => 'PER', + 'iso_3166_1_numeric' => '604', + 'cctld' => 'pe', + 'name_english' => 'Peru', + 'name_korean' => '페루', + 'name_native' => 'Perú', + ), + array( + 'iso_3166_1_alpha2' => 'PH', + 'iso_3166_1_alpha3' => 'PHL', + 'iso_3166_1_numeric' => '608', + 'cctld' => 'ph', + 'name_english' => 'Philippines', + 'name_korean' => '필리핀', + 'name_native' => 'Pilipinas', + ), + array( + 'iso_3166_1_alpha2' => 'PN', + 'iso_3166_1_alpha3' => 'PCN', + 'iso_3166_1_numeric' => '612', + 'cctld' => 'pn', + 'name_english' => 'Pitcairn Islands', + 'name_korean' => '핏케언 제도', + 'name_native' => 'Pitcairn Islands', + ), + array( + 'iso_3166_1_alpha2' => 'PL', + 'iso_3166_1_alpha3' => 'POL', + 'iso_3166_1_numeric' => '616', + 'cctld' => 'pl', + 'name_english' => 'Poland', + 'name_korean' => '폴란드', + 'name_native' => 'Polska', + ), + array( + 'iso_3166_1_alpha2' => 'PT', + 'iso_3166_1_alpha3' => 'PRT', + 'iso_3166_1_numeric' => '620', + 'cctld' => 'pt', + 'name_english' => 'Portugal', + 'name_korean' => '포르투갈', + 'name_native' => 'Portugal', + ), + array( + 'iso_3166_1_alpha2' => 'GW', + 'iso_3166_1_alpha3' => 'GNB', + 'iso_3166_1_numeric' => '624', + 'cctld' => 'gw', + 'name_english' => 'Guinea-Bissau', + 'name_korean' => '기니비사우', + 'name_native' => 'Guiné-Bissau', + ), + array( + 'iso_3166_1_alpha2' => 'TL', + 'iso_3166_1_alpha3' => 'TLS', + 'iso_3166_1_numeric' => '626', + 'cctld' => 'tl', + 'name_english' => 'Timor-Leste', + 'name_korean' => '동티모르', + 'name_native' => 'Timor Lorosa\'e', + ), + array( + 'iso_3166_1_alpha2' => 'PR', + 'iso_3166_1_alpha3' => 'PRI', + 'iso_3166_1_numeric' => '630', + 'cctld' => 'pr', + 'name_english' => 'Puerto Rico', + 'name_korean' => '푸에르토리코', + 'name_native' => 'Puerto Rico', + ), + array( + 'iso_3166_1_alpha2' => 'QA', + 'iso_3166_1_alpha3' => 'QAT', + 'iso_3166_1_numeric' => '634', + 'cctld' => 'qa', + 'name_english' => 'Qatar', + 'name_korean' => '카타르', + 'name_native' => 'قطر', + ), + array( + 'iso_3166_1_alpha2' => 'RE', + 'iso_3166_1_alpha3' => 'REU', + 'iso_3166_1_numeric' => '638', + 'cctld' => 're', + 'name_english' => 'Réunion', + 'name_korean' => '레위니옹', + 'name_native' => 'Réunion', + ), + array( + 'iso_3166_1_alpha2' => 'RO', + 'iso_3166_1_alpha3' => 'ROU', + 'iso_3166_1_numeric' => '642', + 'cctld' => 'ro', + 'name_english' => 'Romania', + 'name_korean' => '루마니아', + 'name_native' => 'România', + ), + array( + 'iso_3166_1_alpha2' => 'RU', + 'iso_3166_1_alpha3' => 'RUS', + 'iso_3166_1_numeric' => '643', + 'cctld' => 'ru', + 'name_english' => 'Russia', + 'name_korean' => '러시아', + 'name_native' => 'Россия', + ), + array( + 'iso_3166_1_alpha2' => 'RW', + 'iso_3166_1_alpha3' => 'RWA', + 'iso_3166_1_numeric' => '646', + 'cctld' => 'rw', + 'name_english' => 'Rwanda', + 'name_korean' => '르완다', + 'name_native' => 'Rwanda', + ), + array( + 'iso_3166_1_alpha2' => 'BL', + 'iso_3166_1_alpha3' => 'BLM', + 'iso_3166_1_numeric' => '652', + 'cctld' => 'bl', + 'name_english' => 'Saint-Barthélemy', + 'name_korean' => '생바르텔레미', + 'name_native' => 'Saint-Barthélemy', + ), + array( + 'iso_3166_1_alpha2' => 'SH', + 'iso_3166_1_alpha3' => 'SHN', + 'iso_3166_1_numeric' => '654', + 'cctld' => 'sh', + 'name_english' => 'Saint Helena, Ascension and Tristan da Cunha', + 'name_korean' => '세인트헬레나', + 'name_native' => 'Saint Helena, Ascension and Tristan da Cunha', + ), + array( + 'iso_3166_1_alpha2' => 'KN', + 'iso_3166_1_alpha3' => 'KNA', + 'iso_3166_1_numeric' => '659', + 'cctld' => 'kn', + 'name_english' => 'Saint Kitts and Nevis', + 'name_korean' => '세인트키츠 네비스', + 'name_native' => 'Saint Kitts and Nevis', + ), + array( + 'iso_3166_1_alpha2' => 'AI', + 'iso_3166_1_alpha3' => 'AIA', + 'iso_3166_1_numeric' => '660', + 'cctld' => 'ai', + 'name_english' => 'Anguilla', + 'name_korean' => '앵귈라', + 'name_native' => 'Anguilla', + ), + array( + 'iso_3166_1_alpha2' => 'LC', + 'iso_3166_1_alpha3' => 'LCA', + 'iso_3166_1_numeric' => '662', + 'cctld' => 'lc', + 'name_english' => 'Saint Lucia', + 'name_korean' => '세인트루시아', + 'name_native' => 'Saint Lucia', + ), + array( + 'iso_3166_1_alpha2' => 'MF', + 'iso_3166_1_alpha3' => 'MAF', + 'iso_3166_1_numeric' => '663', + 'cctld' => 'mf', + 'name_english' => 'Saint-Martin (French)', + 'name_korean' => '생마르탱 (프랑스령)', + 'name_native' => 'Saint-Martin', + ), + array( + 'iso_3166_1_alpha2' => 'PM', + 'iso_3166_1_alpha3' => 'SPM', + 'iso_3166_1_numeric' => '666', + 'cctld' => 'pm', + 'name_english' => 'Saint Pierre and Miquelon', + 'name_korean' => '생피에르 미클롱', + 'name_native' => 'Saint-Pierre et Miquelon', + ), + array( + 'iso_3166_1_alpha2' => 'VC', + 'iso_3166_1_alpha3' => 'VCT', + 'iso_3166_1_numeric' => '670', + 'cctld' => 'vc', + 'name_english' => 'Saint Vincent and the Grenadines', + 'name_korean' => '세인트빈센트 그레나', + 'name_native' => 'Saint Vincent and the Grenadines', + ), + array( + 'iso_3166_1_alpha2' => 'SM', + 'iso_3166_1_alpha3' => 'SMR', + 'iso_3166_1_numeric' => '674', + 'cctld' => 'sm', + 'name_english' => 'San Marino', + 'name_korean' => '산마리노', + 'name_native' => 'San Marino', + ), + array( + 'iso_3166_1_alpha2' => 'ST', + 'iso_3166_1_alpha3' => 'STP', + 'iso_3166_1_numeric' => '678', + 'cctld' => 'st', + 'name_english' => 'Sao Tome and Principe', + 'name_korean' => '상투메 프린시페', + 'name_native' => 'São Tomé e Príncipe', + ), + array( + 'iso_3166_1_alpha2' => 'SA', + 'iso_3166_1_alpha3' => 'SAU', + 'iso_3166_1_numeric' => '682', + 'cctld' => 'sa', + 'name_english' => 'Saudi Arabia', + 'name_korean' => '사우디아라비아', + 'name_native' => 'المملكة العربية السعودية', + ), + array( + 'iso_3166_1_alpha2' => 'SN', + 'iso_3166_1_alpha3' => 'SEN', + 'iso_3166_1_numeric' => '686', + 'cctld' => 'sn', + 'name_english' => 'Senegal', + 'name_korean' => '세네갈', + 'name_native' => 'Sénégal', + ), + array( + 'iso_3166_1_alpha2' => 'RS', + 'iso_3166_1_alpha3' => 'SRB', + 'iso_3166_1_numeric' => '688', + 'cctld' => 'rs', + 'name_english' => 'Serbia', + 'name_korean' => '세르비아', + 'name_native' => 'Србија', + ), + array( + 'iso_3166_1_alpha2' => 'SC', + 'iso_3166_1_alpha3' => 'SYC', + 'iso_3166_1_numeric' => '690', + 'cctld' => 'sc', + 'name_english' => 'Seychelles', + 'name_korean' => '세이셸', + 'name_native' => 'Sesel', + ), + array( + 'iso_3166_1_alpha2' => 'SL', + 'iso_3166_1_alpha3' => 'SLE', + 'iso_3166_1_numeric' => '694', + 'cctld' => 'sl', + 'name_english' => 'Sierra Leone', + 'name_korean' => '시에라리온', + 'name_native' => 'Sierra Leone', + ), + array( + 'iso_3166_1_alpha2' => 'SG', + 'iso_3166_1_alpha3' => 'SGP', + 'iso_3166_1_numeric' => '702', + 'cctld' => 'sg', + 'name_english' => 'Singapore', + 'name_korean' => '싱가포르', + 'name_native' => 'Singapura', + ), + array( + 'iso_3166_1_alpha2' => 'SK', + 'iso_3166_1_alpha3' => 'SVK', + 'iso_3166_1_numeric' => '703', + 'cctld' => 'sk', + 'name_english' => 'Slovakia', + 'name_korean' => '슬로바키아', + 'name_native' => 'Slovensko', + ), + array( + 'iso_3166_1_alpha2' => 'VN', + 'iso_3166_1_alpha3' => 'VNM', + 'iso_3166_1_numeric' => '704', + 'cctld' => 'vn', + 'name_english' => 'Viet Nam', + 'name_korean' => '베트남', + 'name_native' => 'Việt Nam', + ), + array( + 'iso_3166_1_alpha2' => 'SI', + 'iso_3166_1_alpha3' => 'SVN', + 'iso_3166_1_numeric' => '705', + 'cctld' => 'si', + 'name_english' => 'Slovenia', + 'name_korean' => '슬로베니아', + 'name_native' => 'Slovenija', + ), + array( + 'iso_3166_1_alpha2' => 'SO', + 'iso_3166_1_alpha3' => 'SOM', + 'iso_3166_1_numeric' => '706', + 'cctld' => 'so', + 'name_english' => 'Somalia', + 'name_korean' => '소말리아', + 'name_native' => 'الصومال', + ), + array( + 'iso_3166_1_alpha2' => 'ZA', + 'iso_3166_1_alpha3' => 'ZAF', + 'iso_3166_1_numeric' => '710', + 'cctld' => 'za', + 'name_english' => 'South Africa', + 'name_korean' => '남아프리카 공화국', + 'name_native' => 'South Africa', + ), + array( + 'iso_3166_1_alpha2' => 'ZW', + 'iso_3166_1_alpha3' => 'ZWE', + 'iso_3166_1_numeric' => '716', + 'cctld' => 'zw', + 'name_english' => 'Zimbabwe', + 'name_korean' => '짐바브웨', + 'name_native' => 'Zimbabwe', + ), + array( + 'iso_3166_1_alpha2' => 'ES', + 'iso_3166_1_alpha3' => 'ESP', + 'iso_3166_1_numeric' => '724', + 'cctld' => 'es', + 'name_english' => 'Spain', + 'name_korean' => '스페인', + 'name_native' => 'España', + ), + array( + 'iso_3166_1_alpha2' => 'SS', + 'iso_3166_1_alpha3' => 'SSD', + 'iso_3166_1_numeric' => '728', + 'cctld' => 'ss', + 'name_english' => 'South Sudan', + 'name_korean' => '남수단', + 'name_native' => 'South Sudan', + ), + array( + 'iso_3166_1_alpha2' => 'SD', + 'iso_3166_1_alpha3' => 'SDN', + 'iso_3166_1_numeric' => '729', + 'cctld' => 'sd', + 'name_english' => 'Sudan', + 'name_korean' => '수단', + 'name_native' => 'السودان', + ), + array( + 'iso_3166_1_alpha2' => 'EH', + 'iso_3166_1_alpha3' => 'ESH', + 'iso_3166_1_numeric' => '732', + 'cctld' => 'eh', + 'name_english' => 'Western Sahara', + 'name_korean' => '서사하라', + 'name_native' => 'الصحراء الغربية', + ), + array( + 'iso_3166_1_alpha2' => 'SR', + 'iso_3166_1_alpha3' => 'SUR', + 'iso_3166_1_numeric' => '740', + 'cctld' => 'sr', + 'name_english' => 'Suriname', + 'name_korean' => '수리남', + 'name_native' => 'Suriname', + ), + array( + 'iso_3166_1_alpha2' => 'SJ', + 'iso_3166_1_alpha3' => 'SJM', + 'iso_3166_1_numeric' => '744', + 'cctld' => 'sj', + 'name_english' => 'Svalbard', + 'name_korean' => '스발바르', + 'name_native' => 'Svalbard', + ), + array( + 'iso_3166_1_alpha2' => 'SZ', + 'iso_3166_1_alpha3' => 'SWZ', + 'iso_3166_1_numeric' => '748', + 'cctld' => 'sz', + 'name_english' => 'Swaziland', + 'name_korean' => '스와질란드', + 'name_native' => 'Umbuso weSwatini', + ), + array( + 'iso_3166_1_alpha2' => 'SE', + 'iso_3166_1_alpha3' => 'SWE', + 'iso_3166_1_numeric' => '752', + 'cctld' => 'se', + 'name_english' => 'Sweden', + 'name_korean' => '스웨덴', + 'name_native' => 'Sverige', + ), + array( + 'iso_3166_1_alpha2' => 'CH', + 'iso_3166_1_alpha3' => 'CHE', + 'iso_3166_1_numeric' => '756', + 'cctld' => 'ch', + 'name_english' => 'Switzerland', + 'name_korean' => '스위스', + 'name_native' => 'Schweiz, Suisse, Svizzera, Svizra', + ), + array( + 'iso_3166_1_alpha2' => 'SY', + 'iso_3166_1_alpha3' => 'SYR', + 'iso_3166_1_numeric' => '760', + 'cctld' => 'sy', + 'name_english' => 'Syria', + 'name_korean' => '시리아', + 'name_native' => 'سورية', + ), + array( + 'iso_3166_1_alpha2' => 'TJ', + 'iso_3166_1_alpha3' => 'TJK', + 'iso_3166_1_numeric' => '762', + 'cctld' => 'tj', + 'name_english' => 'Tajikistan', + 'name_korean' => '타지키스탄', + 'name_native' => 'Тоҷикистон', + ), + array( + 'iso_3166_1_alpha2' => 'TH', + 'iso_3166_1_alpha3' => 'THA', + 'iso_3166_1_numeric' => '764', + 'cctld' => 'th', + 'name_english' => 'Thailand', + 'name_korean' => '태국', + 'name_native' => 'ประเทศไทย', + ), + array( + 'iso_3166_1_alpha2' => 'TG', + 'iso_3166_1_alpha3' => 'TGO', + 'iso_3166_1_numeric' => '768', + 'cctld' => 'tg', + 'name_english' => 'Togo', + 'name_korean' => '토고', + 'name_native' => 'Togo', + ), + array( + 'iso_3166_1_alpha2' => 'TK', + 'iso_3166_1_alpha3' => 'TKL', + 'iso_3166_1_numeric' => '772', + 'cctld' => 'tk', + 'name_english' => 'Tokelau', + 'name_korean' => '토켈라우', + 'name_native' => 'Tokelau', + ), + array( + 'iso_3166_1_alpha2' => 'TO', + 'iso_3166_1_alpha3' => 'TON', + 'iso_3166_1_numeric' => '776', + 'cctld' => 'to', + 'name_english' => 'Tonga', + 'name_korean' => '통가', + 'name_native' => 'Tonga', + ), + array( + 'iso_3166_1_alpha2' => 'TT', + 'iso_3166_1_alpha3' => 'TTO', + 'iso_3166_1_numeric' => '780', + 'cctld' => 'tt', + 'name_english' => 'Trinidad and Tobago', + 'name_korean' => '트리니다드 토바고', + 'name_native' => 'Trinidad and Tobago', + ), + array( + 'iso_3166_1_alpha2' => 'AE', + 'iso_3166_1_alpha3' => 'ARE', + 'iso_3166_1_numeric' => '784', + 'cctld' => 'ae', + 'name_english' => 'United Arab Emirates', + 'name_korean' => '아랍에미리트', + 'name_native' => 'الإمارات العربيّة المتّحدة', + ), + array( + 'iso_3166_1_alpha2' => 'TN', + 'iso_3166_1_alpha3' => 'TUN', + 'iso_3166_1_numeric' => '788', + 'cctld' => 'tn', + 'name_english' => 'Tunisia', + 'name_korean' => '튀니지', + 'name_native' => 'تونس', + ), + array( + 'iso_3166_1_alpha2' => 'TR', + 'iso_3166_1_alpha3' => 'TUR', + 'iso_3166_1_numeric' => '792', + 'cctld' => 'tr', + 'name_english' => 'Turkey', + 'name_korean' => '터키', + 'name_native' => 'Türkiye', + ), + array( + 'iso_3166_1_alpha2' => 'TM', + 'iso_3166_1_alpha3' => 'TKM', + 'iso_3166_1_numeric' => '795', + 'cctld' => 'tm', + 'name_english' => 'Turkmenistan', + 'name_korean' => '투르크메니스탄', + 'name_native' => 'Türkmenistan', + ), + array( + 'iso_3166_1_alpha2' => 'TC', + 'iso_3166_1_alpha3' => 'TCA', + 'iso_3166_1_numeric' => '796', + 'cctld' => 'tc', + 'name_english' => 'Turks and Caicos Islands', + 'name_korean' => '터크스 케이커스 제도', + 'name_native' => 'Turks and Caicos Islands', + ), + array( + 'iso_3166_1_alpha2' => 'TV', + 'iso_3166_1_alpha3' => 'TUV', + 'iso_3166_1_numeric' => '798', + 'cctld' => 'tv', + 'name_english' => 'Tuvalu', + 'name_korean' => '투발루', + 'name_native' => 'Tuvalu', + ), + array( + 'iso_3166_1_alpha2' => 'UG', + 'iso_3166_1_alpha3' => 'UGA', + 'iso_3166_1_numeric' => '800', + 'cctld' => 'ug', + 'name_english' => 'Uganda', + 'name_korean' => '우간다', + 'name_native' => 'Uganda', + ), + array( + 'iso_3166_1_alpha2' => 'UA', + 'iso_3166_1_alpha3' => 'UKR', + 'iso_3166_1_numeric' => '804', + 'cctld' => 'ua', + 'name_english' => 'Ukraine', + 'name_korean' => '우크라이나', + 'name_native' => 'Україна', + ), + array( + 'iso_3166_1_alpha2' => 'MK', + 'iso_3166_1_alpha3' => 'MKD', + 'iso_3166_1_numeric' => '807', + 'cctld' => 'mk', + 'name_english' => 'Macedonia', + 'name_korean' => '마케도니아', + 'name_native' => 'Македонија', + ), + array( + 'iso_3166_1_alpha2' => 'EG', + 'iso_3166_1_alpha3' => 'EGY', + 'iso_3166_1_numeric' => '818', + 'cctld' => 'eg', + 'name_english' => 'Egypt', + 'name_korean' => '이집트', + 'name_native' => 'مصر', + ), + array( + 'iso_3166_1_alpha2' => 'GB', + 'iso_3166_1_alpha3' => 'GBR', + 'iso_3166_1_numeric' => '826', + 'cctld' => 'gb', + 'name_english' => 'United Kingdom', + 'name_korean' => '영국', + 'name_native' => 'United Kingdom', + ), + array( + 'iso_3166_1_alpha2' => 'GG', + 'iso_3166_1_alpha3' => 'GGY', + 'iso_3166_1_numeric' => '831', + 'cctld' => 'gg', + 'name_english' => 'Guernsey', + 'name_korean' => '건지 섬', + 'name_native' => 'Guernsey', + ), + array( + 'iso_3166_1_alpha2' => 'JE', + 'iso_3166_1_alpha3' => 'JEY', + 'iso_3166_1_numeric' => '832', + 'cctld' => 'je', + 'name_english' => 'Jersey', + 'name_korean' => '저지 섬', + 'name_native' => 'Jersey', + ), + array( + 'iso_3166_1_alpha2' => 'IM', + 'iso_3166_1_alpha3' => 'IMN', + 'iso_3166_1_numeric' => '833', + 'cctld' => 'im', + 'name_english' => 'Isle of Man', + 'name_korean' => '맨 섬', + 'name_native' => 'Isle of Man', + ), + array( + 'iso_3166_1_alpha2' => 'TZ', + 'iso_3166_1_alpha3' => 'TZA', + 'iso_3166_1_numeric' => '834', + 'cctld' => 'tz', + 'name_english' => 'Tanzania', + 'name_korean' => '탄자니아', + 'name_native' => 'Tanzania', + ), + array( + 'iso_3166_1_alpha2' => 'US', + 'iso_3166_1_alpha3' => 'USA', + 'iso_3166_1_numeric' => '840', + 'cctld' => 'us', + 'name_english' => 'United States of America', + 'name_korean' => '미국', + 'name_native' => 'United States of America', + ), + array( + 'iso_3166_1_alpha2' => 'VI', + 'iso_3166_1_alpha3' => 'VIR', + 'iso_3166_1_numeric' => '850', + 'cctld' => 'vi', + 'name_english' => 'Virgin Islands (U.S.)', + 'name_korean' => '미국령 버진아일랜드', + 'name_native' => 'Virgin Islands (U.S.)', + ), + array( + 'iso_3166_1_alpha2' => 'BF', + 'iso_3166_1_alpha3' => 'BFA', + 'iso_3166_1_numeric' => '854', + 'cctld' => 'bf', + 'name_english' => 'Burkina Faso', + 'name_korean' => '부르키나파소', + 'name_native' => 'Burkina Faso', + ), + array( + 'iso_3166_1_alpha2' => 'UY', + 'iso_3166_1_alpha3' => 'URY', + 'iso_3166_1_numeric' => '858', + 'cctld' => 'uy', + 'name_english' => 'Uruguay', + 'name_korean' => '우루과이', + 'name_native' => 'Uruguay', + ), + array( + 'iso_3166_1_alpha2' => 'UZ', + 'iso_3166_1_alpha3' => 'UZB', + 'iso_3166_1_numeric' => '860', + 'cctld' => 'uz', + 'name_english' => 'Uzbekistan', + 'name_korean' => '우즈베키스탄', + 'name_native' => 'Ўзбекистон', + ), + array( + 'iso_3166_1_alpha2' => 'VE', + 'iso_3166_1_alpha3' => 'VEN', + 'iso_3166_1_numeric' => '862', + 'cctld' => 've', + 'name_english' => 'Venezuela', + 'name_korean' => '베네수엘라', + 'name_native' => 'Venezuela', + ), + array( + 'iso_3166_1_alpha2' => 'WF', + 'iso_3166_1_alpha3' => 'WLF', + 'iso_3166_1_numeric' => '876', + 'cctld' => 'wf', + 'name_english' => 'Wallis and Futuna', + 'name_korean' => '왈리스 퓌튀나', + 'name_native' => 'Wallis-et-Futuna', + ), + array( + 'iso_3166_1_alpha2' => 'WS', + 'iso_3166_1_alpha3' => 'WSM', + 'iso_3166_1_numeric' => '882', + 'cctld' => 'ws', + 'name_english' => 'Samoa', + 'name_korean' => '사모아', + 'name_native' => 'Samoa', + ), + array( + 'iso_3166_1_alpha2' => 'YE', + 'iso_3166_1_alpha3' => 'YEM', + 'iso_3166_1_numeric' => '887', + 'cctld' => 'ye', + 'name_english' => 'Yemen', + 'name_korean' => '예멘', + 'name_native' => 'اليمن', + ), + array( + 'iso_3166_1_alpha2' => 'ZM', + 'iso_3166_1_alpha3' => 'ZMB', + 'iso_3166_1_numeric' => '894', + 'cctld' => 'zm', + 'name_english' => 'Zambia', + 'name_korean' => '잠비아', + 'name_native' => 'Zambia', + ), +); diff --git a/common/defaults/korea.ipv4.php b/common/defaults/korea.ipv4.php new file mode 100644 index 000000000..d2ce958aa --- /dev/null +++ b/common/defaults/korea.ipv4.php @@ -0,0 +1,3863 @@ + + array ( + 0 => '17498112', + 1 => '17563647', + ), + 1 => + array ( + 0 => '17825792', + 1 => '17842175', + ), + 2 => + array ( + 0 => '23068672', + 1 => '24117247', + ), + 3 => + array ( + 0 => '28311552', + 1 => '28442623', + ), + 4 => + array ( + 0 => '29949952', + 1 => '30015487', + ), + 5 => + array ( + 0 => '30408704', + 1 => '33554431', + ), + 6 => + array ( + 0 => '234889216', + 1 => '234913791', + ), + 7 => + array ( + 0 => '235143168', + 1 => '235405311', + ), + 8 => + array ( + 0 => '236978176', + 1 => '241172479', + ), + 9 => + array ( + 0 => '243302400', + 1 => '243400703', + ), + 10 => + array ( + 0 => '243924992', + 1 => '243990527', + ), + 11 => + array ( + 0 => '247484416', + 1 => '247488511', + ), + 12 => + array ( + 0 => '248381440', + 1 => '248446975', + ), + 13 => + array ( + 0 => '453045248', + 1 => '453046271', + ), + 14 => + array ( + 0 => '453050368', + 1 => '453115903', + ), + 15 => + array ( + 0 => '455278592', + 1 => '455344127', + ), + 16 => + array ( + 0 => '459309056', + 1 => '459325439', + ), + 17 => + array ( + 0 => '459571200', + 1 => '459735039', + ), + 18 => + array ( + 0 => '460283904', + 1 => '460292095', + ), + 19 => + array ( + 0 => '460357632', + 1 => '460423167', + ), + 20 => + array ( + 0 => '460554240', + 1 => '460587007', + ), + 21 => + array ( + 0 => '460603392', + 1 => '460718079', + ), + 22 => + array ( + 0 => '460734464', + 1 => '460865535', + ), + 23 => + array ( + 0 => '461012992', + 1 => '461045759', + ), + 24 => + array ( + 0 => '461144064', + 1 => '461209599', + ), + 25 => + array ( + 0 => '461242368', + 1 => '461258751', + ), + 26 => + array ( + 0 => '463470592', + 1 => '465043455', + ), + 27 => + array ( + 0 => '468189184', + 1 => '468713471', + ), + 28 => + array ( + 0 => '469712896', + 1 => '469729279', + ), + 29 => + array ( + 0 => '606470144', + 1 => '606601215', + ), + 30 => + array ( + 0 => '654573568', + 1 => '654835711', + ), + 31 => + array ( + 0 => '655360000', + 1 => '656408575', + ), + 32 => + array ( + 0 => '661651456', + 1 => '662700031', + ), + 33 => + array ( + 0 => '705167360', + 1 => '707788799', + ), + 34 => + array ( + 0 => '710017024', + 1 => '710082559', + ), + 35 => + array ( + 0 => '736126976', + 1 => '736127999', + ), + 36 => + array ( + 0 => '736326656', + 1 => '736328703', + ), + 37 => + array ( + 0 => '736403456', + 1 => '736404479', + ), + 38 => + array ( + 0 => '736493568', + 1 => '736494591', + ), + 39 => + array ( + 0 => '736513024', + 1 => '736515071', + ), + 40 => + array ( + 0 => '736548864', + 1 => '736549887', + ), + 41 => + array ( + 0 => '737241088', + 1 => '737243135', + ), + 42 => + array ( + 0 => '737308672', + 1 => '737309695', + ), + 43 => + array ( + 0 => '737400832', + 1 => '737401855', + ), + 44 => + array ( + 0 => '737581056', + 1 => '737582079', + ), + 45 => + array ( + 0 => '737634304', + 1 => '737635327', + ), + 46 => + array ( + 0 => '737656832', + 1 => '737657855', + ), + 47 => + array ( + 0 => '737843200', + 1 => '737844223', + ), + 48 => + array ( + 0 => '737900544', + 1 => '737901567', + ), + 49 => + array ( + 0 => '738128896', + 1 => '738129919', + ), + 50 => + array ( + 0 => '738195456', + 1 => '738197503', + ), + 51 => + array ( + 0 => '759204864', + 1 => '759206911', + ), + 52 => + array ( + 0 => '759207936', + 1 => '759208959', + ), + 53 => + array ( + 0 => '759213056', + 1 => '759214079', + ), + 54 => + array ( + 0 => '762337280', + 1 => '762345471', + ), + 55 => + array ( + 0 => '762353664', + 1 => '762358783', + ), + 56 => + array ( + 0 => '762391552', + 1 => '762393599', + ), + 57 => + array ( + 0 => '762550272', + 1 => '762551295', + ), + 58 => + array ( + 0 => '762645504', + 1 => '762646527', + ), + 59 => + array ( + 0 => '762810368', + 1 => '762811391', + ), + 60 => + array ( + 0 => '762855424', + 1 => '762857471', + ), + 61 => + array ( + 0 => '762946560', + 1 => '762947583', + ), + 62 => + array ( + 0 => '763226112', + 1 => '763227135', + ), + 63 => + array ( + 0 => '822149120', + 1 => '822214655', + ), + 64 => + array ( + 0 => '823132160', + 1 => '824180735', + ), + 65 => + array ( + 0 => '825360384', + 1 => '825361407', + ), + 66 => + array ( + 0 => '825364480', + 1 => '825376767', + ), + 67 => + array ( + 0 => '825393152', + 1 => '825409535', + ), + 68 => + array ( + 0 => '825753600', + 1 => '826277887', + ), + 69 => + array ( + 0 => '830521344', + 1 => '830529535', + ), + 70 => + array ( + 0 => '831389696', + 1 => '831512575', + ), + 71 => + array ( + 0 => '832569344', + 1 => '833617919', + ), + 72 => + array ( + 0 => '837566464', + 1 => '837599231', + ), + 73 => + array ( + 0 => '837697536', + 1 => '837746687', + ), + 74 => + array ( + 0 => '837779456', + 1 => '837795839', + ), + 75 => + array ( + 0 => '838205440', + 1 => '838238207', + ), + 76 => + array ( + 0 => '838270976', + 1 => '838336511', + ), + 77 => + array ( + 0 => '838729728', + 1 => '838795263', + ), + 78 => + array ( + 0 => '974979072', + 1 => '975044607', + ), + 79 => + array ( + 0 => '977354752', + 1 => '977371135', + ), + 80 => + array ( + 0 => '977797120', + 1 => '978321407', + ), + 81 => + array ( + 0 => '978594816', + 1 => '978595839', + ), + 82 => + array ( + 0 => '978788352', + 1 => '978796543', + ), + 83 => + array ( + 0 => '979763200', + 1 => '979894271', + ), + 84 => + array ( + 0 => '980942848', + 1 => '981467135', + ), + 85 => + array ( + 0 => '982171648', + 1 => '982188031', + ), + 86 => + array ( + 0 => '982253568', + 1 => '982515711', + ), + 87 => + array ( + 0 => '982581248', + 1 => '982614015', + ), + 88 => + array ( + 0 => '982695936', + 1 => '982712319', + ), + 89 => + array ( + 0 => '982757376', + 1 => '982759423', + ), + 90 => + array ( + 0 => '982777856', + 1 => '983039999', + ), + 91 => + array ( + 0 => '984875008', + 1 => '984956927', + ), + 92 => + array ( + 0 => '985137152', + 1 => '985202687', + ), + 93 => + array ( + 0 => '987758592', + 1 => '988807167', + ), + 94 => + array ( + 0 => '989855744', + 1 => '991952895', + ), + 95 => + array ( + 0 => '995540992', + 1 => '995557375', + ), + 96 => + array ( + 0 => '999686144', + 1 => '999751679', + ), + 97 => + array ( + 0 => '999800832', + 1 => '999817215', + ), + 98 => + array ( + 0 => '999849984', + 1 => '999866367', + ), + 99 => + array ( + 0 => '1002045440', + 1 => '1002176511', + ), + 100 => + array ( + 0 => '1019478016', + 1 => '1019609087', + ), + 101 => + array ( + 0 => '1023213568', + 1 => '1023238143', + ), + 102 => + array ( + 0 => '1023721472', + 1 => '1023737855', + ), + 103 => + array ( + 0 => '1023778816', + 1 => '1023787007', + ), + 104 => + array ( + 0 => '1024380928', + 1 => '1024381951', + ), + 105 => + array ( + 0 => '1025507328', + 1 => '1026293759', + ), + 106 => + array ( + 0 => '1026539520', + 1 => '1026555903', + ), + 107 => + array ( + 0 => '1028128768', + 1 => '1029046271', + ), + 108 => + array ( + 0 => '1029701632', + 1 => '1030027263', + ), + 109 => + array ( + 0 => '1030029312', + 1 => '1030086655', + ), + 110 => + array ( + 0 => '1030091776', + 1 => '1030092799', + ), + 111 => + array ( + 0 => '1030094848', + 1 => '1030627327', + ), + 112 => + array ( + 0 => '1030631424', + 1 => '1030701055', + ), + 113 => + array ( + 0 => '1030713344', + 1 => '1030733823', + ), + 114 => + array ( + 0 => '1030746112', + 1 => '1030750207', + ), + 115 => + array ( + 0 => '1039511552', + 1 => '1039515647', + ), + 116 => + array ( + 0 => '1039523840', + 1 => '1039532031', + ), + 117 => + array ( + 0 => '1039613952', + 1 => '1039638527', + ), + 118 => + array ( + 0 => '1039646720', + 1 => '1039654911', + ), + 119 => + array ( + 0 => '1039708160', + 1 => '1039720447', + ), + 120 => + array ( + 0 => '1039753216', + 1 => '1039769599', + ), + 121 => + array ( + 0 => '1039785984', + 1 => '1039871999', + ), + 122 => + array ( + 0 => '1039876096', + 1 => '1039925247', + ), + 123 => + array ( + 0 => '1039929344', + 1 => '1039941631', + ), + 124 => + array ( + 0 => '1039949824', + 1 => '1040187391', + ), + 125 => + array ( + 0 => '1694566400', + 1 => '1694568447', + ), + 126 => + array ( + 0 => '1694572544', + 1 => '1694580735', + ), + 127 => + array ( + 0 => '1697988608', + 1 => '1697996799', + ), + 128 => + array ( + 0 => '1698103296', + 1 => '1698136063', + ), + 129 => + array ( + 0 => '1699676160', + 1 => '1699741695', + ), + 130 => + array ( + 0 => '1701150720', + 1 => '1701183487', + ), + 131 => + array ( + 0 => '1707737088', + 1 => '1707802623', + ), + 132 => + array ( + 0 => '1709899776', + 1 => '1709965311', + ), + 133 => + array ( + 0 => '1710882816', + 1 => '1710948351', + ), + 134 => + array ( + 0 => '1728203776', + 1 => '1728204799', + ), + 135 => + array ( + 0 => '1728205824', + 1 => '1728206847', + ), + 136 => + array ( + 0 => '1728207872', + 1 => '1728208895', + ), + 137 => + array ( + 0 => '1728259072', + 1 => '1728260095', + ), + 138 => + array ( + 0 => '1728327680', + 1 => '1728328703', + ), + 139 => + array ( + 0 => '1728353280', + 1 => '1728354303', + ), + 140 => + array ( + 0 => '1728360448', + 1 => '1728362495', + ), + 141 => + array ( + 0 => '1728413696', + 1 => '1728414719', + ), + 142 => + array ( + 0 => '1728417792', + 1 => '1728418815', + ), + 143 => + array ( + 0 => '1728464896', + 1 => '1728465919', + ), + 144 => + array ( + 0 => '1728466944', + 1 => '1728467967', + ), + 145 => + array ( + 0 => '1728472064', + 1 => '1728473087', + ), + 146 => + array ( + 0 => '1728490496', + 1 => '1728491519', + ), + 147 => + array ( + 0 => '1728520192', + 1 => '1728521215', + ), + 148 => + array ( + 0 => '1728560640', + 1 => '1728561151', + ), + 149 => + array ( + 0 => '1728574464', + 1 => '1728575487', + ), + 150 => + array ( + 0 => '1728603136', + 1 => '1728604159', + ), + 151 => + array ( + 0 => '1728636416', + 1 => '1728636671', + ), + 152 => + array ( + 0 => '1728651264', + 1 => '1728652287', + ), + 153 => + array ( + 0 => '1728675840', + 1 => '1728676863', + ), + 154 => + array ( + 0 => '1728732160', + 1 => '1728733183', + ), + 155 => + array ( + 0 => '1728763904', + 1 => '1728764927', + ), + 156 => + array ( + 0 => '1728780288', + 1 => '1728781311', + ), + 157 => + array ( + 0 => '1728785408', + 1 => '1728786431', + ), + 158 => + array ( + 0 => '1728788480', + 1 => '1728789503', + ), + 159 => + array ( + 0 => '1728806912', + 1 => '1728807935', + ), + 160 => + array ( + 0 => '1728837632', + 1 => '1728838655', + ), + 161 => + array ( + 0 => '1728903168', + 1 => '1728905215', + ), + 162 => + array ( + 0 => '1728918528', + 1 => '1728919551', + ), + 163 => + array ( + 0 => '1728946176', + 1 => '1728947199', + ), + 164 => + array ( + 0 => '1729330176', + 1 => '1729331199', + ), + 165 => + array ( + 0 => '1729378816', + 1 => '1729379071', + ), + 166 => + array ( + 0 => '1729393664', + 1 => '1729394687', + ), + 167 => + array ( + 0 => '1729480704', + 1 => '1729481727', + ), + 168 => + array ( + 0 => '1729551360', + 1 => '1729552383', + ), + 169 => + array ( + 0 => '1729581056', + 1 => '1729583103', + ), + 170 => + array ( + 0 => '1729628160', + 1 => '1729629183', + ), + 171 => + array ( + 0 => '1729695744', + 1 => '1729696767', + ), + 172 => + array ( + 0 => '1729855488', + 1 => '1729856511', + ), + 173 => + array ( + 0 => '1729860608', + 1 => '1729861631', + ), + 174 => + array ( + 0 => '1729903616', + 1 => '1729905663', + ), + 175 => + array ( + 0 => '1730046976', + 1 => '1730047999', + ), + 176 => + array ( + 0 => '1730060288', + 1 => '1730061311', + ), + 177 => + array ( + 0 => '1730071552', + 1 => '1730072575', + ), + 178 => + array ( + 0 => '1730130944', + 1 => '1730131967', + ), + 179 => + array ( + 0 => '1730549760', + 1 => '1730550783', + ), + 180 => + array ( + 0 => '1730618368', + 1 => '1730619391', + ), + 181 => + array ( + 0 => '1730852864', + 1 => '1730853887', + ), + 182 => + array ( + 0 => '1730887680', + 1 => '1730887935', + ), + 183 => + array ( + 0 => '1730902016', + 1 => '1730903039', + ), + 184 => + array ( + 0 => '1731275776', + 1 => '1731276799', + ), + 185 => + array ( + 0 => '1731340288', + 1 => '1731341311', + ), + 186 => + array ( + 0 => '1731438592', + 1 => '1731441663', + ), + 187 => + array ( + 0 => '1731442688', + 1 => '1731447807', + ), + 188 => + array ( + 0 => '1731457024', + 1 => '1731461119', + ), + 189 => + array ( + 0 => '1731512320', + 1 => '1731513343', + ), + 190 => + array ( + 0 => '1731555840', + 1 => '1731556095', + ), + 191 => + array ( + 0 => '1731666688', + 1 => '1731666943', + ), + 192 => + array ( + 0 => '1731705856', + 1 => '1731706879', + ), + 193 => + array ( + 0 => '1731804160', + 1 => '1731805183', + ), + 194 => + array ( + 0 => '1731959808', + 1 => '1731960831', + ), + 195 => + array ( + 0 => '1732016128', + 1 => '1732018175', + ), + 196 => + array ( + 0 => '1732174848', + 1 => '1732175871', + ), + 197 => + array ( + 0 => '1740794880', + 1 => '1740795903', + ), + 198 => + array ( + 0 => '1740831744', + 1 => '1740832767', + ), + 199 => + array ( + 0 => '1741572608', + 1 => '1741573119', + ), + 200 => + array ( + 0 => '1741794304', + 1 => '1741795327', + ), + 201 => + array ( + 0 => '1742882816', + 1 => '1742884863', + ), + 202 => + array ( + 0 => '1742888960', + 1 => '1742889983', + ), + 203 => + array ( + 0 => '1743100928', + 1 => '1743101951', + ), + 204 => + array ( + 0 => '1743155200', + 1 => '1743156223', + ), + 205 => + array ( + 0 => '1743224832', + 1 => '1743225855', + ), + 206 => + array ( + 0 => '1743389696', + 1 => '1743390719', + ), + 207 => + array ( + 0 => '1743460352', + 1 => '1743461375', + ), + 208 => + array ( + 0 => '1743590400', + 1 => '1743591423', + ), + 209 => + array ( + 0 => '1743714304', + 1 => '1743715327', + ), + 210 => + array ( + 0 => '1743745024', + 1 => '1743746047', + ), + 211 => + array ( + 0 => '1743776768', + 1 => '1743778815', + ), + 212 => + array ( + 0 => '1743789056', + 1 => '1743790079', + ), + 213 => + array ( + 0 => '1743794176', + 1 => '1743795199', + ), + 214 => + array ( + 0 => '1744029696', + 1 => '1744030719', + ), + 215 => + array ( + 0 => '1744054272', + 1 => '1744055295', + ), + 216 => + array ( + 0 => '1744071680', + 1 => '1744072703', + ), + 217 => + array ( + 0 => '1744189440', + 1 => '1744190463', + ), + 218 => + array ( + 0 => '1744235520', + 1 => '1744236543', + ), + 219 => + array ( + 0 => '1744296960', + 1 => '1744297983', + ), + 220 => + array ( + 0 => '1744300032', + 1 => '1744301055', + ), + 221 => + array ( + 0 => '1744332800', + 1 => '1744333823', + ), + 222 => + array ( + 0 => '1744378880', + 1 => '1744379903', + ), + 223 => + array ( + 0 => '1744529408', + 1 => '1744530431', + ), + 224 => + array ( + 0 => '1744695296', + 1 => '1744696319', + ), + 225 => + array ( + 0 => '1779040256', + 1 => '1779073023', + ), + 226 => + array ( + 0 => '1784676352', + 1 => '1785200639', + ), + 227 => + array ( + 0 => '1794113536', + 1 => '1795162111', + ), + 228 => + array ( + 0 => '1845772288', + 1 => '1845788671', + ), + 229 => + array ( + 0 => '1845854208', + 1 => '1845886975', + ), + 230 => + array ( + 0 => '1846018048', + 1 => '1846542335', + ), + 231 => + array ( + 0 => '1847738368', + 1 => '1847754751', + ), + 232 => + array ( + 0 => '1847787520', + 1 => '1847803903', + ), + 233 => + array ( + 0 => '1847812096', + 1 => '1847853055', + ), + 234 => + array ( + 0 => '1848385536', + 1 => '1848393727', + ), + 235 => + array ( + 0 => '1848426496', + 1 => '1848639487', + ), + 236 => + array ( + 0 => '1849950208', + 1 => '1850212351', + ), + 237 => + array ( + 0 => '1850490880', + 1 => '1850507263', + ), + 238 => + array ( + 0 => '1850510336', + 1 => '1850511359', + ), + 239 => + array ( + 0 => '1851528192', + 1 => '1851528959', + ), + 240 => + array ( + 0 => '1851555840', + 1 => '1851588607', + ), + 241 => + array ( + 0 => '1851594752', + 1 => '1851596799', + ), + 242 => + array ( + 0 => '1851617280', + 1 => '1851637759', + ), + 243 => + array ( + 0 => '1856307200', + 1 => '1856315391', + ), + 244 => + array ( + 0 => '1856323584', + 1 => '1856339967', + ), + 245 => + array ( + 0 => '1856791552', + 1 => '1856798719', + ), + 246 => + array ( + 0 => '1860722688', + 1 => '1860723711', + ), + 247 => + array ( + 0 => '1866563584', + 1 => '1866579967', + ), + 248 => + array ( + 0 => '1866715136', + 1 => '1866727423', + ), + 249 => + array ( + 0 => '1868267520', + 1 => '1868283903', + ), + 250 => + array ( + 0 => '1868348416', + 1 => '1868349439', + ), + 251 => + array ( + 0 => '1870004224', + 1 => '1870036991', + ), + 252 => + array ( + 0 => '1873477632', + 1 => '1873510399', + ), + 253 => + array ( + 0 => '1876557824', + 1 => '1876688895', + ), + 254 => + array ( + 0 => '1876762624', + 1 => '1876764671', + ), + 255 => + array ( + 0 => '1883799552', + 1 => '1883832319', + ), + 256 => + array ( + 0 => '1884028928', + 1 => '1884159999', + ), + 257 => + array ( + 0 => '1885995008', + 1 => '1886191615', + ), + 258 => + array ( + 0 => '1886199808', + 1 => '1886207999', + ), + 259 => + array ( + 0 => '1886978048', + 1 => '1886986239', + ), + 260 => + array ( + 0 => '1887027200', + 1 => '1887043583', + ), + 261 => + array ( + 0 => '1887764480', + 1 => '1887813631', + ), + 262 => + array ( + 0 => '1887993856', + 1 => '1888026623', + ), + 263 => + array ( + 0 => '1888071680', + 1 => '1888073727', + ), + 264 => + array ( + 0 => '1888239616', + 1 => '1888255999', + ), + 265 => + array ( + 0 => '1888260096', + 1 => '1888264191', + ), + 266 => + array ( + 0 => '1888272384', + 1 => '1888288767', + ), + 267 => + array ( + 0 => '1888485376', + 1 => '1891631103', + ), + 268 => + array ( + 0 => '1891942400', + 1 => '1891950591', + ), + 269 => + array ( + 0 => '1892941824', + 1 => '1893015551', + ), + 270 => + array ( + 0 => '1893072896', + 1 => '1893138431', + ), + 271 => + array ( + 0 => '1893203968', + 1 => '1893728255', + ), + 272 => + array ( + 0 => '1896480768', + 1 => '1896497151', + ), + 273 => + array ( + 0 => '1897201664', + 1 => '1897209855', + ), + 274 => + array ( + 0 => '1897758720', + 1 => '1897779199', + ), + 275 => + array ( + 0 => '1897791488', + 1 => '1897824255', + ), + 276 => + array ( + 0 => '1899268096', + 1 => '1899270143', + ), + 277 => + array ( + 0 => '1899282432', + 1 => '1899290623', + ), + 278 => + array ( + 0 => '1899724800', + 1 => '1899741183', + ), + 279 => + array ( + 0 => '1899757568', + 1 => '1899831295', + ), + 280 => + array ( + 0 => '1899849728', + 1 => '1899850751', + ), + 281 => + array ( + 0 => '1904361472', + 1 => '1904369663', + ), + 282 => + array ( + 0 => '1904377856', + 1 => '1904476159', + ), + 283 => + array ( + 0 => '1908424704', + 1 => '1908441087', + ), + 284 => + array ( + 0 => '1908756480', + 1 => '1908760575', + ), + 285 => + array ( + 0 => '1908801536', + 1 => '1908899839', + ), + 286 => + array ( + 0 => '1909981184', + 1 => '1910112255', + ), + 287 => + array ( + 0 => '1914503168', + 1 => '1914544127', + ), + 288 => + array ( + 0 => '1914568704', + 1 => '1914576895', + ), + 289 => + array ( + 0 => '1914580992', + 1 => '1914585087', + ), + 290 => + array ( + 0 => '1914601472', + 1 => '1914634239', + ), + 291 => + array ( + 0 => '1914642432', + 1 => '1914650623', + ), + 292 => + array ( + 0 => '1914662912', + 1 => '1914667007', + ), + 293 => + array ( + 0 => '1916010496', + 1 => '1916141567', + ), + 294 => + array ( + 0 => '1917190144', + 1 => '1917321215', + ), + 295 => + array ( + 0 => '1919680512', + 1 => '1919729663', + ), + 296 => + array ( + 0 => '1919844352', + 1 => '1919877119', + ), + 297 => + array ( + 0 => '1919885312', + 1 => '1919893503', + ), + 298 => + array ( + 0 => '1919926272', + 1 => '1919942655', + ), + 299 => + array ( + 0 => '1921073152', + 1 => '1921089535', + ), + 300 => + array ( + 0 => '1921105920', + 1 => '1921122303', + ), + 301 => + array ( + 0 => '1921843200', + 1 => '1921851391', + ), + 302 => + array ( + 0 => '1921853440', + 1 => '1921855487', + ), + 303 => + array ( + 0 => '1921900544', + 1 => '1921908735', + ), + 304 => + array ( + 0 => '1925644288', + 1 => '1925660671', + ), + 305 => + array ( + 0 => '1925677056', + 1 => '1926234111', + ), + 306 => + array ( + 0 => '1929379840', + 1 => '1930952703', + ), + 307 => + array ( + 0 => '1931436032', + 1 => '1931444223', + ), + 308 => + array ( + 0 => '1932001280', + 1 => '1932132351', + ), + 309 => + array ( + 0 => '1933836288', + 1 => '1933901823', + ), + 310 => + array ( + 0 => '1933926400', + 1 => '1933934591', + ), + 311 => + array ( + 0 => '1934032896', + 1 => '1934098431', + ), + 312 => + array ( + 0 => '1934925824', + 1 => '1934927871', + ), + 313 => + array ( + 0 => '1934991360', + 1 => '1934999551', + ), + 314 => + array ( + 0 => '1935015936', + 1 => '1935081471', + ), + 315 => + array ( + 0 => '1935147008', + 1 => '1935671295', + ), + 316 => + array ( + 0 => '1937686528', + 1 => '1937702911', + ), + 317 => + array ( + 0 => '1938292736', + 1 => '1938948095', + ), + 318 => + array ( + 0 => '1939865600', + 1 => '1939898367', + ), + 319 => + array ( + 0 => '1939931136', + 1 => '1939996671', + ), + 320 => + array ( + 0 => '1940238336', + 1 => '1940240383', + ), + 321 => + array ( + 0 => '1941053440', + 1 => '1941057535', + ), + 322 => + array ( + 0 => '1941061632', + 1 => '1941069823', + ), + 323 => + array ( + 0 => '1941655552', + 1 => '1941657599', + ), + 324 => + array ( + 0 => '1948254208', + 1 => '1949302783', + ), + 325 => + array ( + 0 => '1950547968', + 1 => '1950580735', + ), + 326 => + array ( + 0 => '1950621696', + 1 => '1950629887', + ), + 327 => + array ( + 0 => '1951662080', + 1 => '1951727615', + ), + 328 => + array ( + 0 => '1952030720', + 1 => '1952038911', + ), + 329 => + array ( + 0 => '1952110592', + 1 => '1952112639', + ), + 330 => + array ( + 0 => '1952292864', + 1 => '1952317439', + ), + 331 => + array ( + 0 => '1954021376', + 1 => '1954545663', + ), + 332 => + array ( + 0 => '1958825984', + 1 => '1958830079', + ), + 333 => + array ( + 0 => '1959239680', + 1 => '1959241727', + ), + 334 => + array ( + 0 => '1959264256', + 1 => '1959395327', + ), + 335 => + array ( + 0 => '1960050688', + 1 => '1960058879', + ), + 336 => + array ( + 0 => '1962885120', + 1 => '1962901503', + ), + 337 => + array ( + 0 => '1963982848', + 1 => '1964113919', + ), + 338 => + array ( + 0 => '1964265472', + 1 => '1964269567', + ), + 339 => + array ( + 0 => '1964294144', + 1 => '1964310527', + ), + 340 => + array ( + 0 => '1966342144', + 1 => '1966407679', + ), + 341 => + array ( + 0 => '1966424064', + 1 => '1966440447', + ), + 342 => + array ( + 0 => '1966456832', + 1 => '1966473215', + ), + 343 => + array ( + 0 => '1966571520', + 1 => '1966587903', + ), + 344 => + array ( + 0 => '1966768128', + 1 => '1966772223', + ), + 345 => + array ( + 0 => '1970143232', + 1 => '1970210303', + ), + 346 => + array ( + 0 => '1970144768', + 1 => '1970211071', + ), + 347 => + array ( + 0 => '1970145536', + 1 => '1970274303', + ), + 348 => + array ( + 0 => '1970995200', + 1 => '1971060735', + ), + 349 => + array ( + 0 => '1981808640', + 1 => '1983905791', + ), + 350 => + array ( + 0 => '1984135168', + 1 => '1984151551', + ), + 351 => + array ( + 0 => '1985675264', + 1 => '1985708031', + ), + 352 => + array ( + 0 => '1985712128', + 1 => '1985716223', + ), + 353 => + array ( + 0 => '1986510848', + 1 => '1986519039', + ), + 354 => + array ( + 0 => '1986764800', + 1 => '1986768895', + ), + 355 => + array ( + 0 => '1988083712', + 1 => '1988362239', + ), + 356 => + array ( + 0 => '1988870144', + 1 => '1988886527', + ), + 357 => + array ( + 0 => '1991245824', + 1 => '1991311359', + ), + 358 => + array ( + 0 => '1993867264', + 1 => '1994391551', + ), + 359 => + array ( + 0 => '1995046912', + 1 => '1995177983', + ), + 360 => + array ( + 0 => '1997602816', + 1 => '1997611007', + ), + 361 => + array ( + 0 => '1997619200', + 1 => '1997635583', + ), + 362 => + array ( + 0 => '1997684736', + 1 => '1997701119', + ), + 363 => + array ( + 0 => '1998487552', + 1 => '1998503935', + ), + 364 => + array ( + 0 => '1998581760', + 1 => '1998585855', + ), + 365 => + array ( + 0 => '1999282176', + 1 => '1999290367', + ), + 366 => + array ( + 0 => '2000191488', + 1 => '2000224255', + ), + 367 => + array ( + 0 => '2000355328', + 1 => '2000371711', + ), + 368 => + array ( + 0 => '2000674816', + 1 => '2001207295', + ), + 369 => + array ( + 0 => '2001420288', + 1 => '2001453055', + ), + 370 => + array ( + 0 => '2001559552', + 1 => '2001567743', + ), + 371 => + array ( + 0 => '2001870848', + 1 => '2001879039', + ), + 372 => + array ( + 0 => '2006216704', + 1 => '2006228991', + ), + 373 => + array ( + 0 => '2006253568', + 1 => '2006319103', + ), + 374 => + array ( + 0 => '2007040000', + 1 => '2007048191', + ), + 375 => + array ( + 0 => '2009071616', + 1 => '2011168767', + ), + 376 => + array ( + 0 => '2011951104', + 1 => '2011953151', + ), + 377 => + array ( + 0 => '2015199232', + 1 => '2015203327', + ), + 378 => + array ( + 0 => '2016559104', + 1 => '2016583679', + ), + 379 => + array ( + 0 => '2018050048', + 1 => '2018115583', + ), + 380 => + array ( + 0 => '2022195200', + 1 => '2022211583', + ), + 381 => + array ( + 0 => '2022572032', + 1 => '2022637567', + ), + 382 => + array ( + 0 => '2022678528', + 1 => '2022703103', + ), + 383 => + array ( + 0 => '2030059520', + 1 => '2030108671', + ), + 384 => + array ( + 0 => '2030125056', + 1 => '2030141439', + ), + 385 => + array ( + 0 => '2033324032', + 1 => '2033328127', + ), + 386 => + array ( + 0 => '2033336320', + 1 => '2033352703', + ), + 387 => + array ( + 0 => '2033377280', + 1 => '2033385471', + ), + 388 => + array ( + 0 => '2033516544', + 1 => '2033582079', + ), + 389 => + array ( + 0 => '2033631232', + 1 => '2033647615', + ), + 390 => + array ( + 0 => '2033664000', + 1 => '2033696767', + ), + 391 => + array ( + 0 => '2034237440', + 1 => '2034499583', + ), + 392 => + array ( + 0 => '2035154944', + 1 => '2035220479', + ), + 393 => + array ( + 0 => '2035810304', + 1 => '2035875839', + ), + 394 => + array ( + 0 => '2036613120', + 1 => '2036629503', + ), + 395 => + array ( + 0 => '2036711424', + 1 => '2036715519', + ), + 396 => + array ( + 0 => '2036719616', + 1 => '2036727807', + ), + 397 => + array ( + 0 => '2038169600', + 1 => '2038366207', + ), + 398 => + array ( + 0 => '2038382592', + 1 => '2038415359', + ), + 399 => + array ( + 0 => '2038431744', + 1 => '2042626047', + ), + 400 => + array ( + 0 => '2043166720', + 1 => '2043183103', + ), + 401 => + array ( + 0 => '2046558208', + 1 => '2046705663', + ), + 402 => + array ( + 0 => '2046722048', + 1 => '2046754815', + ), + 403 => + array ( + 0 => '2046822400', + 1 => '2046824447', + ), + 404 => + array ( + 0 => '2046828544', + 1 => '2046836735', + ), + 405 => + array ( + 0 => '2048917504', + 1 => '2049966079', + ), + 406 => + array ( + 0 => '2050048000', + 1 => '2050064383', + ), + 407 => + array ( + 0 => '2053341184', + 1 => '2053373951', + ), + 408 => + array ( + 0 => '2053382144', + 1 => '2053390335', + ), + 409 => + array ( + 0 => '2053439488', + 1 => '2053505023', + ), + 410 => + array ( + 0 => '2055217152', + 1 => '2055229439', + ), + 411 => + array ( + 0 => '2055241728', + 1 => '2055274495', + ), + 412 => + array ( + 0 => '2055327744', + 1 => '2055329791', + ), + 413 => + array ( + 0 => '2055335936', + 1 => '2055340031', + ), + 414 => + array ( + 0 => '2056806400', + 1 => '2056814591', + ), + 415 => + array ( + 0 => '2056847360', + 1 => '2056912895', + ), + 416 => + array ( + 0 => '2059878400', + 1 => '2059927551', + ), + 417 => + array ( + 0 => '2060066816', + 1 => '2060075007', + ), + 418 => + array ( + 0 => '2060091392', + 1 => '2060189695', + ), + 419 => + array ( + 0 => '2063351808', + 1 => '2063368191', + ), + 420 => + array ( + 0 => '2063384576', + 1 => '2063392767', + ), + 421 => + array ( + 0 => '2063499264', + 1 => '2063532031', + ), + 422 => + array ( + 0 => '2063597568', + 1 => '2063601663', + ), + 423 => + array ( + 0 => '2065694720', + 1 => '2066743295', + ), + 424 => + array ( + 0 => '2070061056', + 1 => '2070077439', + ), + 425 => + array ( + 0 => '2070102016', + 1 => '2070118399', + ), + 426 => + array ( + 0 => '2070192128', + 1 => '2070200319', + ), + 427 => + array ( + 0 => '2070679552', + 1 => '2070683647', + ), + 428 => + array ( + 0 => '2070716416', + 1 => '2070724607', + ), + 429 => + array ( + 0 => '2070740992', + 1 => '2070806527', + ), + 430 => + array ( + 0 => '2070872064', + 1 => '2070937599', + ), + 431 => + array ( + 0 => '2072772608', + 1 => '2073034751', + ), + 432 => + array ( + 0 => '2076639232', + 1 => '2076671999', + ), + 433 => + array ( + 0 => '2076721152', + 1 => '2076737535', + ), + 434 => + array ( + 0 => '2077491200', + 1 => '2077753343', + ), + 435 => + array ( + 0 => '2078539776', + 1 => '2078670847', + ), + 436 => + array ( + 0 => '2079850496', + 1 => '2079916031', + ), + 437 => + array ( + 0 => '2079981568', + 1 => '2080112639', + ), + 438 => + array ( + 0 => '2080260096', + 1 => '2080268287', + ), + 439 => + array ( + 0 => '2080276480', + 1 => '2080309247', + ), + 440 => + array ( + 0 => '2080374784', + 1 => '2080636927', + ), + 441 => + array ( + 0 => '2080702464', + 1 => '2080767999', + ), + 442 => + array ( + 0 => '2082209792', + 1 => '2082258943', + ), + 443 => + array ( + 0 => '2083389440', + 1 => '2083454975', + ), + 444 => + array ( + 0 => '2083520512', + 1 => '2084569087', + ), + 445 => + array ( + 0 => '2084745216', + 1 => '2084749311', + ), + 446 => + array ( + 0 => '2084753408', + 1 => '2084757503', + ), + 447 => + array ( + 0 => '2085617664', + 1 => '2085683199', + ), + 448 => + array ( + 0 => '2087649280', + 1 => '2087714815', + ), + 449 => + array ( + 0 => '2089287680', + 1 => '2089549823', + ), + 450 => + array ( + 0 => '2089943040', + 1 => '2089959423', + ), + 451 => + array ( + 0 => '2090434560', + 1 => '2090467327', + ), + 452 => + array ( + 0 => '2093088768', + 1 => '2093154303', + ), + 453 => + array ( + 0 => '2093195264', + 1 => '2093203455', + ), + 454 => + array ( + 0 => '2093211648', + 1 => '2093219839', + ), + 455 => + array ( + 0 => '2093318144', + 1 => '2093342719', + ), + 456 => + array ( + 0 => '2093350912', + 1 => '2093383679', + ), + 457 => + array ( + 0 => '2093416448', + 1 => '2093432831', + ), + 458 => + array ( + 0 => '2093449216', + 1 => '2093481983', + ), + 459 => + array ( + 0 => '2094530560', + 1 => '2094596095', + ), + 460 => + array ( + 0 => '2094645248', + 1 => '2094653439', + ), + 461 => + array ( + 0 => '2096300032', + 1 => '2096332799', + ), + 462 => + array ( + 0 => '2097053696', + 1 => '2097086463', + ), + 463 => + array ( + 0 => '2097643520', + 1 => '2097676287', + ), + 464 => + array ( + 0 => '2099216384', + 1 => '2099232767', + ), + 465 => + array ( + 0 => '2100876800', + 1 => '2100877055', + ), + 466 => + array ( + 0 => '2100887552', + 1 => '2100953087', + ), + 467 => + array ( + 0 => '2101084160', + 1 => '2101108735', + ), + 468 => + array ( + 0 => '2101149696', + 1 => '2101182463', + ), + 469 => + array ( + 0 => '2101270528', + 1 => '2101272575', + ), + 470 => + array ( + 0 => '2105540608', + 1 => '2107637759', + ), + 471 => + array ( + 0 => '2108686336', + 1 => '2109734911', + ), + 472 => + array ( + 0 => '2110799872', + 1 => '2110816255', + ), + 473 => + array ( + 0 => '2110832640', + 1 => '2110865407', + ), + 474 => + array ( + 0 => '2110898176', + 1 => '2110914559', + ), + 475 => + array ( + 0 => '2112880640', + 1 => '2113683455', + ), + 476 => + array ( + 0 => '2156265472', + 1 => '2156331007', + ), + 477 => + array ( + 0 => '2180907008', + 1 => '2180972543', + ), + 478 => + array ( + 0 => '2253062144', + 1 => '2253127679', + ), + 479 => + array ( + 0 => '2302935040', + 1 => '2303000575', + ), + 480 => + array ( + 0 => '2341863424', + 1 => '2341928959', + ), + 481 => + array ( + 0 => '2380201984', + 1 => '2380267519', + ), + 482 => + array ( + 0 => '2415394816', + 1 => '2415460351', + ), + 483 => + array ( + 0 => '2466643968', + 1 => '2466709503', + ), + 484 => + array ( + 0 => '2469068800', + 1 => '2469134335', + ), + 485 => + array ( + 0 => '2469265408', + 1 => '2469396479', + ), + 486 => + array ( + 0 => '2523612160', + 1 => '2523613183', + ), + 487 => + array ( + 0 => '2523615232', + 1 => '2523617279', + ), + 488 => + array ( + 0 => '2525093888', + 1 => '2525094911', + ), + 489 => + array ( + 0 => '2526412800', + 1 => '2526478335', + ), + 490 => + array ( + 0 => '2528575488', + 1 => '2528641023', + ), + 491 => + array ( + 0 => '2529492992', + 1 => '2529558527', + ), + 492 => + array ( + 0 => '2532475904', + 1 => '2532476927', + ), + 493 => + array ( + 0 => '2532478976', + 1 => '2532479999', + ), + 494 => + array ( + 0 => '2556624896', + 1 => '2556690431', + ), + 495 => + array ( + 0 => '2559901696', + 1 => '2559967231', + ), + 496 => + array ( + 0 => '2584346624', + 1 => '2584412159', + ), + 497 => + array ( + 0 => '2615541760', + 1 => '2615607295', + ), + 498 => + array ( + 0 => '2626879488', + 1 => '2626945023', + ), + 499 => + array ( + 0 => '2646933504', + 1 => '2646999039', + ), + 500 => + array ( + 0 => '2653683712', + 1 => '2653749247', + ), + 501 => + array ( + 0 => '2709127168', + 1 => '2709192703', + ), + 502 => + array ( + 0 => '2738199552', + 1 => '2738200575', + ), + 503 => + array ( + 0 => '2744647680', + 1 => '2744713215', + ), + 504 => + array ( + 0 => '2746482688', + 1 => '2746548223', + ), + 505 => + array ( + 0 => '2748645376', + 1 => '2748710911', + ), + 506 => + array ( + 0 => '2749235200', + 1 => '2749300735', + ), + 507 => + array ( + 0 => '2749693952', + 1 => '2749759487', + ), + 508 => + array ( + 0 => '2750349312', + 1 => '2750414847', + ), + 509 => + array ( + 0 => '2751397888', + 1 => '2751463423', + ), + 510 => + array ( + 0 => '2759589888', + 1 => '2759720959', + ), + 511 => + array ( + 0 => '2776891392', + 1 => '2777022463', + ), + 512 => + array ( + 0 => '2777481216', + 1 => '2777546751', + ), + 513 => + array ( + 0 => '2780430336', + 1 => '2780495871', + ), + 514 => + array ( + 0 => '2780954624', + 1 => '2781020159', + ), + 515 => + array ( + 0 => '2782199808', + 1 => '2782265343', + ), + 516 => + array ( + 0 => '2783248384', + 1 => '2783313919', + ), + 517 => + array ( + 0 => '2784165888', + 1 => '2784296959', + ), + 518 => + array ( + 0 => '2784362496', + 1 => '2784428031', + ), + 519 => + array ( + 0 => '2790195200', + 1 => '2790260735', + ), + 520 => + array ( + 0 => '2791768064', + 1 => '2791899135', + ), + 521 => + array ( + 0 => '2793209856', + 1 => '2793275391', + ), + 522 => + array ( + 0 => '2823684096', + 1 => '2823749631', + ), + 523 => + array ( + 0 => '2826108928', + 1 => '2826174463', + ), + 524 => + array ( + 0 => '2826829824', + 1 => '2826895359', + ), + 525 => + array ( + 0 => '2827157504', + 1 => '2827223039', + ), + 526 => + array ( + 0 => '2828664832', + 1 => '2828730367', + ), + 527 => + array ( + 0 => '2830893056', + 1 => '2830958591', + ), + 528 => + array ( + 0 => '2832924672', + 1 => '2832990207', + ), + 529 => + array ( + 0 => '2834825216', + 1 => '2834956287', + ), + 530 => + array ( + 0 => '2844524544', + 1 => '2844590079', + ), + 531 => + array ( + 0 => '2848980992', + 1 => '2850029567', + ), + 532 => + array ( + 0 => '2937856000', + 1 => '2937860095', + ), + 533 => + array ( + 0 => '2938699776', + 1 => '2938703871', + ), + 534 => + array ( + 0 => '2939002880', + 1 => '2939004927', + ), + 535 => + array ( + 0 => '2939011072', + 1 => '2939027455', + ), + 536 => + array ( + 0 => '2942976000', + 1 => '2942992383', + ), + 537 => + array ( + 0 => '2943041536', + 1 => '2943057919', + ), + 538 => + array ( + 0 => '2943291392', + 1 => '2943295487', + ), + 539 => + array ( + 0 => '2943352832', + 1 => '2944401407', + ), + 540 => + array ( + 0 => '2946367488', + 1 => '2946375679', + ), + 541 => + array ( + 0 => '2947579904', + 1 => '2947583999', + ), + 542 => + array ( + 0 => '2948595712', + 1 => '2952790015', + ), + 543 => + array ( + 0 => '3024093184', + 1 => '3024617471', + ), + 544 => + array ( + 0 => '3025141760', + 1 => '3025403903', + ), + 545 => + array ( + 0 => '3025944576', + 1 => '3025960959', + ), + 546 => + array ( + 0 => '3025989632', + 1 => '3025993727', + ), + 547 => + array ( + 0 => '3028484096', + 1 => '3028500479', + ), + 548 => + array ( + 0 => '3028549632', + 1 => '3028811775', + ), + 549 => + array ( + 0 => '3029644288', + 1 => '3029645311', + ), + 550 => + array ( + 0 => '3029778432', + 1 => '3029788671', + ), + 551 => + array ( + 0 => '3031826432', + 1 => '3031891967', + ), + 552 => + array ( + 0 => '3032301568', + 1 => '3032317951', + ), + 553 => + array ( + 0 => '3032330240', + 1 => '3032334335', + ), + 554 => + array ( + 0 => '3033661440', + 1 => '3033694207', + ), + 555 => + array ( + 0 => '3033710592', + 1 => '3033712639', + ), + 556 => + array ( + 0 => '3033726976', + 1 => '3033743359', + ), + 557 => + array ( + 0 => '3034578944', + 1 => '3035103231', + ), + 558 => + array ( + 0 => '3035217920', + 1 => '3035234303', + ), + 559 => + array ( + 0 => '3035365376', + 1 => '3035627519', + ), + 560 => + array ( + 0 => '3055484928', + 1 => '3055550463', + ), + 561 => + array ( + 0 => '3056734208', + 1 => '3056746495', + ), + 562 => + array ( + 0 => '3064029184', + 1 => '3064135679', + ), + 563 => + array ( + 0 => '3064168448', + 1 => '3064201215', + ), + 564 => + array ( + 0 => '3064725504', + 1 => '3064791039', + ), + 565 => + array ( + 0 => '3064811520', + 1 => '3064823807', + ), + 566 => + array ( + 0 => '3064832000', + 1 => '3064840191', + ), + 567 => + array ( + 0 => '3066036224', + 1 => '3066560511', + ), + 568 => + array ( + 0 => '3067084800', + 1 => '3068657663', + ), + 569 => + array ( + 0 => '3068993536', + 1 => '3069018111', + ), + 570 => + array ( + 0 => '3069034496', + 1 => '3069050879', + ), + 571 => + array ( + 0 => '3069968384', + 1 => '3069984767', + ), + 572 => + array ( + 0 => '3070001152', + 1 => '3070033919', + ), + 573 => + array ( + 0 => '3070197760', + 1 => '3070230527', + ), + 574 => + array ( + 0 => '3075375104', + 1 => '3075383295', + ), + 575 => + array ( + 0 => '3075391488', + 1 => '3075407871', + ), + 576 => + array ( + 0 => '3075915776', + 1 => '3075932159', + ), + 577 => + array ( + 0 => '3076161536', + 1 => '3076169727', + ), + 578 => + array ( + 0 => '3076243456', + 1 => '3076259839', + ), + 579 => + array ( + 0 => '3076521984', + 1 => '3078619135', + ), + 580 => + array ( + 0 => '3221576192', + 1 => '3221576447', + ), + 581 => + array ( + 0 => '3227779584', + 1 => '3227779839', + ), + 582 => + array ( + 0 => '3228045056', + 1 => '3228045311', + ), + 583 => + array ( + 0 => '3234014976', + 1 => '3234015487', + ), + 584 => + array ( + 0 => '3234564608', + 1 => '3234566911', + ), + 585 => + array ( + 0 => '3237345536', + 1 => '3237346303', + ), + 586 => + array ( + 0 => '3237548032', + 1 => '3237552127', + ), + 587 => + array ( + 0 => '3389198336', + 1 => '3389202431', + ), + 588 => + array ( + 0 => '3389562880', + 1 => '3389571071', + ), + 589 => + array ( + 0 => '3389938176', + 1 => '3389938687', + ), + 590 => + array ( + 0 => '3389941504', + 1 => '3389941759', + ), + 591 => + array ( + 0 => '3389957376', + 1 => '3389957631', + ), + 592 => + array ( + 0 => '3390329600', + 1 => '3390330111', + ), + 593 => + array ( + 0 => '3390333696', + 1 => '3390333951', + ), + 594 => + array ( + 0 => '3390338816', + 1 => '3390339071', + ), + 595 => + array ( + 0 => '3390341120', + 1 => '3390375935', + ), + 596 => + array ( + 0 => '3390963712', + 1 => '3390972671', + ), + 597 => + array ( + 0 => '3390972928', + 1 => '3390973695', + ), + 598 => + array ( + 0 => '3390973952', + 1 => '3390977023', + ), + 599 => + array ( + 0 => '3390977536', + 1 => '3390978047', + ), + 600 => + array ( + 0 => '3390978560', + 1 => '3390978815', + ), + 601 => + array ( + 0 => '3390979072', + 1 => '3391068671', + ), + 602 => + array ( + 0 => '3391068928', + 1 => '3391069183', + ), + 603 => + array ( + 0 => '3391074304', + 1 => '3391075583', + ), + 604 => + array ( + 0 => '3391075840', + 1 => '3391082495', + ), + 605 => + array ( + 0 => '3391083520', + 1 => '3391085567', + ), + 606 => + array ( + 0 => '3391086592', + 1 => '3391094783', + ), + 607 => + array ( + 0 => '3391827968', + 1 => '3391832063', + ), + 608 => + array ( + 0 => '3392919552', + 1 => '3392921599', + ), + 609 => + array ( + 0 => '3393511424', + 1 => '3393519615', + ), + 610 => + array ( + 0 => '3393815552', + 1 => '3393816575', + ), + 611 => + array ( + 0 => '3394635776', + 1 => '3394637823', + ), + 612 => + array ( + 0 => '3394862080', + 1 => '3394863103', + ), + 613 => + array ( + 0 => '3394893824', + 1 => '3394894847', + ), + 614 => + array ( + 0 => '3397283840', + 1 => '3397285887', + ), + 615 => + array ( + 0 => '3397411840', + 1 => '3397412351', + ), + 616 => + array ( + 0 => '3397588992', + 1 => '3397591039', + ), + 617 => + array ( + 0 => '3397718016', + 1 => '3397722111', + ), + 618 => + array ( + 0 => '3397939200', + 1 => '3397951487', + ), + 619 => + array ( + 0 => '3398873088', + 1 => '3398877183', + ), + 620 => + array ( + 0 => '3399389184', + 1 => '3399393279', + ), + 621 => + array ( + 0 => '3399712768', + 1 => '3399720959', + ), + 622 => + array ( + 0 => '3399825408', + 1 => '3399826431', + ), + 623 => + array ( + 0 => '3399995392', + 1 => '3399999487', + ), + 624 => + array ( + 0 => '3400267776', + 1 => '3400268799', + ), + 625 => + array ( + 0 => '3400423424', + 1 => '3400424447', + ), + 626 => + array ( + 0 => '3400773632', + 1 => '3400775679', + ), + 627 => + array ( + 0 => '3406946816', + 1 => '3406947071', + ), + 628 => + array ( + 0 => '3411085312', + 1 => '3411086335', + ), + 629 => + array ( + 0 => '3411116032', + 1 => '3411124223', + ), + 630 => + array ( + 0 => '3411204864', + 1 => '3411205631', + ), + 631 => + array ( + 0 => '3411210240', + 1 => '3411212287', + ), + 632 => + array ( + 0 => '3411247104', + 1 => '3411249151', + ), + 633 => + array ( + 0 => '3411254784', + 1 => '3411255295', + ), + 634 => + array ( + 0 => '3411341312', + 1 => '3411345407', + ), + 635 => + array ( + 0 => '3411681280', + 1 => '3411689471', + ), + 636 => + array ( + 0 => '3412369408', + 1 => '3412377599', + ), + 637 => + array ( + 0 => '3412918272', + 1 => '3412926463', + ), + 638 => + array ( + 0 => '3413884928', + 1 => '3413893119', + ), + 639 => + array ( + 0 => '3414204416', + 1 => '3414220799', + ), + 640 => + array ( + 0 => '3414223872', + 1 => '3414224895', + ), + 641 => + array ( + 0 => '3414230528', + 1 => '3414231039', + ), + 642 => + array ( + 0 => '3414310912', + 1 => '3414327295', + ), + 643 => + array ( + 0 => '3414339584', + 1 => '3414343679', + ), + 644 => + array ( + 0 => '3414466560', + 1 => '3414474751', + ), + 645 => + array ( + 0 => '3414532096', + 1 => '3414540287', + ), + 646 => + array ( + 0 => '3415121920', + 1 => '3415130111', + ), + 647 => + array ( + 0 => '3415136256', + 1 => '3415136767', + ), + 648 => + array ( + 0 => '3415568384', + 1 => '3415572479', + ), + 649 => + array ( + 0 => '3415777280', + 1 => '3415785471', + ), + 650 => + array ( + 0 => '3415838720', + 1 => '3415842815', + ), + 651 => + array ( + 0 => '3416707072', + 1 => '3416709119', + ), + 652 => + array ( + 0 => '3416851456', + 1 => '3416851967', + ), + 653 => + array ( + 0 => '3416940544', + 1 => '3416948735', + ), + 654 => + array ( + 0 => '3417022464', + 1 => '3417030655', + ), + 655 => + array ( + 0 => '3417137152', + 1 => '3417145343', + ), + 656 => + array ( + 0 => '3417251840', + 1 => '3417260031', + ), + 657 => + array ( + 0 => '3417291776', + 1 => '3417292799', + ), + 658 => + array ( + 0 => '3418227712', + 1 => '3418228735', + ), + 659 => + array ( + 0 => '3418233344', + 1 => '3418233855', + ), + 660 => + array ( + 0 => '3419344896', + 1 => '3419348991', + ), + 661 => + array ( + 0 => '3419541504', + 1 => '3419553791', + ), + 662 => + array ( + 0 => '3419693056', + 1 => '3419701247', + ), + 663 => + array ( + 0 => '3419709440', + 1 => '3419717631', + ), + 664 => + array ( + 0 => '3419914240', + 1 => '3419922431', + ), + 665 => + array ( + 0 => '3419971584', + 1 => '3419979775', + ), + 666 => + array ( + 0 => '3420048384', + 1 => '3420061695', + ), + 667 => + array ( + 0 => '3420413952', + 1 => '3420422143', + ), + 668 => + array ( + 0 => '3420434688', + 1 => '3420434943', + ), + 669 => + array ( + 0 => '3420454912', + 1 => '3421077503', + ), + 670 => + array ( + 0 => '3421084160', + 1 => '3421084927', + ), + 671 => + array ( + 0 => '3421093888', + 1 => '3421503487', + ), + 672 => + array ( + 0 => '3421536256', + 1 => '3421544447', + ), + 673 => + array ( + 0 => '3421552640', + 1 => '3421611519', + ), + 674 => + array ( + 0 => '3421611776', + 1 => '3421613823', + ), + 675 => + array ( + 0 => '3421614080', + 1 => '3421624319', + ), + 676 => + array ( + 0 => '3421625344', + 1 => '3421663231', + ), + 677 => + array ( + 0 => '3421665280', + 1 => '3421716479', + ), + 678 => + array ( + 0 => '3421703168', + 1 => '3421705215', + ), + 679 => + array ( + 0 => '3421732864', + 1 => '3422296063', + ), + 680 => + array ( + 0 => '3422296832', + 1 => '3422367743', + ), + 681 => + array ( + 0 => '3422371840', + 1 => '3422415103', + ), + 682 => + array ( + 0 => '3422415360', + 1 => '3422420991', + ), + 683 => + array ( + 0 => '3422421248', + 1 => '3422421503', + ), + 684 => + array ( + 0 => '3422429184', + 1 => '3422429695', + ), + 685 => + array ( + 0 => '3422431232', + 1 => '3422431487', + ), + 686 => + array ( + 0 => '3422433792', + 1 => '3422435583', + ), + 687 => + array ( + 0 => '3422445568', + 1 => '3422543359', + ), + 688 => + array ( + 0 => '3422543872', + 1 => '3422546687', + ), + 689 => + array ( + 0 => '3422546944', + 1 => '3422552063', + ), + 690 => + array ( + 0 => '3523223552', + 1 => '3523231743', + ), + 691 => + array ( + 0 => '3523354624', + 1 => '3523362815', + ), + 692 => + array ( + 0 => '3523500032', + 1 => '3523502079', + ), + 693 => + array ( + 0 => '3523532800', + 1 => '3523534847', + ), + 694 => + array ( + 0 => '3524313088', + 1 => '3524329471', + ), + 695 => + array ( + 0 => '3527008256', + 1 => '3527016447', + ), + 696 => + array ( + 0 => '3528966144', + 1 => '3528974335', + ), + 697 => + array ( + 0 => '3529089024', + 1 => '3529097215', + ), + 698 => + array ( + 0 => '3529113600', + 1 => '3529622527', + ), + 699 => + array ( + 0 => '3529629696', + 1 => '3529834495', + ), + 700 => + array ( + 0 => '3529850880', + 1 => '3530506239', + ), + 701 => + array ( + 0 => '3530510336', + 1 => '3530518527', + ), + 702 => + array ( + 0 => '3530522624', + 1 => '3530702847', + ), + 703 => + array ( + 0 => '3530708992', + 1 => '3530711039', + ), + 704 => + array ( + 0 => '3530713088', + 1 => '3530715135', + ), + 705 => + array ( + 0 => '3530727424', + 1 => '3530735615', + ), + 706 => + array ( + 0 => '3530739712', + 1 => '3531538431', + ), + 707 => + array ( + 0 => '3531546624', + 1 => '3531603967', + ), + 708 => + array ( + 0 => '3534880768', + 1 => '3535273983', + ), + 709 => + array ( + 0 => '3535814656', + 1 => '3535822847', + ), + 710 => + array ( + 0 => '3536584704', + 1 => '3536846847', + ), + 711 => + array ( + 0 => '3537027072', + 1 => '3537047551', + ), + 712 => + array ( + 0 => '3537059840', + 1 => '3537068031', + ), + 713 => + array ( + 0 => '3537371136', + 1 => '3537526783', + ), + 714 => + array ( + 0 => '3537534976', + 1 => '3537739775', + ), + 715 => + array ( + 0 => '3537743872', + 1 => '3537895423', + ), + 716 => + array ( + 0 => '3542089728', + 1 => '3542306815', + ), + 717 => + array ( + 0 => '3542310912', + 1 => '3542311935', + ), + 718 => + array ( + 0 => '3542315008', + 1 => '3542376447', + ), + 719 => + array ( + 0 => '3542384640', + 1 => '3543114751', + ), + 720 => + array ( + 0 => '3543117824', + 1 => '3543134207', + ), + 721 => + array ( + 0 => '3543138304', + 1 => '3544014847', + ), + 722 => + array ( + 0 => '3544018944', + 1 => '3544145919', + ), + 723 => + array ( + 0 => '3544154112', + 1 => '3544186879', + ), + 724 => + array ( + 0 => '3546808320', + 1 => '3547856895', + ), + 725 => + array ( + 0 => '3551002624', + 1 => '3551313919', + ), + 726 => + array ( + 0 => '3551318016', + 1 => '3552456703', + ), + 727 => + array ( + 0 => '3552473088', + 1 => '3552481279', + ), + 728 => + array ( + 0 => '3552501760', + 1 => '3552514047', + ), + 729 => + array ( + 0 => '3552518144', + 1 => '3552522239', + ), + 730 => + array ( + 0 => '3552526336', + 1 => '3552534527', + ), + 731 => + array ( + 0 => '3552538624', + 1 => '3552546815', + ), + 732 => + array ( + 0 => '3552550912', + 1 => '3552559103', + ), + 733 => + array ( + 0 => '3552571392', + 1 => '3555287039', + ), + 734 => + array ( + 0 => '3555295232', + 1 => '3555389439', + ), + 735 => + array ( + 0 => '3555390464', + 1 => '3555393535', + ), + 736 => + array ( + 0 => '3555401728', + 1 => '3555561471', + ), + 737 => + array ( + 0 => '3555565568', + 1 => '3556696063', + ), + 738 => + array ( + 0 => '3556703232', + 1 => '3556769791', + ), + 739 => + array ( + 0 => '3659792384', + 1 => '3659890687', + ), + 740 => + array ( + 0 => '3659907072', + 1 => '3660054527', + ), + 741 => + array ( + 0 => '3660578816', + 1 => '3661103103', + ), + 742 => + array ( + 0 => '3664084992', + 1 => '3664117759', + ), + 743 => + array ( + 0 => '3666870272', + 1 => '3667918847', + ), + 744 => + array ( + 0 => '3671130112', + 1 => '3671195647', + ), + 745 => + array ( + 0 => '3672637440', + 1 => '3673161727', + ), + 746 => + array ( + 0 => '3689938944', + 1 => '3690070015', + ), + 747 => + array ( + 0 => '3690463232', + 1 => '3690987519', + ), + 748 => + array ( + 0 => '3695181824', + 1 => '3697278975', + ), + 749 => + array ( + 0 => '3697737728', + 1 => '3697803263', + ), + 750 => + array ( + 0 => '3698589696', + 1 => '3699376127', + ), + 751 => + array ( + 0 => '3700752384', + 1 => '3700817919', + ), + 752 => + array ( + 0 => '3706060800', + 1 => '3706126335', + ), + 753 => + array ( + 0 => '3716431872', + 1 => '3716440063', + ), + 754 => + array ( + 0 => '3716493312', + 1 => '3716497407', + ), + 755 => + array ( + 0 => '3716513792', + 1 => '3716530175', + ), + 756 => + array ( + 0 => '3716808704', + 1 => '3718840319', + ), + 757 => + array ( + 0 => '3730833408', + 1 => '3732602879', + ), + 758 => + array ( + 0 => '3739680768', + 1 => '3739697151', + ), + 759 => + array ( + 0 => '3739746304', + 1 => '3740270591', + ), + 760 => + array ( + 0 => '3741024256', + 1 => '3741057023', + ), + 761 => + array ( + 0 => '3743055872', + 1 => '3743088639', + ), + 762 => + array ( + 0 => '3743186944', + 1 => '3743219711', + ), + 763 => + array ( + 0 => '3743416320', + 1 => '3745513471', + ), + 764 => + array ( + 0 => '3749855232', + 1 => '3749969919', + ), + 765 => + array ( + 0 => '3752165376', + 1 => '3752198143', + ), + 766 => + array ( + 0 => '3752329216', + 1 => '3752853503', + ), + 767 => + array ( + 0 => '3754033152', + 1 => '3754164223', + ), + 768 => + array ( + 0 => '3755868160', + 1 => '3755933695', + ), + 769 => + array ( + 0 => '3757899776', + 1 => '3757965311', + ), + 770 => + array ( + 0 => '3758080000', + 1 => '3758088191', + ), +); diff --git a/common/defaults/korea.ipv6.php b/common/defaults/korea.ipv6.php new file mode 100644 index 000000000..291776383 --- /dev/null +++ b/common/defaults/korea.ipv6.php @@ -0,0 +1,503 @@ + + array ( + 0 => '2001000000000000', + 1 => '2001000fffffffff', + ), + 1 => + array ( + 0 => '2001022000000000', + 1 => '20010220ffffffff', + ), + 2 => + array ( + 0 => '2001023000000000', + 1 => '20010230ffffffff', + ), + 3 => + array ( + 0 => '2001027000000000', + 1 => '20010270ffffffff', + ), + 4 => + array ( + 0 => '2001028000000000', + 1 => '20010280ffffffff', + ), + 5 => + array ( + 0 => '2001029000000000', + 1 => '20010290ffffffff', + ), + 6 => + array ( + 0 => '200102b000000000', + 1 => '200102b0ffffffff', + ), + 7 => + array ( + 0 => '200102b800000000', + 1 => '200102b8ffffffff', + ), + 8 => + array ( + 0 => '200102d800000000', + 1 => '200102d8ffffffff', + ), + 9 => + array ( + 0 => '2001032000000000', + 1 => '20010320ffffffff', + ), + 10 => + array ( + 0 => '2001033000000000', + 1 => '20010330ffffffff', + ), + 11 => + array ( + 0 => '2001037800000000', + 1 => '20010378ffffffff', + ), + 12 => + array ( + 0 => '2001039000000000', + 1 => '20010390ffffffff', + ), + 13 => + array ( + 0 => '200103a800000000', + 1 => '200103a8ffffffff', + ), + 14 => + array ( + 0 => '200107fa00000002', + 1 => '200107fa00000002', + ), + 15 => + array ( + 0 => '200107fa00080000', + 1 => '200107fa0008ffff', + ), + 16 => + array ( + 0 => '20010c4800000000', + 1 => '20010c48ffffffff', + ), + 17 => + array ( + 0 => '20010c9800000000', + 1 => '20010c98ffffffff', + ), + 18 => + array ( + 0 => '20010cf000000000', + 1 => '20010cf0ffffffff', + ), + 19 => + array ( + 0 => '20010d3800000000', + 1 => '20010d38ffffffff', + ), + 20 => + array ( + 0 => '20010dc500000000', + 1 => '20010dc5ffffffff', + ), + 21 => + array ( + 0 => '20010dcc00000000', + 1 => '20010dccffffffff', + ), + 22 => + array ( + 0 => '20010ea000000000', + 1 => '20010ea0ffffffff', + ), + 23 => + array ( + 0 => '20010ea800000000', + 1 => '20010ea8ffffffff', + ), + 24 => + array ( + 0 => '20010eb800000000', + 1 => '20010eb8ffffffff', + ), + 25 => + array ( + 0 => '20010ed000000000', + 1 => '20010ed0ffffffff', + ), + 26 => + array ( + 0 => '20010ee800000000', + 1 => '20010ee8ffffffff', + ), + 27 => + array ( + 0 => '20010ef000000000', + 1 => '20010ef0ffffffff', + ), + 28 => + array ( + 0 => '20010ef800000000', + 1 => '20010ef8ffffffff', + ), + 29 => + array ( + 0 => '20010f2800000000', + 1 => '20010f28ffffffff', + ), + 30 => + array ( + 0 => '20010f4800000000', + 1 => '20010f48ffffffff', + ), + 31 => + array ( + 0 => '24033e0000000000', + 1 => '24033e00ffffffff', + ), + 32 => + array ( + 0 => '2001443000000000', + 1 => '20014430ffffffff', + ), + 33 => + array ( + 0 => '2400000000000000', + 1 => '24000fffffffffff', + ), + 34 => + array ( + 0 => '2400180000000000', + 1 => '24001800ffffffff', + ), + 35 => + array ( + 0 => '2400330000000000', + 1 => '24003300ffffffff', + ), + 36 => + array ( + 0 => '2400478000000000', + 1 => '24004780ffffffff', + ), + 37 => + array ( + 0 => '2400498000000000', + 1 => '24004980ffffffff', + ), + 38 => + array ( + 0 => '24009f8000000000', + 1 => '24009f80ffffffff', + ), + 39 => + array ( + 0 => '2400a58000000000', + 1 => '2400a580ffffffff', + ), + 40 => + array ( + 0 => '2400ab0000000000', + 1 => '2400ab00ffffffff', + ), + 41 => + array ( + 0 => '2400cf0000000000', + 1 => '2400cf00ffffffff', + ), + 42 => + array ( + 0 => '2400fd8000000000', + 1 => '2400fd80ffffffff', + ), + 43 => + array ( + 0 => '2401270000000000', + 1 => '24012700ffffffff', + ), + 44 => + array ( + 0 => '2401400000000000', + 1 => '24014000ffffffff', + ), + 45 => + array ( + 0 => '2401a00000000000', + 1 => '2401a000ffffffff', + ), + 46 => + array ( + 0 => '2401a80000000000', + 1 => '2401a800ffffffff', + ), + 47 => + array ( + 0 => '2401c50000000000', + 1 => '2401c500ffffffff', + ), + 48 => + array ( + 0 => '2402000000000000', + 1 => '240200ffffffffff', + ), + 49 => + array ( + 0 => '24021a0000000000', + 1 => '24021a00ffffffff', + ), + 50 => + array ( + 0 => '2402310000000000', + 1 => '24023100ffffffff', + ), + 51 => + array ( + 0 => '2402580000000000', + 1 => '24025800ffffffff', + ), + 52 => + array ( + 0 => '2402610000000000', + 1 => '24026100ffffffff', + ), + 53 => + array ( + 0 => '2402700000000000', + 1 => '24027000ffffffff', + ), + 54 => + array ( + 0 => '2402be0000000000', + 1 => '2402be00ffffffff', + ), + 55 => + array ( + 0 => '2402de0000000000', + 1 => '2402de00ffffffff', + ), + 56 => + array ( + 0 => '2402f40000000000', + 1 => '2402f400ffffffff', + ), + 57 => + array ( + 0 => '2403370000000000', + 1 => '24033700ffffffff', + ), + 58 => + array ( + 0 => '2403630000000000', + 1 => '24036300ffffffff', + ), + 59 => + array ( + 0 => '2403650000000000', + 1 => '24036500ffffffff', + ), + 60 => + array ( + 0 => '2404000000000000', + 1 => '2404000fffffffff', + ), + 61 => + array ( + 0 => '2404080000000000', + 1 => '24040800ffffffff', + ), + 62 => + array ( + 0 => '2404230000000000', + 1 => '24042300ffffffff', + ), + 63 => + array ( + 0 => '2404460000000000', + 1 => '24044600ffffffff', + ), + 64 => + array ( + 0 => '2405350000000000', + 1 => '24053500ffffffff', + ), + 65 => + array ( + 0 => '2405430000000000', + 1 => '24054300ffffffff', + ), + 66 => + array ( + 0 => '2405580000000000', + 1 => '24055800ffffffff', + ), + 67 => + array ( + 0 => '20010e6000000000', + 1 => '20010e60ffffffff', + ), + 68 => + array ( + 0 => '20010e7000000000', + 1 => '20010e70ffffffff', + ), + 69 => + array ( + 0 => '20010e7800000000', + 1 => '20010e78ffffffff', + ), + 70 => + array ( + 0 => '20010e9800000000', + 1 => '20010e98ffffffff', + ), + 71 => + array ( + 0 => '24009e8000000000', + 1 => '24009e80ffffffff', + ), + 72 => + array ( + 0 => '2400e18000000000', + 1 => '2400e180ffffffff', + ), + 73 => + array ( + 0 => '2401e20000000000', + 1 => '2401e200ffffffff', + ), + 74 => + array ( + 0 => '24053d0000000000', + 1 => '24053d00ffffffff', + ), + 75 => + array ( + 0 => '24055f0000000000', + 1 => '24055f00ffffffff', + ), + 76 => + array ( + 0 => '24057b0000000000', + 1 => '24057b00ffffffff', + ), + 77 => + array ( + 0 => '2405860000000000', + 1 => '24058600ffffffff', + ), + 78 => + array ( + 0 => '2405950000000000', + 1 => '24059500ffffffff', + ), + 79 => + array ( + 0 => '2405c00000000000', + 1 => '2405c000ffffffff', + ), + 80 => + array ( + 0 => '2406400000000000', + 1 => '24064000ffffffff', + ), + 81 => + array ( + 0 => '2406590000000000', + 1 => '24065900ffffffff', + ), + 82 => + array ( + 0 => '2406660000000000', + 1 => '24066600ffffffff', + ), + 83 => + array ( + 0 => '2406680000000000', + 1 => '24066800ffffffff', + ), + 84 => + array ( + 0 => '24066a0000000000', + 1 => '24066a00ffffffff', + ), + 85 => + array ( + 0 => '2406ad0000000000', + 1 => '2406ad00ffffffff', + ), + 86 => + array ( + 0 => '2406b00000000000', + 1 => '2406b000ffffffff', + ), + 87 => + array ( + 0 => '2406d00000000000', + 1 => '2406d000ffffffff', + ), + 88 => + array ( + 0 => '2406d70000000000', + 1 => '2406d700ffffffff', + ), + 89 => + array ( + 0 => '24070b0000000000', + 1 => '24070b00ffffffff', + ), + 90 => + array ( + 0 => '2407200000000000', + 1 => '24072000ffffffff', + ), + 91 => + array ( + 0 => '2407350000000000', + 1 => '24073500ffffffff', + ), + 92 => + array ( + 0 => '2407650000000000', + 1 => '24076500ffffffff', + ), + 93 => + array ( + 0 => '2407670000000000', + 1 => '24076700ffffffff', + ), + 94 => + array ( + 0 => '2407910000000000', + 1 => '24079100ffffffff', + ), + 95 => + array ( + 0 => '2407b20000000000', + 1 => '2407b200ffffffff', + ), + 96 => + array ( + 0 => '2407b80000000000', + 1 => '2407b800ffffffff', + ), + 97 => + array ( + 0 => '2407c00000000000', + 1 => '2407c000ffffffff', + ), + 98 => + array ( + 0 => '2407c70000000000', + 1 => '2407c700ffffffff', + ), +); diff --git a/common/defaults/whitelist.php b/common/defaults/whitelist.php index 272da733b..887ca296f 100644 --- a/common/defaults/whitelist.php +++ b/common/defaults/whitelist.php @@ -64,10 +64,12 @@ return array( 'www.youtube.com/', 'www.youtube-nocookie.com/', // Google Maps + 'www.google.com/maps/embed', 'maps.google.com/', 'maps.google.co.kr/', // Daum TV Pot 'flvs.daum.net/', + 'videofarm.daum.net/', // NAVER TVCAST 'serviceapi.rmcnmv.naver.com/', // SBS @@ -77,1652 +79,4 @@ return array( // Afreeca 'afree.ca/', ), - - /** - * Allowed extensions in or tag - */ - 'extensions' => array( - '123' => 1, - '3ds' => 1, - '3g2' => 1, - '3gp' => 1, - '7z' => 1, - 'aab' => 1, - 'aac' => 1, - 'aam' => 1, - 'aas' => 1, - 'abw' => 1, - 'ac' => 1, - 'acc' => 1, - 'ace' => 1, - 'acu' => 1, - 'acutc' => 1, - 'adp' => 1, - 'aep' => 1, - 'afm' => 1, - 'afp' => 1, - 'ahead' => 1, - 'ai' => 1, - 'aif' => 1, - 'aifc' => 1, - 'aiff' => 1, - 'air' => 1, - 'ait' => 1, - 'ami' => 1, - 'apk' => 1, - 'application' => 1, - 'apr' => 1, - 'arc' => 1, - 'asc' => 1, - 'asf' => 1, - 'aso' => 1, - 'asx' => 1, - 'atc' => 1, - 'atom' => 1, - 'atomcat' => 1, - 'atomsvc' => 1, - 'atx' => 1, - 'au' => 1, - 'avi' => 1, - 'aw' => 1, - 'azf' => 1, - 'azs' => 1, - 'azw' => 1, - 'bat' => 1, - 'bcpio' => 1, - 'bdf' => 1, - 'bdm' => 1, - 'bed' => 1, - 'bh2' => 1, - 'bin' => 1, - 'blb' => 1, - 'blorb' => 1, - 'bmi' => 1, - 'bmp' => 1, - 'book' => 1, - 'box' => 1, - 'boz' => 1, - 'bpk' => 1, - 'btif' => 1, - 'bz' => 1, - 'bz2' => 1, - 'c11amc' => 1, - 'c11amz' => 1, - 'c4d' => 1, - 'c4f' => 1, - 'c4g' => 1, - 'c4p' => 1, - 'c4u' => 1, - 'cab' => 1, - 'caf' => 1, - 'cap' => 1, - 'car' => 1, - 'cat' => 1, - 'cb7' => 1, - 'cba' => 1, - 'cbr' => 1, - 'cbt' => 1, - 'cbz' => 1, - 'cct' => 1, - 'ccxml' => 1, - 'cdbcmsg' => 1, - 'cdf' => 1, - 'cdkey' => 1, - 'cdmia' => 1, - 'cdmic' => 1, - 'cdmid' => 1, - 'cdmio' => 1, - 'cdmiq' => 1, - 'cdx' => 1, - 'cdxml' => 1, - 'cdy' => 1, - 'cer' => 1, - 'cfs' => 1, - 'cgm' => 1, - 'chat' => 1, - 'chm' => 1, - 'chrt' => 1, - 'cif' => 1, - 'cii' => 1, - 'cil' => 1, - 'cla' => 1, - 'class' => 1, - 'clkk' => 1, - 'clkp' => 1, - 'clkt' => 1, - 'clkw' => 1, - 'clkx' => 1, - 'clp' => 1, - 'cmc' => 1, - 'cmdf' => 1, - 'cml' => 1, - 'cmp' => 1, - 'cmx' => 1, - 'cod' => 1, - 'com' => 1, - 'cpio' => 1, - 'cpt' => 1, - 'crd' => 1, - 'crl' => 1, - 'crt' => 1, - 'cryptonote' => 1, - 'csh' => 1, - 'csml' => 1, - 'csp' => 1, - 'cst' => 1, - 'cu' => 1, - 'cww' => 1, - 'cxt' => 1, - 'dae' => 1, - 'daf' => 1, - 'dart' => 1, - 'dataless' => 1, - 'davmount' => 1, - 'dbk' => 1, - 'dcr' => 1, - 'dd2' => 1, - 'ddd' => 1, - 'deb' => 1, - 'deploy' => 1, - 'der' => 1, - 'dfac' => 1, - 'dgc' => 1, - 'dir' => 1, - 'dis' => 1, - 'dist' => 1, - 'distz' => 1, - 'djv' => 1, - 'djvu' => 1, - 'dll' => 1, - 'dmg' => 1, - 'dmp' => 1, - 'dms' => 1, - 'dna' => 1, - 'doc dot' => 1, - 'docm' => 1, - 'docx' => 1, - 'dotm' => 1, - 'dotx' => 1, - 'dp' => 1, - 'dpg' => 1, - 'dra' => 1, - 'dssc' => 1, - 'dtb' => 1, - 'dtd' => 1, - 'dts' => 1, - 'dtshd' => 1, - 'dump' => 1, - 'dvb' => 1, - 'dvi' => 1, - 'dwf' => 1, - 'dwg' => 1, - 'dxf' => 1, - 'dxp' => 1, - 'dxr' => 1, - 'ecelp4800' => 1, - 'ecelp7470' => 1, - 'ecelp9600' => 1, - 'ecma' => 1, - 'edm' => 1, - 'edx' => 1, - 'efif' => 1, - 'ei6' => 1, - 'elc' => 1, - 'emf' => 1, - 'eml' => 1, - 'emma' => 1, - 'emz' => 1, - 'eol' => 1, - 'eot' => 1, - 'eps' => 1, - 'epub' => 1, - 'es3' => 1, - 'esa' => 1, - 'esf' => 1, - 'et3' => 1, - 'eva' => 1, - 'evy' => 1, - 'exe' => 1, - 'exi' => 1, - 'ext' => 1, - 'ez' => 1, - 'ez2' => 1, - 'ez3' => 1, - 'f4v' => 1, - 'fbs' => 1, - 'fcdt' => 1, - 'fcs' => 1, - 'fdf' => 1, - 'fe_launch' => 1, - 'fg5' => 1, - 'fgd' => 1, - 'fh' => 1, - 'fh4' => 1, - 'fh5' => 1, - 'fh7' => 1, - 'fhc' => 1, - 'fig' => 1, - 'flac' => 1, - 'fli' => 1, - 'flo' => 1, - 'flv' => 1, - 'flw' => 1, - 'fm' => 1, - 'fnc' => 1, - 'fpx' => 1, - 'frame' => 1, - 'fsc' => 1, - 'fst' => 1, - 'ftc' => 1, - 'fti' => 1, - 'fvt' => 1, - 'fxp' => 1, - 'fxpl' => 1, - 'fzs' => 1, - 'g2w' => 1, - 'g3' => 1, - 'g3w' => 1, - 'gac' => 1, - 'gam' => 1, - 'gbr' => 1, - 'gca' => 1, - 'gdl' => 1, - 'geo' => 1, - 'gex' => 1, - 'ggb' => 1, - 'ggt' => 1, - 'ghf' => 1, - 'gif' => 1, - 'gim' => 1, - 'gml' => 1, - 'gmx' => 1, - 'gnumeric' => 1, - 'gph' => 1, - 'gpx' => 1, - 'gqf' => 1, - 'gqs' => 1, - 'gram' => 1, - 'gramps' => 1, - 'gre' => 1, - 'grv' => 1, - 'grxml' => 1, - 'gsf' => 1, - 'gtar' => 1, - 'gtm' => 1, - 'gtw' => 1, - 'gxf' => 1, - 'gxt' => 1, - 'h261' => 1, - 'h263' => 1, - 'h264' => 1, - 'hal' => 1, - 'hbci' => 1, - 'hdf' => 1, - 'hlp' => 1, - 'hpgl' => 1, - 'hpid' => 1, - 'hps' => 1, - 'hqx' => 1, - 'htke' => 1, - 'hvd' => 1, - 'hvp' => 1, - 'hvs' => 1, - 'i2g' => 1, - 'icc' => 1, - 'ice' => 1, - 'icm' => 1, - 'ico' => 1, - 'ief' => 1, - 'ifm' => 1, - 'iges' => 1, - 'igl' => 1, - 'igm' => 1, - 'igs' => 1, - 'igx' => 1, - 'iif' => 1, - 'imp' => 1, - 'ims' => 1, - 'ink' => 1, - 'inkml' => 1, - 'install' => 1, - 'iota' => 1, - 'ipfix' => 1, - 'ipk' => 1, - 'irm' => 1, - 'irp' => 1, - 'iso' => 1, - 'itp' => 1, - 'ivp' => 1, - 'ivu' => 1, - 'jam' => 1, - 'jar' => 1, - 'jisp' => 1, - 'jlt' => 1, - 'jnlp' => 1, - 'joda' => 1, - 'jpe' => 1, - 'jpeg' => 1, - 'jpg' => 1, - 'jpgm' => 1, - 'jpgv' => 1, - 'jpm' => 1, - 'js' => 1, - 'json' => 1, - 'jsonml' => 1, - 'kar' => 1, - 'karbon' => 1, - 'kfo' => 1, - 'kia' => 1, - 'kml' => 1, - 'kmz' => 1, - 'kne' => 1, - 'knp' => 1, - 'kon' => 1, - 'kpr' => 1, - 'kpt' => 1, - 'kpxx' => 1, - 'ksp' => 1, - 'ktr' => 1, - 'ktx' => 1, - 'ktz' => 1, - 'kwd' => 1, - 'kwt' => 1, - 'lasxml' => 1, - 'latex' => 1, - 'lbd' => 1, - 'lbe' => 1, - 'les' => 1, - 'lha' => 1, - 'link66' => 1, - 'list3820' => 1, - 'listafp' => 1, - 'lnk' => 1, - 'lostxml' => 1, - 'lrf' => 1, - 'lrm' => 1, - 'ltf' => 1, - 'lvp' => 1, - 'lwp' => 1, - 'lzh' => 1, - 'm13' => 1, - 'm14' => 1, - 'm1v' => 1, - 'm21 mp21' => 1, - 'm2a' => 1, - 'm2v' => 1, - 'm3a' => 1, - 'm3u' => 1, - 'm3u8' => 1, - 'm4u' => 1, - 'm4v' => 1, - 'ma' => 1, - 'mads' => 1, - 'mag' => 1, - 'maker' => 1, - 'mar' => 1, - 'mathml' => 1, - 'mb' => 1, - 'mbk' => 1, - 'mbox' => 1, - 'mc1' => 1, - 'mcd' => 1, - 'mdb' => 1, - 'mdi' => 1, - 'mesh' => 1, - 'meta4' => 1, - 'metalink' => 1, - 'mets' => 1, - 'mfm' => 1, - 'mft' => 1, - 'mgp' => 1, - 'mgz' => 1, - 'mid' => 1, - 'midi' => 1, - 'mie' => 1, - 'mif' => 1, - 'mime' => 1, - 'mj2' => 1, - 'mjp2' => 1, - 'mk3d' => 1, - 'mka' => 1, - 'mks' => 1, - 'mkv' => 1, - 'mlp' => 1, - 'mmd' => 1, - 'mmf' => 1, - 'mmr' => 1, - 'mng' => 1, - 'mny' => 1, - 'mobi' => 1, - 'mods' => 1, - 'mov' => 1, - 'movie' => 1, - 'mp2' => 1, - 'mp2a' => 1, - 'mp3' => 1, - 'mp4' => 1, - 'mp4a' => 1, - 'mp4s' => 1, - 'mp4v' => 1, - 'mpc' => 1, - 'mpe' => 1, - 'mpeg' => 1, - 'mpg' => 1, - 'mpg4' => 1, - 'mpga' => 1, - 'mpkg' => 1, - 'mpm' => 1, - 'mpn' => 1, - 'mpp' => 1, - 'mpt' => 1, - 'mpy' => 1, - 'mqy' => 1, - 'mrc' => 1, - 'mrcx' => 1, - 'mscml' => 1, - 'mseed' => 1, - 'mseq' => 1, - 'msf' => 1, - 'msh' => 1, - 'msi' => 1, - 'msl' => 1, - 'msty' => 1, - 'mts' => 1, - 'mus' => 1, - 'musicxml' => 1, - 'mvb' => 1, - 'mwf' => 1, - 'mxf' => 1, - 'mxl' => 1, - 'mxml' => 1, - 'mxs' => 1, - 'mxu' => 1, - 'n-gage' => 1, - 'nb' => 1, - 'nbp' => 1, - 'nc' => 1, - 'ncx' => 1, - 'ngdat' => 1, - 'nitf' => 1, - 'nlu' => 1, - 'nml' => 1, - 'nnd' => 1, - 'nns' => 1, - 'nnw' => 1, - 'npx' => 1, - 'nsc' => 1, - 'nsf' => 1, - 'nzb' => 1, - 'oa2' => 1, - 'oa3' => 1, - 'oas' => 1, - 'obd' => 1, - 'obj' => 1, - 'oda' => 1, - 'odb' => 1, - 'odc' => 1, - 'odf' => 1, - 'odft' => 1, - 'odg' => 1, - 'odi' => 1, - 'odm' => 1, - 'odp' => 1, - 'ods' => 1, - 'odt' => 1, - 'oga' => 1, - 'ogg' => 1, - 'ogv' => 1, - 'ogx' => 1, - 'omdoc' => 1, - 'onepkg' => 1, - 'onetmp' => 1, - 'onetoc' => 1, - 'onetoc2' => 1, - 'opf' => 1, - 'oprc' => 1, - 'org' => 1, - 'osf' => 1, - 'osfpvg' => 1, - 'otc' => 1, - 'otf' => 1, - 'otg' => 1, - 'oth' => 1, - 'oti' => 1, - 'otp' => 1, - 'ots' => 1, - 'ott' => 1, - 'oxps' => 1, - 'oxt' => 1, - 'p10' => 1, - 'p12' => 1, - 'p7b' => 1, - 'p7c' => 1, - 'p7m' => 1, - 'p7r' => 1, - 'p7s' => 1, - 'p8' => 1, - 'paw' => 1, - 'pbd' => 1, - 'pbm' => 1, - 'pcap' => 1, - 'pcf' => 1, - 'pcl' => 1, - 'pclxl' => 1, - 'pct' => 1, - 'pcurl' => 1, - 'pcx' => 1, - 'pdb' => 1, - 'pdf' => 1, - 'pfa' => 1, - 'pfb' => 1, - 'pfm' => 1, - 'pfr' => 1, - 'pfx' => 1, - 'pgm' => 1, - 'pgn' => 1, - 'pgp' => 1, - 'pic' => 1, - 'pkg' => 1, - 'pki' => 1, - 'pkipath' => 1, - 'plb' => 1, - 'plc' => 1, - 'plf' => 1, - 'pls' => 1, - 'pml' => 1, - 'png' => 1, - 'pnm' => 1, - 'portpkg' => 1, - 'pot' => 1, - 'potm' => 1, - 'potx' => 1, - 'ppam' => 1, - 'ppd' => 1, - 'ppm' => 1, - 'pps' => 1, - 'ppsm' => 1, - 'ppsx' => 1, - 'ppt' => 1, - 'pptm' => 1, - 'pptx' => 1, - 'pqa' => 1, - 'prc' => 1, - 'pre' => 1, - 'prf' => 1, - 'ps' => 1, - 'psb' => 1, - 'psd' => 1, - 'psf' => 1, - 'pskcxml' => 1, - 'ptid' => 1, - 'pub' => 1, - 'pvb' => 1, - 'pwn' => 1, - 'pya' => 1, - 'pyv' => 1, - 'qam' => 1, - 'qbo' => 1, - 'qfx' => 1, - 'qps' => 1, - 'qt' => 1, - 'qwd' => 1, - 'qwt' => 1, - 'qxb' => 1, - 'qxd' => 1, - 'qxl' => 1, - 'qxt' => 1, - 'ra' => 1, - 'ram' => 1, - 'rar' => 1, - 'ras' => 1, - 'rcprofile' => 1, - 'rdf' => 1, - 'rdz' => 1, - 'rep' => 1, - 'res' => 1, - 'rgb' => 1, - 'rif' => 1, - 'rip' => 1, - 'ris' => 1, - 'rl' => 1, - 'rlc' => 1, - 'rld' => 1, - 'rm' => 1, - 'rmi' => 1, - 'rmp' => 1, - 'rms' => 1, - 'rmvb' => 1, - 'rnc' => 1, - 'roa' => 1, - 'rp9' => 1, - 'rpss' => 1, - 'rpst' => 1, - 'rq' => 1, - 'rs' => 1, - 'rsd' => 1, - 'rss' => 1, - 'rtf' => 1, - 's3m' => 1, - 'saf' => 1, - 'sbml' => 1, - 'sc' => 1, - 'scd' => 1, - 'scm' => 1, - 'scq' => 1, - 'scs' => 1, - 'sda' => 1, - 'sdc' => 1, - 'sdd' => 1, - 'sdkd' => 1, - 'sdkm' => 1, - 'sdp' => 1, - 'sdw' => 1, - 'see' => 1, - 'seed' => 1, - 'sema' => 1, - 'semd' => 1, - 'semf' => 1, - 'ser' => 1, - 'setpay' => 1, - 'setreg' => 1, - 'sfd-hdstx' => 1, - 'sfs' => 1, - 'sgi' => 1, - 'sgl' => 1, - 'sh' => 1, - 'shar' => 1, - 'shf' => 1, - 'sid' => 1, - 'sig' => 1, - 'sil' => 1, - 'silo' => 1, - 'sis' => 1, - 'sisx' => 1, - 'sit' => 1, - 'sitx' => 1, - 'skd' => 1, - 'skm' => 1, - 'skp' => 1, - 'skt' => 1, - 'sldm' => 1, - 'sldx' => 1, - 'slt' => 1, - 'sm' => 1, - 'smf' => 1, - 'smi' => 1, - 'smil' => 1, - 'smv' => 1, - 'smzip' => 1, - 'snd' => 1, - 'snf' => 1, - 'so' => 1, - 'spc' => 1, - 'spf' => 1, - 'spl' => 1, - 'spp' => 1, - 'spq' => 1, - 'spx' => 1, - 'sql' => 1, - 'src' => 1, - 'srt' => 1, - 'sru' => 1, - 'srx' => 1, - 'ssdl' => 1, - 'sse' => 1, - 'ssf' => 1, - 'ssml' => 1, - 'st' => 1, - 'stc' => 1, - 'std' => 1, - 'stf' => 1, - 'sti' => 1, - 'stk' => 1, - 'stl' => 1, - 'str' => 1, - 'stw' => 1, - 'sub' => 1, - 'sus' => 1, - 'susp' => 1, - 'sv4cpio' => 1, - 'sv4crc' => 1, - 'svc' => 1, - 'svd' => 1, - 'svg' => 1, - 'svgz' => 1, - 'swa' => 1, - 'swf' => 1, - 'swi' => 1, - 'sxc' => 1, - 'sxd' => 1, - 'sxg' => 1, - 'sxi' => 1, - 'sxm' => 1, - 'sxw' => 1, - 't3' => 1, - 'taglet' => 1, - 'tao' => 1, - 'tar' => 1, - 'tcap' => 1, - 'tcl' => 1, - 'teacher' => 1, - 'tei' => 1, - 'teicorpus' => 1, - 'tex' => 1, - 'texi' => 1, - 'texinfo' => 1, - 'tfi' => 1, - 'tfm' => 1, - 'tga' => 1, - 'thmx' => 1, - 'tif' => 1, - 'tiff' => 1, - 'tmo' => 1, - 'torrent' => 1, - 'tpl' => 1, - 'tpt' => 1, - 'tra' => 1, - 'trm' => 1, - 'tsd' => 1, - 'ttc' => 1, - 'ttf' => 1, - 'twd' => 1, - 'twds' => 1, - 'txd' => 1, - 'txf' => 1, - 'u32' => 1, - 'udeb' => 1, - 'ufd' => 1, - 'ufdl' => 1, - 'ulx' => 1, - 'umj' => 1, - 'unityweb' => 1, - 'uoml' => 1, - 'ustar' => 1, - 'utz' => 1, - 'uva' => 1, - 'uvd' => 1, - 'uvf' => 1, - 'uvg' => 1, - 'uvh' => 1, - 'uvi' => 1, - 'uvm' => 1, - 'uvp' => 1, - 'uvs' => 1, - 'uvt' => 1, - 'uvu' => 1, - 'uvv' => 1, - 'uvva' => 1, - 'uvvd' => 1, - 'uvvf' => 1, - 'uvvg' => 1, - 'uvvh' => 1, - 'uvvi' => 1, - 'uvvm' => 1, - 'uvvp' => 1, - 'uvvs' => 1, - 'uvvt' => 1, - 'uvvu' => 1, - 'uvvv' => 1, - 'uvvx' => 1, - 'uvvz' => 1, - 'uvx' => 1, - 'uvz' => 1, - 'vcd' => 1, - 'vcg' => 1, - 'vcx' => 1, - 'vis' => 1, - 'viv' => 1, - 'vob' => 1, - 'vor' => 1, - 'vox' => 1, - 'vrml' => 1, - 'vsd' => 1, - 'vsf' => 1, - 'vss' => 1, - 'vst' => 1, - 'vsw' => 1, - 'vtu' => 1, - 'vxml' => 1, - 'w3d' => 1, - 'wad' => 1, - 'wav' => 1, - 'wax' => 1, - 'wbmp' => 1, - 'wbs' => 1, - 'wbxml' => 1, - 'wcm' => 1, - 'wdb' => 1, - 'wdp' => 1, - 'weba' => 1, - 'webm' => 1, - 'webp' => 1, - 'wg' => 1, - 'wgt' => 1, - 'wks' => 1, - 'wm' => 1, - 'wma' => 1, - 'wmd' => 1, - 'wmf' => 1, - 'wmlc' => 1, - 'wmlsc' => 1, - 'wmv' => 1, - 'wmx' => 1, - 'wmz' => 1, - 'woff' => 1, - 'wpd' => 1, - 'wpl' => 1, - 'wps' => 1, - 'wqd' => 1, - 'wri' => 1, - 'wrl' => 1, - 'wsdl' => 1, - 'wspolicy' => 1, - 'wtb' => 1, - 'wvx' => 1, - 'x32' => 1, - 'x3d' => 1, - 'x3db' => 1, - 'x3dbz' => 1, - 'x3dv' => 1, - 'x3dvz' => 1, - 'x3dz' => 1, - 'xaml' => 1, - 'xap' => 1, - 'xar' => 1, - 'xbap' => 1, - 'xbd' => 1, - 'xbm' => 1, - 'xdf' => 1, - 'xdm' => 1, - 'xdp' => 1, - 'xdssc' => 1, - 'xdw' => 1, - 'xenc' => 1, - 'xer' => 1, - 'xfdf' => 1, - 'xfdl' => 1, - 'xht' => 1, - 'xhtml' => 1, - 'xhvml' => 1, - 'xif' => 1, - 'xla' => 1, - 'xlam' => 1, - 'xlc' => 1, - 'xlf' => 1, - 'xlm' => 1, - 'xls' => 1, - 'xlsb' => 1, - 'xlsm' => 1, - 'xlsx' => 1, - 'xlt' => 1, - 'xltm' => 1, - 'xltx' => 1, - 'xlw' => 1, - 'xm' => 1, - 'xml' => 1, - 'xo' => 1, - 'xop' => 1, - 'xpi' => 1, - 'xpl' => 1, - 'xpm' => 1, - 'xpr' => 1, - 'xps' => 1, - 'xpw' => 1, - 'xpx' => 1, - 'xsl' => 1, - 'xslt' => 1, - 'xsm' => 1, - 'xspf' => 1, - 'xul' => 1, - 'xvm' => 1, - 'xvml' => 1, - 'xwd' => 1, - 'xyz' => 1, - 'xz' => 1, - 'yang' => 1, - 'yin' => 1, - 'z1' => 1, - 'z2' => 1, - 'z3' => 1, - 'z4' => 1, - 'z5' => 1, - 'z6' => 1, - 'z7' => 1, - 'z8' => 1, - 'zaz' => 1, - 'zip' => 1, - 'zir' => 1, - 'zirz' => 1, - 'zmm' => 1, - ), - - // Allowed MIME types - 'mime' => array( - 'application/andrew-inset' => 1, - 'application/applixware' => 1, - 'application/atom+xml' => 1, - 'application/atomcat+xml' => 1, - 'application/atomsvc+xml' => 1, - 'application/ccxml+xml' => 1, - 'application/cdmi-capability' => 1, - 'application/cdmi-container' => 1, - 'application/cdmi-domain' => 1, - 'application/cdmi-object' => 1, - 'application/cdmi-queue' => 1, - 'application/cu-seeme' => 1, - 'application/davmount+xml' => 1, - 'application/docbook+xml' => 1, - 'application/dssc+der' => 1, - 'application/dssc+xml' => 1, - 'application/ecmascript' => 1, - 'application/emma+xml' => 1, - 'application/epub+zip' => 1, - 'application/exi' => 1, - 'application/font-tdpfr' => 1, - 'application/gml+xml' => 1, - 'application/gpx+xml' => 1, - 'application/gxf' => 1, - 'application/hyperstudio' => 1, - 'application/inkml+xml' => 1, - 'application/ipfix' => 1, - 'application/java-archive' => 1, - 'application/java-serialized-object' => 1, - 'application/java-vm' => 1, - 'application/javascript' => 1, - 'application/json' => 1, - 'application/jsonml+json' => 1, - 'application/lost+xml' => 1, - 'application/mac-binhex40' => 1, - 'application/mac-compactpro' => 1, - 'application/mads+xml' => 1, - 'application/marc' => 1, - 'application/marcxml+xml' => 1, - 'application/mathematica' => 1, - 'application/mathml+xml' => 1, - 'application/mbox' => 1, - 'application/mediaservercontrol+xml' => 1, - 'application/metalink+xml' => 1, - 'application/metalink4+xml' => 1, - 'application/mets+xml' => 1, - 'application/mods+xml' => 1, - 'application/mp21' => 1, - 'application/mp4' => 1, - 'application/msword' => 1, - 'application/mxf' => 1, - 'application/octet-stream' => 1, - 'application/oda' => 1, - 'application/oebps-package+xml' => 1, - 'application/ogg' => 1, - 'application/omdoc+xml' => 1, - 'application/onenote' => 1, - 'application/oxps' => 1, - 'application/patch-ops-error+xml' => 1, - 'application/pdf' => 1, - 'application/pgp-encrypted' => 1, - 'application/pgp-signature' => 1, - 'application/pics-rules' => 1, - 'application/pkcs10' => 1, - 'application/pkcs7-mime' => 1, - 'application/pkcs7-signature' => 1, - 'application/pkcs8' => 1, - 'application/pkix-attr-cert' => 1, - 'application/pkix-cert' => 1, - 'application/pkix-crl' => 1, - 'application/pkix-pkipath' => 1, - 'application/pkixcmp' => 1, - 'application/pls+xml' => 1, - 'application/postscript' => 1, - 'application/prs.cww' => 1, - 'application/pskc+xml' => 1, - 'application/rdf+xml' => 1, - 'application/reginfo+xml' => 1, - 'application/relax-ng-compact-syntax' => 1, - 'application/resource-lists+xml' => 1, - 'application/resource-lists-diff+xml' => 1, - 'application/rls-services+xml' => 1, - 'application/rpki-ghostbusters' => 1, - 'application/rpki-manifest' => 1, - 'application/rpki-roa' => 1, - 'application/rsd+xml' => 1, - 'application/rss+xml' => 1, - 'application/rtf' => 1, - 'application/sbml+xml' => 1, - 'application/scvp-cv-request' => 1, - 'application/scvp-cv-response' => 1, - 'application/scvp-vp-request' => 1, - 'application/scvp-vp-response' => 1, - 'application/sdp' => 1, - 'application/set-payment-initiation' => 1, - 'application/set-registration-initiation' => 1, - 'application/shf+xml' => 1, - 'application/smil+xml' => 1, - 'application/sparql-query' => 1, - 'application/sparql-results+xml' => 1, - 'application/srgs' => 1, - 'application/srgs+xml' => 1, - 'application/sru+xml' => 1, - 'application/ssdl+xml' => 1, - 'application/ssml+xml' => 1, - 'application/tei+xml' => 1, - 'application/thraud+xml' => 1, - 'application/timestamped-data' => 1, - 'application/vnd.3gpp.pic-bw-large' => 1, - 'application/vnd.3gpp.pic-bw-small' => 1, - 'application/vnd.3gpp.pic-bw-var' => 1, - 'application/vnd.3gpp2.tcap' => 1, - 'application/vnd.3m.post-it-notes' => 1, - 'application/vnd.accpac.simply.aso' => 1, - 'application/vnd.accpac.simply.imp' => 1, - 'application/vnd.acucobol' => 1, - 'application/vnd.acucorp' => 1, - 'application/vnd.adobe.air-application-installer-package+zip' => 1, - 'application/vnd.adobe.formscentral.fcdt' => 1, - 'application/vnd.adobe.fxp' => 1, - 'application/vnd.adobe.xdp+xml' => 1, - 'application/vnd.adobe.xfdf' => 1, - 'application/vnd.ahead.space' => 1, - 'application/vnd.airzip.filesecure.azf' => 1, - 'application/vnd.airzip.filesecure.azs' => 1, - 'application/vnd.amazon.ebook' => 1, - 'application/vnd.americandynamics.acc' => 1, - 'application/vnd.amiga.ami' => 1, - 'application/vnd.android.package-archive' => 1, - 'application/vnd.anser-web-certificate-issue-initiation' => 1, - 'application/vnd.anser-web-funds-transfer-initiation' => 1, - 'application/vnd.antix.game-component' => 1, - 'application/vnd.apple.installer+xml' => 1, - 'application/vnd.apple.mpegurl' => 1, - 'application/vnd.aristanetworks.swi' => 1, - 'application/vnd.astraea-software.iota' => 1, - 'application/vnd.audiograph' => 1, - 'application/vnd.blueice.multipass' => 1, - 'application/vnd.bmi' => 1, - 'application/vnd.businessobjects' => 1, - 'application/vnd.chemdraw+xml' => 1, - 'application/vnd.chipnuts.karaoke-mmd' => 1, - 'application/vnd.cinderella' => 1, - 'application/vnd.claymore' => 1, - 'application/vnd.cloanto.rp9' => 1, - 'application/vnd.clonk.c4group' => 1, - 'application/vnd.cluetrust.cartomobile-config' => 1, - 'application/vnd.cluetrust.cartomobile-config-pkg' => 1, - 'application/vnd.commonspace' => 1, - 'application/vnd.contact.cmsg' => 1, - 'application/vnd.cosmocaller' => 1, - 'application/vnd.crick.clicker' => 1, - 'application/vnd.crick.clicker.keyboard' => 1, - 'application/vnd.crick.clicker.palette' => 1, - 'application/vnd.crick.clicker.template' => 1, - 'application/vnd.crick.clicker.wordbank' => 1, - 'application/vnd.criticaltools.wbs+xml' => 1, - 'application/vnd.ctc-posml' => 1, - 'application/vnd.cups-ppd' => 1, - 'application/vnd.curl.car' => 1, - 'application/vnd.curl.pcurl' => 1, - 'application/vnd.dart' => 1, - 'application/vnd.data-vision.rdz' => 1, - 'application/vnd.dece.data' => 1, - 'application/vnd.dece.ttml+xml' => 1, - 'application/vnd.dece.unspecified' => 1, - 'application/vnd.dece.zip' => 1, - 'application/vnd.denovo.fcselayout-link' => 1, - 'application/vnd.dna' => 1, - 'application/vnd.dolby.mlp' => 1, - 'application/vnd.dpgraph' => 1, - 'application/vnd.dreamfactory' => 1, - 'application/vnd.ds-keypoint' => 1, - 'application/vnd.dvb.ait' => 1, - 'application/vnd.dvb.service' => 1, - 'application/vnd.dynageo' => 1, - 'application/vnd.ecowin.chart' => 1, - 'application/vnd.enliven' => 1, - 'application/vnd.epson.esf' => 1, - 'application/vnd.epson.msf' => 1, - 'application/vnd.epson.quickanime' => 1, - 'application/vnd.epson.salt' => 1, - 'application/vnd.epson.ssf' => 1, - 'application/vnd.eszigno3+xml' => 1, - 'application/vnd.ezpix-album' => 1, - 'application/vnd.ezpix-package' => 1, - 'application/vnd.fdf' => 1, - 'application/vnd.fdsn.mseed' => 1, - 'application/vnd.fdsn.seed' => 1, - 'application/vnd.flographit' => 1, - 'application/vnd.fluxtime.clip' => 1, - 'application/vnd.framemaker' => 1, - 'application/vnd.frogans.fnc' => 1, - 'application/vnd.frogans.ltf' => 1, - 'application/vnd.fsc.weblaunch' => 1, - 'application/vnd.fujitsu.oasys' => 1, - 'application/vnd.fujitsu.oasys2' => 1, - 'application/vnd.fujitsu.oasys3' => 1, - 'application/vnd.fujitsu.oasysgp' => 1, - 'application/vnd.fujitsu.oasysprs' => 1, - 'application/vnd.fujixerox.ddd' => 1, - 'application/vnd.fujixerox.docuworks' => 1, - 'application/vnd.fujixerox.docuworks.binder' => 1, - 'application/vnd.fuzzysheet' => 1, - 'application/vnd.genomatix.tuxedo' => 1, - 'application/vnd.geogebra.file' => 1, - 'application/vnd.geogebra.tool' => 1, - 'application/vnd.geometry-explorer' => 1, - 'application/vnd.geonext' => 1, - 'application/vnd.geoplan' => 1, - 'application/vnd.geospace' => 1, - 'application/vnd.gmx' => 1, - 'application/vnd.google-earth.kml+xml' => 1, - 'application/vnd.google-earth.kmz' => 1, - 'application/vnd.grafeq' => 1, - 'application/vnd.groove-account' => 1, - 'application/vnd.groove-help' => 1, - 'application/vnd.groove-identity-message' => 1, - 'application/vnd.groove-injector' => 1, - 'application/vnd.groove-tool-message' => 1, - 'application/vnd.groove-tool-template' => 1, - 'application/vnd.groove-vcard' => 1, - 'application/vnd.hal+xml' => 1, - 'application/vnd.handheld-entertainment+xml' => 1, - 'application/vnd.hbci' => 1, - 'application/vnd.hhe.lesson-player' => 1, - 'application/vnd.hp-hpgl' => 1, - 'application/vnd.hp-hpid' => 1, - 'application/vnd.hp-hps' => 1, - 'application/vnd.hp-jlyt' => 1, - 'application/vnd.hp-pcl' => 1, - 'application/vnd.hp-pclxl' => 1, - 'application/vnd.hydrostatix.sof-data' => 1, - 'application/vnd.ibm.minipay' => 1, - 'application/vnd.ibm.modcap' => 1, - 'application/vnd.ibm.rights-management' => 1, - 'application/vnd.ibm.secure-container' => 1, - 'application/vnd.iccprofile' => 1, - 'application/vnd.igloader' => 1, - 'application/vnd.immervision-ivp' => 1, - 'application/vnd.immervision-ivu' => 1, - 'application/vnd.insors.igm' => 1, - 'application/vnd.intercon.formnet' => 1, - 'application/vnd.intergeo' => 1, - 'application/vnd.intu.qbo' => 1, - 'application/vnd.intu.qfx' => 1, - 'application/vnd.ipunplugged.rcprofile' => 1, - 'application/vnd.irepository.package+xml' => 1, - 'application/vnd.is-xpr' => 1, - 'application/vnd.isac.fcs' => 1, - 'application/vnd.jam' => 1, - 'application/vnd.jcp.javame.midlet-rms' => 1, - 'application/vnd.jisp' => 1, - 'application/vnd.joost.joda-archive' => 1, - 'application/vnd.kahootz' => 1, - 'application/vnd.kde.karbon' => 1, - 'application/vnd.kde.kchart' => 1, - 'application/vnd.kde.kformula' => 1, - 'application/vnd.kde.kivio' => 1, - 'application/vnd.kde.kontour' => 1, - 'application/vnd.kde.kpresenter' => 1, - 'application/vnd.kde.kspread' => 1, - 'application/vnd.kde.kword' => 1, - 'application/vnd.kenameaapp' => 1, - 'application/vnd.kidspiration' => 1, - 'application/vnd.kinar' => 1, - 'application/vnd.koan' => 1, - 'application/vnd.kodak-descriptor' => 1, - 'application/vnd.las.las+xml' => 1, - 'application/vnd.llamagraphics.life-balance.desktop' => 1, - 'application/vnd.llamagraphics.life-balance.exchange+xml' => 1, - 'application/vnd.lotus-1-2-3' => 1, - 'application/vnd.lotus-approach' => 1, - 'application/vnd.lotus-freelance' => 1, - 'application/vnd.lotus-notes' => 1, - 'application/vnd.lotus-organizer' => 1, - 'application/vnd.lotus-screencam' => 1, - 'application/vnd.lotus-wordpro' => 1, - 'application/vnd.macports.portpkg' => 1, - 'application/vnd.mcd' => 1, - 'application/vnd.medcalcdata' => 1, - 'application/vnd.mediastation.cdkey' => 1, - 'application/vnd.mfer' => 1, - 'application/vnd.mfmp' => 1, - 'application/vnd.micrografx.flo' => 1, - 'application/vnd.micrografx.igx' => 1, - 'application/vnd.mif' => 1, - 'application/vnd.mobius.daf' => 1, - 'application/vnd.mobius.dis' => 1, - 'application/vnd.mobius.mbk' => 1, - 'application/vnd.mobius.mqy' => 1, - 'application/vnd.mobius.msl' => 1, - 'application/vnd.mobius.plc' => 1, - 'application/vnd.mobius.txf' => 1, - 'application/vnd.mophun.application' => 1, - 'application/vnd.mophun.certificate' => 1, - 'application/vnd.mozilla.xul+xml' => 1, - 'application/vnd.ms-artgalry' => 1, - 'application/vnd.ms-cab-compressed' => 1, - 'application/vnd.ms-excel' => 1, - 'application/vnd.ms-excel.addin.macroenabled.12' => 1, - 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 1, - 'application/vnd.ms-excel.sheet.macroenabled.12' => 1, - 'application/vnd.ms-excel.template.macroenabled.12' => 1, - 'application/vnd.ms-fontobject' => 1, - 'application/vnd.ms-htmlhelp' => 1, - 'application/vnd.ms-ims' => 1, - 'application/vnd.ms-lrm' => 1, - 'application/vnd.ms-officetheme' => 1, - 'application/vnd.ms-pki.seccat' => 1, - 'application/vnd.ms-pki.stl' => 1, - 'application/vnd.ms-powerpoint' => 1, - 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 1, - 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 1, - 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 1, - 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 1, - 'application/vnd.ms-powerpoint.template.macroenabled.12' => 1, - 'application/vnd.ms-project' => 1, - 'application/vnd.ms-word.document.macroenabled.12' => 1, - 'application/vnd.ms-word.template.macroenabled.12' => 1, - 'application/vnd.ms-works' => 1, - 'application/vnd.ms-wpl' => 1, - 'application/vnd.ms-xpsdocument' => 1, - 'application/vnd.mseq' => 1, - 'application/vnd.musician' => 1, - 'application/vnd.muvee.style' => 1, - 'application/vnd.mynfc' => 1, - 'application/vnd.neurolanguage.nlu' => 1, - 'application/vnd.nitf' => 1, - 'application/vnd.noblenet-directory' => 1, - 'application/vnd.noblenet-sealer' => 1, - 'application/vnd.noblenet-web' => 1, - 'application/vnd.nokia.n-gage.data' => 1, - 'application/vnd.nokia.n-gage.symbian.install' => 1, - 'application/vnd.nokia.radio-preset' => 1, - 'application/vnd.nokia.radio-presets' => 1, - 'application/vnd.novadigm.edm' => 1, - 'application/vnd.novadigm.edx' => 1, - 'application/vnd.novadigm.ext' => 1, - 'application/vnd.oasis.opendocument.chart' => 1, - 'application/vnd.oasis.opendocument.chart-template' => 1, - 'application/vnd.oasis.opendocument.database' => 1, - 'application/vnd.oasis.opendocument.formula' => 1, - 'application/vnd.oasis.opendocument.formula-template' => 1, - 'application/vnd.oasis.opendocument.graphics' => 1, - 'application/vnd.oasis.opendocument.graphics-template' => 1, - 'application/vnd.oasis.opendocument.image' => 1, - 'application/vnd.oasis.opendocument.image-template' => 1, - 'application/vnd.oasis.opendocument.presentation' => 1, - 'application/vnd.oasis.opendocument.presentation-template' => 1, - 'application/vnd.oasis.opendocument.spreadsheet' => 1, - 'application/vnd.oasis.opendocument.spreadsheet-template' => 1, - 'application/vnd.oasis.opendocument.text' => 1, - 'application/vnd.oasis.opendocument.text-master' => 1, - 'application/vnd.oasis.opendocument.text-template' => 1, - 'application/vnd.oasis.opendocument.text-web' => 1, - 'application/vnd.olpc-sugar' => 1, - 'application/vnd.oma.dd2+xml' => 1, - 'application/vnd.openofficeorg.extension' => 1, - 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 1, - 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 1, - 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 1, - 'application/vnd.openxmlformats-officedocument.presentationml.template' => 1, - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 1, - 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 1, - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 1, - 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 1, - 'application/vnd.osgeo.mapguide.package' => 1, - 'application/vnd.osgi.dp' => 1, - 'application/vnd.osgi.subsystem' => 1, - 'application/vnd.palm' => 1, - 'application/vnd.pawaafile' => 1, - 'application/vnd.pg.format' => 1, - 'application/vnd.pg.osasli' => 1, - 'application/vnd.picsel' => 1, - 'application/vnd.pmi.widget' => 1, - 'application/vnd.pocketlearn' => 1, - 'application/vnd.powerbuilder6' => 1, - 'application/vnd.previewsystems.box' => 1, - 'application/vnd.proteus.magazine' => 1, - 'application/vnd.publishare-delta-tree' => 1, - 'application/vnd.pvi.ptid1' => 1, - 'application/vnd.quark.quarkxpress' => 1, - 'application/vnd.realvnc.bed' => 1, - 'application/vnd.recordare.musicxml' => 1, - 'application/vnd.recordare.musicxml+xml' => 1, - 'application/vnd.rig.cryptonote' => 1, - 'application/vnd.rim.cod' => 1, - 'application/vnd.rn-realmedia' => 1, - 'application/vnd.rn-realmedia-vbr' => 1, - 'application/vnd.route66.link66+xml' => 1, - 'application/vnd.sailingtracker.track' => 1, - 'application/vnd.seemail' => 1, - 'application/vnd.sema' => 1, - 'application/vnd.semd' => 1, - 'application/vnd.semf' => 1, - 'application/vnd.shana.informed.formdata' => 1, - 'application/vnd.shana.informed.formtemplate' => 1, - 'application/vnd.shana.informed.interchange' => 1, - 'application/vnd.shana.informed.package' => 1, - 'application/vnd.simtech-mindmapper' => 1, - 'application/vnd.smaf' => 1, - 'application/vnd.smart.teacher' => 1, - 'application/vnd.solent.sdkm+xml' => 1, - 'application/vnd.spotfire.dxp' => 1, - 'application/vnd.spotfire.sfs' => 1, - 'application/vnd.stardivision.calc' => 1, - 'application/vnd.stardivision.draw' => 1, - 'application/vnd.stardivision.impress' => 1, - 'application/vnd.stardivision.math' => 1, - 'application/vnd.stardivision.writer' => 1, - 'application/vnd.stardivision.writer-global' => 1, - 'application/vnd.stepmania.package' => 1, - 'application/vnd.stepmania.stepchart' => 1, - 'application/vnd.sun.xml.calc' => 1, - 'application/vnd.sun.xml.calc.template' => 1, - 'application/vnd.sun.xml.draw' => 1, - 'application/vnd.sun.xml.draw.template' => 1, - 'application/vnd.sun.xml.impress' => 1, - 'application/vnd.sun.xml.impress.template' => 1, - 'application/vnd.sun.xml.math' => 1, - 'application/vnd.sun.xml.writer' => 1, - 'application/vnd.sun.xml.writer.global' => 1, - 'application/vnd.sun.xml.writer.template' => 1, - 'application/vnd.sus-calendar' => 1, - 'application/vnd.svd' => 1, - 'application/vnd.symbian.install' => 1, - 'application/vnd.syncml+xml' => 1, - 'application/vnd.syncml.dm+wbxml' => 1, - 'application/vnd.syncml.dm+xml' => 1, - 'application/vnd.tao.intent-module-archive' => 1, - 'application/vnd.tcpdump.pcap' => 1, - 'application/vnd.tmobile-livetv' => 1, - 'application/vnd.trid.tpt' => 1, - 'application/vnd.triscape.mxs' => 1, - 'application/vnd.trueapp' => 1, - 'application/vnd.ufdl' => 1, - 'application/vnd.uiq.theme' => 1, - 'application/vnd.umajin' => 1, - 'application/vnd.unity' => 1, - 'application/vnd.uoml+xml' => 1, - 'application/vnd.vcx' => 1, - 'application/vnd.visio' => 1, - 'application/vnd.visionary' => 1, - 'application/vnd.vsf' => 1, - 'application/vnd.wap.wbxml' => 1, - 'application/vnd.wap.wmlc' => 1, - 'application/vnd.wap.wmlscriptc' => 1, - 'application/vnd.webturbo' => 1, - 'application/vnd.wolfram.player' => 1, - 'application/vnd.wordperfect' => 1, - 'application/vnd.wqd' => 1, - 'application/vnd.wt.stf' => 1, - 'application/vnd.xara' => 1, - 'application/vnd.xfdl' => 1, - 'application/vnd.yamaha.hv-dic' => 1, - 'application/vnd.yamaha.hv-script' => 1, - 'application/vnd.yamaha.hv-voice' => 1, - 'application/vnd.yamaha.openscoreformat' => 1, - 'application/vnd.yamaha.openscoreformat.osfpvg+xml' => 1, - 'application/vnd.yamaha.smaf-audio' => 1, - 'application/vnd.yamaha.smaf-phrase' => 1, - 'application/vnd.yellowriver-custom-menu' => 1, - 'application/vnd.zul' => 1, - 'application/vnd.zzazz.deck+xml' => 1, - 'application/voicexml+xml' => 1, - 'application/widget' => 1, - 'application/winhlp' => 1, - 'application/wsdl+xml' => 1, - 'application/wspolicy+xml' => 1, - 'application/x-7z-compressed' => 1, - 'application/x-abiword' => 1, - 'application/x-ace-compressed' => 1, - 'application/x-apple-diskimage' => 1, - 'application/x-authorware-bin' => 1, - 'application/x-authorware-map' => 1, - 'application/x-authorware-seg' => 1, - 'application/x-bcpio' => 1, - 'application/x-bittorrent' => 1, - 'application/x-blorb' => 1, - 'application/x-bzip' => 1, - 'application/x-bzip2' => 1, - 'application/x-cbr' => 1, - 'application/x-cdlink' => 1, - 'application/x-cfs-compressed' => 1, - 'application/x-chat' => 1, - 'application/x-chess-pgn' => 1, - 'application/x-conference' => 1, - 'application/x-cpio' => 1, - 'application/x-csh' => 1, - 'application/x-debian-package' => 1, - 'application/x-dgc-compressed' => 1, - 'application/x-director' => 1, - 'application/x-doom' => 1, - 'application/x-dtbncx+xml' => 1, - 'application/x-dtbook+xml' => 1, - 'application/x-dtbresource+xml' => 1, - 'application/x-dvi' => 1, - 'application/x-envoy' => 1, - 'application/x-eva' => 1, - 'application/x-font-bdf' => 1, - 'application/x-font-ghostscript' => 1, - 'application/x-font-linux-psf' => 1, - 'application/x-font-otf' => 1, - 'application/x-font-pcf' => 1, - 'application/x-font-snf' => 1, - 'application/x-font-ttf' => 1, - 'application/x-font-type1' => 1, - 'application/x-font-woff' => 1, - 'application/x-freearc' => 1, - 'application/x-futuresplash' => 1, - 'application/x-gca-compressed' => 1, - 'application/x-glulx' => 1, - 'application/x-gnumeric' => 1, - 'application/x-gramps-xml' => 1, - 'application/x-gtar' => 1, - 'application/x-hdf' => 1, - 'application/x-install-instructions' => 1, - 'application/x-iso9660-image' => 1, - 'application/x-java-jnlp-file' => 1, - 'application/x-latex' => 1, - 'application/x-lzh-compressed' => 1, - 'application/x-mie' => 1, - 'application/x-mobipocket-ebook' => 1, - 'application/x-ms-application' => 1, - 'application/x-ms-shortcut' => 1, - 'application/x-ms-wmd' => 1, - 'application/x-ms-wmz' => 1, - 'application/x-ms-xbap' => 1, - 'application/x-msaccess' => 1, - 'application/x-msbinder' => 1, - 'application/x-mscardfile' => 1, - 'application/x-msclip' => 1, - 'application/x-msdownload' => 1, - 'application/x-msmediaview' => 1, - 'application/x-msmetafile' => 1, - 'application/x-msmoney' => 1, - 'application/x-mspublisher' => 1, - 'application/x-msschedule' => 1, - 'application/x-msterminal' => 1, - 'application/x-mswrite' => 1, - 'application/x-netcdf' => 1, - 'application/x-nzb' => 1, - 'application/x-pkcs12' => 1, - 'application/x-pkcs7-certificates' => 1, - 'application/x-pkcs7-certreqresp' => 1, - 'application/x-rar-compressed' => 1, - 'application/x-research-info-systems' => 1, - 'application/x-sh' => 1, - 'application/x-shar' => 1, - 'application/x-shockwave-flash' => 1, - 'application/x-silverlight-app' => 1, - 'application/x-silverlight-2' => 1, - 'application/x-sql' => 1, - 'application/x-stuffit' => 1, - 'application/x-stuffitx' => 1, - 'application/x-subrip' => 1, - 'application/x-sv4cpio' => 1, - 'application/x-sv4crc' => 1, - 'application/x-t3vm-image' => 1, - 'application/x-tads' => 1, - 'application/x-tar' => 1, - 'application/x-tcl' => 1, - 'application/x-tex' => 1, - 'application/x-tex-tfm' => 1, - 'application/x-texinfo' => 1, - 'application/x-tgif' => 1, - 'application/x-ustar' => 1, - 'application/x-wais-source' => 1, - 'application/x-x509-ca-cert' => 1, - 'application/x-xfig' => 1, - 'application/x-xliff+xml' => 1, - 'application/x-xpinstall' => 1, - 'application/x-xz' => 1, - 'application/x-zmachine' => 1, - 'application/xaml+xml' => 1, - 'application/xcap-diff+xml' => 1, - 'application/xenc+xml' => 1, - 'application/xhtml+xml' => 1, - 'application/xml' => 1, - 'application/xml-dtd' => 1, - 'application/xop+xml' => 1, - 'application/xproc+xml' => 1, - 'application/xslt+xml' => 1, - 'application/xspf+xml' => 1, - 'application/xv+xml' => 1, - 'application/yang' => 1, - 'application/yin+xml' => 1, - 'application/zip' => 1, - 'audio/adpcm' => 1, - 'audio/basic' => 1, - 'audio/midi' => 1, - 'audio/mp4' => 1, - 'audio/mpeg' => 1, - 'audio/ogg' => 1, - 'audio/s3m' => 1, - 'audio/silk' => 1, - 'audio/vnd.dece.audio' => 1, - 'audio/vnd.digital-winds' => 1, - 'audio/vnd.dra' => 1, - 'audio/vnd.dts' => 1, - 'audio/vnd.dts.hd' => 1, - 'audio/vnd.lucent.voice' => 1, - 'audio/vnd.ms-playready.media.pya' => 1, - 'audio/vnd.nuera.ecelp4800' => 1, - 'audio/vnd.nuera.ecelp7470' => 1, - 'audio/vnd.nuera.ecelp9600' => 1, - 'audio/vnd.rip' => 1, - 'audio/webm' => 1, - 'audio/x-aac' => 1, - 'audio/x-aiff' => 1, - 'audio/x-caf' => 1, - 'audio/x-flac' => 1, - 'audio/x-matroska' => 1, - 'audio/x-mpegurl' => 1, - 'audio/x-ms-wax' => 1, - 'audio/x-ms-wma' => 1, - 'audio/x-pn-realaudio' => 1, - 'audio/x-pn-realaudio-plugin' => 1, - 'audio/x-wav' => 1, - 'audio/xm' => 1, - 'chemical/x-cdx' => 1, - 'chemical/x-cif' => 1, - 'chemical/x-cmdf' => 1, - 'chemical/x-cml' => 1, - 'chemical/x-csml' => 1, - 'chemical/x-xyz' => 1, - 'image/bmp' => 1, - 'image/cgm' => 1, - 'image/g3fax' => 1, - 'image/gif' => 1, - 'image/ief' => 1, - 'image/jpeg' => 1, - 'image/ktx' => 1, - 'image/png' => 1, - 'image/prs.btif' => 1, - 'image/sgi' => 1, - 'image/svg+xml' => 1, - 'image/tiff' => 1, - 'image/vnd.adobe.photoshop' => 1, - 'image/vnd.dece.graphic' => 1, - 'image/vnd.dvb.subtitle' => 1, - 'image/vnd.djvu' => 1, - 'image/vnd.dwg' => 1, - 'image/vnd.dxf' => 1, - 'image/vnd.fastbidsheet' => 1, - 'image/vnd.fpx' => 1, - 'image/vnd.fst' => 1, - 'image/vnd.fujixerox.edmics-mmr' => 1, - 'image/vnd.fujixerox.edmics-rlc' => 1, - 'image/vnd.ms-modi' => 1, - 'image/vnd.ms-photo' => 1, - 'image/vnd.net-fpx' => 1, - 'image/vnd.wap.wbmp' => 1, - 'image/vnd.xiff' => 1, - 'image/webp' => 1, - 'image/x-3ds' => 1, - 'image/x-cmu-raster' => 1, - 'image/x-cmx' => 1, - 'image/x-freehand' => 1, - 'image/x-icon' => 1, - 'image/x-mrsid-image' => 1, - 'image/x-pcx' => 1, - 'image/x-pict' => 1, - 'image/x-portable-anymap' => 1, - 'image/x-portable-bitmap' => 1, - 'image/x-portable-graymap' => 1, - 'image/x-portable-pixmap' => 1, - 'image/x-rgb' => 1, - 'image/x-tga' => 1, - 'image/x-xbitmap' => 1, - 'image/x-xpixmap' => 1, - 'image/x-xwindowdump' => 1, - 'message/rfc822' => 1, - 'model/iges' => 1, - 'model/mesh' => 1, - 'model/vnd.collada+xml' => 1, - 'model/vnd.dwf' => 1, - 'model/vnd.gdl' => 1, - 'model/vnd.gtw' => 1, - 'model/vnd.mts' => 1, - 'model/vnd.vtu' => 1, - 'model/vrml' => 1, - 'model/x3d+binary' => 1, - 'model/x3d+vrml' => 1, - 'model/x3d+xml' => 1, - 'video/3gpp' => 1, - 'video/3gpp2' => 1, - 'video/h261' => 1, - 'video/h263' => 1, - 'video/h264' => 1, - 'video/jpeg' => 1, - 'video/jpm' => 1, - 'video/mj2' => 1, - 'video/mp4' => 1, - 'video/mpeg' => 1, - 'video/ogg' => 1, - 'video/quicktime' => 1, - 'video/vnd.dece.hd' => 1, - 'video/vnd.dece.mobile' => 1, - 'video/vnd.dece.pd' => 1, - 'video/vnd.dece.sd' => 1, - 'video/vnd.dece.video' => 1, - 'video/vnd.dvb.file' => 1, - 'video/vnd.fvt' => 1, - 'video/vnd.mpegurl' => 1, - 'video/vnd.ms-playready.media.pyv' => 1, - 'video/vnd.uvvu.mp4' => 1, - 'video/vnd.vivo' => 1, - 'video/webm' => 1, - 'video/x-f4v' => 1, - 'video/x-fli' => 1, - 'video/x-flv' => 1, - 'video/x-m4v' => 1, - 'video/x-matroska' => 1, - 'video/x-mng' => 1, - 'video/x-ms-asf' => 1, - 'video/x-ms-vob' => 1, - 'video/x-ms-wm' => 1, - 'video/x-ms-wmv' => 1, - 'video/x-ms-wmx' => 1, - 'video/x-ms-wvx' => 1, - 'video/x-msvideo' => 1, - 'video/x-sgi-movie' => 1, - 'video/x-smv' => 1, - 'x-conference/x-cooltalk' => 1, - ), ); diff --git a/common/framework/calendar.php b/common/framework/calendar.php new file mode 100644 index 000000000..67aaafbe4 --- /dev/null +++ b/common/framework/calendar.php @@ -0,0 +1,132 @@ +ftp_info); $buff = 'file, $entry->line)); @@ -173,8 +173,8 @@ class Debug // Rewrite the error message with relative paths. $message = str_replace(array( - ' called in ' . RX_BASEDIR, - ' defined in ' . RX_BASEDIR, + ' called in ' . \RX_BASEDIR, + ' defined in ' . \RX_BASEDIR, ), array( ' called in ', ' defined in ', @@ -397,6 +397,12 @@ class Debug */ public static function displayErrorScreen($message) { + // Do not display error screen in CLI. + if (php_sapi_name() === 'cli') + { + return; + } + // Disable output buffering. while (ob_get_level()) { @@ -445,13 +451,17 @@ class Debug return $cache = true; case 'ip': - $allowed_ip = Config::get('debug.allow'); - foreach ($allowed_ip as $range) + if (Filters\IpFilter::inRanges(\RX_CLIENT_IP, Config::get('debug.allow'))) { - if (IpFilter::inRange(RX_CLIENT_IP, $range)) - { - return $cache = true; - } + return $cache = true; + } + if (\RX_CLIENT_IP === '127.0.0.1' || \RX_CLIENT_IP === '::1') + { + return $cache = true; + } + if (\RX_CLIENT_IP === $_SERVER['SERVER_ADDR'] || \RX_CLIENT_IP === $_SERVER['LOCAL_ADDR']) + { + return $cache = true; } return $cache = false; @@ -475,7 +485,7 @@ class Debug { // Collect debug information. $data = (object)array( - 'timestamp' => DateTime::formatTimestamp('Y-m-d H:i:s', RX_TIME), + 'timestamp' => DateTime::formatTimestamp('Y-m-d H:i:s', \RX_TIME), 'url' => getCurrentPageUrl(), 'request' => (object)array( 'method' => $_SERVER['REQUEST_METHOD'] . ($_SERVER['REQUEST_METHOD'] !== \Context::getRequestMethod() ? (' (' . \Context::getRequestMethod() . ')') : ''), diff --git a/common/framework/filters/filenamefilter.php b/common/framework/filters/filenamefilter.php new file mode 100644 index 000000000..dd99954c9 --- /dev/null +++ b/common/framework/filters/filenamefilter.php @@ -0,0 +1,88 @@ +', '{', '}', ':', ';', '|', '"', '~', '`', '@', '#', '$', '%', '^', '&', '*', '?'); + $replace = array('', '', '(', ')', '(', ')', '_', ',', '_', '', '_', '\'', '_', '_', '_', '_', '_', '_', '', ''); + $filename = str_replace($illegal, $replace, $filename); + + // Remove control characters. + $filename = preg_replace('/([\\x00-\\x1f\\x7f\\xff]+)/u', '', $filename); + + // Standardize whitespace characters. + $filename = trim(preg_replace('/[\\pZ\\pC]+/u', ' ', $filename)); + + // Remove excess spaces and replacement characters. + $filename = trim($filename, ' .-_'); + $filename = preg_replace('/__+/', '_', $filename); + + // Change .php files to .phps to make them non-executable. + if (strtolower(substr($filename, strlen($filename) - 4)) === '.php') + { + $filename = substr($filename, 0, strlen($filename) - 4) . '.phps'; + } + + // Truncate filenames over 127 chars long, or extensions over 16 chars long. + if (mb_strlen($filename, 'UTF-8') > 127) + { + $extension = strrchr($filename, '.'); + if (mb_strlen($extension, 'UTF-8') > 16) $extension = mb_substr($extension, 0, 16); + $filename = mb_substr($filename, 0, 127 - mb_strlen($extension)) . $extension; + } + + return $filename; + } + + /** + * Clean a path to remove ./, ../, trailing slashes, etc. + * + * @param string $path + * @return string + */ + public static function cleanPath($path) + { + // Convert relative paths to absolute paths. + if (!preg_match('@^(?:/|[a-z]:[\\\\/]|\\\\|https?:)@i', $path)) + { + $path = \RX_BASEDIR . $path; + } + + // Convert backslashes to forward slashes. + $path = str_replace('\\', '/', $path); + + // Remove querystrings and URL fragments. + if (($querystring = strpbrk($path, '?#')) !== false) + { + $path = substr($path, 0, -1 * strlen($querystring)); + } + + // Remove single dots, three or more dots, and duplicate slashes. + $path = preg_replace(array( + '@(?purify($input); + $output = self::_postprocess($output); + + foreach (self::$_postproc as $callback) + { + $output = $callback($output); + } + + return $output; + } + + /** + * Get an instance of HTMLPurifier. + * + * @return object + */ + public static function getHTMLPurifier() + { + // Create an instance with reasonable defaults. + if (self::$_htmlpurifier === null) + { + // Get the default configuration. + $config = \HTMLPurifier_Config::createDefault(); + + // Customize the default configuration. + $config->set('Attr.AllowedFrameTargets', array('_blank')); + $config->set('Attr.DefaultImageAlt', ''); + $config->set('Attr.EnableID', false); + $config->set('AutoFormat.AutoParagraph', false); + $config->set('AutoFormat.DisplayLinkURI', false); + $config->set('AutoFormat.Linkify', false); + $config->set('Core.Encoding', 'UTF-8'); + $config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); + $config->set('HTML.FlashAllowFullScreen', true); + $config->set('HTML.MaxImgLength', null); + $config->set('CSS.MaxImgLength', null); + $config->set('CSS.Proprietary', true); + $config->set('Output.FlashCompat', true); + $config->set('Output.Newline', "\n"); + $config->set('URI.MakeAbsolute', false); + + // Allow embedding of external multimedia content. + $config->set('HTML.SafeEmbed', true); + $config->set('HTML.SafeIframe', true); + $config->set('HTML.SafeObject', true); + $config->set('URI.SafeIframeRegexp', MediaFilter::getIframeWhitelistRegex()); + + // Set the serializer path. + $config->set('Cache.SerializerPath', \RX_BASEDIR . 'files/cache/htmlpurifier'); + Storage::createDirectory(\RX_BASEDIR . 'files/cache/htmlpurifier'); + + // Modify the HTML definition to support editor components and widgets. + $def = $config->getHTMLDefinition(true); + $def->addAttribute('img', 'editor_component', 'Text'); + $def->addAttribute('div', 'editor_component', 'Text'); + $def->addAttribute('img', 'rx_encoded_properties', 'Text'); + $def->addAttribute('div', 'rx_encoded_properties', 'Text'); + + // Support HTML5 and CSS3. + self::_supportHTML5($config); + self::_supportCSS3($config); + + // Cache our instance of HTMLPurifier. + self::$_htmlpurifier = new \HTMLPurifier($config); + } + + // Return the cached instance. + return self::$_htmlpurifier; + } + + /** + * Patch HTMLPurifier to support some HTML5 tags and attributes. + * + * These changes are based on https://github.com/xemlock/htmlpurifier-html5 + * but modified to support even more tags and attributes. + * + * @param object $config + * @return void + */ + protected static function _supportHTML5($config) + { + // Get the HTML definition. + $def = $config->getHTMLDefinition(true); + + // Add various block-level tags. + $def->addElement('header', 'Block', 'Flow', 'Common'); + $def->addElement('footer', 'Block', 'Flow', 'Common'); + $def->addElement('nav', 'Block', 'Flow', 'Common'); + $def->addElement('main', 'Block', 'Flow', 'Common'); + $def->addElement('section', 'Block', 'Flow', 'Common'); + $def->addElement('article', 'Block', 'Flow', 'Common'); + $def->addElement('aside', 'Block', 'Flow', 'Common'); + + // Add various inline tags. + $def->addElement('s', 'Inline', 'Inline', 'Common'); + $def->addElement('sub', 'Inline', 'Inline', 'Common'); + $def->addElement('sup', 'Inline', 'Inline', 'Common'); + $def->addElement('mark', 'Inline', 'Inline', 'Common'); + $def->addElement('wbr', 'Inline', 'Empty', 'Core'); + + // Support figures. + $def->addElement('figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'); + $def->addElement('figcaption', 'Inline', 'Flow', 'Common'); + + // Support insertions and deletions. + $def->addElement('ins', 'Block', 'Flow', 'Common', array('cite' => 'URI', 'datetime' => 'Text')); + $def->addElement('del', 'Block', 'Flow', 'Common', array('cite' => 'URI', 'datetime' => 'Text')); + + // Support the )?!is', $replacement, $input); + $input = preg_replace('!]*>(.*?)?!is', $replacement, $input); + $input = preg_replace('!]*editor_component="multimedia_link"[^>]*>(.*?)?!is', $replacement, $input); + return $input; + } + + /** + * Load whitelists. + * + * @param array $custom_whitelist + * @return void + */ + protected static function _loadWhitelists($custom_whitelist = array()) + { + $default_whitelist = (include \RX_BASEDIR . 'common/defaults/whitelist.php'); + self::$_object_whitelist = array(); + self::$_iframe_whitelist = array(); + + if(count($custom_whitelist)) + { + if(!is_array($custom_whitelist) || !isset($custom_whitelist['iframe']) || !isset($custom_whitelist['object'])) + { + $whitelist = array( + 'iframe' => isset($whitelist->iframe) ? $whitelist->iframe : array(), + 'object' => isset($whitelist->object) ? $whitelist->object : array(), + ); + } + foreach ($custom_whitelist['iframe'] as $prefix) + { + self::$_iframe_whitelist[] = self::formatPrefix($prefix); + } + foreach ($custom_whitelist['object'] as $prefix) + { + self::$_object_whitelist[] = self::formatPrefix($prefix); + } + } + else + { + foreach ($default_whitelist['iframe'] as $prefix) + { + self::$_iframe_whitelist[] = $prefix; + } + foreach ($default_whitelist['object'] as $prefix) + { + self::$_object_whitelist[] = $prefix; + } + if ($iframe_whitelist = config('mediafilter.iframe') ?: config('embedfilter.iframe')) + { + foreach ($iframe_whitelist as $prefix) + { + self::$_iframe_whitelist[] = self::formatPrefix($prefix); + } + } + if ($object_whitelist = config('mediafilter.object') ?: config('embedfilter.object')) + { + foreach ($object_whitelist as $prefix) + { + self::$_object_whitelist[] = self::formatPrefix($prefix); + } + } + } + + self::$_object_whitelist = array_unique(self::$_object_whitelist); + self::$_iframe_whitelist = array_unique(self::$_iframe_whitelist); + natcasesort(self::$_object_whitelist); + natcasesort(self::$_iframe_whitelist); + } +} diff --git a/common/framework/formatter.php b/common/framework/formatter.php new file mode 100644 index 000000000..6865a17c1 --- /dev/null +++ b/common/framework/formatter.php @@ -0,0 +1,311 @@ + instead of
to separate lines. + if ($options & self::TEXT_NEWLINE_AS_P) + { + $lines = array_map('trim', explode("\n", escape(trim($text)))); + $result = ''; + foreach ($lines as $line) + { + $result .= "

$line

\n"; + } + return $result; + } + + // This option uses
to separate lines and

to separate paragraphs. + if ($options & self::TEXT_DOUBLE_NEWLINE_AS_P) + { + $lines = preg_replace('!(
)+\s*$!', '', nl2br(escape(trim($text)))); + $lines = preg_split('!(
\s*)+
!', $lines); + foreach ($lines as $line) + { + $result .= "

\n" . trim($line) . "\n

\n"; + } + return $result; + } + + // The default is to use
always. + return nl2br(escape(trim($text))) . "
\n"; + } + + /** + * Convert HTML to plain text. + * + * @param string $html + * @return string + */ + public static function html2text($html) + { + // Add line breaks after
and

tags. + $html = preg_replace('!]*>\s*!i', "\n", $html); + $html = preg_replace('!]*>\s*!i', '', $html); + $html = preg_replace('!]*>\s*!i', "\n\n", $html); + + // Encode links and images to preserve essential information. + $html = preg_replace_callback('!]*href="([^>"]+)"[^>]*>([^<]*)!i', function($matches) { + return trim($matches[2] . ' <' . $matches[1] . '>'); + }, $html); + $html = preg_replace_callback('!]*src="([^>"]+)"[^>]*>!i', function($matches) { + $title = preg_match('!title="([^>"]+)"!i', $matches[0], $m) ? $m[1] : null; + $title = $title ?: (preg_match('!alt="([^>"]+)"!i', $matches[0], $m) ? $m[1] : 'IMAGE'); + return trim('[' . $title . '] <' . $matches[1] . '>'); + }, $html); + + // Strip all other HTML. + $text = html_entity_decode(strip_tags($html)); + unset($html); + + // Normalize whitespace and return. + $text = str_replace("\r\n", "\n", $text); + $text = preg_replace('/\n(?:\s*\n)+/', "\n\n", $text); + return trim($text) . "\n"; + } + + /** + * Convert Markdown to HTML. + * + * @param string $markdown + * @param int $options (optional) + * @return string + */ + public static function markdown2html($markdown, $options = 0) + { + if ($options & self::MD_NEWLINE_AS_BR) + { + $markdown = preg_replace('/(?getConfig()->setOption('bold_style', '**'); + $converter->getConfig()->setOption('italic_style', '_'); + $converter->getConfig()->setOption('strip_tags', true); + return trim($converter->convert($html)) . "\n"; + } + + /** + * Convert BBCode to HTML. + * + * @param string $bbcode + * @return string + */ + public static function bbcode($bbcode) + { + $parser = new \JBBCode\Parser; + $parser->addCodeDefinitionSet(new \JBBCode\DefaultCodeDefinitionSet()); + + $builder = new \JBBCode\CodeDefinitionBuilder('quote', '

{param}
'); + $parser->addCodeDefinition($builder->build()); + $builder = new \JBBCode\CodeDefinitionBuilder('code', '
{param}
'); + $builder->setParseContent(false); + $parser->addCodeDefinition($builder->build()); + + $parser->parse($bbcode); + $html = $parser->getAsHtml(); + return Filters\HTMLFilter::clean($html); + } + + /** + * Apply smart quotes and other stylistic enhancements to HTML. + * + * @param string $html + * @return string + */ + public static function applySmartQuotes($html) + { + return \Michelf\SmartyPants::defaultTransform($html, 'qbBdDiew'); + } + + /** + * Compile LESS into CSS. + * + * @param string|array $source_filename + * @param string $target_filename + * @param array $variables (optional) + * @parsm bool $minify (optional) + * @return bool + */ + public static function compileLESS($source_filename, $target_filename, $variables = array(), $minify = false) + { + // Get the cleaned and concatenated content. + $content = self::_concatenate($source_filename, $target_filename); + + // Compile! + try + { + $less_compiler = new \lessc; + $less_compiler->setFormatter($minify ? 'compressed' : 'lessjs'); + $less_compiler->setImportDir(array(dirname(is_array($source_filename) ? array_first($source_filename) : $source_filename))); + if ($variables) + { + $less_compiler->setVariables($variables); + } + + $content = '@charset "UTF-8";' . "\n" . $less_compiler->compile($content) . "\n"; + $result = true; + } + catch (\Exception $e) + { + $content = '/*' . "\n" . 'Error while compiling LESS:' . "\n" . $e->getMessage() . "\n" . '*/' . "\n"; + $result = false; + } + + // Save the result to the target file. + Storage::write($target_filename, $content); + return $result; + } + + /** + * Compile SCSS into CSS. + * + * @param string|array $source_filename + * @param string $target_filename + * @param array $variables (optional) + * @parsm bool $minify (optional) + * @return bool + */ + public static function compileSCSS($source_filename, $target_filename, $variables = array(), $minify = false) + { + // Get the cleaned and concatenated content. + $content = self::_concatenate($source_filename, $target_filename); + + // Compile! + try + { + $scss_compiler = new \Leafo\ScssPhp\Compiler; + $scss_compiler->setFormatter($minify ? '\Leafo\ScssPhp\Formatter\Crunched' : '\Leafo\ScssPhp\Formatter\Expanded'); + $scss_compiler->setImportPaths(array(dirname(is_array($source_filename) ? array_first($source_filename) : $source_filename))); + if ($variables) + { + $scss_compiler->setVariables($variables); + } + + $content = '@charset "UTF-8";' . "\n" . $scss_compiler->compile($content) . "\n"; + $result = true; + } + catch (\Exception $e) + { + $content = '/*' . "\n" . 'Error while compiling SCSS:' . "\n" . $e->getMessage() . "\n" . '*/' . "\n"; + $result = false; + } + + // Save the result to the target file. + Storage::write($target_filename, $content); + return $result; + } + + /** + * Minify CSS. + * + * @param string|array $source_filename + * @param string $target_filename + * @return bool + */ + public static function minifyCSS($source_filename, $target_filename) + { + $minifier = new \MatthiasMullie\Minify\CSS($source_filename); + $content = $minifier->execute($target_filename); + Storage::write($target_filename, $content); + return strlen($content) ? true : false; + } + + /** + * Minify JS. + * + * @param string|array $source_filename + * @param string $target_filename + * @return bool + */ + public static function minifyJS($source_filename, $target_filename) + { + $minifier = new \MatthiasMullie\Minify\JS($source_filename); + $content = $minifier->execute($target_filename); + Storage::write($target_filename, $content); + return strlen($content) ? true : false; + } + + /** + * CSS concatenation subroutine for compileLESS() and compileSCSS(). + * + * @param string|array $source_filename + * @param string $target_filename + * @return string + */ + protected static function _concatenate($source_filename, $target_filename) + { + $result = ''; + + if (!is_array($source_filename)) + { + $source_filename = array($source_filename); + } + foreach ($source_filename as $filename) + { + $content = utf8_clean(file_get_contents($filename)); + $path_converter = new \MatthiasMullie\PathConverter\Converter($filename, $target_filename); + $content = preg_replace_callback('/\burl\\(([^)]+)\\)/iU', function($matches) use ($path_converter) { + $url = trim($matches[1], '\'"'); + if (!strlen($url) || $url[0] === '/') + { + return $matches[0]; + } + else + { + return 'url("' . escape_dqstr($path_converter->convert($url)) . '")'; + } + }, $content); + unset($path_converter); + $result .= trim($content) . "\n\n"; + } + + return $result; + } +} diff --git a/common/framework/i18n.php b/common/framework/i18n.php new file mode 100644 index 000000000..fe3ee894b --- /dev/null +++ b/common/framework/i18n.php @@ -0,0 +1,78 @@ +iso_3166_1_alpha2, $b->iso_3166_1_alpha2); + }); + break; + case self::SORT_CODE_3: + uasort($result, function($a, $b) { + return strcmp($a->iso_3166_1_alpha3, $b->iso_3166_1_alpha3); + }); + break; + case self::SORT_CODE_NUMERIC: + uasort($result, function($a, $b) { + return strcmp($a->iso_3166_1_numeric, $b->iso_3166_1_numeric); + }); + break; + case self::SORT_CCTLD: + uasort($result, function($a, $b) { + return strcmp($a->cctld, $b->cctld); + }); + break; + case self::SORT_NAME_ENGLISH: + uasort($result, function($a, $b) { + return strcmp($a->name_english, $b->name_english); + }); + break; + case self::SORT_NAME_KOREAN: + uasort($result, function($a, $b) { + return strcmp($a->name_korean, $b->name_korean); + }); + break; + case self::SORT_NAME_NATIVE: + uasort($result, function($a, $b) { + return strcmp($a->name_native, $b->name_native); + }); + break; + } + + return $result; + } +} diff --git a/common/framework/korea.php b/common/framework/korea.php new file mode 100644 index 000000000..5996decb5 --- /dev/null +++ b/common/framework/korea.php @@ -0,0 +1,453 @@ + date('ymd')) + { + return false; + } + + // Calculate the checksum. + $sum = 0; + for ($i = 0; $i < 12; $i++) + { + $sum += $code[$i] * (($i % 8) + 2); + } + $checksum = (11 - ($sum % 11)) % 10; + if (in_array((int)($code[6]), array(1, 2, 3, 4, 9, 0))) + { + return $checksum === (int)($code[12]); + } + else + { + if (substr($code, 7, 2) % 2 !== 0) + { + return false; + } + else + { + return (($checksum + 2) % 10) === (int)($code[12]); + } + } + } + + /** + * Check if the given string is a valid corporation registration number (법인등록번호). + * + * This method only checks the format. + * It does not check that the number is actually in use. + * + * @param string $code + * @return bool + */ + public static function isValidCorporationNumber($code) + { + // Return false if the format is obviously wrong. + if (!preg_match('/^[0-9]{6}-?[0-9]{7}$/', $code)) + { + return false; + } + + // Remove hyphen. + $code = str_replace('-', '', $code); + + // Calculate the checksum. + $sum = 0; + for ($i = 0; $i < 12; $i++) + { + $sum += $code[$i] * (($i % 2) + 1); + } + $checksum = (10 - ($sum % 10)) % 10; + + // Check the 7th and 13th digits. + if ($code[6] !== '0') + { + return false; + } + return $checksum === (int)($code[12]); + } + + /** + * Check if the given string is a valid business registration number (사업자등록번호). + * + * This method only checks the format. + * It does not check that the number is actually in use. + * + * @param string $code + * @return bool + */ + public static function isValidBusinessNumber($code) + { + // Return false if the format is obviously wrong. + if (!preg_match('/^[0-9]{3}-?[0-9]{2}-?[0-9]{5}$/', $code)) + { + return false; + } + + // Remove hyphen. + $code = str_replace('-', '', $code); + + // Calculate the checksum. + $sum = 0; + $sum += $code[0] + ($code[1] * 3) + ($code[2] * 7); + $sum += $code[3] + ($code[4] * 3) + ($code[5] * 7); + $sum += $code[6] + ($code[7] * 3) + ($code[8] * 5); + $sum += floor(($code[8] * 5) / 10); + $checksum = (10 - ($sum % 10)) % 10; + + // Check the last digit. + return $checksum === (int)($code[9]); + } + + /** + * Check if the given IP address is Korean. + * + * This method may return incorrect results if the IP allocation databases + * (korea.ipv4.php, korea.ipv6.php) are out of date. + * + * @param string $ip + * @return bool + */ + public static function isKoreanIP($ip) + { + // Extract the IPv4 address from an "IPv4-mapped IPv6" address. + if (preg_match('/::ffff:(?:0+:)?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/', $ip, $matches)) $ip = $matches[1]; + + // Return false if the IP address is not in the right format. + if (!filter_var($ip, \FILTER_VALIDATE_IP)) return false; + + // Check IPv4. + if (filter_var($ip, \FILTER_VALIDATE_IP, array('flags' => \FILTER_FLAG_IPV4))) + { + // Convert to integer. + $ipnum = sprintf('%u', ip2long($ip)); + + // Treat local addresses as Korean. + if ($ipnum >= 167772160 && $ipnum <= 184549375) return true; // 10.0.0.0/8 + if ($ipnum >= 2130706432 && $ipnum <= 2147483647) return true; // 127.0.0.0/8 + if ($ipnum >= 3232235520 && $ipnum <= 3232301055) return true; // 192.168.0.0/16 + if ($ipnum >= 2886729728 && $ipnum <= 2887778303) return true; // 172.16.0.0/20 + + // Check the IPv4 allocation database. + $ranges = (include \RX_BASEDIR . 'common/defaults/korea.ipv4.php'); + foreach ($ranges as $range) + { + if ($ipnum >= $range[0] && $ipnum <= $range[1]) return true; + } + return false; + } + + // Check IPv6. + elseif (function_exists('inet_pton')) + { + // Convert to hexadecimal format. + $ipbin = strtolower(bin2hex(inet_pton($ip))); + + // Treat local addresses as Korean. + if ($ipbin == '00000000000000000000000000000001') return true; // ::1 + if (preg_match('/^f(?:[cd]|e80{13})/', $ipbin)) return true; // fc00::/8, fd00::/8, fe80::/64 + + // Check the IPv6 allocation database. + $ranges = (include \RX_BASEDIR . 'common/defaults/korea.ipv6.php'); + foreach ($ranges as $range) + { + if (strncmp($ipbin, $range[0], 16) >= 0 && strncmp($ipbin, $range[1], 16) <= 0) return true; + } + return false; + } + + return false; + } + + /** + * Check if the given email address is hosted by a Korean portal site. + * + * This can be used to tell which recipients may subscribe to the KISA RBL (kisarbl.or.kr). + * If the domain is not found, this method returns false. + * + * @param string $domain + * @param bool $clear_cache (optional) + * @return bool + */ + public static function isKoreanEmailAddress($email_address, $clear_cache = false) + { + // Clear the cache if requested. + if ($clear_cache) + { + self::$_domain_cache = array(); + } + + // Get the domain from the email address. + if ($pos = strpos($email_address, '@')) + { + $domain = substr($email_address, $pos + 1); + } + else + { + $domain = $email_address; + } + $domain = rtrim(strtolower($domain), '.'); + + // Return cached result if available. + if (array_key_exists($domain, self::$_domain_cache)) + { + return self::$_domain_cache[$domain]; + } + + // Shortcut for known domains. + if (in_array($domain, self::$known_korean)) + { + return self::$_domain_cache[$domain] = true; + } + if (in_array($domain, self::$known_foreign)) + { + return self::$_domain_cache[$domain] = false; + } + + // For unknown domains, check the MX record. + $mx = self::_getDNSRecords($domain, \DNS_MX); + + $i = 0; + foreach ($mx as $mx) + { + $mx = rtrim($mx, '.'); + foreach (self::$known_korean as $portal) + { + if ($mx === $portal || ends_with('.' . $portal, $mx)) + { + return self::$_domain_cache[$domain] = true; + } + } + foreach (self::$known_foreign as $portal) + { + if ($mx === $portal || ends_with('.' . $portal, $mx)) + { + return self::$_domain_cache[$domain] = false; + } + } + foreach (self::_getDNSRecords($domain, \DNS_A) as $mx_ip) + { + return self::$_domain_cache[$domain] = self::isKoreanIP($mx_ip); + } + if (++$i > 2) + { + break; + } + } + + return self::$_domain_cache[$domain] = false; + } + + /** + * Get the DNS records of a domain. + * + * @param string $domain + * @param int $type + * @return array + */ + protected static function _getDNSRecords($domain, $type) + { + $records = dns_get_record($domain, $type); + if (!$records) + { + return array(); + } + + $result = array(); + foreach ($records as $record) + { + if (isset($record['pri']) && isset($record['target'])) + { + $result[intval($record['pri'])] = $record['target']; + } + elseif (isset($record['target'])) + { + $result[] = $record['target']; + } + elseif (isset($record['ip']) || isset($record['ipv6'])) + { + $result[] = isset($record['ip']) ? $record['ip'] : $record['ipv6']; + } + elseif (isset($record['txt'])) + { + $result[] = $record['txt']; + } + } + + ksort($result); + return $result; + } + + /** + * Prevent multiple lookups for the same domain. + */ + protected static $_domain_cache = array(); + + /** + * Domains known to be Korean and subscribed to the KISA RBL. + */ + public static $known_korean = array( + 'hanmail.net', + 'hanmail2.net', + 'daum.net', + 'paran.com', + 'tistory.com', + 'naver.com', + 'navercorp.com', + 'nate.com', + 'cyworld.com', + 'dreamwiz.com', + 'korea.com', + 'dreamx.com', + 'chol.com', + 'chollian.net', + 'hanmir.com', + 'hitel.com', + 'freechal.com', + 'empas.com', + 'empal.com', + 'hanafos.com', + ); + + /** + * Domains known to be foreign. + */ + public static $known_foreign = array( + 'gmail.com', + 'googlemail.com', + 'google.com', + 'yahoo.com', + 'yahoo.co.kr', + 'hotmail.com', + 'hotmail.co.kr', + 'live.com', + 'outlook.com', + 'msn.com', + 'me.com', + 'mac.com', + 'icloud.com', + 'facebook.com', + 'aol.com', + 'gmx.com', + 'mail.com', + 'fastmail.com', + 'fastmail.fm', + 'runbox.com', + 'inbox.com', + 'lycos.com', + 'zoho.com', + ); +} diff --git a/common/framework/lang.php b/common/framework/lang.php index d8c678cf0..7880be069 100644 --- a/common/framework/lang.php +++ b/common/framework/lang.php @@ -75,19 +75,19 @@ class Lang if ($name === 'common') { - $this->loadDirectory(RX_BASEDIR . 'common/lang', 'common'); + $this->loadDirectory(\RX_BASEDIR . 'common/lang', 'common'); } - elseif (file_exists(RX_BASEDIR . "plugins/$name/lang")) + elseif (file_exists(\RX_BASEDIR . "plugins/$name/lang")) { - $this->loadDirectory(RX_BASEDIR . "plugins/$name/lang", $name); + $this->loadDirectory(\RX_BASEDIR . "plugins/$name/lang", $name); } - elseif (file_exists(RX_BASEDIR . "modules/$name/lang")) + elseif (file_exists(\RX_BASEDIR . "modules/$name/lang")) { - $this->loadDirectory(RX_BASEDIR . "modules/$name/lang", $name); + $this->loadDirectory(\RX_BASEDIR . "modules/$name/lang", $name); } - elseif (file_exists(RX_BASEDIR . "addons/$name/lang")) + elseif (file_exists(\RX_BASEDIR . "addons/$name/lang")) { - $this->loadDirectory(RX_BASEDIR . "addons/$name/lang", $name); + $this->loadDirectory(\RX_BASEDIR . "addons/$name/lang", $name); } } @@ -108,70 +108,52 @@ class Lang return true; } - // Load the language file. - $lang = $this->getPluginLang($dir); + // Initialize variables. + $filename = null; + $lang = new \stdClass; + $result = true; - // Load the default language file. + // Find a suitable language file in the given directory. + if (file_exists($dir . '/' . $this->_language . '.php')) + { + $filename = $dir . '/' . $this->_language . '.php'; + } + elseif (($hyphen = strpos($this->_language, '-')) !== false && file_exists($dir . '/' . substr($this->_language, 0, $hyphen) . '.php')) + { + $filename = $dir . '/' . substr($this->_language, 0, $hyphen) . '.php'; + } + elseif (file_exists("$dir/lang.xml")) + { + $filename = Parsers\LangParser::compileXMLtoPHP("$dir/lang.xml", $this->_language === 'ja' ? 'jp' : $this->_language); + } + elseif (file_exists($dir . '/' . ($this->_language === 'ja' ? 'jp' : $this->_language) . '.lang.php')) + { + $filename = $dir . '/' . ($this->_language === 'ja' ? 'jp' : $this->_language) . '.lang.php'; + } + + // Load the language file. + if ($filename) + { + include $filename; + array_unshift($this->_search_priority, $plugin_name); + $result = true; + } + else + { + $result = false; + } + + // Mark this directory and plugin as loaded. + $this->_loaded_directories[$dir] = true; + $this->_loaded_plugins[$plugin_name] = $lang; + + // Load the same directory in the default language, too. if ($this->_language !== 'en') { self::getInstance('en')->loadDirectory($dir, $plugin_name); } - if (!empty($lang)) - { - $this->_loaded_directories[$dir] = true; - $this->_loaded_plugins[$plugin_name] = $lang; - array_unshift($this->_search_priority, $plugin_name); - return true; - } - else - { - $this->_loaded_directories[$dir] = true; - $this->_loaded_plugins[$plugin_name] = new \stdClass; - return false; - } - } - - /** - * Get the language file from plugin. - * - * @param string $dir - * @param string $language - * @return object - */ - public function getPluginLang($dir, $language = null) - { - if (!$language) - { - $language = $this->_language; - } - - if (file_exists($dir . '/' . $language . '.php')) - { - $filename = $dir . '/' . $language . '.php'; - } - elseif (($hyphen = strpos($language, '-')) !== false && file_exists($dir . '/' . substr($language, 0, $hyphen) . '.php')) - { - $filename = $dir . '/' . substr($language, 0, $hyphen) . '.php'; - } - elseif (file_exists("$dir/lang.xml")) - { - $filename = Compat\LangParser::compileXMLtoPHP("$dir/lang.xml", $language === 'ja' ? 'jp' : $language); - } - elseif (file_exists($dir . '/' . ($language === 'ja' ? 'jp' : $language) . '.lang.php')) - { - $filename = $dir . '/' . ($language === 'ja' ? 'jp' : $language) . '.lang.php'; - } - - if (!$filename) - { - return new \stdClass; - } - - $lang = new \stdClass; - include $filename; - - return $lang; + return $result; } /** @@ -181,7 +163,7 @@ class Lang */ public static function getSupportedList() { - return (include RX_BASEDIR . 'common/defaults/lang.php'); + return (include \RX_BASEDIR . 'common/defaults/lang.php'); } /** @@ -194,7 +176,19 @@ class Lang { $args = func_get_args(); array_shift($args); - return $this->__call($key, $args); + if (count($args) === 1 && is_array($args[0])) + { + $args = $args[0]; + } + + // Get the translation. + $translation = $this->__get($key); + + // If there are no arguments, return the translation. + if (!count($args)) return $translation; + + // If there are arguments, interpolate them into the translation and return the result. + return vsprintf($translation, $args); } /** @@ -209,6 +203,24 @@ class Lang $this->__set($key, $value); } + /** + * Fallback method for getting the default translation. + * + * @param string $key + * @return string + */ + public function getFromDefaultLang($key) + { + if ($this->_language === 'en') + { + return $key; + } + else + { + return self::getInstance('en')->__get($key); + } + } + /** * Magic method for translations without arguments. * @@ -217,84 +229,59 @@ class Lang */ public function __get($key) { - // Get default language - if ($this->_language !== 'en') + // Load a dot-separated key (prefixed by plugin name). + if (preg_match('/^[a-z0-9_.-]+$/i', $key) && ($keys = explode('.', $key)) && count($keys) >= 2) { - $lang_en = self::getInstance('en')->{$key}; - } - - // Separate the plugin name from the key. - if (preg_match('/^[a-z0-9_.-]+$/i', $key) && ($keys = explode('.', $key, 2)) && count($keys) === 2) - { - list($plugin_name, $lang_key) = $keys; + // Attempt to load the plugin. + $plugin_name = array_shift($keys); if (!isset($this->_loaded_plugins[$plugin_name])) { $this->loadPlugin($plugin_name); } - - if (isset($this->_loaded_plugins[$plugin_name]->{$lang_key})) + if (!isset($this->_loaded_plugins[$plugin_name])) { - $lang = $this->_loaded_plugins[$plugin_name]->{$lang_key}; - if (is_array($lang) && is_array($lang_en) && count($lang_en, COUNT_RECURSIVE) > count($lang, COUNT_RECURSIVE)) - { - return $lang_en; - } - - return $lang; + return $this->getFromDefaultLang($key); } - } - else - { - // Search custom translations first. - if (isset($this->_loaded_plugins['_custom_']->{$key})) + + // Find the given key. + $lang = $this->_loaded_plugins[$plugin_name]; + foreach ($keys as $subkey) { - $lang = $this->_loaded_plugins['_custom_']->{$key}; - if (is_array($lang)) + if (is_object($lang) && isset($lang->{$subkey})) { - if (is_array($lang_en) && count($lang_en, COUNT_RECURSIVE) > count($lang, COUNT_RECURSIVE)) - { - return new \ArrayObject($lang_en, 3); - } - - return new \ArrayObject($lang, 3); + $lang = $lang->{$subkey}; + } + elseif (is_array($lang) && isset($lang[$subkey])) + { + $lang = $lang[$subkey]; } else { - return $lang; - } - } - - // Search other plugins. - foreach ($this->_search_priority as $plugin_name) - { - if (isset($this->_loaded_plugins[$plugin_name]->{$key})) - { - $lang = $this->_loaded_plugins[$plugin_name]->{$key}; - if (is_array($lang)) - { - if (is_array($lang_en) && count($lang_en, COUNT_RECURSIVE) > count($lang, COUNT_RECURSIVE)) - { - return new \ArrayObject($lang_en, 3); - } - - return new \ArrayObject($lang, 3); - } - else - { - return $lang; - } + return $this->getFromDefaultLang($key); } } + return is_array($lang) ? new \ArrayObject($lang, 3) : $lang; } - // Search other language. - if (isset($lang_en)) + // Search custom translations first. + if (isset($this->_loaded_plugins['_custom_']->{$key})) { - return $lang_en; + $lang = $this->_loaded_plugins['_custom_']->{$key}; + return is_array($lang) ? new \ArrayObject($lang, 3) : $lang; } - // If no translation is found, return the key. - return $key; + // Search other plugins. + foreach ($this->_search_priority as $plugin_name) + { + if (isset($this->_loaded_plugins[$plugin_name]->{$key})) + { + $lang = $this->_loaded_plugins[$plugin_name]->{$key}; + return is_array($lang) ? new \ArrayObject($lang, 3) : $lang; + } + } + + // If no translation is found, return the default language. + return $this->getFromDefaultLang($key); } /** @@ -306,6 +293,73 @@ class Lang */ public function __set($key, $value) { + // Set a dot-separated key (prefixed by plugin name). + if (preg_match('/^[a-z0-9_.-]+$/i', $key) && ($keys = explode('.', $key)) && count($keys) >= 2) + { + // Attempt to load the plugin. + $plugin_name = array_shift($keys); + if (!isset($this->_loaded_plugins[$plugin_name])) + { + $this->loadPlugin($plugin_name); + } + if (!isset($this->_loaded_plugins[$plugin_name])) + { + return false; + } + + // Set the given key. + $count = count($keys); + $lang = $this->_loaded_plugins[$plugin_name]; + foreach ($keys as $i => $subkey) + { + if (is_object($lang) && isset($lang->{$subkey})) + { + if ($i === $count - 1) + { + $lang->{$subkey} = $value; + break; + } + elseif (is_array($lang->{$subkey})) + { + $lang = &$lang->{$subkey}; + } + else + { + return false; + } + } + elseif (is_array($lang) && isset($lang[$subkey])) + { + if ($i === $count - 1) + { + $lang[$subkey] = $value; + break; + } + elseif (is_array($lang[$subkey])) + { + $lang = &$lang[$subkey]; + } + else + { + return false; + } + } + else + { + if (is_object($lang)) + { + $lang->{$subkey} = $value; + } + else + { + $lang[$subkey] = $value; + } + break; + } + } + } + + // Set a regular key. $this->_loaded_plugins['_custom_']->{$key} = $value; } @@ -335,13 +389,7 @@ class Lang */ public function __unset($key) { - foreach ($this->_loaded_plugins as $plugin_name => $translations) - { - if (isset($translations->{$key})) - { - unset($translations->{$key}); - } - } + $this->set($key, null); } /** @@ -353,16 +401,6 @@ class Lang */ public function __call($key, $args = array()) { - // Remove a colon from the beginning of the string. - if ($key !== '' && $key[0] === ':') $key = substr($key, 1); - - // Find the translation. - $translation = $this->__get($key); - - // If there are no arguments, return the translation. - if (!count($args)) return $translation; - - // If there are arguments, interpolate them into the translation and return the result. - return vsprintf($translation, $args); + return $this->get($key, $args); } } diff --git a/common/framework/mime.php b/common/framework/mime.php new file mode 100644 index 000000000..7c033f6bb --- /dev/null +++ b/common/framework/mime.php @@ -0,0 +1,154 @@ + $mime) + { + if (!strncasecmp($type, $mime, strlen($type))) return $extension; + } + return false; + } + + /** + * The default MIME type for unknown extensions. + */ + protected static $_default = 'application/octet-stream'; + + /** + * The list of known MIME types. + */ + protected static $_types = array( + + // Text-based document formats. + 'html' => 'text/html', + 'htm' => 'text/html', + 'shtml' => 'text/html', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => 'text/plain', + 'md' => 'text/markdown', + 'markdown' => 'text/markdown', + 'rtf' => 'text/rtf', + 'xml' => 'text/xml', + 'xsl' => 'text/xml', + 'css' => 'text/css', + 'csv' => 'text/csv', + + // Binary document formats. + 'doc' => 'application/msword', + 'dot' => 'application/msword', + 'xls' => 'application/vnd.ms-excel', + 'ppt' => 'application/vnd.ms-powerpoint', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'pdf' => 'application/pdf', + + // Images. + 'bmp' => 'image/bmp', + 'gif' => 'image/gif', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'png' => 'image/png', + 'svg' => 'image/svg+xml', + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'ico' => 'image/vnd.microsoft.icon', + + // Audio. + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'ra' => 'audio/x-realaudio', + 'wav' => 'audio/x-wav', + 'ogg' => 'audio/ogg', + + // Video. + 'avi' => 'video/x-msvideo', + 'flv' => 'video/x-flv', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'mp4' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'rv' => 'video/vnd.rn-realvideo', + 'dvi' => 'application/x-dvi', + + // Other multimedia file formats. + 'psd' => 'application/x-photoshop', + 'swf' => 'application/x-shockwave-flash', + 'ai' => 'application/postscript', + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'mif' => 'application/vnd.mif', + 'xul' => 'application/vnd.mozilla.xul+xml', + + // Source code formats. + 'phps' => 'application/x-httpd-php-source', + 'js' => 'application/x-javascript', + + // Archives. + 'bz2' => 'application/x-bzip', + 'gz' => 'application/x-gzip', + 'tar' => 'application/x-tar', + 'tgz' => 'application/x-tar', + 'gtar' => 'application/x-gtar', + 'rar' => 'application/x-rar-compressed', + 'zip' => 'application/x-zip', + + // RFC822 email message. + 'eml' => 'message/rfc822', + ); +} diff --git a/common/framework/pagination.php b/common/framework/pagination.php new file mode 100644 index 000000000..cc26906e4 --- /dev/null +++ b/common/framework/pagination.php @@ -0,0 +1,153 @@ + $total_pages) + { + $last_shown = $total_pages; + } + } + else + { + $first_shown = $current_page - floor(($count - 1) / 2); + if ($first_shown < 1) + { + $first_shown = 1; + } + $last_shown = $first_shown + $count - 1; + if ($last_shown > $total_pages) + { + $last_shown = $total_pages; + $first_shown = max(1, $last_shown - $count + 1); + } + } + + // Open the
tag. + $return = array(' + diff --git a/modules/board/tpl/filter/update.xml b/modules/board/tpl/filter/update.xml new file mode 100644 index 000000000..a55476429 --- /dev/null +++ b/modules/board/tpl/filter/update.xml @@ -0,0 +1,7 @@ + +
+ + + + +
diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 5c073722b..ab2c4262e 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -829,9 +829,9 @@ class commentController extends comment } // set modifier's information if logged-in and posting author and modifier are matched. + $logged_info = Context::get('logged_info'); if(Context::get('is_logged')) { - $logged_info = Context::get('logged_info'); if($source_obj->member_srl == $logged_info->member_srl) { $obj->member_srl = $logged_info->member_srl; diff --git a/modules/communication/communication.admin.controller.php b/modules/communication/communication.admin.controller.php index f0e7f0974..fd05dcb35 100644 --- a/modules/communication/communication.admin.controller.php +++ b/modules/communication/communication.admin.controller.php @@ -24,39 +24,14 @@ class communicationAdminController extends communication function procCommunicationAdminInsertConfig() { // get the default information - $args = Context::gets('skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_write_default','grant_write_group', 'member_menu'); + $args = Context::gets('enable_message', 'enable_friend', 'skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_send_default','grant_send_group'); $args->editor_colorset = $args->sel_editor_colorset; unset($args->sel_editor_colorset); - if(!$args->skin) - { - $args->skin = 'default'; - } - - if(!$args->colorset) - { - $args->colorset = 'white'; - } - - if(!$args->editor_skin) - { - $args->editor_skin = 'default'; - } - - if(!$args->mskin) - { - $args->mskin = 'default'; - } - - if(!$args->layout_srl) - { - $args->layout_srl = NULL; - } - $oCommunicationModel = getModel('communication'); - $args->grant_write = $oCommunicationModel->getGrantArray($args->grant_write_default, $args->grant_write_group); - unset($args->grant_write_default); - unset($args->grant_write_group); + $args->grant_send = $oCommunicationModel->getGrantArray($args->grant_send_default, $args->grant_send_group); + unset($args->grant_send_default); + unset($args->grant_send_group); // create the module module Controller object $oModuleController = getController('module'); diff --git a/modules/communication/communication.admin.view.php b/modules/communication/communication.admin.view.php index 9fc91e73d..89dd8f498 100644 --- a/modules/communication/communication.admin.view.php +++ b/modules/communication/communication.admin.view.php @@ -30,7 +30,7 @@ class communicationAdminView extends communication $oCommunicationModel = getModel('communication'); // get the configurations of communication module - Context::set('communication_config', $oCommunicationModel->getConfig()); + Context::set('config', $oCommunicationModel->getConfig()); // get a list of layout Context::set('layout_list', $oLayoutModel->getLayoutList()); @@ -39,10 +39,10 @@ class communicationAdminView extends communication Context::set('editor_skin_list', $oEditorModel->getEditorSkinList()); // get a list of communication skins - Context::set('communication_skin_list', $oModuleModel->getSkins($this->module_path)); + Context::set('skin_list', $oModuleModel->getSkins($this->module_path)); // get a list of communication skins - Context::set('communication_mobile_skin_list', $oModuleModel->getSkins($this->module_path, 'm.skins')); + Context::set('mobile_skin_list', $oModuleModel->getSkins($this->module_path, 'm.skins')); // Get a layout list $layout_list = $oLayoutModel->getLayoutList(); @@ -52,11 +52,11 @@ class communicationAdminView extends communication Context::set('mlayout_list', $mlayout_list); $security = new Security(); - $security->encodeHTML('communication_config..'); + $security->encodeHTML('config..'); $security->encodeHTML('layout_list..'); $security->encodeHTML('editor_skin_list..'); - $security->encodeHTML('communication_skin_list..title'); - $security->encodeHTML('communication_mobile_skin_list..title'); + $security->encodeHTML('skin_list..title'); + $security->encodeHTML('mobile_skin_list..title'); $oMemberModel = getModel('member'); $group_list = $oMemberModel->getGroups($this->site_srl); diff --git a/modules/communication/communication.class.php b/modules/communication/communication.class.php index 559e2f28b..1da302005 100644 --- a/modules/communication/communication.class.php +++ b/modules/communication/communication.class.php @@ -9,7 +9,11 @@ class communication extends ModuleObject { private $triggers = array( - array('moduleHandler.init', 'communication', 'controller', 'triggerModuleHandlerAfter', 'after') + array('moduleHandler.init', 'communication', 'controller', 'triggerModuleHandlerBefore', 'before'), + array('member.getMemberMenu', 'communication', 'controller', 'triggerMemberMenu', 'before') + ); + private $delete_triggers = array( + array('moduleObject.proc', 'communication', 'controller', 'triggerModuleProcAfter', 'after') ); /** * Implement if additional tasks are necessary when installing @@ -18,6 +22,7 @@ class communication extends ModuleObject function moduleInstall() { $oModuleController = getController('module'); + foreach($this->triggers as $trigger) { $oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]); @@ -25,6 +30,7 @@ class communication extends ModuleObject // Create a temporary file storage for one new private message notification FileHandler::makeDir('./files/member_extra_info/new_message_flags'); + return new Object(); } @@ -34,28 +40,8 @@ class communication extends ModuleObject */ function checkUpdate() { - if(!is_dir("./files/member_extra_info/new_message_flags")) - { - return TRUE; - } - - $oModuleModel = getModel('module'); - $config = $oModuleModel->getModuleConfig('message'); - - if($config->skin) - { - $config_parse = explode('.', $config->skin); - if(count($config_parse) > 1) - { - $template_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]); - if(is_dir($template_path)) - { - return TRUE; - } - } - } - $oModuleModel = getModel('module'); + foreach($this->triggers as $trigger) { if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) @@ -63,6 +49,21 @@ class communication extends ModuleObject return TRUE; } } + + foreach($this->delete_triggers as $trigger) + { + + if($oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) + { + return TRUE; + } + } + + if(!is_dir("./files/member_extra_info/new_message_flags")) + { + return TRUE; + } + return FALSE; } @@ -72,13 +73,9 @@ class communication extends ModuleObject */ function moduleUpdate() { - if(!is_dir("./files/member_extra_info/new_message_flags")) - { - FileHandler::makeDir('./files/member_extra_info/new_message_flags'); - } - $oModuleModel = getModel('module'); $oModuleController = getController('module'); + foreach($this->triggers as $trigger) { if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) @@ -86,24 +83,18 @@ class communication extends ModuleObject $oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]); } } - $config = $oModuleModel->getModuleConfig('message'); - if(!is_object($config)) + + foreach($this->delete_triggers as $trigger) { - $config = new stdClass(); + if($oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) + { + $oModuleController->deleteTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]); + } } - if($config->skin) + if(!is_dir("./files/member_extra_info/new_message_flags")) { - $config_parse = explode('.', $config->skin); - if(count($config_parse) > 1) - { - $template_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]); - if(is_dir($template_path)) - { - $config->skin = implode('|@|', $config_parse); - $oModuleController->updateModuleConfig('communication', $config); - } - } + FileHandler::makeDir('./files/member_extra_info/new_message_flags'); } return new Object(0, 'success_updated'); diff --git a/modules/communication/communication.controller.php b/modules/communication/communication.controller.php index 585e92722..026fbbb76 100644 --- a/modules/communication/communication.controller.php +++ b/modules/communication/communication.controller.php @@ -89,7 +89,7 @@ class communicationController extends communication $oCommunicationModel = getModel('communication'); $config = $oCommunicationModel->getConfig(); - if(!$oCommunicationModel->checkGrant($config->grant_write)) + if(!$oCommunicationModel->checkGrant($config->grant_send)) { return new Object(-1, 'msg_not_permitted'); } @@ -254,15 +254,11 @@ class communicationController extends communication $oDB->rollback(); return $trigger_output; } - - // create a flag that message is sent (in file format) - $flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($receiver_srl); - FileHandler::makeDir($flag_path); - $flag_file = sprintf('%s%s', $flag_path, $receiver_srl); - $flag_count = FileHandler::readFile($flag_file); - FileHandler::writeFile($flag_file, ++$flag_count); - + $oDB->commit(); + + // create a flag that message is sent (in file format) + $this->updateFlagFile($receiver_srl); return new Object(0, 'success_sended'); } @@ -303,7 +299,7 @@ class communicationController extends communication { return $output; } - + $this->updateFlagFile($logged_info->member_srl); $this->setMessage('success_registed'); } @@ -363,7 +359,7 @@ class communicationController extends communication { return $output; } - + $this->updateFlagFile($member_srl); $this->setMessage('success_deleted'); } @@ -441,7 +437,7 @@ class communicationController extends communication { return $output; } - + $this->updateFlagFile($member_srl); $this->setMessage('success_deleted'); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispCommunicationMessages', 'message_type', Context::get('message_type')); @@ -463,10 +459,20 @@ class communicationController extends communication $logged_info = Context::get('logged_info'); $target_srl = (int) trim(Context::get('target_srl')); - if(!$target_srl) + if(!$target_srl || $target_srl == $logged_info->member_srl) { return new Object(-1, 'msg_invalid_request'); } + + // Check duplicate friend + $args = new stdClass(); + $args->member_srl = $logged_info->member_srl; + $args->target_srl = $target_srl; + $output = executeQuery('communication.isAddedFriend', $args); + if($output->data->count) + { + return new Object(-1, 'msg_already_friend'); + } // Variable $args = new stdClass(); @@ -771,85 +777,111 @@ class communicationController extends communication */ function setMessageReaded($message_srl) { - $args = new stdClass(); + $args = new stdClass; $args->message_srl = $message_srl; $args->related_srl = $message_srl; - return executeQuery('communication.setMessageReaded', $args); + $output = executeQuery('communication.setMessageReaded', $args); + + // Update flag file + $logged_info = Context::get('logged_info'); + $this->updateFlagFile($logged_info->member_srl); + + return $output; + } + + /** + * Update flag file + * @param int $member_srl + * @return void + */ + function updateFlagFile($member_srl) + { + $flag_path = \RX_BASEDIR . 'files/member_extra_info/new_message_flags/' . getNumberingPath($member_srl); + $flag_file = $flag_path . $member_srl; + $new_message_count = getModel('communication')->getNewMessageCount($member_srl); + if($new_message_count > 0) + { + FileHandler::writeFile($flag_file, $new_message_count); + } + else + { + FileHandler::removeFile($flag_file); + } } - function triggerModuleHandlerAfter($module) + function triggerModuleHandlerBefore($obj) { - if(!Context::get('is_logged') && isCrawler()) + // Add menus on the member login information + $config = getModel('communication')->getConfig(); + $oMemberController = getController('member'); + + if($config->enable_message == 'Y') + { + $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); + } + + if($config->enable_friend == 'Y') + { + $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); + } + } + + function triggerMemberMenu() + { + if(!Context::get('is_logged')) { return new Object(); } - - if($module->module == 'admin') - { - return new Object(); - } - + $oCommunicationModel = getModel('communication'); $config = $oCommunicationModel->getConfig(); - - if($config->member_menu != 'Y') + + if($config->enable_message == 'N' && $config->enable_friend == 'N') { return new Object(); } - $act = Context::get('act'); - if($module->module != 'member') + + $mid = Context::get('cur_mid'); + $member_srl = Context::get('target_srl'); + $logged_info = Context::get('logged_info'); + $oMemberController = getController('member'); + + // Add a feature to display own message box. + if($logged_info->member_srl == $member_srl) { - $oMemberController = getController('member'); - $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); - $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); - - // Pop-up to display messages if a flag on new message is set - $new_message_count = $oCommunicationModel->getNewMessageCount(); - if($new_message_count > 0) + // Add your own viewing Note Template + if($config->enable_message == 'Y') { - Context::loadFile('./modules/communication/tpl/js/member_communication.js'); - $text = preg_replace('@\r?\n@', '\\n', addslashes(lang('alert_new_message_arrived'))); - Context::addHtmlHeader(""); - } - - } - elseif($act == 'getMemberMenu') - { - $member_srl = Context::get('target_srl'); - $oCommunicationModel = getModel('communication'); - $logged_info = Context::get('logged_info'); - // Add a feature to display own message box. - if($logged_info->member_srl == $member_srl) - { - $mid = Context::get('cur_mid'); - $oMemberController = getController('member'); - // Add your own viewing Note Template $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self'); - // Display a list of friends - $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); - // If not, Add menus to send message and to add friends } - else + + // Display a list of friends + if($config->enable_friend == 'Y') { - // Get member information - $oMemberModel = getModel('member'); - $target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); - if(!$target_member_info->member_srl) - { - return new Object(); - } + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); + } + } + // If not, Add menus to send message and to add friends + else + { + // Get member information + $oMemberModel = getModel('member'); + $target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); + if(!$target_member_info->member_srl) + { + return new Object(); + } - $oMemberController = getController('member'); - // Add a menu for sending message - if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) - { - $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); - } - // Add a menu for listing friends (if a friend is new) - if(!$oCommunicationModel->isAddedFriend($member_srl)) - { - $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); - } + // Add a menu for sending message + if($config->enable_message == 'Y' && ($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))) + { + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); + } + + // Add a menu for listing friends (if a friend is new) + if($config->enable_friend == 'Y' && !$oCommunicationModel->isAddedFriend($member_srl)) + { + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); } } } diff --git a/modules/communication/communication.model.php b/modules/communication/communication.model.php index 753bb2132..b4bb6974c 100644 --- a/modules/communication/communication.model.php +++ b/modules/communication/communication.model.php @@ -25,44 +25,44 @@ class communicationModel extends communication function getConfig() { $oModuleModel = getModel('module'); - $communication_config = $oModuleModel->getModuleConfig('communication'); + $config = $oModuleModel->getModuleConfig('communication'); - if(!is_object($communication_config)) + if(!$config->skin) { - $communication_config = new stdClass(); + $config->skin = 'default'; } - if(!$communication_config->skin) + if(!$config->colorset) { - $communication_config->skin = 'default'; + $config->colorset = 'white'; } - if(!$communication_config->colorset) + if(!$config->editor_skin) { - $communication_config->colorset = 'white'; + $config->editor_skin = 'ckeditor'; } - if(!$communication_config->editor_skin) + if(!$config->mskin) { - $communication_config->editor_skin = 'ckeditor'; + $config->mskin = 'default'; + } + + if(!$config->grant_send) + { + $config->grant_send = array('default' => 'member'); } - if(!$communication_config->mskin) + if(!$config->enable_message) { - $communication_config->mskin = 'default'; + $config->enable_message = 'Y'; + } + + if(!$config->enable_friend) + { + $config->enable_friend = 'Y'; } - if(!$communication_config->grant_write) - { - $communication_config->grant_write = array('default_grant' => 'member'); - } - - if(!$communication_config->member_menu) - { - $communication_config->member_menu = 'Y'; - } - - return $communication_config; + return $config; } /** @@ -74,82 +74,60 @@ class communicationModel extends communication function getGrantArray($default, $group) { $grant = array(); - if($default!="") + if($default) { - switch($default) - { - case "-2": - $grant = array("default_grant"=>"site"); - break; - case "-3": - $grant = array("default_grant"=>"manager"); - break; - default : - $grant = array("default_grant"=>"member"); - break; - } - } + $grant = array('default' => $default); + } else if(is_array($group)) { - $oMemberModel = getModel('member'); - $group_list = $oMemberModel->getGroups($this->site_srl); - - $group_grant = array(); + $grant_group = array(); foreach($group as $group_srl) { - $group_grant[$group_srl] = $group_list[$group_srl]->title; + $grant_group[$group_srl] = true; } - $grant = array('group_grant'=>$group_grant); + + $grant = array('group' => $grant_group); } + return $grant; } /** - * @brief check member's grant - * @param object $member_info + * @brief Check Grant * @param array $arrGrant * @return boolean */ function checkGrant($arrGrant) { - if(!$arrGrant) - return false; - - if(!Context::get('is_logged')) - return false; + if(!$arrGrant) return false; $logged_info = Context::get('logged_info'); - if($logged_info->is_admin == "Y") - return true; + if($logged_info->is_admin == 'Y') return true; - if($arrGrant['default_grant']) + if($arrGrant['default']) { - if($arrGrant['default_grant'] == "member" && $logged_info) - return true; - - if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) - return true; - - if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") - return true; - } - - if($arrGrant['group_grant']) - { - $group_grant = $arrGrant['group_grant']; - if(!is_array($group_grant)) - return false; - - foreach($logged_info->group_list as $group_srl=>$title) + if($arrGrant['default'] == 'member') { - if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) - return true; + if(Context::get('is_logged')) return true; + } + else if($arrGrant['default'] == 'site') + { + if($this->site_srl == $logged_info->site_srl) return true; + } + else if($arrGrant['default'] == 'manager') + { + if($logged_info->is_admin == 'Y') return true; + } + } + else if(is_array($arrGrant['group'])) + { + foreach($logged_info->group_list as $group_srl => $title) + { + if(isset($arrGrant['group'][$group_srl])) return true; } - } return false; - } /** diff --git a/modules/communication/communication.view.php b/modules/communication/communication.view.php index 23c008524..28e043767 100644 --- a/modules/communication/communication.view.php +++ b/modules/communication/communication.view.php @@ -17,10 +17,10 @@ class communicationView extends communication { $oCommunicationModel = getModel('communication'); - $this->communication_config = $oCommunicationModel->getConfig(); - $skin = $this->communication_config->skin; + $this->config = $oCommunicationModel->getConfig(); + $skin = $this->config->skin; - Context::set('communication_config', $this->communication_config); + Context::set('communication_config', $this->config); $config_parse = explode('|@|', $skin); @@ -36,10 +36,10 @@ class communicationView extends communication $this->setTemplatePath($tpl_path); $oLayoutModel = getModel('layout'); - $layout_info = $oLayoutModel->getLayout($this->communication_config->layout_srl); + $layout_info = $oLayoutModel->getLayout($this->config->layout_srl); if($layout_info) { - $this->module_info->layout_srl = $this->communication_config->layout_srl; + $this->module_info->layout_srl = $this->config->layout_srl; $this->setLayoutPath($layout_info->path); } } @@ -50,6 +50,11 @@ class communicationView extends communication */ function dispCommunicationMessages() { + if($this->config->enable_message == 'N') + { + return $this->stop('msg_invalid_request'); + } + // Error appears if not logged-in if(!Context::get('is_logged')) { @@ -58,11 +63,6 @@ class communicationView extends communication $logged_info = Context::get('logged_info'); - if(!array_key_exists('dispCommunicationMessages', $logged_info->menu_list)) - { - return $this->stop('msg_invalid_request'); - } - // Set the variables $message_srl = Context::get('message_srl'); $message_type = Context::get('message_type'); @@ -115,7 +115,7 @@ class communicationView extends communication // Extract a list $columnList = array('message_srl', 'readed', 'title', 'member.member_srl', 'member.nick_name', 'message.regdate', 'readed_date'); $output = $oCommunicationModel->getMessages($message_type, $columnList); - + // set a template file Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); @@ -138,6 +138,11 @@ class communicationView extends communication $this->setLayoutPath('./common/tpl/'); $this->setLayoutFile('popup_layout'); + if($this->config->enable_message == 'N') + { + return $this->stop('msg_invalid_request'); + } + // Error appears if not logged-in if(!Context::get('is_logged')) { @@ -157,11 +162,6 @@ class communicationView extends communication Context::set('message', $message); } - // Delete a flag - $flag_path = './files/communication_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl); - $flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl); - FileHandler::removeFile($flag_file); - $this->setTemplateFile('new_message'); } @@ -174,9 +174,11 @@ class communicationView extends communication $this->setLayoutPath('./common/tpl/'); $this->setLayoutFile("popup_layout"); - $oCommunicationModel = getModel('communication'); - $oMemberModel = getModel('member'); - + if($this->config->enable_message == 'N') + { + return $this->stop('msg_invalid_request'); + } + // Error appears if not logged-in if(!Context::get('is_logged')) { @@ -199,6 +201,9 @@ class communicationView extends communication return $this->stop('msg_cannot_send_to_yourself'); } + $oCommunicationModel = getModel('communication'); + $oMemberModel = getModel('member'); + // get message_srl of the original message if it is a reply $message_srl = Context::get('message_srl'); if($message_srl) @@ -235,8 +240,8 @@ class communicationView extends communication $option->resizable = FALSE; $option->disable_html = TRUE; $option->height = 300; - $option->skin = $this->communication_config->editor_skin; - $option->colorset = $this->communication_config->editor_colorset; + $option->skin = $this->config->editor_skin; + $option->colorset = $this->config->editor_colorset; $editor = $oEditorModel->getEditor($logged_info->member_srl, $option); Context::set('editor', $editor); @@ -249,12 +254,17 @@ class communicationView extends communication */ function dispCommunicationFriend() { + if($this->config->enable_friend == 'N') + { + return $this->stop('msg_invalid_request'); + } + // Error appears if not logged-in if(!Context::get('is_logged')) { return $this->stop('msg_not_logged'); } - + $oCommunicationModel = getModel('communication'); // get a group list @@ -307,7 +317,12 @@ class communicationView extends communication { $this->setLayoutPath('./common/tpl/'); $this->setLayoutFile("popup_layout"); - + + if($this->config->enable_friend == 'N') + { + return $this->stop('msg_invalid_request'); + } + // error appears if not logged-in if(!Context::get('is_logged')) { @@ -349,7 +364,12 @@ class communicationView extends communication { $this->setLayoutPath('./common/tpl/'); $this->setLayoutFile("popup_layout"); - + + if($this->config->enable_friend == 'N') + { + return $this->stop('msg_invalid_request'); + } + // error apprears if not logged-in if(!Context::get('is_logged')) { diff --git a/modules/communication/lang/en.php b/modules/communication/lang/en.php index 4289cec4c..ed0c26480 100644 --- a/modules/communication/lang/en.php +++ b/modules/communication/lang/en.php @@ -21,7 +21,9 @@ $lang->cmd_message_box = 'Message Box'; $lang->cmd_view_message_box = 'Message Box'; $lang->cmd_store = 'Save'; $lang->cmd_add_friend_group = 'Add Friend Group'; -$lang->cmd_rename_friend_group = 'Modify Friend Group Name'; +$lang->cmd_rename_friend_group = 'Rename Friend Group'; +$lang->cmd_delete_friend_group = 'Delete Friend Group'; +$lang->msg_already_friend = 'You are already friends with this person.'; $lang->msg_no_message = 'There is no message.'; $lang->msg_cannot_send_to_yourself = 'Cannot send a message to yourself.'; $lang->message_received = 'You have a new message.'; @@ -32,6 +34,8 @@ $lang->msg_disallow_message = 'Failed to send a message because the recipient bl $lang->about_allow_message = 'You can set whether to receive messages or not.'; $lang->message_notice = 'Send a message to the author about this. If you don\'t write a message, it is not sent.'; $lang->friends_page_does_not_support = 'Friends in a mobile environment is not supported. Please go to the PC page.'; -$lang->cmd_write_communication = 'Write Grant'; +$lang->communication_send_message_grant = 'Send Message Grant'; $lang->cmd_manage_base = 'Basic infomation'; $lang->alert_new_message_arrived = 'You have %d new message(s). Do you want to check it now?'; +$lang->enable_communication_friend = 'Friend Enable'; +$lang->enable_communication_message = 'Message Enable'; diff --git a/modules/communication/lang/ja.php b/modules/communication/lang/ja.php index b0a821f76..3c8345302 100644 --- a/modules/communication/lang/ja.php +++ b/modules/communication/lang/ja.php @@ -22,6 +22,8 @@ $lang->cmd_view_message_box = 'メッセージ'; $lang->cmd_store = '保存'; $lang->cmd_add_friend_group = '友達グループ追加'; $lang->cmd_rename_friend_group = '友達グループ名変更'; +$lang->cmd_delete_friend_group = '友達グループ削除'; +$lang->msg_already_friend = '既に友達として登録されています。'; $lang->msg_no_message = 'メッセージがありません。'; $lang->msg_cannot_send_to_yourself = '自分自身へのメッセージ送信はできません。'; $lang->message_received = 'メッセージが届きました。'; diff --git a/modules/communication/lang/ko.php b/modules/communication/lang/ko.php index fc7b22f74..9b4548cdd 100644 --- a/modules/communication/lang/ko.php +++ b/modules/communication/lang/ko.php @@ -22,6 +22,8 @@ $lang->cmd_view_message_box = '쪽지함 보기'; $lang->cmd_store = '보관'; $lang->cmd_add_friend_group = '친구 그룹 추가'; $lang->cmd_rename_friend_group = '친구 그룹 이름 변경'; +$lang->cmd_delete_friend_group = '친구 그룹 삭제'; +$lang->msg_already_friend = '이미 친구로 등록되어 있습니다.'; $lang->msg_no_message = '쪽지가 없습니다.'; $lang->msg_cannot_send_to_yourself = '자기 자신에게 쪽지를 보낼 수 없습니다.'; $lang->message_received = '쪽지가 왔습니다.'; @@ -32,6 +34,8 @@ $lang->msg_disallow_message = '쪽지 수신을 거부한 사용자라서 쪽지 $lang->about_allow_message = '쪽지 수신 여부를 결정할 수 있습니다.'; $lang->message_notice = '저작자에게 쪽지를 발송해서 이 사실을 알립니다. 작성하지 않으면 발송하지 않습니다.'; $lang->friends_page_does_not_support = '모바일 환경에서는 친구 보기 페이지를 지원하지 않습니다. PC 화면으로 이동하세요.'; -$lang->cmd_write_communication = '작성 권한'; +$lang->communication_send_message_grant = '쪽지 발송 권한'; $lang->cmd_manage_base = '기본 정보'; $lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?'; +$lang->enable_communication_friend = '친구기능 사용'; +$lang->enable_communication_message = '쪽지기능 사용'; diff --git a/modules/communication/skins/default/friends.html b/modules/communication/skins/default/friends.html index ffaba4538..bd2bdbf2c 100644 --- a/modules/communication/skins/default/friends.html +++ b/modules/communication/skins/default/friends.html @@ -20,12 +20,12 @@ - - - + + {$lang->cmd_add_friend_group}
@@ -42,7 +42,7 @@ - {$val->group_title?$val->group_title:" "} + {$val->group_title?$val->group_title:$lang->default_friend_group} {$val->nick_name} {zdate($val->regdate,"Y-m-d")} @@ -50,11 +50,11 @@
- - +
diff --git a/modules/communication/skins/default/send_message.html b/modules/communication/skins/default/send_message.html index 461d05f4c..c77307eec 100644 --- a/modules/communication/skins/default/send_message.html +++ b/modules/communication/skins/default/send_message.html @@ -8,7 +8,7 @@
- + diff --git a/modules/communication/tpl/index.html b/modules/communication/tpl/index.html index da496c9b0..4f3909820 100644 --- a/modules/communication/tpl/index.html +++ b/modules/communication/tpl/index.html @@ -20,18 +20,37 @@ +
+
{$lang->enable_communication_message}
+
+ + +
+
+
+
{$lang->enable_communication_friend}
+
+ + +
+
- +
@@ -40,7 +59,7 @@
@@ -48,7 +67,7 @@
@@ -63,7 +82,7 @@
@@ -71,7 +90,7 @@
@@ -81,39 +100,41 @@
-
- +
- + + + + -
-
- -
- -
-
diff --git a/modules/communication/tpl/js/member_communication.js b/modules/communication/tpl/js/member_communication.js index 78f6501e2..661a431ab 100644 --- a/modules/communication/tpl/js/member_communication.js +++ b/modules/communication/tpl/js/member_communication.js @@ -1,26 +1,28 @@ (function($){ + var $bar; window.xeNotifyMessage = function(text, count){ - var $bar; $bar = $('div.message.info'); if(!$bar.length) { - $bar = $('
') - .hide() - .css({ - 'position' : 'absolute', - 'z-index' : '100', - }) - .prependTo(document.body); + $bar = jQuery('
').hide().css({ + 'position' : 'absolute', + 'opacity' : 0.7, + 'z-index' : 10000, + }).appendTo(document.body); } + text = text.replace('%d', count); - var cur_module = current_url.getQuery('module'); - if( cur_module == "admin" ) - h = $bar.html('

'+text+'

').height(); - else - h = $bar.html('

'+text+'

').height(); + var link = jQuery(''); + link.attr("href", current_url.setQuery('module','').setQuery('act','dispCommunicationMessages')); + //link.attr("onclick", "popopen(this.href, 'popup');xeNotifyMessageClose(); return false;"); + link.text(text); + var para = jQuery('

'); + para.append(link).appendTo($bar); $bar.show().animate({top:0}); - // hide after 10 seconds + }; + + window.xeNotifyMessageClose = function(){ setTimeout(function(){ $bar.slideUp(); - }, 5000); + }, 2000); }; })(jQuery); diff --git a/modules/counter/tpl/index.html b/modules/counter/tpl/index.html index 04884cbc7..e8c58f4b7 100644 --- a/modules/counter/tpl/index.html +++ b/modules/counter/tpl/index.html @@ -47,7 +47,7 @@ } }; - $.extend(option,$.datepicker.regional['{$lang_type}']); + $.extend($.datepicker.regional['{$lang_type}'],option); $(".inputDate").datepicker(option); }); })(jQuery); diff --git a/modules/document/document.class.php b/modules/document/document.class.php index 17d9d0530..3eef195d0 100644 --- a/modules/document/document.class.php +++ b/modules/document/document.class.php @@ -127,6 +127,9 @@ class document extends ModuleObject // 2016. 1. 27: Add a column(declare_message) for report if(!$oDB->isColumnExists("document_declared_log","declare_message")) return true; + // 2016. 3. 14 Add a column(document_upate_log) for admin + if(!$oDB->isColumnExists('document_update_log', 'is_admin')) return true; + return false; } @@ -328,6 +331,13 @@ class document extends ModuleObject $oDB->addColumn('document_declared_log',"declare_message","text"); } + // 2016. 3. 14 Add a column(document_update_log) for admin + if(!$oDB->isColumnExists('document_update_log', 'is_admin')) + { + $oDB->addColumn('document_update_log', 'is_admin', 'varchar', 1); + $oDB->addIndex('document_update_log', 'idx_is_admin', array('is_admin')); + } + return new Object(0,'success_updated'); } diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index 81d2685b4..4f109ba0c 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -476,6 +476,7 @@ class documentController extends document { $obj->extra_vars = serialize($extra_vars); $update_output = $this->insertDocumentUpdateLog($obj); + if(!$update_output->toBool()) { $oDB->rollback(); @@ -607,10 +608,11 @@ class documentController extends document { $obj->password = getModel('member')->hashPassword($obj->password); } + // If an author is identical to the modifier or history is used, use the logged-in user's information. - if(Context::get('is_logged') && $module_info->use_anonymous != 'Y') + $logged_info = Context::get('logged_info'); + if(Context::get('is_logged') && !$manual_updated && $module_info->use_anonymous != 'Y') { - $logged_info = Context::get('logged_info'); if($source_obj->get('member_srl')==$logged_info->member_srl) { $obj->member_srl = $logged_info->member_srl; @@ -620,6 +622,7 @@ class documentController extends document $obj->homepage = $logged_info->homepage; } } + // For the document written by logged-in user however no nick_name exists if($source_obj->get('member_srl')&& !$obj->nick_name) { @@ -747,6 +750,10 @@ class documentController extends document if($obj->update_log_setting === 'Y') { $obj->extra_vars = serialize($extra_vars); + if($this->grant->manager) + { + $obj->is_admin = 'Y'; + } $update_output = $this->insertDocumentUpdateLog($obj, $source_obj); if(!$update_output->toBool()) { @@ -814,6 +821,7 @@ class documentController extends document $update_args->tags = $obj->tags; $update_args->extra_vars = $obj->extra_vars; $update_args->reason_update = $obj->reason_update; + $update_args->is_admin = $obj->is_admin; $update_output = executeQuery('document.insertDocumentUpdateLog', $update_args); return $update_output; @@ -1090,7 +1098,11 @@ class documentController extends document function updateReadedCount(&$oDocument) { // Pass if Crawler access - if(isCrawler()) return false; + if (\Rhymix\Framework\UA::isRobot()) + { + return false; + } + $oDocumentModel = getModel('document'); $config = $oDocumentModel->getDocumentConfig(); diff --git a/modules/document/document.model.php b/modules/document/document.model.php index ac5df7e32..16e345d59 100644 --- a/modules/document/document.model.php +++ b/modules/document/document.model.php @@ -1567,6 +1567,25 @@ class documentModel extends document return $updage_log; } + + function getUpdateLogAdminisExists($document_srl = null) + { + if($document_srl == null) + { + return; + } + $args = new stdClass(); + $args->document_srl = $document_srl; + $args->is_admin = 'Y'; + $output = executeQuery('document.getUpdateLogAdminisExists', $args); + + if($output->data->count > 0) + { + return true; + } + + return false; + } } /* End of file document.model.php */ /* Location: ./modules/document/document.model.php */ diff --git a/modules/document/queries/getDocumentUpdateLog.xml b/modules/document/queries/getDocumentUpdateLog.xml index c7ceeedc0..db61979cb 100644 --- a/modules/document/queries/getDocumentUpdateLog.xml +++ b/modules/document/queries/getDocumentUpdateLog.xml @@ -9,6 +9,7 @@ + diff --git a/modules/document/queries/getUpdateLogAdminisExists.xml b/modules/document/queries/getUpdateLogAdminisExists.xml new file mode 100644 index 000000000..5c494fc5d --- /dev/null +++ b/modules/document/queries/getUpdateLogAdminisExists.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + + + diff --git a/modules/document/queries/insertDocumentUpdateLog.xml b/modules/document/queries/insertDocumentUpdateLog.xml index 921dd1b51..e92360a85 100644 --- a/modules/document/queries/insertDocumentUpdateLog.xml +++ b/modules/document/queries/insertDocumentUpdateLog.xml @@ -18,5 +18,6 @@ + diff --git a/modules/document/schemas/document_update_log.xml b/modules/document/schemas/document_update_log.xml index 85a99283a..fee66b4bd 100644 --- a/modules/document/schemas/document_update_log.xml +++ b/modules/document/schemas/document_update_log.xml @@ -15,4 +15,5 @@ +
diff --git a/modules/document/tpl/category_list.html b/modules/document/tpl/category_list.html index e9f03e0ad..664266301 100644 --- a/modules/document/tpl/category_list.html +++ b/modules/document/tpl/category_list.html @@ -61,7 +61,7 @@
- + {$lang->help}
@@ -77,7 +77,6 @@
- {$lang->about_category_group_srls}
diff --git a/modules/editor/components/image_gallery/tpl/popup.html b/modules/editor/components/image_gallery/tpl/popup.html index d8cd62292..3e0b93d5a 100644 --- a/modules/editor/components/image_gallery/tpl/popup.html +++ b/modules/editor/components/image_gallery/tpl/popup.html @@ -40,13 +40,13 @@
- +
- +
diff --git a/modules/editor/skins/ckeditor/js/xe_interface.js b/modules/editor/skins/ckeditor/js/xe_interface.js index 454e3d055..2639e7ee4 100755 --- a/modules/editor/skins/ckeditor/js/xe_interface.js +++ b/modules/editor/skins/ckeditor/js/xe_interface.js @@ -19,8 +19,6 @@ function editorGetContent(editor_sequence) { //Replace html content to editor function editorReplaceHTML(iframe_obj, content) { - content = editorReplacePath(content); - var editor_sequence = parseInt(iframe_obj.id.replace(/^.*_/, ''), 10); _getCkeInstance(editor_sequence).insertHtml(content, "unfiltered_html"); @@ -29,16 +27,3 @@ function editorReplaceHTML(iframe_obj, content) { function editorGetIFrame(editor_sequence) { return jQuery('#ckeditor_instance_' + editor_sequence).get(0); } - - -function editorReplacePath(content) { - // 태그 내 src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경 - content = content.replace(/\<([^\>\<]*)(src=|href=|url\()("|\')*([^"\'\)]+)("|\'|\))*(\s|>)*/ig, function(m0,m1,m2,m3,m4,m5,m6) { - if(m2=="url(") { m3=''; m5=')'; } else { if(typeof(m3)=='undefined') m3 = '"'; if(typeof(m5)=='undefined') m5 = '"'; if(typeof(m6)=='undefined') m6 = ''; } - var val = jQuery.trim(m4).replace(/^\.\//,''); - if(/^(http\:|https\:|ftp\:|telnet\:|mms\:|mailto\:|\/|\.\.|\#)/i.test(val)) return m0; - return '<'+m1+m2+m3+request_uri+val+m5+m6; - }); - - return content; -} diff --git a/modules/editor/skins/xpresseditor/js/xe_interface.js b/modules/editor/skins/xpresseditor/js/xe_interface.js index e2b97cc0a..3d8884403 100644 --- a/modules/editor/skins/xpresseditor/js/xe_interface.js +++ b/modules/editor/skins/xpresseditor/js/xe_interface.js @@ -41,9 +41,6 @@ function editorStart_xe(editor_sequence, primary_key, content_key, editor_height var content = form[content_key].value; if(xFF && !content) content = '
'; - // src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경 - content = editorReplacePath(content); - form[content_key].value = content; jQuery("#xpress-editor-"+editor_sequence).val(content); @@ -203,24 +200,10 @@ function editorGetIframe(srl) { } function editorReplaceHTML(iframe_obj, content) { - // src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경 - content = editorReplacePath(content); - var srl = parseInt(iframe_obj.id.replace(/^.*_/,''),10); editorRelKeys[srl]["pasteHTML"](content); } -function editorReplacePath(content) { - // 태그 내 src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경 - content = content.replace(/\<([^\>\<]*)(src=|href=|url\()("|\')*([^"\'\)]+)("|\'|\))*(\s|>)*/ig, function(m0,m1,m2,m3,m4,m5,m6) { - if(m2=="url(") { m3=''; m5=')'; } else { if(typeof(m3)=='undefined') m3 = '"'; if(typeof(m5)=='undefined') m5 = '"'; if(typeof(m6)=='undefined') m6 = ''; } - var val = jQuery.trim(m4).replace(/^\.\//,''); - if(/^(http\:|https\:|ftp\:|telnet\:|mms\:|mailto\:|\/|\.\.|\#)/i.test(val)) return m0; - return '<'+m1+m2+m3+request_uri+val+m5+m6; - }); - return content; -} - function editorGetAutoSavedDoc(form) { var param = new Array(); param['mid'] = current_mid; diff --git a/modules/editor/skins/xpresseditor/js/xpresseditor.js b/modules/editor/skins/xpresseditor/js/xpresseditor.js index 5688cdcb4..e2f1d82ee 100644 --- a/modules/editor/skins/xpresseditor/js/xpresseditor.js +++ b/modules/editor/skins/xpresseditor/js/xpresseditor.js @@ -5868,9 +5868,6 @@ function editorStart_xe(editor_sequence, primary_key, content_key, editor_height var content = form[content_key].value; if(xFF && !content) content = '
'; - // src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경 - content = editorReplacePath(content); - form[content_key].value = content; jQuery("#xpress-editor-"+editor_sequence).val(content); @@ -6030,24 +6027,10 @@ function editorGetIframe(srl) { } function editorReplaceHTML(iframe_obj, content) { - // src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경 - content = editorReplacePath(content); - var srl = parseInt(iframe_obj.id.replace(/^.*_/,''),10); editorRelKeys[srl]["pasteHTML"](content); } -function editorReplacePath(content) { - // 태그 내 src, href, url의 XE 상대경로를 http로 시작하는 full path로 변경 - content = content.replace(/\<([^\>\<]*)(src=|href=|url\()("|\')*([^"\'\)]+)("|\'|\))*(\s|>)*/ig, function(m0,m1,m2,m3,m4,m5,m6) { - if(m2=="url(") { m3=''; m5=')'; } else { if(typeof(m3)=='undefined') m3 = '"'; if(typeof(m5)=='undefined') m5 = '"'; if(typeof(m6)=='undefined') m6 = ''; } - var val = jQuery.trim(m4).replace(/^\.\//,''); - if(/^(http\:|https\:|ftp\:|telnet\:|mms\:|mailto\:|\/|\.\.|\#)/i.test(val)) return m0; - return '<'+m1+m2+m3+request_uri+val+m5+m6; - }); - return content; -} - function editorGetAutoSavedDoc(form) { var param = new Array(); param['mid'] = current_mid; diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index 11b876063..655b73b9b 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -45,13 +45,15 @@ class fileController extends file if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); + Context::setResponseMethod('JSON'); - $this->add('file_srl',$output->get('file_srl')); - $this->add('file_size',$output->get('file_size')); - $this->add('direct_download',$output->get('direct_download')); - $this->add('source_filename',$output->get('source_filename')); - $this->add('download_url',$output->get('uploaded_filename')); - $this->add('upload_target_srl',$output->get('upload_target_srl')); + $this->add('file_srl', $output->get('file_srl')); + $this->add('file_size', $output->get('file_size')); + $this->add('direct_download', $output->get('direct_download')); + $this->add('source_filename', $output->get('source_filename')); + $this->add('upload_target_srl', $output->get('upload_target_srl')); + $this->add('download_url', $oFileModel->getDirectFileUrl($output->get('uploaded_filename'))); + if($output->error != '0') $this->stop($output->message); } @@ -285,8 +287,7 @@ class fileController extends file // Redirect to procFileOutput using file key if(!isset($_SESSION['__XE_FILE_KEY__']) || !is_string($_SESSION['__XE_FILE_KEY__']) || strlen($_SESSION['__XE_FILE_KEY__']) != 32) { - $random = new Password(); - $_SESSION['__XE_FILE_KEY__'] = $random->createSecureSalt(32, 'hex'); + $_SESSION['__XE_FILE_KEY__'] = Rhymix\Framework\Security::getRandom(32, 'hex'); } $file_key_data = $file_obj->file_srl . $file_obj->file_size . $file_obj->uploaded_filename . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']; $file_key = substr(hash_hmac('sha256', $file_key_data, $_SESSION['__XE_FILE_KEY__']), 0, 32); @@ -732,13 +733,8 @@ class fileController extends file } } - // https://github.com/xpressengine/xe-core/issues/1713 - $file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']); - $file_info['name'] = removeHackTag($file_info['name']); - $file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']); - - // Get random number generator - $random = new Password(); + // Sanitize filename + $file_info['name'] = Rhymix\Framework\Filters\FilenameFilter::clean($file_info['name']); // Set upload path by checking if the attachement is an image or other kinds of file if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) @@ -749,7 +745,7 @@ class fileController extends file // change to random file name. because window php bug. window php is not recognize unicode character file name - by cherryfilter $ext = substr(strrchr($file_info['name'],'.'),1); //$_filename = preg_replace('/[#$&*?+%"\']/', '_', $file_info['name']); - $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext; + $_filename = Rhymix\Framework\Security::getRandom(32, 'hex') . '.' . $ext; $filename = $path.$_filename; $idx = 1; while(file_exists($filename)) @@ -762,17 +758,15 @@ class fileController extends file else { $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); - $filename = $path.$random->createSecureSalt(32, 'hex'); + $filename = $path . Rhymix\Framework\Security::getRandom(32, 'hex'); $direct_download = 'N'; } + // Create a directory - if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create'); - - // Check uploaded file - if(!checkUploadedFile($file_info['tmp_name'])) return new Object(-1,'msg_file_upload_error'); - - // Get random number generator - $random = new Password(); + if(!Rhymix\Framework\Storage::isDirectory($path) && !Rhymix\Framework\Storage::createDirectory($path)) + { + return new Object(-1,'msg_not_permitted_create'); + } // Move the file if($manual_insert) @@ -780,7 +774,7 @@ class fileController extends file @copy($file_info['tmp_name'], $filename); if(!file_exists($filename)) { - $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; + $filename = $path . Rhymix\Framework\Security::getRandom(32, 'hex') . '.' . $ext; @copy($file_info['tmp_name'], $filename); } } @@ -788,7 +782,7 @@ class fileController extends file { if(!@move_uploaded_file($file_info['tmp_name'], $filename)) { - $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; + $filename = $path . Rhymix\Framework\Security::getRandom(32, 'hex') . '.' . $ext; if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1,'msg_file_upload_error'); } } @@ -807,7 +801,7 @@ class fileController extends file $args->file_size = @filesize($filename); $args->comment = NULL; $args->member_srl = $member_srl; - $args->sid = $random->createSecureSalt(32, 'hex'); + $args->sid = Rhymix\Framework\Security::getRandom(32, 'hex'); $output = executeQuery('file.insertFile', $args); if(!$output->toBool()) return $output; @@ -982,13 +976,12 @@ class fileController extends file if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_info->source_filename)) { $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); - $new_file = $path.$file_info->source_filename; + $new_file = $path . $file_info->source_filename; } else { $path = sprintf("./files/attach/binaries/%s/%s/", $target_module_srl, $target_srl); - $random = new Password(); - $new_file = $path.$random->createSecureSalt(32, 'hex'); + $new_file = $path . Rhymix\Framework\Security::getRandom(32, 'hex'); } // Pass if a target document to move is same if($old_file == $new_file) continue; diff --git a/modules/file/file.model.php b/modules/file/file.model.php index a58a0f411..cee62d217 100644 --- a/modules/file/file.model.php +++ b/modules/file/file.model.php @@ -47,8 +47,14 @@ class fileModel extends file $obj->source_filename = $file_info->source_filename; $obj->file_size = $file_info->file_size; $obj->disp_file_size = FileHandler::filesize($file_info->file_size); - if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); - else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); + if($file_info->direct_download == 'N') + { + $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); + } + else + { + $obj->download_url = $this->getDirectFileUrl($file_info->uploaded_filename); + } $obj->direct_download = $file_info->direct_download; $obj->cover_image = ($file_info->cover_image === 'Y') ? true : false; $files[] = $obj; @@ -109,7 +115,23 @@ class fileModel extends file { return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s&module_srl=%s', 'file', 'procFileDownload', $file_srl, $sid, $module_srl); } + + /** + * Return direct download file url + * + * @param string $path + * @return string + */ + function getDirectFileUrl($path) + { + if(dirname($_SERVER['SCRIPT_NAME']) == '/' || dirname($_SERVER['SCRIPT_NAME']) == '\\') + { + return '/' . substr($path, 2); + } + return dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($path, 2); + } + /** * Get file configurations * diff --git a/modules/install/install.controller.php b/modules/install/install.controller.php index 6b33b4229..2f6f373a0 100644 --- a/modules/install/install.controller.php +++ b/modules/install/install.controller.php @@ -364,15 +364,14 @@ class installController extends install $checklist = array(); // Check PHP version - $checklist['php_version'] = true; - if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) + if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '>=')) + { + $checklist['php_version'] = true; + } + else { $checklist['php_version'] = false; } - if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) - { - Context::set('phpversion_warning', true); - } // Check DB if(DB::getEnableList()) diff --git a/modules/install/install.view.php b/modules/install/install.view.php index 0d8c0498f..27f504ea7 100644 --- a/modules/install/install.view.php +++ b/modules/install/install.view.php @@ -74,7 +74,7 @@ class installView extends install function dispInstallCheckEnv() { // Create a temporary file for mod_rewrite check. - self::$rewriteCheckString = Password::createSecureSalt(32); + self::$rewriteCheckString = Rhymix\Framework\Security::getRandom(32); FileHandler::writeFile(_XE_PATH_ . self::$rewriteCheckFilePath, self::$rewriteCheckString);; // Check if the web server is nginx. diff --git a/modules/install/tpl/check_env.html b/modules/install/tpl/check_env.html index 8bb498790..e2cc54949 100644 --- a/modules/install/tpl/check_env.html +++ b/modules/install/tpl/check_env.html @@ -16,14 +16,13 @@ ERROR - + - {sprintf($lang->install_checklist_desc['php_version_warning'], __XE_RECOMMEND_PHP_VERSION__)} [{$lang->more}] - - - - - {$lang->install_checklist_desc[$key]} + + {sprintf($lang->install_checklist_desc[$key], __XE_MIN_PHP_VERSION__)} + + {$lang->install_checklist_desc[$key]} + diff --git a/modules/integration_search/integration_search.admin.controller.php b/modules/integration_search/integration_search.admin.controller.php index 232af8d62..3bd38c4e4 100644 --- a/modules/integration_search/integration_search.admin.controller.php +++ b/modules/integration_search/integration_search.admin.controller.php @@ -85,7 +85,7 @@ class integration_searchAdminController extends integration_search continue; } // Ignore if the file is not successfully uploaded, and check uploaded file - if(!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name'])) + if(!is_uploaded_file($image_obj['tmp_name'])) { unset($obj->{$vars->name}); continue; diff --git a/modules/layout/layout.admin.controller.php b/modules/layout/layout.admin.controller.php index 6a3342021..572d052ee 100644 --- a/modules/layout/layout.admin.controller.php +++ b/modules/layout/layout.admin.controller.php @@ -435,9 +435,6 @@ class layoutAdminController extends layout $ext = substr(strrchr($filename,'.'),1); $filename = sprintf('%s.%s', md5($filename), $ext); } - - // Check uploaded file - if(!checkUploadedFile($source['tmp_name'])) return false; if(file_exists($path .'/'. $filename)) @unlink($path . $filename); if(!move_uploaded_file($source['tmp_name'], $path . $filename )) return false; @@ -690,7 +687,7 @@ class layoutAdminController extends layout // check upload if(!Context::isUploaded()) exit(); $file = Context::get('file'); - if(!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) exit(); + if(!is_uploaded_file($file['tmp_name'])) exit(); if(substr_compare($file['name'], '.tar', -4) !== 0) exit(); @@ -925,7 +922,7 @@ class layoutAdminController extends layout $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile("after_upload_config_image.html"); - if(!$img['tmp_name'] || !is_uploaded_file($img['tmp_name']) || !checkUploadedFile($img['tmp_name'])) + if(!$img['tmp_name'] || !is_uploaded_file($img['tmp_name'])) { Context::set('msg', lang('upload failed')); return; diff --git a/modules/layout/tpl/faceoff_layout_menu.html b/modules/layout/tpl/faceoff_layout_menu.html index 13bc6d802..a2dc156d9 100644 --- a/modules/layout/tpl/faceoff_layout_menu.html +++ b/modules/layout/tpl/faceoff_layout_menu.html @@ -218,7 +218,7 @@ {$lang->layout_manager[38]} - + - + - + - + - + +
@@ -335,7 +335,7 @@
- +
diff --git a/modules/layout/tpl/layout_info_view.html b/modules/layout/tpl/layout_info_view.html index 780111419..98b48ef9b 100644 --- a/modules/layout/tpl/layout_info_view.html +++ b/modules/layout/tpl/layout_info_view.html @@ -129,7 +129,7 @@ {@ $use_colorpicker = true; } - +

{$var->description}

diff --git a/modules/member/m.skins/default/modify_info.html b/modules/member/m.skins/default/modify_info.html index e70313449..551bdeceb 100644 --- a/modules/member/m.skins/default/modify_info.html +++ b/modules/member/m.skins/default/modify_info.html @@ -8,6 +8,10 @@ + + + + \ No newline at end of file diff --git a/modules/member/m.skins/default/signup_form.html b/modules/member/m.skins/default/signup_form.html index 62e0c1669..fffc40e05 100644 --- a/modules/member/m.skins/default/signup_form.html +++ b/modules/member/m.skins/default/signup_form.html @@ -1,5 +1,7 @@ + +

{$lang->cmd_signup}

@@ -58,3 +60,34 @@
+ \ No newline at end of file diff --git a/modules/member/member.admin.controller.php b/modules/member/member.admin.controller.php index 918838a72..f18ec15c8 100644 --- a/modules/member/member.admin.controller.php +++ b/modules/member/member.admin.controller.php @@ -166,8 +166,7 @@ class memberAdminController extends member 'update_nickname_log' ); - $oPassword = new Password(); - if(!array_key_exists($args->password_hashing_algorithm, $oPassword->getSupportedAlgorithms())) + if(!array_key_exists($args->password_hashing_algorithm, Rhymix\Framework\Password::getSupportedAlgorithms())) { $args->password_hashing_algorithm = 'md5'; } diff --git a/modules/member/member.admin.model.php b/modules/member/member.admin.model.php index 9bca07a60..e9930e5db 100644 --- a/modules/member/member.admin.model.php +++ b/modules/member/member.admin.model.php @@ -298,26 +298,12 @@ class memberAdminModel extends member { if ($allow_list = ($allow_list === null) ? config('admin.allow') : $allow_list) { - foreach ($allow_list as $range) - { - if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $range)) - { - return true; - } - } - return false; + return Rhymix\Framework\Filters\IpFilter::inRanges(RX_CLIENT_IP, $allow_list); } if ($deny_list = ($deny_list === null) ? config('admin.deny') : $deny_list) { - foreach ($deny_list as $range) - { - if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $range)) - { - return false; - } - } - return true; + return !Rhymix\Framework\Filters\IpFilter::inRanges(RX_CLIENT_IP, $deny_list); } return true; diff --git a/modules/member/member.admin.view.php b/modules/member/member.admin.view.php index 93619b3c4..a2a3e4b5a 100644 --- a/modules/member/member.admin.view.php +++ b/modules/member/member.admin.view.php @@ -129,8 +129,7 @@ class memberAdminView extends member */ public function dispMemberAdminConfig() { - $oPassword = new Password(); - Context::set('password_hashing_algos', $oPassword->getSupportedAlgorithms()); + Context::set('password_hashing_algos', Rhymix\Framework\Password::getSupportedAlgorithms()); $this->setTemplateFile('default_config'); } @@ -486,7 +485,7 @@ class memberAdminView extends member else if($formInfo->name == 'birthday') { $formTag->type = 'date'; - $inputTag = sprintf(' ', + $inputTag = sprintf(' ', $memberInfo['birthday'], zdate($memberInfo['birthday'], 'Y-m-d', false), $lang->cmd_delete); @@ -627,7 +626,7 @@ class memberAdminView extends member else if($extendForm->column_type == 'date') { $extentionReplace = array('date' => zdate($extendForm->value, 'Y-m-d'), 'cmd_delete' => $lang->cmd_delete); - $template = ' '; + $template = ' '; } $replace = array_merge($extentionReplace, $replace); diff --git a/modules/member/member.class.php b/modules/member/member.class.php index b2a63f159..5922c11f7 100644 --- a/modules/member/member.class.php +++ b/modules/member/member.class.php @@ -73,8 +73,7 @@ class member extends ModuleObject { if(!$config->password_hashing_algorithm) { - $oPassword = new Password(); - $config->password_hashing_algorithm = $oPassword->getBestAlgorithm(); + $config->password_hashing_algorithm = Rhymix\Framework\Password::getBestSupportedAlgorithm(); } if(!$config->password_hashing_work_factor) { diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php index c6bb4c134..38b90874c 100644 --- a/modules/member/member.controller.php +++ b/modules/member/member.controller.php @@ -301,7 +301,16 @@ class memberController extends member $args->{$val} = Context::get($val); if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); } - $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); + + // mobile input date format can be different + if($args->birthday !== intval($args->birthday)) + { + $args->birthday = date('Ymd', strtotime($args->birthday)); + } + else + { + $args->birthday = intval($args->birthday); + } if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); $args->find_account_answer = Context::get('find_account_answer'); @@ -535,8 +544,18 @@ class memberController extends member // Login Information $logged_info = Context::get('logged_info'); $args->member_srl = $logged_info->member_srl; - $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); + + // mobile input date format can be different + if($args->birthday !== intval($args->birthday)) + { + $args->birthday = date('Ymd', strtotime($args->birthday)); + } + else + { + $args->birthday = intval($args->birthday); + } if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); + // Remove some unnecessary variables from all the vars $all_args = Context::getRequestVars(); unset($all_args->module); @@ -729,10 +748,6 @@ class memberController extends member */ function insertProfileImage($member_srl, $target_file) { - - // Check uploaded file - if(!checkUploadedFile($target_file)) return; - $oMemberModel = getModel('member'); $config = $oMemberModel->getMemberConfig(); @@ -808,9 +823,6 @@ class memberController extends member */ function insertImageName($member_srl, $target_file) { - // Check uploaded file - if(!checkUploadedFile($target_file)) return; - $oModuleModel = getModel('module'); $config = $oModuleModel->getModuleConfig('member'); // Get an image size @@ -917,9 +929,6 @@ class memberController extends member */ function insertImageMark($member_srl, $target_file) { - // Check uploaded file - if(!checkUploadedFile($target_file)) return; - $oModuleModel = getModel('module'); $config = $oModuleModel->getModuleConfig('member'); // Get an image size @@ -994,12 +1003,11 @@ class memberController extends member } // Insert data into the authentication DB - $oPassword = new Password(); $args = new stdClass(); $args->user_id = $member_info->user_id; $args->member_srl = $member_info->member_srl; - $args->new_password = $oPassword->createTemporaryPassword(8); - $args->auth_key = $oPassword->createSecureSalt(40); + $args->new_password = Rhymix\Framework\Password::getRandomPassword(8); + $args->auth_key = Rhymix\Framework\Security::getRandom(40, 'hex'); $args->is_register = 'N'; $output = executeQuery('member.insertAuthMail', $args); @@ -1103,8 +1111,7 @@ class memberController extends member } // Update to a temporary password and set change_password_date to 1 - $oPassword = new Password(); - $temp_password = $oPassword->createTemporaryPassword(8); + $temp_password = Rhymix\Framework\Password::getRandomPassword(8); $args = new stdClass(); $args->member_srl = $member_srl; @@ -1333,12 +1340,11 @@ class memberController extends member $this->_clearMemberCache($args->member_srl); // generate new auth key - $oPassword = new Password(); $auth_args = new stdClass(); $auth_args->user_id = $memberInfo->user_id; $auth_args->member_srl = $memberInfo->member_srl; $auth_args->new_password = $memberInfo->password; - $auth_args->auth_key = $oPassword->createSecureSalt(40); + $auth_args->auth_key = Rhymix\Framework\Security::getRandom(40, 'hex'); $auth_args->is_register = 'Y'; $output = executeQuery('member.insertAuthMail', $auth_args); @@ -1823,8 +1829,7 @@ class memberController extends member if($keep_signed) { // Key generate for auto login - $oPassword = new Password(); - $random_key = $oPassword->createSecureSalt(32, 'hex'); + $random_key = Rhymix\Framework\Security::getRandom(32, 'hex'); $extra_key = strtolower($user_id).$this->memberInfo->password.$_SERVER['HTTP_USER_AGENT']; $extra_key = substr(hash_hmac('sha256', $extra_key, $random_key), 0, 32); $autologin_args = new stdClass; @@ -1938,10 +1943,23 @@ class memberController extends member $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); if(!$output->toBool()) return $output; // Terms and Conditions portion of the information set up by members reaffirmed - $oModuleModel = getModel('module'); - $config = $oModuleModel->getModuleConfig('member'); + $oMemberModel = getModel('member'); + $config = $oMemberModel->getMemberConfig(); $logged_info = Context::get('logged_info'); + // limit_date format is YYYYMMDD + if($args->limit_date) + { + // mobile input date format can be different + if($args->limit_date !== intval($args->limit_date)) + { + $args->limit_date = date('Ymd', strtotime($args->limit_date)); + } + else + { + $args->limit_date = intval($args->limit_date); + } + } // If the date of the temporary restrictions limit further information on the date of if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); @@ -1980,6 +1998,49 @@ class memberController extends member if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; + + $extend_form_list = $oMemberModel->getCombineJoinForm($memberInfo); + $security = new Security($extend_form_list); + $security->encodeHTML('..column_title', '..description', '..default_value.'); + if($config->signupForm) { + foreach($config->signupForm as $no => $formInfo) + { + if(!$formInfo->isUse) continue; + if($formInfo->isDefaultForm) + { + // birthday format is YYYYMMDD + if($formInfo->name === 'birthday' && $args->{$formInfo->name}) + { + // mobile input date format can be different + if($args->{$formInfo->name} !== intval($args->{$formInfo->name})) + { + $args->{$formInfo->name} = date('Ymd', strtotime($args->{$formInfo->name})); + } + else + { + $args->{$formInfo->name} = intval($args->{$formInfo->name}); + } + } + } + else + { + $extendForm = $extend_form_list[$formInfo->member_join_form_srl]; + // date format is YYYYMMDD + if($extendForm->column_type == 'date' && $args->{$formInfo->name}) + { + if($args->{$formInfo->name} !== intval($args->{$formInfo->name})) + { + $args->{$formInfo->name} = date('Ymd', strtotime($args->{$formInfo->name})); + } + else + { + $args->{$formInfo->name} = intval($args->{$formInfo->name}); + } + } + } + } + } + // Create a model object $oMemberModel = getModel('member'); @@ -2096,17 +2157,15 @@ class memberController extends member } } - $member_config = $oModuleModel->getModuleConfig('member'); // When using email authentication mode (when you subscribed members denied a) certified mail sent if($args->denied == 'Y') { // Insert data into the authentication DB - $oPassword = new Password(); $auth_args = new stdClass(); $auth_args->user_id = $args->user_id; $auth_args->member_srl = $args->member_srl; $auth_args->new_password = $args->password; - $auth_args->auth_key = $oPassword->createSecureSalt(40); + $auth_args->auth_key = Rhymix\Framework\Security::getRandom(40, 'hex'); $auth_args->is_register = 'Y'; $output = executeQuery('member.insertAuthMail', $auth_args); @@ -2146,6 +2205,7 @@ class memberController extends member if(!$output->toBool()) return $output; // Create a model object $oMemberModel = getModel('member'); + $config = $oMemberModel->getMemberConfig(); $logged_info = Context::get('logged_info'); // Get what you want to modify the original information @@ -2180,7 +2240,62 @@ class memberController extends member if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; // check member identifier form - $config = $oMemberModel->getMemberConfig(); + + // limit_date format is YYYYMMDD + if($args->limit_date) + { + // mobile input date format can be different + if($args->limit_date !== intval($args->limit_date)) + { + $args->limit_date = date('Ymd', strtotime($args->limit_date)); + } + else + { + $args->limit_date = intval($args->limit_date); + } + } + + $extend_form_list = $oMemberModel->getCombineJoinForm($memberInfo); + $security = new Security($extend_form_list); + $security->encodeHTML('..column_title', '..description', '..default_value.'); + if($config->signupForm){ + foreach($config->signupForm as $no => $formInfo) + { + if(!$formInfo->isUse) continue; + + if($formInfo->isDefaultForm) + { + // birthday format is YYYYMMDD + if($formInfo->name === 'birthday' && $args->{$formInfo->name}) + { + if($args->{$formInfo->name} !== intval($args->{$formInfo->name})) + { + $args->{$formInfo->name} = date('Ymd', strtotime($args->{$formInfo->name})); + } + else + { + $args->{$formInfo->name} = intval($args->{$formInfo->name}); + } + } + } + else + { + $extendForm = $extend_form_list[$formInfo->member_join_form_srl]; + // date format is YYYYMMDD + if($extendForm->column_type == 'date' && $args->{$formInfo->name}) + { + if($args->{$formInfo->name} !== intval($args->{$formInfo->name})) + { + $args->{$formInfo->name} = date('Ymd', strtotime($args->{$formInfo->name})); + } + else + { + $args->{$formInfo->name} = intval($args->{$formInfo->name}); + } + } + } + } + } $output = executeQuery('member.getMemberInfoByMemberSrl', $args); $orgMemberInfo = $output->data; @@ -2562,11 +2677,10 @@ class memberController extends member } unset($_SESSION['rechecked_password_step']); - $oPassword = new Password(); $auth_args = new stdClass(); $auth_args->user_id = $newEmail; $auth_args->member_srl = $member_info->member_srl; - $auth_args->auth_key = $oPassword->createSecureSalt(40); + $auth_args->auth_key = Rhymix\Framework\Security::getRandom(40, 'hex'); $auth_args->new_password = 'XE_change_emaill_address'; $oDB = &DB::getInstance(); diff --git a/modules/member/member.model.php b/modules/member/member.model.php index 7b26ef013..01750966f 100644 --- a/modules/member/member.model.php +++ b/modules/member/member.model.php @@ -155,10 +155,14 @@ class memberModel extends member } // Send an email only if email address is public - if(($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address) + if($email_config->isPublic == 'Y' && $member_info->email_address) { - $url = 'mailto:'.htmlspecialchars($member_info->email_address, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); - $oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path); + $oCommunicationModel = getModel('communication'); + if($logged_info->is_admin == 'Y' || $oCommunicationModel->isFriend($member_info->member_srl)) + { + $url = 'mailto:'.htmlspecialchars($member_info->email_address, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); + $oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path); + } } } // View homepage info @@ -1047,6 +1051,14 @@ class memberModel extends member $info->title = $group_info->title; $info->description = $group_info->description; $info->src = $group_info->image_mark; + if(preg_match('@^https?://@', $info->src)) + { + $localpath = str_replace('/./', '/', parse_url($info->src, PHP_URL_PATH)); + if(file_exists($_SERVER['DOCUMENT_ROOT'] . $localpath)) + { + $info->src = $localpath . '?' . date('YmdHis', filemtime($_SERVER['DOCUMENT_ROOT'] . $localpath)); + } + } $GLOBALS['__member_info__']['group_image_mark'][$member_srl] = $info; break; } @@ -1095,10 +1107,19 @@ class memberModel extends member } // Check the password - $oPassword = new Password(); - $current_algorithm = $oPassword->checkAlgorithm($hashed_password); - $match = $oPassword->checkPassword($password_text, $hashed_password, $current_algorithm); - if(!$match) + $password_match = false; + $current_algorithm = false; + $possible_algorithms = Rhymix\Framework\Password::checkAlgorithm($hashed_password); + foreach ($possible_algorithms as $algorithm) + { + if (Rhymix\Framework\Password::checkPassword($password_text, $hashed_password, $algorithm)) + { + $password_match = true; + $current_algorithm = $algorithm; + break; + } + } + if (!$password_match) { return false; } @@ -1107,22 +1128,26 @@ class memberModel extends member $config = $this->getMemberConfig(); if($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N') { - $need_upgrade = false; - - if(!$need_upgrade) + $required_algorithm = Rhymix\Framework\Password::getDefaultAlgorithm(); + if ($required_algorithm !== $current_algorithm) { - $required_algorithm = $oPassword->getCurrentlySelectedAlgorithm(); - if($required_algorithm !== $current_algorithm) $need_upgrade = true; + $need_upgrade = true; + } + else + { + $required_work_factor = Rhymix\Framework\Password::getWorkFactor(); + $current_work_factor = Rhymix\Framework\Password::checkWorkFactor($hashed_password); + if ($current_work_factor !== false && $required_work_factor > $current_work_factor) + { + $need_upgrade = true; + } + else + { + $need_upgrade = false; + } } - if(!$need_upgrade) - { - $required_work_factor = $oPassword->getWorkFactor(); - $current_work_factor = $oPassword->checkWorkFactor($hashed_password); - if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; - } - - if($need_upgrade === true) + if ($need_upgrade) { $args = new stdClass(); $args->member_srl = $member_srl; @@ -1143,8 +1168,7 @@ class memberModel extends member */ function hashPassword($password_text, $algorithm = null) { - $oPassword = new Password(); - return $oPassword->createHash($password_text, $algorithm); + return Rhymix\Framework\Password::hashPassword($password_text, $algorithm); } function checkPasswordStrength($password, $strength) diff --git a/modules/member/member.view.php b/modules/member/member.view.php index b54f40144..09241b3ad 100644 --- a/modules/member/member.view.php +++ b/modules/member/member.view.php @@ -84,9 +84,9 @@ class memberView extends member if($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl)) { - $start = strpos($member_info->email_address, '@')+1; - $replaceStr = str_repeat('*', (strlen($member_info->email_address) - $start)); - $member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start); + list($email_id, $email_host) = explode('@', $member_info->email_address); + $protect_id = substr($email_id, 0, 2) . str_repeat('*', strlen($email_id)-2); + $member_info->email_address = sprintf('%s@%s', $protect_id, $email_host); } if(!$member_info->member_srl) return $this->dispMemberSignUpForm(); diff --git a/modules/member/skins/default/modify_info.html b/modules/member/skins/default/modify_info.html index f09eefd3a..ced6dae08 100644 --- a/modules/member/skins/default/modify_info.html +++ b/modules/member/skins/default/modify_info.html @@ -66,16 +66,33 @@ jQuery(function($){ }); }); (function($){ - $(function(){ - var option = { changeMonth: true, changeYear: true, gotoCurrent: false,yearRange:'-100:+10', dateFormat:'yy-mm-dd', onSelect:function(){ - $(this).prev('input[type="hidden"]').val(this.value.replace(/-/g,""))} - }; - $.extend(option,$.datepicker.regional['{$lang_type}']); - $(".inputDate").datepicker(option); + $(function(){ + // check if the browser support type date. + if ( $(".inputDate").prop('type') != 'date' ) { + var option = { + changeMonth: true, + changeYear: true, + gotoCurrent: false, + yearRange:'-200:+10', + dateFormat:'yy-mm-dd', + defaultDate: new Date("{date('Y-m-d',time())}"), + minDate: new Date("{date('Y-m-d',strtotime('-200 years'))}"), + + onSelect:function(){ + $(this).prev('input[type="hidden"]').val(this.value.replace(/-/g,"")) + } + }; + $.extend($.datepicker.regional['{$lang_type}'],option); + + //if the browser does not support type date input, start datepicker. If it does, brower's UI will show their datepicker. + $(".inputDate").datepicker(option); + } else { + $(".inputDate").prop('readonly', false); + } $(".dateRemover").click(function() { $(this).prevAll('input').val(''); return false;}); - }); + }); })(jQuery); diff --git a/modules/member/skins/default/signup_form.html b/modules/member/skins/default/signup_form.html index cc6788c4e..b3d464d38 100644 --- a/modules/member/skins/default/signup_form.html +++ b/modules/member/skins/default/signup_form.html @@ -72,7 +72,7 @@ - + \ No newline at end of file diff --git a/modules/member/tpl/insert_member.html b/modules/member/tpl/insert_member.html index e76df5070..552c3d62d 100644 --- a/modules/member/tpl/insert_member.html +++ b/modules/member/tpl/insert_member.html @@ -88,7 +88,7 @@
- + {$lang->about_limit_date}
@@ -124,15 +124,31 @@ diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.black.css b/modules/ncenterlite/m.skins/default/ncenterlite.black.css new file mode 100644 index 000000000..6f2596f91 --- /dev/null +++ b/modules/ncenterlite/m.skins/default/ncenterlite.black.css @@ -0,0 +1,15 @@ +#nc_container { border-bottom-color:#555; background-color:#333; color:#B0B0B0; opacity:0.95; } +#nc_container a { color:#B0B0B0; } +#nc_container a:hover { color:#B0B0B0; } +#nc_container strong { color:#F3F3F3; } + +#nc_container .list { background-color:#333; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#555; } +#nc_container .list li a:hover { background-color:#555; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list .more { background: #555; } +#nc_container a.readall { display:none; color:#555; color:#D83722;} + +#nc_container a.notify { color:white; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.blacknoprofile.css b/modules/ncenterlite/m.skins/default/ncenterlite.blacknoprofile.css new file mode 100644 index 000000000..88c94a4a4 --- /dev/null +++ b/modules/ncenterlite/m.skins/default/ncenterlite.blacknoprofile.css @@ -0,0 +1,17 @@ +#nc_container { border-bottom-color:#555; background-color:#333; color:#B0B0B0; opacity:0.95; } +#nc_container a { color:#B0B0B0; } +#nc_container a:hover { color:#B0B0B0; } +#nc_container strong { color:#F3F3F3; } + +#nc_container .list { background-color:#333; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#555; } +#nc_container .list li a:hover { background-color:#555; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list .more { background: #555; } +#nc_container a.readall { display:none; color:#555; color:#D83722;} + +#nc_container a.notify { color:white; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } + +#nc_container img.nc_profile_img { display:none;} diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.css b/modules/ncenterlite/m.skins/default/ncenterlite.css new file mode 100644 index 000000000..60df8e548 --- /dev/null +++ b/modules/ncenterlite/m.skins/default/ncenterlite.css @@ -0,0 +1,185 @@ +#nc_container { + z-index:99; + position:fixed; + top:0; + left:0; + margin:0; + padding:0; + width:100%; + height:30px; + border-bottom:1px solid; + font-size:12px; + line-height:15px; +} + +.ncenterlite_block { + height:28px; +} + +#nc_container a { + padding:0; + font-size:12px; + text-decoration:none; +} + +#nc_container ul.nc_memu { + display:block; + margin:0; + padding:4px; + list-style:none; + line-height:20px; +} + +#nc_container ul:after { + content:""; + display:block; + clear:both; +} + +#nc_container ul.nc_memu li { + display:inline-block; + padding:0 5px; + height:20px; + width:auto; + background:transparent!important; +} + +#nc_container ul.nc_memu li.fLeft { + float:left; +} + +#nc_container ul.nc_memu li.fRight { + float:right; +} + +#nc_container ul.nc_memu li a.notify { + display:block; + float:left; +} + +#nc_container a.close { + display:block; +} + +#nc_container .nc_profile img { + width:20px; + height:20px; + vertical-align:top; +} + +#nc_container a.notify .num { + padding:1px 2px; + border:0; + border-radius:3px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + font-size:12px; + font-weight:700; + font-family:Gulim,"lucida grande",tahoma,verdana,arial,sans-serif; +} + +#nc_container .list { + display:none; + position:absolute; + top:30px; + left:0; + max-width:330px; + width:330px; + box-sizing:border-box; + -moz-box-sizing:border-box; + -webkit-box-sizing:border-box; + -o-box-sizing:border-box; +} + +#nc_container a.readall { + display:none; + float:left; + margin:0 4px; + font-size:11px; + font-weight:700; +} + +#nc_container .listscroll { + overflow-y:auto; + overflow-x:hidden; +} + +#nc_container .list ul { + overflow:hidden; + margin:-1px 0; + padding:0; + list-style:none; +} + +#nc_container .list li { + margin:-1px 0; + border:1px solid #555; + border-width:1px 0; +} + +#nc_container .list li img { + float:left; + margin-right:5px; + width:45px; + height:45px; + border:0; +} + +#nc_container .list li a { + display:block; + overflow:hidden; + padding:10px; + font-size:12px; +} + +#nc_container .list span.ago { + display:block; + font-size:10px; +} + +#nc_container .list .more { + display:block; + padding:10px; + text-align:center; +} + +#nc_container ~ .navbar.navbar-fixed-top { + top:28px; +} + +#nc_container a:hover,#nc_container .list li a:hover,#nc_container .list .more:hover { + text-decoration:none; +} + +@media only screen and max-device-width 480px { + #nc_container { + position:relative; + height:auto; + } + + #nc_container .list { + top:2px; + position:relative; + } + + #nc_container .list ul { + display:block; + position:relative; + } + + #nc_container ul.nc_memu:after { + content:""; + display:block; + visibility:hidden; + height:0; + clear:both; + } + + #nc_container .listscroll { + overflow:visible; + } + + .ncenterlite_block { + display:none; + } +} diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.gray.css b/modules/ncenterlite/m.skins/default/ncenterlite.gray.css new file mode 100644 index 000000000..4d167ea21 --- /dev/null +++ b/modules/ncenterlite/m.skins/default/ncenterlite.gray.css @@ -0,0 +1,16 @@ +#nc_container { border-bottom-color:#C0C0C0; background-color:#efefef; color:#666; opacity:0.95; } +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#666; } +#nc_container a.notify strong { color:#FC2772; } +#nc_container .list { background-color:#efefef; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#ddd; } +#nc_container .list li a:hover { background-color: #ddd; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify sup.num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #ddd; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.graynoprofile.css b/modules/ncenterlite/m.skins/default/ncenterlite.graynoprofile.css new file mode 100644 index 000000000..d8704070b --- /dev/null +++ b/modules/ncenterlite/m.skins/default/ncenterlite.graynoprofile.css @@ -0,0 +1,18 @@ +#nc_container { border-bottom-color:#C0C0C0; background-color:#efefef; color:#666; opacity:0.95; } +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#666; } +#nc_container a.notify strong { color:#FC2772; } +#nc_container .list { background-color:#efefef; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#ddd; } +#nc_container .list li a:hover { background-color: #ddd; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify sup.num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #ddd; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } + +#nc_container img.nc_profile_img { display:none;} diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.html b/modules/ncenterlite/m.skins/default/ncenterlite.html new file mode 100644 index 000000000..07c776b5d --- /dev/null +++ b/modules/ncenterlite/m.skins/default/ncenterlite.html @@ -0,0 +1,122 @@ + +
+ + diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.mobile.css b/modules/ncenterlite/m.skins/default/ncenterlite.mobile.css new file mode 100644 index 000000000..ef3125177 --- /dev/null +++ b/modules/ncenterlite/m.skins/default/ncenterlite.mobile.css @@ -0,0 +1,12 @@ +#nc_container { height:auto; position:relative; } +#nc_container .list { top:2px; position:relative; } +#nc_container .list ul { display:block; position:relative; } +#nc_container ul.nc_memu:after { + content: ""; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +#nc_container .listscroll { overflow: visible; } +.ncenterlite_block { display:none; } diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.white.css b/modules/ncenterlite/m.skins/default/ncenterlite.white.css new file mode 100644 index 000000000..c3fd4444a --- /dev/null +++ b/modules/ncenterlite/m.skins/default/ncenterlite.white.css @@ -0,0 +1,16 @@ +#nc_container { border:1px solid #efefef; background-color:#fff; color:#000; opacity:0.95; } +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#000; } +#nc_container a.notify strong { color:#F60; } +#nc_container .list { border:1px solid #efefef; background-color:#fff; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#eee; } +#nc_container .list li a:hover { background-color: #eee; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify .num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #eee; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.whitenoprofile.css b/modules/ncenterlite/m.skins/default/ncenterlite.whitenoprofile.css new file mode 100644 index 000000000..69342bd1d --- /dev/null +++ b/modules/ncenterlite/m.skins/default/ncenterlite.whitenoprofile.css @@ -0,0 +1,18 @@ +#nc_container { border:1px solid #efefef; background-color:#fff; color:#000; opacity:0.95; } +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#000; } +#nc_container a.notify strong { color:#F60; } +#nc_container .list { border:1px solid #efefef; background-color:#fff; filter:alpha(opacity=97); opacity:0.97; -moz-opacity:0.97; } +#nc_container .list li { border-color:#eee; } +#nc_container .list li a:hover { background-color: #eee; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify .num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #eee; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } + +#nc_container img.nc_profile_img { display:none;} diff --git a/modules/ncenterlite/m.skins/default/notify.css b/modules/ncenterlite/m.skins/default/notify.css new file mode 100644 index 000000000..0c6e55f3d --- /dev/null +++ b/modules/ncenterlite/m.skins/default/notify.css @@ -0,0 +1,97 @@ +@charset "utf-8"; + +.sosi-title { + position: relative; + font-size: 16px; + font-style: bold; + display: block; + margin: 14px 0 14px 14px; + width: auto; +} + + +.history-list { + margin: 0 0 22px 0px; +} + +.history-list .history-item { + position: relative; + padding: 4px 0 4px 14px; + border-top: 1px solid #ececec; + overflow: hidden; + +} + +.history-list .history-info { +padding: 0 11px 9px 0; +} + +.history-list .history-info .history-gird{ + color: #252525; + font-size: 14px; + line-height: 16px; + font-weight: bold; + margin-top: 9px; + display:block; +} + +.text-ellipsis { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.history-list .history-info .history-gird .history-succeed{ + color:#3c763d +} +.history-list .history-info .history-gird .history-failed{ + color:#a94442 +} +.history-list .history-text{ + color: #252525; + font-size: 11px; + line-height: 16px; +} +.history-list .history-text .history-ip{ + color: #8A8D99; + font-size: 12px; +} + +.history-list .history-text .history-auth{ + color: #8A8D99; + margin-left:3px; +} + + +html{color:#000;background:#fff;} +legend{color:#000;} +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,ul,li,ol,dl,dt,dd,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;} +abbr,acronym,address,caption,cite,code,dfn,em,strong,th,var,h1,h2,h3,h4,h5,h6{font-style:normal;font-weight:normal;font-variant:normal;} + + + +body{line-height:1; color: #333; font: normal normal normal 13px/1.5 'Helvetica Neue', Helvetica, Arial, sans-serif;} +ol,ul,li{list-style:none;} + + + + + +html {margin: 0; padding: 0; border: 0; overflow: auto; background-color: #f4f4f4;} +body, .default-font {font: normal normal normal 12px/16px 'Helvetica Neue', Helvetica, Arial, sans-serif;} +body, .default-color {color: #3b3b3b;} +body, .default-background-color {background-color: #fff;} +table {font-size: inherit; font: 100%;} + +h1, h2, h3, h4, h5, h6 {margin: 0; font-weight: bold;} +h1 {font-size: 36px; line-height: 45px;} +h2 {font-size: 24px; line-height: 30px;} +h3 {font-size: 18px; line-height: 22px;} +h4 {font-size: 16px; line-height: 20px;} +h5 {font-size: 14px; line-height: 18px;} +h6 {font-size: 12px; line-height: 16px;} + +.cfix { zoom:1 } +.cfix:after { content: '.'; display:block; clear:both; visibility:hidden; line-height:0; height:0; overflow: hidden; } +strong, .bold {font-weight: bold;} +a { text-decoration:none; color:#1769FF;} diff --git a/modules/ncenterlite/m.skins/default/skin.xml b/modules/ncenterlite/m.skins/default/skin.xml new file mode 100644 index 000000000..bc4725b2d --- /dev/null +++ b/modules/ncenterlite/m.skins/default/skin.xml @@ -0,0 +1,32 @@ + + + XE 알림센터 Lite 기본스킨 + 1.1.1 + 2013-03-21 + + + XE Magazine + + + + + 검은색 + + + 회색 + + + 흰색 + + + + 검은색(no profile) + + + 회색(no profile) + + + 흰색(no profile) + + + diff --git a/modules/ncenterlite/m.skins/default/userconfig.html b/modules/ncenterlite/m.skins/default/userconfig.html new file mode 100644 index 000000000..fae62dae5 --- /dev/null +++ b/modules/ncenterlite/m.skins/default/userconfig.html @@ -0,0 +1,66 @@ + +
+ +
+

{$XE_VALIDATOR_MESSAGE}

+
+ + +
+ + + + +
+

{@$user_str = $member_info->nick_name} + {@$user_str = $logged_info->nick_name} + {@$title_str = Context::getLang('ncenterlite_userconfig_title')} + {sprintf($title_str, $user_str)} +

+ +

{$lang->ncenterlite_userconfig_about} ({$lang->ncenterlite_userconfig_about_warning})

+
+ +
+ + +

{$lang->ncenterlite_comment_noti_about}

+
+
+
+ +
+ + +

{$lang->ncenterlite_mention_noti_about}

+
+
+
+ +
+ + +

{$lang->ncenterlite_message_noti_about}

+
+
+ +
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/modules/ncenterlite/ncenterlite.admin.controller.php b/modules/ncenterlite/ncenterlite.admin.controller.php new file mode 100644 index 000000000..91b15fa10 --- /dev/null +++ b/modules/ncenterlite/ncenterlite.admin.controller.php @@ -0,0 +1,152 @@ +use = $obj->use; + $config->display_use = $obj->display_use; + + $config->user_config_list = $obj->user_config_list; + $config->mention_format = $obj->mention_format; + $config->mention_names = $obj->mention_names; + $config->document_notify = $obj->document_notify; + $config->message_notify = $obj->message_notify; + $config->hide_module_srls = $obj->hide_module_srls; + $config->android_format = $obj->android_format; + if(!$config->mention_format && !is_array($config->mention_format)) + { + $config->mention_format = array(); + } + $config->admin_comment_module_srls = $obj->admin_comment_module_srls; + + $config->skin = $obj->skin; + $config->mskin = $obj->mskin; + $config->mcolorset = $obj->mcolorset; + $config->colorset = $obj->colorset; + $config->zindex = $obj->zindex; + $config->anonymous_name = $obj->anonymous_name; + $config->document_read = $obj->document_read; + $config->layout_srl = $obj->layout_srl; + $config->mlayout_srl = $obj->mlayout_srl; + $config->voted_format = $obj->voted_format; + + if(!$config->document_notify) + { + $config->document_notify = 'direct-comment'; + } + + $this->setMessage('success_updated'); + + $oModuleController->updateModuleConfig('ncenterlite', $config); + + if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) + { + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNcenterliteAdminConfig'); + header('location: ' . $returnUrl); + return; + } + } + + /** + * @brief 스킨 테스트를 위한 더미 데이터 생성 5개 생성 + **/ + function procNcenterliteAdminInsertDummyData() + { + $oNcenterliteController = getController('ncenterlite'); + $logged_info = Context::get('logged_info'); + + for($i = 1; $i <= 5; $i++) + { + $args = new stdClass(); + $args->member_srl = $logged_info->member_srl; + $args->srl = 1; + $args->target_srl = 1; + $args->type = $this->_TYPE_TEST; + $args->target_type = $this->_TYPE_TEST; + $args->target_url = getUrl(''); + $args->target_summary = Context::getLang('ncenterlite_thisistest') . rand(); + $args->target_nick_name = $logged_info->nick_name; + $args->regdate = date('YmdHis'); + $args->notify = $oNcenterliteController->_getNotifyId($args); + $output = $oNcenterliteController->_insertNotify($args); + } + } + + /** + * @brief 모듈 푸시 테스트를 위한 더미 데이터 생성 1개 생성 + **/ + function procNcenterliteAdminInsertPushData() + { + $oNcenterliteController = getController('ncenterlite'); + $logged_info = Context::get('logged_info'); + + $args = new stdClass(); + $args->member_srl = $logged_info->member_srl; + $args->srl = 1; + $args->target_srl = 1; + $args->type = $this->_TYPE_DOCUMENT; + $args->target_type = $this->_TYPE_COMMENT; + $args->target_url = getUrl(''); + $args->target_summary = Context::getLang('ncenterlite_thisistest') . rand(); + $args->target_nick_name = $logged_info->nick_name; + $args->regdate = date('YmdHis'); + $args->notify = $oNcenterliteController->_getNotifyId($args); + $output = $oNcenterliteController->_insertNotify($args); + } + + function procNcenterliteAdminDeleteNofity() + { + $old_date = Context::get('old_date'); + $args = new stdClass; + if($old_date) + { + $args->old_date = $old_date; + } + $output = executeQuery('ncenterlite.deleteNotifyAll', $args); + if(!$output->toBool()) + { + $oDB->rollback(); + return $output; + } + + if($old_date) + { + $oNcenterliteModel = getModel('ncenterlite'); + $message = Context::getLang('ncenterlite_message_delete_notification_before'); + $message = sprintf($message, $oNcenterliteModel->getAgo($old_date) ); + $this->setMessage($message); + } + else + { + $this->setMessage('ncenterlite_message_delete_notification_all'); + } + + if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) + { + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNcenterliteAdminList'); + header('location: ' .$returnUrl); + return; + } + } + + function procNcenterliteAdminEnviromentGatheringAgreement() + { + $vars = Context::getRequestVars(); + $oModuleModel = getModel('module'); + $ncenterlite_module_info = $oModuleModel->getModuleInfoXml('ncenterlite'); + $agreement_file = FileHandler::getRealPath(sprintf('%s%s.txt', './files/ncenterlite/ncenterlite-', $ncenterlite_module_info->version)); + + FileHandler::writeFile($agreement_file, $vars->is_agree); + + if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) + { + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNcenterliteAdminConfig'); + header('location: ' . $returnUrl); + return; + } + } +} diff --git a/modules/ncenterlite/ncenterlite.admin.model.php b/modules/ncenterlite/ncenterlite.admin.model.php new file mode 100644 index 000000000..4e5a9ecb9 --- /dev/null +++ b/modules/ncenterlite/ncenterlite.admin.model.php @@ -0,0 +1,105 @@ +getConfig(); + + global $lang; + + $act = Context::get('act'); + $output = $oNcenterliteModel->getNcenterliteAdminList(); + + $oMemberModel = getModel('member'); + $list = $output->data; + + foreach($list as $k => $v) + { + $target_member = $v->target_nick_name; + + switch($v->type) + { + case 'D': + $type = $lang->ncenterlite_document; //$type = '글'; + break; + case 'C': + $type = $lang->ncenterlite_comment; //$type = '댓글'; + break; + // 메시지. 쪽지 + case 'E': + $type = $lang->ncenterlite_type_message; //$type = '쪽지'; + break; + } + + switch($v->target_type) + { + case 'C': + $str = sprintf($lang->ncenterlite_commented, $target_member, $type, $v->target_summary); + //$str = sprintf('%s님이 회원님의 %s에 "%s" 댓글을 남겼습니다.', $target_member, $type, $v->target_summary); + break; + case 'A': + $str = sprintf($lang->ncenterlite_commented_board, $target_member, $v->target_browser, $v->target_summary); + //$str = sprintf('%1$s님이 게시판 "%2$s""%3$s"라고 댓글을 남겼습니다.', $target_member, $type, $v->target_summary); + break; + case 'M': + $str = sprintf($lang->ncenterlite_mentioned, $target_member, $v->target_summary, $type); + //$str = sprintf('%s님이 "%s" %s에서 회원님을 언급하였습니다.', $target_member, $v->target_summary, $type); + break; + // 메시지. 쪽지 + case 'E': + if(version_compare(__XE_VERSION__, '1.7.4', '>=')) + { + $str = sprintf($lang->ncenterlite_message_mention, $target_member, $v->target_summary); + //%s님께서 "%s"라고 메세지를 보내셨습니다. + } + else + { + $str = sprintf($lang->ncenterlite_message_string, $v->target_summary); + } + break; + case 'T': + $str = sprintf($lang->ncenterlite_test_noti, $target_member); + break; + case 'P': + $str = sprintf($lang->ncenterlite_board, $target_member, $v->target_browser, $v->target_summary); + //%1$s님이 게시판 "%2$s""%3$s"라고 글을 남겼습니다. + break; + case 'S': + if($v->target_browser) + { + $str = sprintf($lang->ncenterlite_board, $target_member, $v->target_browser, $v->target_summary); + } + else + { + $str = sprintf($lang->ncenterlite_article, $target_member, $v->target_summary); + } + break; + case 'V': + $str = sprintf($lang->ncenterlite_vote, $target_member, $v->target_summary); + break; + } + + if($v->type=='U') + { + $str = $oNcenterliteModel->getNotifyTypeString($v->notify_type,unserialize($v->target_body)); + } + $v->text = $str; + $v->ago = $oNcenterliteModel->getAgo($v->regdate); + $v->url = getUrl('','act','procNcenterliteRedirect', 'notify', $v->notify, 'url', $v->target_url); + if($v->target_member_srl) + { + $profileImage = $oMemberModel->getProfileImage($v->target_member_srl); + $v->profileImage = $profileImage->src; + } + + $list[$k] = $v; + } + + $output->data = $list; + return $output; + } + +} \ No newline at end of file diff --git a/modules/ncenterlite/ncenterlite.admin.view.php b/modules/ncenterlite/ncenterlite.admin.view.php new file mode 100644 index 000000000..cd28e11f9 --- /dev/null +++ b/modules/ncenterlite/ncenterlite.admin.view.php @@ -0,0 +1,90 @@ +setTemplatePath($this->module_path.'tpl'); + $this->setTemplateFile(str_replace('dispNcenterliteAdmin', '', $this->act)); + } + + function dispNcenterliteAdminConfig() + { + $oModuleModel = getModel('module'); + $oNcenterliteModel = getModel('ncenterlite'); + $oLayoutModel = getModel('layout'); + + $config = $oNcenterliteModel->getConfig(); + Context::set('config', $config); + + $layout_list = $oLayoutModel->getLayoutList(); + Context::set('layout_list', $layout_list); + + $mobile_layout_list = $oLayoutModel->getLayoutList(0, 'M'); + Context::set('mlayout_list', $mobile_layout_list); + + $skin_list = $oModuleModel->getSkins($this->module_path); + Context::set('skin_list', $skin_list); + + $mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins"); + Context::set('mskin_list', $mskin_list); + + if(!$skin_list[$config->skin]) $config->skin = 'default'; + Context::set('colorset_list', $skin_list[$config->skin]->colorset); + + if(!$mskin_list[$config->mskin]) $config->mskin = 'default'; + Context::set('mcolorset_list', $mskin_list[$config->mskin]->colorset); + + $security = new Security(); + $security->encodeHTML('config..'); + $security->encodeHTML('skin_list..title'); + $security->encodeHTML('colorset_list..name','colorset_list..title'); + + $mid_list = $oModuleModel->getMidList(null, array('module_srl', 'mid', 'browser_title', 'module')); + + Context::set('mid_list', $mid_list); + + // 사용환경정보 전송 확인 + $ncenterlite_module_info = $oModuleModel->getModuleInfoXml('ncenterlite'); + $agreement_file = FileHandler::getRealPath(sprintf('%s%s.txt', './files/ncenterlite/ncenterlite-', $ncenterlite_module_info->version)); + + $agreement_ver_file = FileHandler::getRealPath(sprintf('%s%s.txt', './files/ncenterlite/ncenterlite_ver-', $ncenterlite_module_info->version)); + + if(file_exists($agreement_file)) + { + $agreement = FileHandler::readFile($agreement_file); + Context::set('_ncenterlite_env_agreement', $agreement); + $agreement_ver = FileHandler::readFile($agreement_ver_file); + if($agreement == 'Y') + { + $_ncenterlite_iframe_url = 'http://sosifam.com/index.php?mid=ncenterlite_iframe'; + if(!$agreement_ver) + { + $_host_info = urlencode($_SERVER['HTTP_HOST']) . '-NC' . $ncenterlite_module_info->version . '-PHP' . phpversion() . '-RX' . RX_VERSION; + } + Context::set('_ncenterlite_iframe_url', $_ncenterlite_iframe_url . '&_host='. $_host_info); + Context::set('ncenterlite_module_info', $ncenterlite_module_info); + } + FileHandler::writeFile($agreement_ver_file, 'Y'); + } + else + { + Context::set('_ncenterlite_env_agreement', 'NULL'); + } + } + + function dispNcenterliteAdminList() + { + $oNcenterliteAdminModel = getAdminModel('ncenterlite'); + + $output = $oNcenterliteAdminModel->getAdminNotifyList(); + + Context::set('total_count', $output->page_navigation->total_count); + Context::set('total_page', $output->page_navigation->total_page); + Context::set('page', $output->page); + Context::set('ncenterlite_list', $output->data); + Context::set('page_navigation', $output->page_navigation); + + $this->setTemplateFile('ncenter_list'); + } + +} diff --git a/modules/ncenterlite/ncenterlite.class.php b/modules/ncenterlite/ncenterlite.class.php new file mode 100644 index 000000000..ccf8564a4 --- /dev/null +++ b/modules/ncenterlite/ncenterlite.class.php @@ -0,0 +1,231 @@ +disable_notify)) + { + $module_info = Context::get('module_info'); + if(in_array($module_info->mid, $this->disable_notify)) $result = TRUE; + } + + return $result; + } + + function moduleInstall() + { + return new Object(); + } + + function checkUpdate() + { + $oModuleModel = getModel('module'); + $oDB = &DB::getInstance(); + + foreach($this->triggers as $trigger) + { + if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) return true; + } + + foreach($this->delete_triggers as $trigger) + { + if($oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) + { + return true; + } + } + + if(!$oDB->isColumnExists('ncenterlite_notify', 'readed')) + { + return true; + } + + if(!$oDB->isColumnExists('ncenterlite_notify', 'target_body')) + { + return true; + } + + if(!$oDB->isColumnExists('ncenterlite_notify', 'notify_type')) + { + return true; + } + + if(!$oDB->isColumnExists('ncenterlite_notify', 'target_browser')) + { + return true; + } + + if(!$oDB->isColumnExists('ncenterlite_notify', 'target_p_srl')) + { + return true; + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_srl')) + { + return true; + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_target_srl')) + { + return true; + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_target_p_srl')) + { + return true; + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_notify')) + { + return true; + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_target_member_srl')) + { + return true; + } + + return false; + } + + function moduleUpdate() + { + $oModuleModel = getModel('module'); + $oModuleController = getController('module'); + $oDB = &DB::getInstance(); + + foreach($this->triggers as $trigger) + { + if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) + { + $oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]); + } + } + + foreach($this->delete_triggers as $trigger) + { + if($oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) + { + $oModuleController->deleteTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]); + } + } + + if(!$oDB->isColumnExists('ncenterlite_notify','readed')) + { + $oDB->addColumn('ncenterlite_notify', 'readed', 'char', 1, 'N', true); + $oDB->addIndex('ncenterlite_notify', 'idx_readed', array('readed')); + $oDB->addIndex('ncenterlite_notify', 'idx_member_srl', array('member_srl')); + $oDB->addIndex('ncenterlite_notify', 'idx_regdate', array('regdate')); + } + + if(!$oDB->isColumnExists('ncenterlite_notify','target_browser')) + { + $oDB->addColumn('ncenterlite_notify', 'target_browser', 'varchar', 50, true); + } + + if(!$oDB->isColumnExists('ncenterlite_notify','target_body')) + { + $oDB->addColumn('ncenterlite_notify', 'target_body', 'varchar', 255, true); + } + + if(!$oDB->isColumnExists('ncenterlite_notify','notify_type')) + { + $oDB->addColumn('ncenterlite_notify', 'notify_type', 'number', 11, 0); + } + + if(!$oDB->isColumnExists('ncenterlite_notify','target_p_srl')) + { + $oDB->addColumn('ncenterlite_notify', 'target_p_srl', 'number', 10, true); + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_srl')) + { + $oDB->addIndex('ncenterlite_notify', 'idx_srl', array('srl')); + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_target_srl')) + { + $oDB->addIndex('ncenterlite_notify', 'idx_target_srl', array('target_srl')); + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_target_p_srl')) + { + $oDB->addIndex('ncenterlite_notify', 'idx_target_p_srl', array('target_p_srl')); + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_notify')) + { + $oDB->addIndex('ncenterlite_notify', 'idx_notify', array('notify')); + } + + if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_target_member_srl')) + { + $oDB->addIndex('ncenterlite_notify', 'idx_target_member_srl', array('target_member_srl')); + } + + return new Object(0, 'success_updated'); + } + + function recompileCache() + { + return new Object(); + } + + function moduleUninstall() + { + $oModuleController = getController('module'); + + foreach($this->triggers as $trigger) + { + $oModuleController->deleteTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]); + } + return new Object(); + } +} diff --git a/modules/ncenterlite/ncenterlite.controller.php b/modules/ncenterlite/ncenterlite.controller.php new file mode 100644 index 000000000..5935ee658 --- /dev/null +++ b/modules/ncenterlite/ncenterlite.controller.php @@ -0,0 +1,1082 @@ +member_srl; + } + + if($logged_info->member_srl != $member_srl && $logged_info->is_admin != 'Y') + { + return new Object(-1, 'ncenterlite_stop_no_permission_other_user_settings'); + } + + $output = $oNcenterliteModel->getMemberConfig($member_srl); + + $obj = Context::getRequestVars(); + + $args = new stdClass(); + $args->member_srl = $member_srl; + $args->comment_notify = $obj->comment_notify; + $args->mention_notify = $obj->mention_notify; + $args->message_notify = $obj->message_notify; + + if(!$output) + { + $outputs = executeQuery('ncenterlite.insertUserConfig', $args); + } + else + { + $outputs = executeQuery('ncenterlite.updateUserConfig', $args); + } + + $this->setMessage('success_updated'); + + if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) + { + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispNcenterliteUserConfig', 'member_srl', $member_srl); + header('location: ' . $returnUrl); + return; + } + } + + function triggerAfterDeleteMember($obj) + { + $member_srl = $obj->member_srl; + if(!$member_srl) + { + return new Object(); + } + + $args = new stdClass(); + $args->member_srl = $member_srl; + $output = executeQuery('ncenterlite.deleteNotifyByMemberSrl', $args); + if(!$output->toBool()) + { + return $output; + } + return new Object(); + } + + function triggerAfterInsertDocument(&$obj) + { + $oModuleModel = getModel('module'); + + if($this->_isDisable()) + { + return; + } + + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + if($config->use != 'Y') + { + return new Object(); + } + + $content = strip_tags($obj->title . ' ' . $obj->content); + + $mention_targets = $this->_getMentionTarget($content); + if(!$mention_targets || !count($mention_targets)) + { + return new Object(); + } + + $document_srl = $obj->document_srl; + $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); + + $is_anonymous = $this->_isAnonymous($this->_TYPE_DOCUMENT, $obj); + // 맨션 알림일경우 맨션알림 시작. + if($mention_targets) + { + // !TODO 공용 메소드로 분리 + foreach($mention_targets as $mention_member_srl) + { + $target_member_config = $oNcenterliteModel->getMemberConfig($mention_member_srl); + $notify_member_config = $target_member_config->data; + + if($notify_member_config->mention_notify == 'N') + { + continue; + } + + $args = new stdClass(); + $args->member_srl = $mention_member_srl; + $args->srl = $obj->document_srl; + $args->target_p_srl = $obj->document_srl; + $args->target_srl = $obj->document_srl; + $args->type = $this->_TYPE_DOCUMENT; + $args->target_type = $this->_TYPE_MENTION; + $args->target_url = getNotEncodedFullUrl('', 'document_srl', $obj->document_srl); + $args->target_summary = cut_str(strip_tags($obj->title), 50); + $args->target_nick_name = $obj->nick_name; + $args->target_email_address = $obj->email_address; + $args->regdate = date('YmdHis'); + $args->target_browser = $module_info->browser_title; + $args->notify = $this->_getNotifyId($args); + $output = $this->_insertNotify($args, $is_anonymous); + } + } + + return new Object(); + } + + function triggerAfterInsertComment(&$obj) + { + if($this->_isDisable()) + { + return; + } + + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + if($config->use != 'Y') + { + return new Object(); + } + + $logged_info = Context::get('logged_info'); + $notify_member_srl = array(); + + $document_srl = $obj->document_srl; + $oModuleModel = getModel('module'); + $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); + $comment_srl = $obj->comment_srl; + $parent_srl = $obj->parent_srl; + $content = $obj->content; + $regdate = $obj->regdate; + + // 익명 노티 체크 + $is_anonymous = $this->_isAnonymous($this->_TYPE_COMMENT, $obj); + + // 멘션 + $mention_targets = $this->_getMentionTarget(strip_tags($obj->content)); + // !TODO 공용 메소드로 분리 + foreach($mention_targets as $mention_member_srl) + { + $target_member_config = $oNcenterliteModel->getMemberConfig($mention_member_srl); + $notify_member_config = $target_member_config->data; + if($notify_member_config->mention_notify == 'N') + { + continue; + } + + $args = new stdClass(); + $args->member_srl = $mention_member_srl; + $args->target_p_srl = $obj->comment_srl; + $args->srl = $obj->document_srl; + $args->target_srl = $obj->comment_srl; + $args->type = $this->_TYPE_COMMENT; + $args->target_type = $this->_TYPE_MENTION; + $args->target_url = getNotEncodedFullUrl('', 'document_srl', $document_srl, '_comment_srl', $comment_srl) . '#comment_' . $comment_srl; + $args->target_summary = cut_str(strip_tags($content), 50); + $args->target_nick_name = $obj->nick_name; + $args->target_email_address = $obj->email_address; + $args->regdate = date('YmdHis'); + $args->target_browser = $module_info->browser_title; + $args->notify = $this->_getNotifyId($args); + $output = $this->_insertNotify($args, $is_anonymous); + $notify_member_srl[] = $mention_member_srl; + } + + $admin_list = $oNcenterliteModel->getMemberAdmins(); + $admins_list = $admin_list->data; + + foreach($admins_list as $admins) + { + if(is_array($config->admin_comment_module_srls) && in_array($module_info->module_srl, $config->admin_comment_module_srls)) + { + $args = new stdClass(); + $args->member_srl = $admins->member_srl; + $args->target_p_srl = $obj->comment_srl; + $args->srl = $obj->document_srl; + $args->target_srl = $obj->comment_srl; + $args->type = $this->_TYPE_COMMENT; + $args->target_type = $this->_TYPE_ADMIN_COMMENT; + $args->target_url = getNotEncodedFullUrl('', 'document_srl', $document_srl, '_comment_srl', $comment_srl) . '#comment_' . $comment_srl; + $args->target_summary = cut_str(strip_tags($content), 50); + $args->target_nick_name = $obj->nick_name; + $args->target_email_address = $obj->email_address; + $args->regdate = date('YmdHis'); + $args->target_browser = $module_info->browser_title; + $args->notify = $this->_getNotifyId($args); + $output = $this->_insertNotify($args, $is_anonymous); + } + } + // 대댓글 + if($parent_srl) + { + $oCommentModel = getModel('comment'); + $oComment = $oCommentModel->getComment($parent_srl); + $member_srl = $oComment->member_srl; + $comment_member_config = $oNcenterliteModel->getMemberConfig($member_srl); + $parent_member_config = $comment_member_config->data; + + // !TODO 공용 메소드로 분리 + if(!in_array(abs($member_srl), $notify_member_srl) && (!$logged_info || ($member_srl != 0 && abs($member_srl) != $logged_info->member_srl)) && $parent_member_config->comment_notify != 'N') + { + $args = new stdClass(); + $args->member_srl = abs($member_srl); + $args->srl = $obj->document_srl; + $args->target_p_srl = $parent_srl; + $args->target_srl = $obj->comment_srl; + $args->type = $this->_TYPE_COMMENT; + $args->target_type = $this->_TYPE_COMMENT; + $args->target_url = getNotEncodedFullUrl('', 'document_srl', $document_srl, '_comment_srl', $comment_srl) . '#comment_' . $comment_srl; + $args->target_summary = cut_str(strip_tags($content), 50); + $args->target_nick_name = $obj->nick_name; + $args->target_email_address = $obj->email_address; + $args->regdate = $regdate; + $args->target_browser = $module_info->browser_title; + $args->notify = $this->_getNotifyId($args); + $output = $this->_insertNotify($args, $is_anonymous); + $notify_member_srl[] = abs($member_srl); + } + } + // 대댓글이 아니고, 게시글의 댓글을 남길 경우 + if(!$parent_srl || ($parent_srl && $config->document_notify == 'all-comment')) + { + $oDocumentModel = getModel('document'); + $oDocument = $oDocumentModel->getDocument($document_srl); + + $member_srl = $oDocument->get('member_srl'); + $comment_member_config = $oNcenterliteModel->getMemberConfig($member_srl); + $document_comment_member_config = $comment_member_config->data; + + // !TODO 공용 메소드로 분리 + if(!in_array(abs($member_srl), $notify_member_srl) && (!$logged_info || ($member_srl != 0 && abs($member_srl) != $logged_info->member_srl)) && $document_comment_member_config->comment_notify != 'N') + { + $args = new stdClass(); + $args->member_srl = abs($member_srl); + $args->srl = $document_srl; + $args->target_p_srl = $comment_srl; + $args->target_srl = $comment_srl; + $args->type = $this->_TYPE_DOCUMENT; + $args->target_type = $this->_TYPE_COMMENT; + $args->target_url = getNotEncodedFullUrl('', 'document_srl', $document_srl, '_comment_srl', $comment_srl) . '#comment_' . $comment_srl; + $args->target_summary = cut_str(strip_tags($content), 50); + $args->target_nick_name = $obj->nick_name; + $args->target_email_address = $obj->email_address; + $args->regdate = $regdate; + $args->target_browser = $module_info->browser_title; + $args->notify = $this->_getNotifyId($args); + $output = $this->_insertNotify($args, $is_anonymous); + } + } + + return new Object(); + } + + function triggerAfterSendMessage(&$trigger_obj) + { + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + $communication_config = getModel('communication')->getConfig(); + if($communication_config->enable_message != 'Y') + { + return new Object(); + } + if($config->use != 'Y' && $config->use != 'message') + { + return new Object(); + } + if($config->message_notify == 'N') + { + return new Object(); + } + $messages_member_config = $oNcenterliteModel->getMemberConfig($trigger_obj->receiver_srl); + $message_member_config = $messages_member_config->data; + + if($message_member_config->message_notify != 'N') + { + $args = new stdClass(); + $args->member_srl = $trigger_obj->receiver_srl; + $args->srl = $trigger_obj->related_srl; + $args->target_p_srl = '1'; + $args->target_srl = $trigger_obj->message_srl; + $args->type = $this->_TYPE_MESSAGE; + $args->target_type = $this->_TYPE_MESSAGE; + $args->target_summary = $trigger_obj->title; + $args->regdate = date('YmdHis'); + $args->notify = $this->_getNotifyId($args); + $args->target_url = getNotEncodedFullUrl('', 'act', 'dispCommunicationMessages', 'message_srl', $trigger_obj->related_srl); + $output = $this->_insertNotify($args); + } + } + + function triggerAfterVotedupdate(&$obj) + { + $oDocumentModel = getModel('document'); + $oDocument = $oDocumentModel->getDocument($obj->document_srl, false, false); + + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + if($config->use != 'Y') + { + return new Object(); + } + if($config->voted_format != 'Y') + { + return new Object(); + } + if($obj->point < 0) + { + return new Object(); + } + + $args = new stdClass(); + $args->member_srl = $obj->member_srl; + $args->srl = $obj->document_srl; + $args->target_p_srl = '1'; + $args->target_srl = $obj->document_srl; + $args->type = $this->_TYPE_DOCUMENT; + $args->target_type = $this->_TYPE_VOTED; + $args->target_summary = $oDocument->get('title'); + $args->regdate = date('YmdHis'); + $args->notify = $this->_getNotifyId($args); + $args->target_url = getNotEncodedFullUrl('', 'document_srl', $obj->document_srl); + $output = $this->_insertNotify($args); + } + + function triggerAfterDeleteComment(&$obj) + { + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + if($config->use != 'Y') + { + return new Object(); + } + + $args = new stdClass(); + $args->srl = $obj->comment_srl; + $output = executeQuery('ncenterlite.deleteNotifyBySrl', $args); + return new Object(); + } + + function triggerAfterDeleteDocument(&$obj) + { + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + if($config->use != 'Y') + { + return new Object(); + } + + $args = new stdClass(); + $args->srl = $obj->document_srl; + $output = executeQuery('ncenterlite.deleteNotifyBySrl', $args); + return new Object(); + } + + function triggerAfterModuleHandlerProc(&$oModule) + { + $vars = Context::getRequestVars(); + $logged_info = Context::get('logged_info'); + $args = new stdClass(); + + if($oModule->getLayoutFile() == 'popup_layout.html') + { + Context::set('ncenterlite_is_popup', TRUE); + } + + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + if($config->use != 'Y') + { + return new Object(); + } + + $this->_hide_ncenterlite = false; + if($oModule->module == 'beluxe' && Context::get('is_modal')) + { + $this->_hide_ncenterlite = true; + } + if($oModule->module == 'bodex' && Context::get('is_iframe')) + { + $this->_hide_ncenterlite = true; + } + if($oModule->getLayoutFile() == 'popup_layout.html') + { + $this->_hide_ncenterlite = true; + } + + if($oModule->act == 'dispBoardReplyComment') + { + $comment_srl = Context::get('comment_srl'); + $logged_info = Context::get('logged_info'); + if($comment_srl && $logged_info) + { + $args->target_srl = $comment_srl; + $args->member_srl = $logged_info->member_srl; + $output_update = executeQuery('ncenterlite.updateNotifyReadedByTargetSrl', $args); + } + } + else if($oModule->act == 'dispBoardContent') + { + $comment_srl = Context::get('_comment_srl'); + $document_srl = Context::get('document_srl'); + $oDocument = Context::get('oDocument'); + $logged_info = Context::get('logged_info'); + + if($document_srl && $logged_info && $config->document_read == 'Y') + { + $args->srl = $document_srl; + $args->member_srl = $logged_info->member_srl; + $outputs = executeQuery('ncenterlite.updateNotifyReadedBySrl', $args); + } + + if($comment_srl && $document_srl && $oDocument) + { + $_comment_list = $oDocument->getComments(); + if($_comment_list) + { + if(array_key_exists($comment_srl, $_comment_list)) + { + $url = getNotEncodedUrl('_comment_srl', '') . '#comment_' . $comment_srl; + $need_check_socialxe = true; + } + else + { + $cpage = $oDocument->comment_page_navigation->cur_page; + if($cpage > 1) + { + $url = getNotEncodedUrl('cpage', $cpage - 1) . '#comment_' . $comment_srl; + $need_check_socialxe = true; + } + else + { + $url = getNotEncodedUrl('_comment_srl', '', 'cpage', '') . '#comment_' . $comment_srl; + } + } + + if($need_check_socialxe) + { + $oDB = &DB::getInstance(); + if($oDB->isTableExists('socialxe')) + { + $args = new stdClass(); + $oModuleModel = getModel('module'); + $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); + $args->module_srl = $module_info->module_srl; + $output = executeQuery('ncenterlite.getSocialxeCount', $args); + if($output->data->cnt) + { + $socialxe_comment_srl = $comment_srl; + + $args = new stdClass(); + $args->comment_srl = $comment_srl; + $oCommentModel = getModel('comment'); + $oComment = $oCommentModel->getComment($comment_srl); + $parent_srl = $oComment->get('parent_srl'); + if($parent_srl) + { + $socialxe_comment_srl = $parent_srl; + } + + $url = getNotEncodedUrl('_comment_srl', '', 'cpage', '', 'comment_srl', $socialxe_comment_srl) . '#comment_' . $comment_srl; + } + } + } + + $url = str_replace('&', '&', $url); + header('location: ' . $url); + Context::close(); + exit; + } + } + } + elseif($oModule->act == 'dispCommunicationMessages') + { + $message_srl = Context::get('message_srl'); + $logged_info = Context::get('logged_info'); + if($message_srl) + { + $args = new stdClass(); + $args->target_srl = $message_srl; + $args->member_srl = $logged_info->member_srl; + executeQuery('ncenterlite.updateNotifyReadedByTargetSrl', $args); + } + } + + // 지식인 모듈의 의견 + // TODO: 코드 분리 + if($oModule->act == 'procKinInsertComment') + { + // 글, 댓글 구분 + $parent_type = ($vars->document_srl == $vars->parent_srl) ? 'DOCUMENT' : 'COMMENT'; + if($parent_type == 'DOCUMENT') + { + $oDocumentModel = getModel('document'); + $oDocument = $oDocumentModel->getDocument($vars->document_srl); + $member_srl = $oDocument->get('member_srl'); + $type = $this->_TYPE_DOCUMENT; + } + else + { + $oCommentModel = getModel('comment'); + $oComment = $oCommentModel->getComment($vars->parent_srl); + $member_srl = $oComment->get('member_srl'); + $type = $this->_TYPE_COMMENT; + } + + if($logged_info->member_srl != $member_srl) + { + $args = new stdClass(); + $args->member_srl = abs($member_srl); + $args->srl = ($parent_type == 'DOCUMENT') ? $vars->document_srl : $vars->parent_srl; + $args->type = $type; + $args->target_type = $this->_TYPE_COMMENT; + $args->target_srl = $vars->parent_srl; + $args->target_p_srl = '1'; + $args->target_url = getNotEncodedFullUrl('', 'document_srl', $vars->document_srl, '_comment_srl', $vars->parent_srl) . '#comment_' . $vars->parent_srl; + $args->target_summary = cut_str(strip_tags($vars->content), 50); + $args->target_nick_name = $logged_info->nick_name; + $args->target_email_address = $logged_info->email_address; + $args->regdate = date('YmdHis'); + $args->notify = $this->_getNotifyId($args); + $output = $this->_insertNotify($args); + } + } + else if($oModule->act == 'dispKinView' || $oModule->act == 'dispKinIndex') + { + // 글을 볼 때 알림 제거 + $oDocumentModel = getModel('document'); + $oDocument = $oDocumentModel->getDocument($vars->document_srl); + $member_srl = $oDocument->get('member_srl'); + + if($logged_info->member_srl == $member_srl) + { + $args = new stdClass; + $args->member_srl = $logged_info->member_srl; + $args->srl = $vars->document_srl; + $args->type = $this->_TYPE_DOCUMENT; + $output = executeQuery('ncenterlite.updateNotifyReadedBySrl', $args); + } + } + else if($oModule->act == 'getKinComments') + { + // 의견을 펼칠 때 알림 제거 + $args = new stdClass; + $args->member_srl = $logged_info->member_srl; + $args->target_srl = $vars->parent_srl; + $output = executeQuery('ncenterlite.updateNotifyReadedByTargetSrl', $args); + } + + return new Object(); + } + + function triggerBeforeDisplay(&$output_display) + { + $act = Context::get('act'); + // 팝업창이면 중지 + if(Context::get('ncenterlite_is_popup')) + { + return; + } + + // 자신의 알림목록을 보고 있을 경우엔 알림센터창을 띄우지 않는다. + if($act == 'dispNcenterliteNotifyList') + { + return; + } + + if(count($this->disable_notify_bar_act)) + { + if(in_array(Context::get('act'), $this->disable_notify_bar_act)) + { + return; + } + } + + // HTML 모드가 아니면 중지 + act에 admin이 포함되어 있으면 중지 + if(Context::getResponseMethod() != 'HTML' || strpos(strtolower(Context::get('act')), 'admin') !== false) + { + return; + } + + $logged_info = Context::get('logged_info'); + + // 로그인 상태가 아니면 중지 + if(!$logged_info) + { + return; + } + + $module_info = Context::get('module_info'); + + if(count($this->disable_notify_bar_mid)) + { + if(in_array($module_info->mid, $this->disable_notify_bar_mid)) + { + return; + } + } + + // admin 모듈이면 중지 + if($module_info->module == 'admin') + { + return; + } + + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + + // 알림센터가 비활성화 되어 있으면 중지 + if($config->use != 'Y' && $config->use != 'message') + { + return new Object(); + } + if($config->display_use == 'N') + { + return new Object(); + } + + // 노티바 제외 페이지이면 중지 + if(in_array($module_info->module_srl, $config->hide_module_srls)) + { + return new Object(); + } + + Context::set('ncenterlite_config', $config); + + $js_args = array('./modules/ncenterlite/tpl/js/ncenterlite.js', 'body', '', 100000); + Context::loadFile($js_args); + + $oNcenterliteModel = getModel('ncenterlite'); + + // 알림 목록 가져오기 + $logged_info = Context::get('logged_info'); + $_output = $oNcenterliteModel->getMyNotifyList($logged_info->member_srl); + // 알림 메시지가 없어도 항상 표시하게 하려면 이 줄을 제거 또는 주석 처리하세요. + if(!$_output->data) + { + return; + } + + $_latest_notify_id = array_slice($_output->data, 0, 1); + $_latest_notify_id = $_latest_notify_id[0]->notify; + Context::set('ncenterlite_latest_notify_id', $_latest_notify_id); + + if($_COOKIE['_ncenterlite_hide_id'] && $_COOKIE['_ncenterlite_hide_id'] == $_latest_notify_id) + { + return; + } + setcookie('_ncenterlite_hide_id', '', 0, '/'); + + $oMemberModel = getModel('member'); + $memberConfig = $oMemberModel->getMemberConfig(); + if($memberConfig->profile_image == 'Y') + { + $profileImage = $oMemberModel->getProfileImage($logged_info->member_srl); + Context::set('profileImage', $profileImage); + } + Context::set('useProfileImage', ($memberConfig->profile_image == 'Y') ? true : false); + + Context::set('ncenterlite_list', $_output->data); + Context::set('ncenterlite_page_navigation', $_output->page_navigation); + + if(Mobile::isFromMobilePhone()) + { + $this->template_path = sprintf('%sm.skins/%s/', $this->module_path, $config->mskin); + if(!is_dir($this->template_path) || !$config->mskin) + { + $config->mskin = 'default'; + $this->template_path = sprintf('%sm.skins/%s/', $this->module_path, $config->mskin); + } + } + else + { + $this->template_path = sprintf('%sskins/%s/', $this->module_path, $config->skin); + if(!is_dir($this->template_path) || !$config->skin) + { + $config->skin = 'default'; + $this->template_path = sprintf('%sskins/%s/', $this->module_path, $config->skin); + } + } + + $this->_addFile(); + $html = $this->_getTemplate(); + $output_display = $html . $output_display; + } + + function triggerAddMemberMenu() + { + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + + if($config->user_config_list == 'Y') + { + $logged_info = Context::get('logged_info'); + if(!Context::get('is_logged')) + { + return new Object(); + } + $target_srl = Context::get('target_srl'); + + $oMemberController = getController('member'); + $oMemberController->addMemberMenu('dispNcenterliteNotifyList', 'ncenterlite_my_list'); + $oMemberController->addMemberMenu('dispNcenterliteUserConfig', 'ncenterlite_my_settings'); + + if($logged_info->is_admin == 'Y') + { + $url = getUrl('', 'act', 'dispNcenterliteUserConfig', 'member_srl', $target_srl); + $str = Context::getLang('ncenterlite_user_settings'); + $oMemberController->addMemberPopupMenu($url, $str, ''); + } + } + + return new Object(); + } + + function _addFile() + { + $oModuleModel = getModel('module'); + $module_info = $oModuleModel->getModuleInfoXml('ncenterlite'); + if(file_exists(FileHandler::getRealPath($this->template_path . 'ncenterlite.css'))) + { + Context::addCssFile($this->template_path . 'ncenterlite.css', true, 'all', '', 100); + } + + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + if(!Mobile::isFromMobilePhone()) + { + if($config->colorset && file_exists(FileHandler::getRealPath($this->template_path . 'ncenterlite.' . $config->colorset . '.css'))) + { + Context::addCssFile($this->template_path . 'ncenterlite.' . $config->colorset . '.css', true, 'all', '', 100); + } + } + elseif(Mobile::isFromMobilePhone()) + { + if($config->mcolorset && file_exists(FileHandler::getRealPath($this->template_path . 'ncenterlite.' . $config->mcolorset . '.css'))) + { + Context::addCssFile($this->template_path . 'ncenterlite.' . $config->mcolorset . '.css', true, 'all', '', 100); + } + + Context::loadFile(array('./common/js/jquery.min.js', 'head', '', -100000), true); + Context::loadFile(array('./common/js/xe.min.js', 'head', '', -100000), true); + Context::addCssFile($this->template_path . 'ncenterlite.mobile.css', true, 'all', '', 100); + } + if($config->zindex) + { + Context::set('ncenterlite_zindex', ' style="z-index:' . $config->zindex . ';" '); + } + } + + function _getTemplate() + { + $oNcenterModel = getModel('ncenterlite'); + $config = $oNcenterModel->getConfig(); + + $oTemplateHandler = TemplateHandler::getInstance(); + $result = ''; + + if(Mobile::isFromMobilePhone()) + { + $path = sprintf('%sm.skins/%s/', $this->module_path, $config->mskin); + } + else + { + $path = sprintf('%sskins/%s/', $this->module_path, $config->skin); + } + $result = $oTemplateHandler->compile($path, 'ncenterlite.html'); + + return $result; + } + + function updateNotifyRead($notify, $member_srl) + { + $args = new stdClass(); + $args->member_srl = $member_srl; + $args->notify = $notify; + $output = executeQuery('ncenterlite.updateNotifyReaded', $args); + //$output = executeQuery('ncenterlite.deleteNotify', $args); + + return $output; + } + + function updateNotifyReadiByTargetSrl($target_srl, $member_srl) + { + $args = new stdClass(); + $args->member_srl = $member_srl; + $args->target_srl = $target_srl; + $output = executeQuery('ncenterlite.updateNotifyReadedByTargetSrl', $args); + //$output = executeQuery('ncenterlite.deleteNotifyByTargetSrl', $args); + + return $output; + } + + function updateNotifyReadAll($member_srl) + { + $args = new stdClass(); + $args->member_srl = $member_srl; + $output = executeQuery('ncenterlite.updateNotifyReadedAll', $args); + //$output = executeQuery('ncenterlite.deleteNotifyByMemberSrl', $args); + + return $output; + } + + function procNcenterliteNotifyReadAll() + { + $logged_info = Context::get('logged_info'); + if(!$logged_info) + { + return new Object(-1, 'msg_invalid_request'); + } + + $output = $this->updateNotifyReadAll($logged_info->member_srl); + return $output; + } + + function procNcenterliteRedirect() + { + $logged_info = Context::get('logged_info'); + $url = Context::get('url'); + $notify = Context::get('notify'); + if(!$logged_info || !$url || !$notify) + { + return new Object(-1, 'msg_invalid_request'); + } + + $output = $this->updateNotifyRead($notify, $logged_info->member_srl); + if(!$output->toBool()) + { + return $output; + } + + $url = str_replace('&', '&', $url); + header('Location: ' . $url, TRUE, 302); + Context::close(); + exit; + } + + /** + * @brief 익명으로 노티해야 할지 체크하여 반환 + * @return boolean + **/ + function _isAnonymous($source_type, $triggerObj) + { + // 회원번호가 음수 + if($triggerObj->member_srl < 0) + { + return TRUE; + } + + $module_info = Context::get('module_info'); + + // DX 익명 체크박스 + if($module_info->module == 'beluxe' && $triggerObj->anonymous == 'Y') + { + return TRUE; + } + + if($source_type == $this->_TYPE_COMMENT) + { + // DX 익명 강제 + if($module_info->module == 'beluxe' && $module_info->use_anonymous == 'Y') + { + return TRUE; + } + } + + if($source_type == $this->_TYPE_DOCUMENT) + { + // DX 익명 강제 + if($module_info->module == 'beluxe' && $module_info->use_anonymous == 'Y') + { + return TRUE; + } + } + + return FALSE; + } + + function _insertNotify($args, $anonymous = FALSE) + { + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + // 비회원 노티 제거 + if($args->member_srl <= 0) + { + return new Object(); + } + + $logged_info = Context::get('logged_info'); + + if($anonymous == TRUE) + { + // 설정에서 익명 이름이 설정되어 있으면 익명 이름을 설정함. 없을 경우 Anonymous 를 사용한다. + if(!$config->anonymous_name) + { + $anonymous_name = 'Anonymous'; + } + else + { + $anonymous_name = $config->anonymous_name; + } + // 익명 노티 시 회원정보 제거 + $args->target_member_srl = 0; + $args->target_nick_name = $anonymous_name; + $args->target_user_id = $anonymous_name; + $args->target_email_address = $anonymous_name; + } + else if($logged_info) + { + // 익명 노티가 아닐 때 로그인 세션의 회원정보 넣기 + $args->target_member_srl = $logged_info->member_srl; + $args->target_nick_name = $logged_info->nick_name; + $args->target_user_id = $logged_info->user_id; + $args->target_email_address = $logged_info->email_address; + } + else if($args->target_member_srl) + { + $oMemberModel = getModel('member'); + $member_info = $oMemberModel->getMemberInfoByMemberSrl($args->target_member_srl); + $args->target_member_srl = $member_info->member_srl; + $args->target_nick_name = $member_info->nick_name; + $args->target_user_id = $member_info->user_id; + $args->target_email_address = $member_info->email_address; + } + else + { + // 비회원 + $args->target_member_srl = 0; + $args->target_user_id = ''; + } + + $output = executeQuery('ncenterlite.insertNotify', $args); + if(!$output->toBool()) + { + return $output; + } + + if($output->toBool()) + { + $trigger_notify = ModuleHandler::triggerCall('ncenterlite._insertNotify', 'after', $args); + if(!$trigger_notify->toBool()) + { + return $trigger_notify; + } + } + + $flag_path = \RX_BASEDIR . 'files/cache/ncenterlite/new_notify/' . getNumberingPath($args->target_member_srl) . $args->target_member_srl . '.php'; + if(file_exists($flag_path)) + { + //remove flag files + FileHandler::removeFile($flag_path); + } + + return $output; + } + + public static function updateFlagFile($member_srl = null, $output) + { + if(!$member_srl) + { + return; + } + $flag_path = \RX_BASEDIR . 'files/cache/ncenterlite/new_notify/' . getNumberingPath($member_srl) . $member_srl . '.php'; + if(file_exists($flag_path)) + { + return; + } + + FileHandler::makeDir(\RX_BASEDIR . 'files/cache/ncenterlite/new_notify' . getNumberingPath($member_srl)); + $buff = "member_srl . $args->srl . $args->target_srl . $args->type . $args->target_type); + } + + /** + * @brief 멘션 대상 member_srl 목록 반환 + * @return array + **/ + function _getMentionTarget($content) + { + $oNcenterliteModel = getModel('ncenterlite'); + $config = $oNcenterliteModel->getConfig(); + $logged_info = Context::get('logged_info'); + + $list = array(); + + $content = strip_tags($content); + $content = str_replace(' ', ' ', $content); + + // 정규표현식 정리 + $split = array(); + if(in_array('comma', $config->mention_format)) + { + $split[] = ','; + } + $regx = join('', array('/(^|\s)@([^@\s', join('', $split), ']+)/i')); + + preg_match_all($regx, $content, $matches); + + // '님'문자 이후 제거 + if(in_array('respect', $config->mention_format)) + { + foreach($matches[2] as $idx => $item) + { + $pos = strpos($item, '님'); + if($pos !== false && $pos > 0) + { + $matches[2][$idx] = trim(substr($item, 0, $pos)); + if($logged_info && $logged_info->nick_name == $matches[2][$idx]) + { + unset($matches[2][$idx]); + } + } + } + } + + $nicks = array_unique($matches[2]); + + $oMemberModel = getModel('member'); + $member_config = $oMemberModel->getMemberConfig(); + + if($config->mention_names == 'id' && $member_config->identifier != 'email_address') + { + foreach($nicks as $user_id) + { + $vars = new stdClass(); + $vars->user_id = $user_id; + $output = executeQuery('ncenterlite.getMemberSrlById', $vars); + if($output->data && $output->data->member_srl) + { + $list[] = $output->data->member_srl; + } + } + } + else + { + foreach($nicks as $nick_name) + { + $vars = new stdClass(); + $vars->nick_name = $nick_name; + $output = executeQuery('ncenterlite.getMemberSrlByNickName', $vars); + if($output->data && $output->data->member_srl) + { + $list[] = $output->data->member_srl; + } + } + } + + return $list; + } +} diff --git a/modules/ncenterlite/ncenterlite.mobile.php b/modules/ncenterlite/ncenterlite.mobile.php new file mode 100644 index 000000000..8d8a5a7c0 --- /dev/null +++ b/modules/ncenterlite/ncenterlite.mobile.php @@ -0,0 +1,38 @@ +getConfig(); + $template_path = sprintf("%sm.skins/%s/",$this->module_path, $config->mskin); + if(!is_dir($template_path)||!$config->mskin) + { + $config->skin = 'default'; + $template_path = sprintf("%sm.skins/%s/",$this->module_path, $config->mskin); + } + $this->setTemplatePath($template_path); + + $oLayoutModel = getModel('layout'); + $layout_info = $oLayoutModel->getLayout($config->mlayout_srl); + + if($layout_info) + { + $this->module_info->mlayout_srl = $config->mlayout_srl; + $this->setLayoutPath($layout_info->path); + } + + } + + function dispNcenterliteNotifyList() + { + parent::dispNcenterliteNotifyList(); + } + + function dispNcenterliteUserConfig() + { + parent::dispNcenterliteUserConfig(); + } + +} diff --git a/modules/ncenterlite/ncenterlite.model.php b/modules/ncenterlite/ncenterlite.model.php new file mode 100644 index 000000000..1ce483fd2 --- /dev/null +++ b/modules/ncenterlite/ncenterlite.model.php @@ -0,0 +1,383 @@ +getModuleConfig('ncenterlite'); + if(!$config->use) $config->use = 'Y'; + if(!$config->display_use) $config->display_use = 'Y'; + + if(!$config->mention_names) $config->mention_names = 'nick_name'; + if(!$config->message_notify) $config->message_notify = 'Y'; + if(!$config->mention_format && !is_array($config->mention_format)) $config->mention_format = array('respect'); + if(!is_array($config->mention_format)) $config->mention_format = explode('|@|', $config->mention_format); + if(!$config->document_notify) $config->document_notify = 'direct-comment'; + if(!$config->hide_module_srls) $config->hide_module_srls = array(); + if(!is_array($config->hide_module_srls)) $config->hide_module_srls = explode('|@|', $config->hide_module_srls); + if(!$config->document_read) $config->document_read = 'N'; + if(!$config->voted_format) $config->voted_format = 'N'; + if(!$config->skin) $config->skin = 'default'; + if(!$config->colorset) $config->colorset = 'black'; + + self::$config = $config; + } + + return self::$config; + } + + function getNotifyTypebySrl($notify_srl='') + { + $args = new stdClass(); + $args->notify_type_srl = $notify_srl; + + $output = executeQuery('ncenterlite.getNotifyType',$args); + + return $output; + } + + function getNotifyTypeString($notify_srl='',$notify_args) + { + $this->notify_args = $notify_args; + + $output = $this->getNotifyTypebySrl($notify_srl); + + $this->notify_arguments = explode("|",$output->data->notify_type_args); + $string = preg_replace_callback("/%([^%]*)%/",array($this, 'replaceNotifyType'),$output->data->notify_string); + + return $string; + } + + function replaceNotifyType($match) + { + //if replace string is not at arguments, return + if(!in_array($match[1],$this->notify_arguments)) + { + return $match[0]; + } + + //if replace string is not set, return + if(!isset($this->notify_args->{$match[1]})) + { + return $match[0]; + } + + return $this->notify_args->{$match[1]}; + } + + function isNotifyTypeExistsbySrl($notify_srl='') + { + $args = new stdClass(); + $args->notify_type_srl = $notify_srl; + + $output = executeQuery('ncenterlite.getNotifyType',$args); + + return isset($output->data->notify_type_id); + } + + function insertNotifyType($args) + { + return executeQuery('ncenterlite.insertNotifyType',$args); + } + + function getMemberConfig($member_srl=null) + { + if(!$member_srl) + { + $logged_info = Context::get('logged_info'); + $member_srl = $logged_info->member_srl; + } + + $args = new stdClass(); + $args->member_srl = $member_srl; + $output = executeQuery('ncenterlite.getUserConfig', $args); + if(!$output->data) return $output->data; + + return $output; + } + + function getAllMemberConfig() + { + $output = executeQueryArray('ncenterlite.getAllUserConfig'); + + return $output; + } + + function getMyNotifyList($member_srl=null, $page=1, $readed='N') + { + global $lang; + + $act = Context::get('act'); + if($act=='dispNcenterliteNotifyList') + { + $output = $this->getMyDispNotifyList($member_srl); + } + else + { + $output = $this->_getMyNotifyList($member_srl, $page, $readed); + } + + $oMemberModel = getModel('member'); + $list = $output->data; + + foreach($list as $k => $v) + { + + $target_member = $v->target_nick_name; + + switch($v->type) + { + case 'D': + $type = $lang->ncenterlite_document; //$type = '글'; + break; + case 'C': + $type = $lang->ncenterlite_comment; //$type = '댓글'; + break; + // 메시지. 쪽지 + case 'E': + $type = $lang->ncenterlite_type_message; //$type = '쪽지'; + break; + } + + switch($v->target_type) + { + case 'C': + $str = sprintf($lang->ncenterlite_commented, $target_member, $type, $v->target_summary); + //$str = sprintf('%s님이 회원님의 %s에 "%s" 댓글을 남겼습니다.', $target_member, $type, $v->target_summary); + break; + case 'A': + $str = sprintf($lang->ncenterlite_commented_board, $target_member, $v->target_browser, $v->target_summary); + //$str = sprintf('%1$s님이 게시판 "%2$s""%3$s"라고 댓글을 남겼습니다.', $target_member, $type, $v->target_summary); + break; + case 'M': + $str = sprintf($lang->ncenterlite_mentioned, $target_member, $v->target_summary, $type); + //$str = sprintf('%s님이 "%s" %s에서 회원님을 언급하였습니다.', $target_member, $v->target_summary, $type); + break; + // 메시지. 쪽지 + case 'E': + $str = sprintf($lang->ncenterlite_message_mention,$target_member, $v->target_summary); + break; + case 'T': + $str = sprintf($lang->ncenterlite_test_noti, $target_member); + break; + case 'P': + $str = sprintf($lang->ncenterlite_board, $target_member, $v->target_browser, $v->target_summary); + break; + case 'S': + if($v->target_browser) + { + $str = sprintf($lang->ncenterlite_board, $target_member, $v->target_browser, $v->target_summary); + } + else + { + $str = sprintf($lang->ncenterlite_article, $target_member, $v->target_summary); + } + break; + case 'V': + $str = sprintf($lang->ncenterlite_vote, $target_member, $v->target_summary); + break; + } + + if($v->type=='U') + { + $str = $this->getNotifyTypeString($v->notify_type,unserialize($v->target_body)); + } + + $v->text = $str; + $v->ago = $this->getAgo($v->regdate); + $v->url = getUrl('','act','procNcenterliteRedirect', 'notify', $v->notify, 'url', $v->target_url); + if($v->target_member_srl) + { + $profileImage = $oMemberModel->getProfileImage($v->target_member_srl); + $v->profileImage = $profileImage->src; + } + + $list[$k] = $v; + } + + $output->data = $list; + if($page <= 1) + { + $oNcenterliteController = getController('ncenterlite'); + $oNcenterliteController->updateFlagFile($member_srl, $output); + } + return $output; + } + + function getMyNotifyListTpl() + { + $logged_info = Context::get('logged_info'); + if(!$logged_info) return new Object(-1, 'msg_not_permitted'); + + $oMemberModel = getModel('member'); + $memberConfig = $oMemberModel->getMemberConfig(); + $page = Context::get('page'); + + $member_srl = $logged_info->member_srl; + $tmp = $this->getMyNotifyList($member_srl, $page); + foreach($tmp->data as $key => $obj) + { + $tmp->data[$key]->url = str_replace('&', '&', $obj->url); + } + + $list = new stdClass(); + $list->data = $tmp->data; + $list->page = $tmp->page_navigation; + $this->add('list', $list); + $this->add('useProfileImage', $memberConfig->profile_image); + } + + function _getMyNotifyList($member_srl=null, $page=1, $readed='N') + { + if(!$member_srl) + { + $logged_info = Context::get('logged_info'); + if(!$logged_info) return array(); + + $member_srl = $logged_info->member_srl; + } + $flag_path = \RX_BASEDIR . 'files/cache/ncenterlite/new_notify/' . getNumberingPath($member_srl) . $member_srl . '.php'; + if(FileHandler::exists($flag_path) && $page <= 1) + { + $output = require_once $flag_path; + if(is_object($output->data)) + { + return $output; + } + } + $args = new stdClass(); + $args->member_srl = $member_srl; + $args->page = $page ? $page : 1; + if($readed) $args->readed = $readed; + $output = executeQueryArray('ncenterlite.getNotifyList', $args); + + if(!$output->data) $output->data = array(); + + return $output; + } + + function getMyDispNotifyList($member_srl) + { + $logged_info = Context::get('logged_info'); + + $member_srl = $logged_info->member_srl; + + $args = new stdClass(); + $args->page = Context::get('page'); + $args->list_count = '20'; + $args->page_count = '10'; + $args->member_srl = $member_srl; + $output = executeQueryArray('ncenterlite.getDispNotifyList', $args); + if(!$output->data) $output->data = array(); + + return $output; + } + + function getNcenterliteAdminList($member_srl) + { + $logged_info = Context::get('logged_info'); + + $member_srl = $logged_info->member_srl; + + $args = new stdClass(); + $args->page = Context::get('page'); + $args->list_count = '20'; + $args->page_count = '10'; + $output = executeQueryArray('ncenterlite.getAdminNotifyList', $args); + if(!$output->data) $output->data = array(); + + return $output; + } + + function getMemberAdmins() + { + $args = new stdClass(); + $args->is_admin = 'Y'; + $output = executeQueryArray('ncenterlite.getMemberAdmins', $args); + if(!$output->data) $output->data = array(); + + return $output; + } + + function _getNewCount($member_srl=null) + { + if(!$member_srl) + { + $logged_info = Context::get('logged_info'); + if(!$logged_info) return 0; + + $member_srl = $logged_info->member_srl; + } + + $args->member_srl = $member_srl; + $output = executeQuery('ncenterlite.getNotifyNewCount', $args); + if(!$output->data) return 0; + return $output->data->cnt; + } + + + function getColorsetList() + { + $oModuleModel = getModel('module'); + $skin = Context::get('skin'); + + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin); + + for($i=0, $c=count($skin_info->colorset); $i<$c; $i++) + { + $colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title); + $colorset_list[] = $colorset; + } + + if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); + $this->add('colorset_list', $colorsets); + } + + /** + * @brief 주어진 시간이 얼마 전 인지 반환 + * @param string YmdHis + * @return string + **/ + function getAgo($datetime) + { + global $lang; + $lang_type = Context::getLangType(); + + $display = $lang->ncenterlite_date; // array('Year', 'Month', 'Day', 'Hour', 'Minute', 'Second') + + $ago = $lang->ncenterlite_ago; // 'Ago' + + $date = getdate(strtotime(zdate($datetime, 'Y-m-d H:i:s'))); + + $current = getdate(); + $p = array('year', 'mon', 'mday', 'hours', 'minutes', 'seconds'); + $factor = array(0, 12, 30, 24, 60, 60); + + for($i = 0; $i < 6; $i++) + { + if($i > 0) + { + $current[$p[$i]] += $current[$p[$i - 1]] * $factor[$i]; + $date[$p[$i]] += $date[$p[$i - 1]] * $factor[$i]; + } + + if($current[$p[$i]] - $date[$p[$i]] > 1) + { + $value = $current[$p[$i]] - $date[$p[$i]]; + if($lang_type == 'en') + { + return $value . ' ' . $display[$i] . (($value != 1) ? 's' : '') . ' ' . $ago; + } + return $value . $display[$i] . ' ' . $ago; + } + } + + return zdate($datetime, 'Y-m-d'); + } +} diff --git a/modules/ncenterlite/ncenterlite.view.php b/modules/ncenterlite/ncenterlite.view.php new file mode 100644 index 000000000..13c9b4823 --- /dev/null +++ b/modules/ncenterlite/ncenterlite.view.php @@ -0,0 +1,71 @@ +getConfig(); + $template_path = sprintf("%sskins/%s/",$this->module_path, $config->skin); + if(!is_dir($template_path)||!$config->skin) + { + $config->skin = 'default'; + $template_path = sprintf("%sskins/%s/",$this->module_path, $config->skin); + } + $this->setTemplatePath($template_path); + + $oLayoutModel = getModel('layout'); + $layout_info = $oLayoutModel->getLayout($config->layout_srl); + + if($layout_info) + { + $this->module_info->layout_srl = $config->layout_srl; + $this->setLayoutPath($layout_info->path); + } + } + + function dispNcenterliteNotifyList() + { + $oNcenterliteModel = getModel('ncenterlite'); + + $output = $oNcenterliteModel->getMyNotifyList(); + + Context::set('total_count', $output->page_navigation->total_count); + Context::set('total_page', $output->page_navigation->total_page); + Context::set('page', $output->page); + Context::set('ncenterlite_list', $output->data); + Context::set('page_navigation', $output->page_navigation); + + $this->setTemplateFile('NotifyList'); + } + + function dispNcenterliteUserConfig() + { + $oMemberModel = getModel('member'); + $member_srl = Context::get('member_srl'); + $logged_info = Context::get('logged_info'); + if(!$logged_info) return new Object(-1, 'ncenterlite_stop_login_required'); + + if($logged_info->is_admin == 'Y') + { + $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); + } + if($logged_info->is_admin != 'Y' && $member_srl) + { + if($member_srl != $logged_info->member_srl) + { + return new Object(-1, 'ncenterlite_stop_no_permission_other_user'); + } + } + $oNcenterliteModel = getModel('ncenterlite'); + if(!$member_srl) + { + $member_srl = $logged_info->member_srl; + } + $output = $oNcenterliteModel->getMemberConfig($member_srl); + + Context::set('member_info', $member_info); + Context::set('user_config', $output->data); + $this->setTemplateFile('userconfig'); + } +} diff --git a/modules/ncenterlite/queries/deleteNotify.xml b/modules/ncenterlite/queries/deleteNotify.xml new file mode 100644 index 000000000..53f3b42a6 --- /dev/null +++ b/modules/ncenterlite/queries/deleteNotify.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/modules/ncenterlite/queries/deleteNotifyAll.xml b/modules/ncenterlite/queries/deleteNotifyAll.xml new file mode 100644 index 000000000..f6886172b --- /dev/null +++ b/modules/ncenterlite/queries/deleteNotifyAll.xml @@ -0,0 +1,8 @@ + + +
+ + + + + diff --git a/modules/ncenterlite/queries/deleteNotifyByMemberSrl.xml b/modules/ncenterlite/queries/deleteNotifyByMemberSrl.xml new file mode 100644 index 000000000..35492b021 --- /dev/null +++ b/modules/ncenterlite/queries/deleteNotifyByMemberSrl.xml @@ -0,0 +1,10 @@ + + +
+ + + + + + + diff --git a/modules/ncenterlite/queries/deleteNotifyBySrl.xml b/modules/ncenterlite/queries/deleteNotifyBySrl.xml new file mode 100644 index 000000000..384f992c0 --- /dev/null +++ b/modules/ncenterlite/queries/deleteNotifyBySrl.xml @@ -0,0 +1,10 @@ + + +
+ + + + + + + diff --git a/modules/ncenterlite/queries/deleteNotifyByTargetSrl.xml b/modules/ncenterlite/queries/deleteNotifyByTargetSrl.xml new file mode 100644 index 000000000..202147b77 --- /dev/null +++ b/modules/ncenterlite/queries/deleteNotifyByTargetSrl.xml @@ -0,0 +1,10 @@ + + +
+ + + + + + + diff --git a/modules/ncenterlite/queries/getAdminNotifyList.xml b/modules/ncenterlite/queries/getAdminNotifyList.xml new file mode 100644 index 000000000..d1a12d794 --- /dev/null +++ b/modules/ncenterlite/queries/getAdminNotifyList.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/ncenterlite/queries/getAllUserConfig.xml b/modules/ncenterlite/queries/getAllUserConfig.xml new file mode 100644 index 000000000..61bb35180 --- /dev/null +++ b/modules/ncenterlite/queries/getAllUserConfig.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/ncenterlite/queries/getCountNewMessage.xml b/modules/ncenterlite/queries/getCountNewMessage.xml new file mode 100644 index 000000000..ba1aa4a84 --- /dev/null +++ b/modules/ncenterlite/queries/getCountNewMessage.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/ncenterlite/queries/getDispNotifyList.xml b/modules/ncenterlite/queries/getDispNotifyList.xml new file mode 100644 index 000000000..e39b573b2 --- /dev/null +++ b/modules/ncenterlite/queries/getDispNotifyList.xml @@ -0,0 +1,20 @@ + + +
+ + + + + + + + + + + + + + + + + diff --git a/modules/ncenterlite/queries/getMemberAdmins.xml b/modules/ncenterlite/queries/getMemberAdmins.xml new file mode 100644 index 000000000..46a776b5c --- /dev/null +++ b/modules/ncenterlite/queries/getMemberAdmins.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + + + diff --git a/modules/ncenterlite/queries/getMemberSrlById.xml b/modules/ncenterlite/queries/getMemberSrlById.xml new file mode 100644 index 000000000..2fcec16c1 --- /dev/null +++ b/modules/ncenterlite/queries/getMemberSrlById.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/ncenterlite/queries/getMemberSrlByNickName.xml b/modules/ncenterlite/queries/getMemberSrlByNickName.xml new file mode 100644 index 000000000..3bb63a178 --- /dev/null +++ b/modules/ncenterlite/queries/getMemberSrlByNickName.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/ncenterlite/queries/getMemberTotals.xml b/modules/ncenterlite/queries/getMemberTotals.xml new file mode 100644 index 000000000..9036bc858 --- /dev/null +++ b/modules/ncenterlite/queries/getMemberTotals.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + + + diff --git a/modules/ncenterlite/queries/getNotifyList.xml b/modules/ncenterlite/queries/getNotifyList.xml new file mode 100644 index 000000000..fc8901dde --- /dev/null +++ b/modules/ncenterlite/queries/getNotifyList.xml @@ -0,0 +1,21 @@ + + +
+ + + + + + + + + + + + + + + + + + diff --git a/modules/ncenterlite/queries/getNotifyNewCount.xml b/modules/ncenterlite/queries/getNotifyNewCount.xml new file mode 100644 index 000000000..dd6b55f1f --- /dev/null +++ b/modules/ncenterlite/queries/getNotifyNewCount.xml @@ -0,0 +1,14 @@ + + +
+ + + + + + + + + + + diff --git a/modules/ncenterlite/queries/getNotifyType.xml b/modules/ncenterlite/queries/getNotifyType.xml new file mode 100644 index 000000000..803ce2aba --- /dev/null +++ b/modules/ncenterlite/queries/getNotifyType.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/ncenterlite/queries/getNotifyTypeByID.xml b/modules/ncenterlite/queries/getNotifyTypeByID.xml new file mode 100644 index 000000000..c2977adfe --- /dev/null +++ b/modules/ncenterlite/queries/getNotifyTypeByID.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/ncenterlite/queries/getSocialxeCount.xml b/modules/ncenterlite/queries/getSocialxeCount.xml new file mode 100644 index 000000000..33b2c96ae --- /dev/null +++ b/modules/ncenterlite/queries/getSocialxeCount.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/ncenterlite/queries/getUserConfig.xml b/modules/ncenterlite/queries/getUserConfig.xml new file mode 100644 index 000000000..2a0ce0f41 --- /dev/null +++ b/modules/ncenterlite/queries/getUserConfig.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/ncenterlite/queries/insertNotify.xml b/modules/ncenterlite/queries/insertNotify.xml new file mode 100644 index 000000000..24e96cdd4 --- /dev/null +++ b/modules/ncenterlite/queries/insertNotify.xml @@ -0,0 +1,24 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/modules/ncenterlite/queries/insertNotifyType.xml b/modules/ncenterlite/queries/insertNotifyType.xml new file mode 100644 index 000000000..5f1e1f27e --- /dev/null +++ b/modules/ncenterlite/queries/insertNotifyType.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/ncenterlite/queries/insertUserConfig.xml b/modules/ncenterlite/queries/insertUserConfig.xml new file mode 100644 index 000000000..c2bc581e3 --- /dev/null +++ b/modules/ncenterlite/queries/insertUserConfig.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + + + diff --git a/modules/ncenterlite/queries/updateNotifyReaded.xml b/modules/ncenterlite/queries/updateNotifyReaded.xml new file mode 100644 index 000000000..23f9f24bc --- /dev/null +++ b/modules/ncenterlite/queries/updateNotifyReaded.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + + + diff --git a/modules/ncenterlite/queries/updateNotifyReadedAll.xml b/modules/ncenterlite/queries/updateNotifyReadedAll.xml new file mode 100644 index 000000000..935cea3bf --- /dev/null +++ b/modules/ncenterlite/queries/updateNotifyReadedAll.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/ncenterlite/queries/updateNotifyReadedBySrl.xml b/modules/ncenterlite/queries/updateNotifyReadedBySrl.xml new file mode 100644 index 000000000..2ecae2689 --- /dev/null +++ b/modules/ncenterlite/queries/updateNotifyReadedBySrl.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/ncenterlite/queries/updateNotifyReadedByTargetSrl.xml b/modules/ncenterlite/queries/updateNotifyReadedByTargetSrl.xml new file mode 100644 index 000000000..842363152 --- /dev/null +++ b/modules/ncenterlite/queries/updateNotifyReadedByTargetSrl.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + + + diff --git a/modules/ncenterlite/queries/updateNotifyReadedByType.xml b/modules/ncenterlite/queries/updateNotifyReadedByType.xml new file mode 100644 index 000000000..6f6328df3 --- /dev/null +++ b/modules/ncenterlite/queries/updateNotifyReadedByType.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + + + diff --git a/modules/ncenterlite/queries/updateUserConfig.xml b/modules/ncenterlite/queries/updateUserConfig.xml new file mode 100644 index 000000000..7bfcb07d6 --- /dev/null +++ b/modules/ncenterlite/queries/updateUserConfig.xml @@ -0,0 +1,14 @@ + + +
+ + + + + + + + + + + diff --git a/modules/ncenterlite/ruleset/insertConfig.xml b/modules/ncenterlite/ruleset/insertConfig.xml new file mode 100644 index 000000000..1015ba521 --- /dev/null +++ b/modules/ncenterlite/ruleset/insertConfig.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/modules/ncenterlite/schemas/ncenterlite_notify.xml b/modules/ncenterlite/schemas/ncenterlite_notify.xml new file mode 100644 index 000000000..083da9708 --- /dev/null +++ b/modules/ncenterlite/schemas/ncenterlite_notify.xml @@ -0,0 +1,24 @@ +
+ + + + + + + + + + + + + + + + + + + + + + +
diff --git a/modules/ncenterlite/schemas/ncenterlite_notify_type.xml b/modules/ncenterlite/schemas/ncenterlite_notify_type.xml new file mode 100644 index 000000000..5beb4bf6e --- /dev/null +++ b/modules/ncenterlite/schemas/ncenterlite_notify_type.xml @@ -0,0 +1,6 @@ + + + + + +
diff --git a/modules/ncenterlite/schemas/ncenterlite_user_set.xml b/modules/ncenterlite/schemas/ncenterlite_user_set.xml new file mode 100644 index 000000000..0562ed1e4 --- /dev/null +++ b/modules/ncenterlite/schemas/ncenterlite_user_set.xml @@ -0,0 +1,7 @@ + + + + + + +
diff --git a/modules/ncenterlite/skins/default/NotifyList.html b/modules/ncenterlite/skins/default/NotifyList.html new file mode 100644 index 000000000..dae56b337 --- /dev/null +++ b/modules/ncenterlite/skins/default/NotifyList.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + {@ + $oMemberModel = getModel('member'); + $member_info = $oMemberModel->getMemberInfoByMemberSrl($val->member_srl); + } + + + + + + + + + +
{$lang->ncenterlite_sender}{$lang->ncenterlite_addressee}{$lang->ncenterlite_noti_contents}{$lang->ncenterlite_read}{$lang->date}
{$val->target_nick_name}{$member_info->nick_name} {$lang->ncenterlite_no_target}{$val->text} + {$lang->ncenterlite_read_y} + {$lang->ncenterlite_read_n} + + {zdate($val->regdate,"Y-m-d")} +
+ {zdate($val->regdate,"H:i:s")} +
+ + + + \ No newline at end of file diff --git a/modules/ncenterlite/skins/default/img/p.png b/modules/ncenterlite/skins/default/img/p.png new file mode 100644 index 000000000..44e3d8d12 Binary files /dev/null and b/modules/ncenterlite/skins/default/img/p.png differ diff --git a/modules/ncenterlite/skins/default/ncenterlite.black.css b/modules/ncenterlite/skins/default/ncenterlite.black.css new file mode 100644 index 000000000..6f2596f91 --- /dev/null +++ b/modules/ncenterlite/skins/default/ncenterlite.black.css @@ -0,0 +1,15 @@ +#nc_container { border-bottom-color:#555; background-color:#333; color:#B0B0B0; opacity:0.95; } +#nc_container a { color:#B0B0B0; } +#nc_container a:hover { color:#B0B0B0; } +#nc_container strong { color:#F3F3F3; } + +#nc_container .list { background-color:#333; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#555; } +#nc_container .list li a:hover { background-color:#555; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list .more { background: #555; } +#nc_container a.readall { display:none; color:#555; color:#D83722;} + +#nc_container a.notify { color:white; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } diff --git a/modules/ncenterlite/skins/default/ncenterlite.blacknoprofile.css b/modules/ncenterlite/skins/default/ncenterlite.blacknoprofile.css new file mode 100644 index 000000000..88c94a4a4 --- /dev/null +++ b/modules/ncenterlite/skins/default/ncenterlite.blacknoprofile.css @@ -0,0 +1,17 @@ +#nc_container { border-bottom-color:#555; background-color:#333; color:#B0B0B0; opacity:0.95; } +#nc_container a { color:#B0B0B0; } +#nc_container a:hover { color:#B0B0B0; } +#nc_container strong { color:#F3F3F3; } + +#nc_container .list { background-color:#333; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#555; } +#nc_container .list li a:hover { background-color:#555; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list .more { background: #555; } +#nc_container a.readall { display:none; color:#555; color:#D83722;} + +#nc_container a.notify { color:white; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } + +#nc_container img.nc_profile_img { display:none;} diff --git a/modules/ncenterlite/skins/default/ncenterlite.css b/modules/ncenterlite/skins/default/ncenterlite.css new file mode 100644 index 000000000..60df8e548 --- /dev/null +++ b/modules/ncenterlite/skins/default/ncenterlite.css @@ -0,0 +1,185 @@ +#nc_container { + z-index:99; + position:fixed; + top:0; + left:0; + margin:0; + padding:0; + width:100%; + height:30px; + border-bottom:1px solid; + font-size:12px; + line-height:15px; +} + +.ncenterlite_block { + height:28px; +} + +#nc_container a { + padding:0; + font-size:12px; + text-decoration:none; +} + +#nc_container ul.nc_memu { + display:block; + margin:0; + padding:4px; + list-style:none; + line-height:20px; +} + +#nc_container ul:after { + content:""; + display:block; + clear:both; +} + +#nc_container ul.nc_memu li { + display:inline-block; + padding:0 5px; + height:20px; + width:auto; + background:transparent!important; +} + +#nc_container ul.nc_memu li.fLeft { + float:left; +} + +#nc_container ul.nc_memu li.fRight { + float:right; +} + +#nc_container ul.nc_memu li a.notify { + display:block; + float:left; +} + +#nc_container a.close { + display:block; +} + +#nc_container .nc_profile img { + width:20px; + height:20px; + vertical-align:top; +} + +#nc_container a.notify .num { + padding:1px 2px; + border:0; + border-radius:3px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + font-size:12px; + font-weight:700; + font-family:Gulim,"lucida grande",tahoma,verdana,arial,sans-serif; +} + +#nc_container .list { + display:none; + position:absolute; + top:30px; + left:0; + max-width:330px; + width:330px; + box-sizing:border-box; + -moz-box-sizing:border-box; + -webkit-box-sizing:border-box; + -o-box-sizing:border-box; +} + +#nc_container a.readall { + display:none; + float:left; + margin:0 4px; + font-size:11px; + font-weight:700; +} + +#nc_container .listscroll { + overflow-y:auto; + overflow-x:hidden; +} + +#nc_container .list ul { + overflow:hidden; + margin:-1px 0; + padding:0; + list-style:none; +} + +#nc_container .list li { + margin:-1px 0; + border:1px solid #555; + border-width:1px 0; +} + +#nc_container .list li img { + float:left; + margin-right:5px; + width:45px; + height:45px; + border:0; +} + +#nc_container .list li a { + display:block; + overflow:hidden; + padding:10px; + font-size:12px; +} + +#nc_container .list span.ago { + display:block; + font-size:10px; +} + +#nc_container .list .more { + display:block; + padding:10px; + text-align:center; +} + +#nc_container ~ .navbar.navbar-fixed-top { + top:28px; +} + +#nc_container a:hover,#nc_container .list li a:hover,#nc_container .list .more:hover { + text-decoration:none; +} + +@media only screen and max-device-width 480px { + #nc_container { + position:relative; + height:auto; + } + + #nc_container .list { + top:2px; + position:relative; + } + + #nc_container .list ul { + display:block; + position:relative; + } + + #nc_container ul.nc_memu:after { + content:""; + display:block; + visibility:hidden; + height:0; + clear:both; + } + + #nc_container .listscroll { + overflow:visible; + } + + .ncenterlite_block { + display:none; + } +} diff --git a/modules/ncenterlite/skins/default/ncenterlite.gray.css b/modules/ncenterlite/skins/default/ncenterlite.gray.css new file mode 100644 index 000000000..4d167ea21 --- /dev/null +++ b/modules/ncenterlite/skins/default/ncenterlite.gray.css @@ -0,0 +1,16 @@ +#nc_container { border-bottom-color:#C0C0C0; background-color:#efefef; color:#666; opacity:0.95; } +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#666; } +#nc_container a.notify strong { color:#FC2772; } +#nc_container .list { background-color:#efefef; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#ddd; } +#nc_container .list li a:hover { background-color: #ddd; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify sup.num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #ddd; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } diff --git a/modules/ncenterlite/skins/default/ncenterlite.graynoprofile.css b/modules/ncenterlite/skins/default/ncenterlite.graynoprofile.css new file mode 100644 index 000000000..d8704070b --- /dev/null +++ b/modules/ncenterlite/skins/default/ncenterlite.graynoprofile.css @@ -0,0 +1,18 @@ +#nc_container { border-bottom-color:#C0C0C0; background-color:#efefef; color:#666; opacity:0.95; } +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#666; } +#nc_container a.notify strong { color:#FC2772; } +#nc_container .list { background-color:#efefef; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#ddd; } +#nc_container .list li a:hover { background-color: #ddd; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify sup.num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #ddd; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } + +#nc_container img.nc_profile_img { display:none;} diff --git a/modules/ncenterlite/skins/default/ncenterlite.html b/modules/ncenterlite/skins/default/ncenterlite.html new file mode 100644 index 000000000..39d6ebe10 --- /dev/null +++ b/modules/ncenterlite/skins/default/ncenterlite.html @@ -0,0 +1,125 @@ + +
+ + diff --git a/modules/ncenterlite/skins/default/ncenterlite.mobile.css b/modules/ncenterlite/skins/default/ncenterlite.mobile.css new file mode 100644 index 000000000..ef3125177 --- /dev/null +++ b/modules/ncenterlite/skins/default/ncenterlite.mobile.css @@ -0,0 +1,12 @@ +#nc_container { height:auto; position:relative; } +#nc_container .list { top:2px; position:relative; } +#nc_container .list ul { display:block; position:relative; } +#nc_container ul.nc_memu:after { + content: ""; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +#nc_container .listscroll { overflow: visible; } +.ncenterlite_block { display:none; } diff --git a/modules/ncenterlite/skins/default/ncenterlite.white.css b/modules/ncenterlite/skins/default/ncenterlite.white.css new file mode 100644 index 000000000..c3fd4444a --- /dev/null +++ b/modules/ncenterlite/skins/default/ncenterlite.white.css @@ -0,0 +1,16 @@ +#nc_container { border:1px solid #efefef; background-color:#fff; color:#000; opacity:0.95; } +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#000; } +#nc_container a.notify strong { color:#F60; } +#nc_container .list { border:1px solid #efefef; background-color:#fff; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#eee; } +#nc_container .list li a:hover { background-color: #eee; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify .num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #eee; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } diff --git a/modules/ncenterlite/skins/default/ncenterlite.whitenoprofile.css b/modules/ncenterlite/skins/default/ncenterlite.whitenoprofile.css new file mode 100644 index 000000000..69342bd1d --- /dev/null +++ b/modules/ncenterlite/skins/default/ncenterlite.whitenoprofile.css @@ -0,0 +1,18 @@ +#nc_container { border:1px solid #efefef; background-color:#fff; color:#000; opacity:0.95; } +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#000; } +#nc_container a.notify strong { color:#F60; } +#nc_container .list { border:1px solid #efefef; background-color:#fff; filter:alpha(opacity=97); opacity:0.97; -moz-opacity:0.97; } +#nc_container .list li { border-color:#eee; } +#nc_container .list li a:hover { background-color: #eee; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify .num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #eee; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } + +#nc_container img.nc_profile_img { display:none;} diff --git a/modules/ncenterlite/skins/default/skin.xml b/modules/ncenterlite/skins/default/skin.xml new file mode 100644 index 000000000..78ac42418 --- /dev/null +++ b/modules/ncenterlite/skins/default/skin.xml @@ -0,0 +1,40 @@ + + + XE 알림센터 Lite 기본스킨 + XE Notification Center Lite Default Skin + 1.1.1 + 2013-03-21 + + + XE Public + XE Public + + + + + 검은색 + Black + + + 회색 + Gray + + + 흰색 + White + + + + 검은색(no profile) + Black (no profile) + + + 회색(no profile) + Gray (no profile) + + + 흰색(no profile) + White (no profile) + + + diff --git a/modules/ncenterlite/skins/default/userconfig.html b/modules/ncenterlite/skins/default/userconfig.html new file mode 100644 index 000000000..fffbfeaeb --- /dev/null +++ b/modules/ncenterlite/skins/default/userconfig.html @@ -0,0 +1,68 @@ + + +
+ +
+

{$XE_VALIDATOR_MESSAGE}

+
+ + +
+ + + + +
+

{@$user_str = $member_info->nick_name} + {@$user_str = $logged_info->nick_name} + {@$title_str = Context::getLang('ncenterlite_userconfig_title')} + {sprintf($title_str, $user_str)} +

+ +

{$lang->ncenterlite_userconfig_about} ({$lang->ncenterlite_userconfig_about_warning})

+
+ +
+ + +

{$lang->ncenterlite_comment_noti_about}

+
+
+
+ +
+ + +

{$lang->ncenterlite_mention_noti_about}

+
+
+
+ +
+ + +

{$lang->ncenterlite_message_noti_about}

+
+
+ +
+
+
+ +
+
+
+
+ \ No newline at end of file diff --git a/modules/ncenterlite/skins/default_bottom/NotifyList.html b/modules/ncenterlite/skins/default_bottom/NotifyList.html new file mode 100644 index 000000000..dae56b337 --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/NotifyList.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + {@ + $oMemberModel = getModel('member'); + $member_info = $oMemberModel->getMemberInfoByMemberSrl($val->member_srl); + } + + + + + + + + + +
{$lang->ncenterlite_sender}{$lang->ncenterlite_addressee}{$lang->ncenterlite_noti_contents}{$lang->ncenterlite_read}{$lang->date}
{$val->target_nick_name}{$member_info->nick_name} {$lang->ncenterlite_no_target}{$val->text} + {$lang->ncenterlite_read_y} + {$lang->ncenterlite_read_n} + + {zdate($val->regdate,"Y-m-d")} +
+ {zdate($val->regdate,"H:i:s")} +
+ + + + \ No newline at end of file diff --git a/modules/ncenterlite/skins/default_bottom/img/p.png b/modules/ncenterlite/skins/default_bottom/img/p.png new file mode 100644 index 000000000..44e3d8d12 Binary files /dev/null and b/modules/ncenterlite/skins/default_bottom/img/p.png differ diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.black.css b/modules/ncenterlite/skins/default_bottom/ncenterlite.black.css new file mode 100644 index 000000000..e0eb7f2ac --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.black.css @@ -0,0 +1,15 @@ +#nc_container { border-bottom-color:#555; background-color:#333; color:#B0B0B0; opacity:0.95;} +#nc_container a { color:#B0B0B0; } +#nc_container a:hover { color:#B0B0B0; } +#nc_container strong { color:#F3F3F3; } + +#nc_container .list { background-color:#333; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#555; } +#nc_container .list li a:hover { background-color:#555; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list .more { background: #555; } +#nc_container a.readall { display:none; color:#555; color:#D83722;} + +#nc_container a.notify { color:white; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.blacknoprofile.css b/modules/ncenterlite/skins/default_bottom/ncenterlite.blacknoprofile.css new file mode 100644 index 000000000..3db203843 --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.blacknoprofile.css @@ -0,0 +1,17 @@ +#nc_container { border-bottom-color:#555; background-color:#333; color:#B0B0B0; opacity:0.95;} +#nc_container a { color:#B0B0B0; } +#nc_container a:hover { color:#B0B0B0; } +#nc_container strong { color:#F3F3F3; } + +#nc_container .list { background-color:#333; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#555; } +#nc_container .list li a:hover { background-color:#555; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list .more { background: #555; } +#nc_container a.readall { display:none; color:#555; color:#D83722;} + +#nc_container a.notify { color:white; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } + +#nc_container img.nc_profile_img { display:none;} diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.css b/modules/ncenterlite/skins/default_bottom/ncenterlite.css new file mode 100644 index 000000000..d22532260 --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.css @@ -0,0 +1,177 @@ +#nc_container { + z-index:99; + position:fixed; + bottom:0; + right:0; + margin:0; + padding:0; + width:330px; + height:50px; + border-bottom:1px solid; + font-size:12px; + line-height:15px; +} + +#nc_container a { + padding:0; + font-size:12px; + text-decoration:none; +} + +#nc_container ul.nc_memu { + display:block; + margin:0; + padding:4px; + list-style:none; + line-height:20px; +} + +#nc_container ul:after { + content:""; + display:block; + clear:both; +} + +#nc_container ul.nc_memu li { + display:inline-block; + padding:0 5px; + height:20px; + width:auto; + background:transparent!important; +} + +#nc_container ul.nc_memu li.fLeft { + float:left; +} + +#nc_container ul.nc_memu li.fRight { + float:right; +} + +#nc_container ul.nc_memu li a.notify { + display:block; + float:left; +} + +#nc_container a.close { + display:block; +} + +#nc_container .nc_profile img { + width:20px; + height:20px; + vertical-align:top; +} + +#nc_container a.notify .num { + padding:1px 2px; + border:0; + border-radius:3px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + font-size:12px; + font-weight:700; + font-family:Gulim,"lucida grande",tahoma,verdana,arial,sans-serif; +} + +#nc_container .list { + display:none; + position:absolute; + left:0; + bottom:50px; + max-width:330px; + width:330px; + box-sizing:border-box; + -moz-box-sizing:border-box; + -webkit-box-sizing:border-box; + -o-box-sizing:border-box; +} + +#nc_container a.readall { + display:none; + float:left; + margin:0 4px; + font-size:11px; + font-weight:700; +} + +#nc_container .listscroll { + overflow-y:auto; + overflow-x:hidden; +} + +#nc_container .list ul { + overflow:hidden; + margin:-1px 0; + padding:0; + list-style:none; +} + +#nc_container .list li { + margin:-1px 0; + border:1px solid #555; + border-width:1px 0; +} + +#nc_container .list li img { + float:left; + margin-right:5px; + width:45px; + height:45px; + border:0; +} + +#nc_container .list li a { + display:block; + overflow:hidden; + padding:10px; + font-size:12px; +} + +#nc_container .list span.ago { + display:block; + font-size:10px; +} + +#nc_container .list .more { + display:block; + padding:10px; + text-align:center; +} + +#nc_container a:hover,#nc_container .list li a:hover,#nc_container .list .more:hover { + text-decoration:none; +} + +@media only screen and max-device-width 480px { + #nc_container { + position:relative; + height:auto; + } + + #nc_container .list { + top:2px; + position:relative; + } + + #nc_container .list ul { + display:block; + position:relative; + } + + #nc_container ul.nc_memu:after { + content:""; + display:block; + visibility:hidden; + height:0; + clear:both; + } + + #nc_container .listscroll { + overflow:visible; + } + + .ncenterlite_block { + display:none; + } +} diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.gray.css b/modules/ncenterlite/skins/default_bottom/ncenterlite.gray.css new file mode 100644 index 000000000..91f3e6898 --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.gray.css @@ -0,0 +1,16 @@ +#nc_container { border-bottom-color:#C0C0C0; background-color:#efefef; color:#666; opacity:0.95;} +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#666; } +#nc_container a.notify strong { color:#FC2772; } +#nc_container .list { background-color:#efefef; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#ddd; } +#nc_container .list li a:hover { background-color: #ddd; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify sup.num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #ddd; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.graynoprofile.css b/modules/ncenterlite/skins/default_bottom/ncenterlite.graynoprofile.css new file mode 100644 index 000000000..b7a8c5d5a --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.graynoprofile.css @@ -0,0 +1,18 @@ +#nc_container { border-bottom-color:#C0C0C0; background-color:#efefef; color:#666; opacity:0.95;} +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#666; } +#nc_container a.notify strong { color:#FC2772; } +#nc_container .list { background-color:#efefef; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#ddd; } +#nc_container .list li a:hover { background-color: #ddd; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify sup.num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #ddd; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } + +#nc_container img.nc_profile_img { display:none;} diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.html b/modules/ncenterlite/skins/default_bottom/ncenterlite.html new file mode 100644 index 000000000..b4a5b5703 --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.html @@ -0,0 +1,124 @@ + + + diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.mobile.css b/modules/ncenterlite/skins/default_bottom/ncenterlite.mobile.css new file mode 100644 index 000000000..c221ae4da --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.mobile.css @@ -0,0 +1,12 @@ +#nc_container { width:100%; height:auto; position:relative; } +#nc_container .list { top:2px; position:relative; } +#nc_container .list ul { display:block; position:relative; } +#nc_container ul.nc_memu:after { + content: ""; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +#nc_container .listscroll { overflow: visible; } +.ncenterlite_block { display:none; } diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.white.css b/modules/ncenterlite/skins/default_bottom/ncenterlite.white.css new file mode 100644 index 000000000..5cd778257 --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.white.css @@ -0,0 +1,16 @@ +#nc_container { border:1px solid #EFEFEF; background-color:#fff; color:#000; opacity:0.95;} +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#000; } +#nc_container a.notify strong { color:#F60; } +#nc_container .list { border:1px solid #EFEFEF; background-color:#fff; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#eee; } +#nc_container .list li a:hover { background-color: #eee; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify .num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #eee; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.whitenoprofile.css b/modules/ncenterlite/skins/default_bottom/ncenterlite.whitenoprofile.css new file mode 100644 index 000000000..175a58afe --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.whitenoprofile.css @@ -0,0 +1,18 @@ +#nc_container { border:1px solid #EFEFEF; background-color:#fff; color:#000; opacity:0.95;} +#nc_container a { color:#666; } +#nc_container a:hover { color:#666; } +#nc_container strong { color:#000; } +#nc_container a.notify strong { color:#F60; } +#nc_container .list { border:1px solid #EFEFEF; background-color:#fff; filter:alpha(opacity=95); opacity:0.95; -moz-opacity:0.95; } +#nc_container .list li { border-color:#eee; } +#nc_container .list li a:hover { background-color: #eee; } +#nc_container .list span.ago { color:#D4AF37; } +#nc_container .list a.notify .num { background-color:#D83722; color:white; } +#nc_container .list .more { background: #eee; } +#nc_container a.readall { display:none; color:#555; font-size:10px; color:#D83722;} + +#nc_container a.notify { color:#666; } +#nc_container a.notify .num { background-color:#D83722; color:white; } +#nc_container ul.nc_memu li { padding-right:5px; } + +#nc_container img.nc_profile_img { display:none;} diff --git a/modules/ncenterlite/skins/default_bottom/skin.xml b/modules/ncenterlite/skins/default_bottom/skin.xml new file mode 100644 index 000000000..aeecfd5cf --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/skin.xml @@ -0,0 +1,40 @@ + + + XE 알림센터 Lite 기본스킨 - 우측 하단 + XE Notification Center Lite Default Skin - Right bottom + 1.2.0 + 2013-05-10 + + + XE Public + XE Public + + + + + 검은색 + Black + + + 회색 + Gray + + + 흰색 + White + + + + 검은색(no profile) + Black (no profile) + + + 회색(no profile) + Gray (no profile) + + + 흰색(no profile) + White (no profile) + + + diff --git a/modules/ncenterlite/skins/default_bottom/userconfig.html b/modules/ncenterlite/skins/default_bottom/userconfig.html new file mode 100644 index 000000000..52e2e2f0b --- /dev/null +++ b/modules/ncenterlite/skins/default_bottom/userconfig.html @@ -0,0 +1,68 @@ + + +
+ +
+

{$XE_VALIDATOR_MESSAGE}

+
+ + +
+ + + + +
+

{@$user_str = $member_info->nick_name} + {@$user_str = $logged_info->nick_name} + {@$title_str = Context::getLang('ncenterlite_userconfig_title')} + {sprintf($title_str, $user_str)} +

+ +

{$lang->ncenterlite_userconfig_about} ({$lang->ncenterlite_userconfig_about_warning})

+
+ +
+ + +

{$lang->ncenterlite_comment_noti_about}

+
+
+
+ +
+ + +

{$lang->ncenterlite_mention_noti_about}

+
+
+
+ +
+ + +

{$lang->ncenterlite_message_noti_about}

+
+
+ +
+
+
+ +
+
+
+
+ \ No newline at end of file diff --git a/modules/ncenterlite/tpl/Config.html b/modules/ncenterlite/tpl/Config.html new file mode 100644 index 000000000..c76e47dc7 --- /dev/null +++ b/modules/ncenterlite/tpl/Config.html @@ -0,0 +1,275 @@ + + + + +
+
+ + +

{$lang->ncenterlite_config_environment}

+ {$lang->ncenterlite_config_environment_about} +
+ + +
+
+
+ + +
+ + + + + + + + + + + + + +
+
+ +
+
+ +
+

{$lang->etc}

+
+ +
+ +
+
+ +
+ +
+ +
+
+
+
+
+

{$lang->ncenterlite_install_version} : Lite v{$ncenterlite_module_info->version}

+ +
\ No newline at end of file diff --git a/modules/ncenterlite/tpl/css/ncenter_admin.css b/modules/ncenterlite/tpl/css/ncenter_admin.css new file mode 100644 index 000000000..b01d9527b --- /dev/null +++ b/modules/ncenterlite/tpl/css/ncenter_admin.css @@ -0,0 +1,12 @@ +.mention_option ul.preview, +.mention_option ul.preview li { margin:0; padding:0; list-style:none; } + +.mention_option ul.preview li { display:inline-block; margin:5px; padding:3px 7px; border-radius:50px; color:red; font-size:1.2em; background:#EEE; } +.mention_option ul.preview li strong { color:black; } + +.mention_option ul.preview li.enable, +.mention_option ul.preview li.disable { color:black; } +.mention_option ul.preview li.enable strong, +.mention_option ul.preview li.disable strong { color:#FFF; } +.mention_option ul.preview li.enable { background:green; } +.mention_option ul.preview li.disable { background:red; } diff --git a/modules/ncenterlite/tpl/header.html b/modules/ncenterlite/tpl/header.html new file mode 100644 index 000000000..be44bc02d --- /dev/null +++ b/modules/ncenterlite/tpl/header.html @@ -0,0 +1,14 @@ +
+

{$lang->ncenterlite}

+
+ + + +
+

{$XE_VALIDATOR_MESSAGE}

+
\ No newline at end of file diff --git a/modules/ncenterlite/tpl/js/ncenter_admin.js b/modules/ncenterlite/tpl/js/ncenter_admin.js new file mode 100644 index 000000000..5fa289894 --- /dev/null +++ b/modules/ncenterlite/tpl/js/ncenter_admin.js @@ -0,0 +1,106 @@ +function doDisplaySkinColorset(sel, colorset) +{ + var skin = sel.options[sel.selectedIndex].value; + + var params = new Array(); + params["skin"] = skin; + params["colorset"] = colorset; + + var response_tags = ['error', 'message', 'colorset_list']; + + exec_xml('ncenterlite', 'getColorsetList', params, completeGetSkinColorset, response_tags, params); +} + +function completeGetSkinColorset(ret_obj, response_tags, params, fo_obj) +{ + var sel = get_by_id('fo_ncenterlite').colorset; + var length = sel.options.length; + var selected_colorset = params['colorset']; + for(var i=0;i= steps) { + //element.style.backgroundColor = 'rgb(' + endcolour.toString() + ')'; + element.style.backgroundColor = c; //'rgb(' + endcolour.toString() + ')'; + clearInterval(timer); + } + }, interval); + } + + var s = decodeURIComponent(location.href).replace(/.*#comment_/,''); + if(!s || s === decodeURIComponent(location.href)) return; + s = 'comment_' + s; + jQuery('.xe_content').each(function(){ + var t = jQuery(this); + if(t.hasClass(s) || (new RegExp(s + '_')).test(t.attr('class'))){ + var c = t.css('display','block').css('background-color'); + y(this, [255,255,60], [255,255,255], 750, c); + ncenterlite_need_highlight = false; + } + }); +} + +if(typeof _viewSubComment == 'function') { + old__viewSubComment = _viewSubComment; + _viewSubComment = function(ret_obj) { + old__viewSubComment(ret_obj); + if(ncenterlite_need_highlight) { + setTimeout(function(){ + var s = decodeURIComponent(location.href).match(/#.*comment_([0-9]+)/); + if(s) { + ncenterlite_highlight(); + location.href = '#social_comment_' + s[1]; + } + }, 500); + } + }; +} + +jQuery(function(){ + ncenterlite_highlight(); +}); diff --git a/modules/ncenterlite/tpl/ncenter_list.html b/modules/ncenterlite/tpl/ncenter_list.html new file mode 100644 index 000000000..2bf1b1fad --- /dev/null +++ b/modules/ncenterlite/tpl/ncenter_list.html @@ -0,0 +1,67 @@ + + + +
+

알림 목록

+ +

알림이 없습니다.

+ + +
+
+
+ + + + +

주의! 회원이 확인하지 않은 알림도 삭제됩니다.

+
+
+
+ + + + + + + + + + + + + + {@ + $oMemberModel = getModel('member'); + $member_info = $oMemberModel->getMemberInfoByMemberSrl($val->member_srl); + } + + + + + + + + + +
보낸사람받은사람내용읽음여부{$lang->date}
{$val->target_nick_name}{$member_info->nick_name} 타겟없음{$val->text}{$val->readed} + {zdate($val->regdate,"Y-m-d")} +
+ {zdate($val->regdate,"H:i:s")} +
+ + +
+
\ No newline at end of file diff --git a/modules/poll/poll.controller.php b/modules/poll/poll.controller.php index c954d77fb..155385bdb 100644 --- a/modules/poll/poll.controller.php +++ b/modules/poll/poll.controller.php @@ -23,7 +23,7 @@ class pollController extends poll // mobile input date format can be different if($stop_date != Context::get('stop_date')) { - $stop_date = date('Ymd', strtodate(Context::get('stop_date'))); + $stop_date = date('Ymd', strtotime(Context::get('stop_date'))); } if($stop_date < date('Ymd')) { diff --git a/modules/rss/rss.admin.controller.php b/modules/rss/rss.admin.controller.php index cb7e9c5bd..8368cb413 100644 --- a/modules/rss/rss.admin.controller.php +++ b/modules/rss/rss.admin.controller.php @@ -44,7 +44,7 @@ class rssAdminController extends rss $total_config->image = ''; } // Ignore if the file is not the one which has been successfully uploaded - if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) + if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name'])) { // Ignore if the file is not an image (swf is accepted ~) $image_obj['name'] = Context::convertEncodingStr($image_obj['name']); diff --git a/modules/rss/rss.class.php b/modules/rss/rss.class.php index 0ed625ca4..4a35d476e 100644 --- a/modules/rss/rss.class.php +++ b/modules/rss/rss.class.php @@ -7,6 +7,8 @@ */ class rss extends ModuleObject { + public $gzhandler_enable = false; + /** * Additional tasks required to accomplish during the installation * diff --git a/modules/widget/tpl/js/generate_code.js b/modules/widget/tpl/js/generate_code.js index 759b270e7..1d2dc9edf 100644 --- a/modules/widget/tpl/js/generate_code.js +++ b/modules/widget/tpl/js/generate_code.js @@ -119,6 +119,20 @@ function doFillWidgetVars() { if(node.type == 'button') continue; if(node.name === '') continue; + if (node.name == 'widget_cache') { + var widget_cache = selected_node.getAttribute(node.name); + var widget_cache_unit = widget_cache.match(/[smhd]$/i); + if (widget_cache_unit) { + jQuery("#widget_cache_unit").val(widget_cache_unit); + widget_cache = widget_cache.replace(/[smhd]$/i, ""); + } + jQuery("#widget_cache").val(widget_cache); + continue; + } + if (node.name == 'widget_cache_unit') { + continue; + } + var length = node.length; var type = node.type; diff --git a/modules/widget/tpl/js/widget.js b/modules/widget/tpl/js/widget.js index 68dea693c..c23414bd2 100644 --- a/modules/widget/tpl/js/widget.js +++ b/modules/widget/tpl/js/widget.js @@ -200,7 +200,6 @@ function doSyncPageContent() { if(!fo_obj.document_srl || fo_obj.document_srl.value == '0') { try { var content = Base64.decode(xInnerHtml(obj)); - content = editorReplacePath(content); get_by_id("content_fo").content.value = content; xe.Editors["1"].exec("SET_IR", [content]); } diff --git a/modules/widget/tpl/widget_generate_code.include.html b/modules/widget/tpl/widget_generate_code.include.html index 8d931af62..5e7656d04 100644 --- a/modules/widget/tpl/widget_generate_code.include.html +++ b/modules/widget/tpl/widget_generate_code.include.html @@ -25,7 +25,14 @@
- {$lang->unit_min} + + +

{$lang->about_widget_cache}

@@ -49,7 +56,7 @@ - + diff --git a/modules/widget/tpl/widget_generate_code_in_page.html b/modules/widget/tpl/widget_generate_code_in_page.html index d6cf20908..7c17c8019 100644 --- a/modules/widget/tpl/widget_generate_code_in_page.html +++ b/modules/widget/tpl/widget_generate_code_in_page.html @@ -5,6 +5,10 @@