From e4b82da1bc0e36b3a2b4ffe8d9298102898ffab2 Mon Sep 17 00:00:00 2001 From: dmzx Date: Fri, 10 Jan 2025 13:05:37 +0100 Subject: [PATCH] use cURL --- acp/upload_info.php | 8 +- acp/upload_module.php | 114 +++++----- adm/style/acp_ext_details.html | 32 +-- adm/style/acp_upload_pagination.html | 2 +- adm/style/js/jquery.form.min.js | 2 +- composer.json | 88 ++++---- includes/compatibility/base.php | 14 +- includes/compatibility/v_3_1_x.php | 30 +-- includes/compatibility/v_3_2_x.php | 12 +- includes/filetree/filetree.php | 4 +- includes/functions/extensions.php | 2 +- includes/functions/files.php | 24 +-- includes/functions/languages.php | 4 +- includes/sources/cache.php | 4 +- includes/sources/extensions_list.php | 26 ++- includes/types/zip.php | 86 +++----- includes/upload/base.php | 14 +- includes/upload/lang.php | 6 +- license.txt | 194 +++++++++--------- .../michelf/php-markdown/Michelf/Markdown.php | 16 +- .../php-markdown/Michelf/MarkdownExtra.php | 26 +-- 21 files changed, 347 insertions(+), 361 deletions(-) diff --git a/acp/upload_info.php b/acp/upload_info.php index 13a1291..2428bb0 100644 --- a/acp/upload_info.php +++ b/acp/upload_info.php @@ -14,10 +14,10 @@ class upload_info function module() { return array( - 'filename' => 'boardtools\upload\acp\upload_module', - 'title' => 'ACP_UPLOAD_EXT_TITLE', - 'version' => '1.0.0', - 'modes' => array( + 'filename' => 'boardtools\upload\acp\upload_module', + 'title' => 'ACP_UPLOAD_EXT_TITLE', + 'version' => '1.0.0', + 'modes' => array( 'main' => array( 'title' => 'ACP_UPLOAD_EXT_CONFIG_TITLE', 'auth' => 'ext_boardtools/upload && acl_a_extensions', diff --git a/acp/upload_module.php b/acp/upload_module.php index e7649ac..038e555 100644 --- a/acp/upload_module.php +++ b/acp/upload_module.php @@ -1,9 +1,9 @@ tpl_name; + objects::$request = $request; + objects::$template = $template; + objects::$tpl_name = $this->tpl_name; objects::$u_action = $this->u_action; - objects::$user = &$user; - objects::$zip_dir = &$this->zip_dir; + objects::$user = $user; + objects::$zip_dir = $this->zip_dir; // Add support for different phpBB branches. objects::set_compatibility_class(); @@ -85,7 +85,7 @@ function main($id, $mode) { $template->assign_vars(array( 'HAS_AJAX' => true, - 'IS_AJAX' => true, + 'IS_AJAX' => true, )); objects::$is_ajax = true; @@ -137,7 +137,7 @@ function main($id, $mode) else { $template->assign_vars(array( - 'S_LOAD_ACTION' => $action, + 'S_LOAD_ACTION' => $action, 'U_MAIN_PAGE_URL' => build_url( array('action', 'ajax', 'ajax_time', 'archive', 'ext_name', 'ext_show', 'lang', 'local_upload', 'result') ), @@ -200,9 +200,9 @@ function main($id, $mode) { $md_manager = objects::$compatibility->create_metadata_manager($ext_name); load::ajax_confirm_box(false, $user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array( - 'i' => $id, - 'mode' => $mode, - 'action' => $action, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, 'ext_name' => $ext_name, ))); } @@ -210,9 +210,9 @@ function main($id, $mode) { $md_manager = objects::$compatibility->create_metadata_manager($ext_name); confirm_box(false, $user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array( - 'i' => $id, - 'mode' => $mode, - 'action' => $action, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, 'ext_name' => $ext_name, ))); } @@ -268,7 +268,7 @@ function main($id, $mode) $extension = new extension(); $extension->upload($action); $template->assign_vars(array( - 'U_UPLOAD' => $this->main_link . '&action=upload', + 'U_UPLOAD' => $this->main_link . '&action=upload', 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', )); break; @@ -280,7 +280,7 @@ function main($id, $mode) } load::zip_files(); $template->assign_vars(array( - 'S_ZIP_PACKAGES' => true, + 'S_ZIP_PACKAGES' => true, 'U_DELETE_ACTION' => objects::$u_action . "&action=delete_zip", )); break; @@ -292,7 +292,7 @@ function main($id, $mode) } extensions::list_uninstalled_exts(); $template->assign_vars(array( - 'S_UNINSTALLED' => true, + 'S_UNINSTALLED' => true, 'U_DELETE_ACTION' => objects::$u_action . "&action=delete_ext", )); break; @@ -353,9 +353,9 @@ function main($id, $mode) if ($force_unstable) { $s_hidden_fields = build_hidden_fields(array( - 'i' => $id, - 'mode' => $mode, - 'action' => $action, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, 'force_unstable' => $force_unstable, )); @@ -391,11 +391,11 @@ function main($id, $mode) extensions::list_all_exts(); objects::$template->assign_vars(array( - 'S_EXT_LIST' => true, + 'S_EXT_LIST' => true, 'U_VERSIONCHECK_FORCE' => objects::$u_action . '&action=list&versioncheck_force=1', - 'FORCE_UNSTABLE' => $config['extension_force_unstable'], - 'SET_FORCE_UNSTABLE' => objects::$request->variable('set_force_unstable', false), - 'U_ACTION_LIST' => objects::$u_action . '&action=list', + 'FORCE_UNSTABLE' => $config['extension_force_unstable'], + 'SET_FORCE_UNSTABLE' => objects::$request->variable('set_force_unstable', false), + 'U_ACTION_LIST' => objects::$u_action . '&action=list', )); add_form_key('version_check_settings'); @@ -459,10 +459,10 @@ function main($id, $mode) { $confirm_text = (sizeof($marked) > 1) ? $user->lang('EXTENSIONS_DELETE_CONFIRM', sizeof($marked)) : $user->lang('EXTENSION_DELETE_CONFIRM', $marked[0]); confirm_box(false, $confirm_text, build_hidden_fields(array( - 'i' => $id, - 'mode' => $mode, - 'action' => $action, - 'mark' => $marked, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'mark' => $marked, 'delmarked' => $deletemark, ))); } @@ -499,10 +499,10 @@ function main($id, $mode) { $confirm_text = (sizeof($marked) > 1) ? $user->lang('EXTENSIONS_ZIP_DELETE_CONFIRM', sizeof($marked)) : $user->lang('EXTENSION_ZIP_DELETE_CONFIRM', $marked[0]); confirm_box(false, $confirm_text, build_hidden_fields(array( - 'i' => $id, - 'mode' => $mode, - 'action' => $action, - 'mark' => $marked, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'mark' => $marked, 'delmarked' => $deletemark, ))); } @@ -546,10 +546,10 @@ function main($id, $mode) $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_TITLE' => $user->lang['INFORMATION'], - 'MESSAGE_TEXT' => $result_text, - 'REFRESH_DATA' => array( + 'MESSAGE_TEXT' => $result_text, + 'REFRESH_DATA' => array( 'time' => 3, - 'url' => redirect(objects::$u_action . '&action=details&ext_show=languages&ajax=1', true) + 'url' => redirect(objects::$u_action . '&action=details&ext_show=languages&ajax=1', true) ) )); } @@ -572,11 +572,11 @@ function main($id, $mode) { $confirm_text = (sizeof($marked) > 1) ? $user->lang('EXT_LANGUAGES_DELETE_CONFIRM', sizeof($marked)) : $user->lang('EXT_LANGUAGE_DELETE_CONFIRM', $marked[0]); confirm_box(false, $confirm_text, build_hidden_fields(array( - 'i' => $id, - 'mode' => $mode, - 'action' => $action, - 'ext_name' => $ext_name, - 'mark' => $marked, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'ext_name' => $ext_name, + 'mark' => $marked, 'delmarked' => $deletemark, ))); } @@ -595,7 +595,7 @@ function main($id, $mode) case 'main': default: $template->assign_vars(array( - 'U_UPLOAD' => $this->main_link . '&action=upload', + 'U_UPLOAD' => $this->main_link . '&action=upload', 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', )); break; @@ -643,17 +643,17 @@ public function get_valid_extensions() $require_php = (isset($latest_release['require']['php'])) ? $latest_release['require']['php'] : ''; objects::$template->assign_block_vars("phpbb_cdb", array( - 'EXT_NAME' => $display_name, - 'EXT_VERSION' => key($value), - 'EXT_DOWNLOAD' => $download_link, + 'EXT_NAME' => $display_name, + 'EXT_VERSION' => key($value), + 'EXT_DOWNLOAD' => $download_link, 'EXT_DOWNLOAD_ENCODED' => urlencode($download_link), - 'EXT_DESCRIPTION' => $description, - 'EXT_HOMEPAGE' => $homepage_link, - 'EXT_CHECKSUM' => $shasum, - 'REQUIRE_PHPBB' => $require_phpbb, + 'EXT_DESCRIPTION' => $description, + 'EXT_HOMEPAGE' => $homepage_link, + 'EXT_CHECKSUM' => $shasum, + 'REQUIRE_PHPBB' => $require_phpbb, 'REQUIRE_PHPBB_STATUS' => !empty($require_phpbb), - 'REQUIRE_PHP' => $require_php, - 'REQUIRE_PHP_STATUS' => !empty($require_php), + 'REQUIRE_PHP' => $require_php, + 'REQUIRE_PHP_STATUS' => !empty($require_php), )); } } @@ -675,7 +675,7 @@ protected function catch_errors() else { objects::$template->assign_vars(array( - 'S_EXT_ERROR' => true, + 'S_EXT_ERROR' => true, 'S_LOAD_ACTION' => 'error', )); } diff --git a/adm/style/acp_ext_details.html b/adm/style/acp_ext_details.html index 7d50c1c..674d711 100644 --- a/adm/style/acp_ext_details.html +++ b/adm/style/acp_ext_details.html @@ -61,23 +61,23 @@

{L_ACP_UPLOAD_EXT_NO_CHECKSUM_TITLE
{EXT_DETAILS_README}
{EXT_DETAILS_CHANGELOG}
- -
style="display:block;"> + +
style="display:block;">

{L_ACP_UPLOAD_EXT_HELP}

- -
- {upload_ext_faq_block.BLOCK_TITLE} - -
- {upload_ext_faq_block.faq_row.FAQ_QUESTION} -
{upload_ext_faq_block.faq_row.FAQ_ANSWER}
-
- -
-
- -
- + +
+ {upload_ext_faq_block.BLOCK_TITLE} + +
+ {upload_ext_faq_block.faq_row.FAQ_QUESTION} +
{upload_ext_faq_block.faq_row.FAQ_ANSWER}
+
+ +
+
+ +
+
style="display:block;"> diff --git a/adm/style/acp_upload_pagination.html b/adm/style/acp_upload_pagination.html index d8e64a8..e65c18a 100644 --- a/adm/style/acp_upload_pagination.html +++ b/adm/style/acp_upload_pagination.html @@ -1,5 +1,5 @@ - {PAGE_NUMBER} • + {PAGE_NUMBER}
  • {L_PREVIOUS}
  • diff --git a/adm/style/js/jquery.form.min.js b/adm/style/js/jquery.form.min.js index 0684ed7..5252d24 100644 --- a/adm/style/js/jquery.form.min.js +++ b/adm/style/js/jquery.form.min.js @@ -16,7 +16,7 @@ * version 2.1 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r),r}:e(jQuery)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).closest("form").ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=r.form;if(i.clk=r,"image"===r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n=/\r?\n/g,i={};i.fileapi=void 0!==e('').get(0).files,i.formdata=void 0!==window.FormData;var o=!!e.fn.prop;e.fn.attr2=function(){if(!o)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,s){function u(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;a',k).val(f.extraData[c].value).appendTo(w)[0]):u.push(e('',k).val(f.extraData[c]).appendTo(w)[0]));f.iframeTarget||h.appendTo(D),v.attachEvent?v.attachEvent("onload",s):v.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(e){document.createElement("form").submit.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",o),r?w.setAttribute("target",r):p.removeAttr("target"),e(u).remove()}}function s(t){if(!x.aborted&&!X){if((O=n(v))||(a("cannot access response document"),t=L),t===A&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t===L&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(O&&O.location.href!==f.iframeSrc||T){v.detachEvent?v.detachEvent("onload",s):v.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"===f.dataType||O.XMLDocument||e.isXMLDoc(O);if(a("isXml="+o),!o&&window.opera&&(null===O.body||!O.body.innerHTML)&&--C)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=O.body?O.body:O.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=O.XMLDocument?O.XMLDocument:O,o&&(f.dataType="xml"),x.getResponseHeader=function(e){return{"content-type":f.dataType}[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(f.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||f.textarea){var p=O.getElementsByTagName("textarea")[0];if(p)x.responseText=p.value,x.status=Number(p.getAttribute("status"))||x.status,x.statusText=p.getAttribute("statusText")||x.statusText;else if(l){var m=O.getElementsByTagName("pre")[0],g=O.getElementsByTagName("body")[0];m?x.responseText=m.textContent?m.textContent:m.innerText:g&&(x.responseText=g.textContent?g.textContent:g.innerText)}}else"xml"===c&&!x.responseXML&&x.responseText&&(x.responseXML=q(x.responseText));try{M=N(x,c,f)}catch(e){i="parsererror",x.error=r=e||i}}catch(e){a("error caught: ",e),i="error",x.error=r=e||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===i?(f.success&&f.success.call(f.context,M,"success",x),S.resolve(x.responseText,"success",x),d&&e.event.trigger("ajaxSuccess",[x,f])):i&&(void 0===r&&(r=x.statusText),f.error&&f.error.call(f.context,x,i,r),S.reject(x,"error",r),d&&e.event.trigger("ajaxError",[x,f,r])),d&&e.event.trigger("ajaxComplete",[x,f]),d&&!--e.active&&e.event.trigger("ajaxStop"),f.complete&&f.complete.call(f.context,x,i),X=!0,f.timeout&&clearTimeout(j),setTimeout(function(){f.iframeTarget?h.attr("src",f.iframeSrc):h.remove(),x.responseXML=null},100)}}}var u,c,f,d,m,h,v,x,y,b,T,j,w=p[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(c=0;c',k)).css({position:"absolute",top:"-1000px",left:"-1000px"}),v=h[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{v.contentWindow.document.execCommand&&v.contentWindow.document.execCommand("Stop")}catch(e){}h.attr("src",f.iframeSrc),x.error=r,f.error&&f.error.call(f.context,x,r,t),d&&e.event.trigger("ajaxError",[x,f,r]),f.complete&&f.complete.call(f.context,x,r)}},(d=f.global)&&0==e.active++&&e.event.trigger("ajaxStart"),d&&e.event.trigger("ajaxSend",[x,f]),f.beforeSend&&!1===f.beforeSend.call(f.context,x,f))return f.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;(y=w.clk)&&(b=y.name)&&!y.disabled&&(f.extraData=f.extraData||{},f.extraData[b]=y.value,"image"===y.type&&(f.extraData[b+".x"]=w.clk_x,f.extraData[b+".y"]=w.clk_y));var A=1,L=2,F=e("meta[name=csrf-token]").attr("content"),E=e("meta[name=csrf-param]").attr("content");E&&F&&(f.extraData=f.extraData||{},f.extraData[E]=F),f.forceSync?i():setTimeout(i,10);var M,O,X,C=50,q=e.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!==t.documentElement.nodeName?t:null},_=e.parseJSON||function(e){return window.eval("("+e+")")},N=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i=("xml"===r||!r)&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&(("json"===r||!r)&&n.indexOf("json")>=0?o=_(o):("script"===r||!r)&&n.indexOf("javascript")>=0&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var l,f,d,p=this;"function"==typeof t?t={success:t}:"string"==typeof t||!1===t&&arguments.length>0?(t={url:t,data:r,dataType:n},"function"==typeof s&&(t.success=s)):void 0===t&&(t={}),l=t.method||t.type||this.attr2("method"),(d=(d="string"==typeof(f=t.url||this.attr2("action"))?e.trim(f):"")||window.location.href||"")&&(d=(d.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:d,success:e.ajaxSettings.success,type:l||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&!1===t.beforeSerialize(this,t))return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var h=t.traditional;void 0===h&&(h=e.ajaxSettings.traditional);var v,g=[],x=this.formToArray(t.semantic,g,t.filtering);if(t.data){var y=e.isFunction(t.data)?t.data(x):t.data;t.extraData=y,v=e.param(y,h)}if(t.beforeSubmit&&!1===t.beforeSubmit(x,this,t))return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[x,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var b=e.param(x,h);v&&(b=b?b+"&"+v:v),"GET"===t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+b,t.data=null):t.data=b;var T=[];if(t.resetForm&&T.push(function(){p.resetForm()}),t.clearForm&&T.push(function(){p.clearForm(t.includeHidden)}),!t.dataType&&t.target){var j=t.success||function(){};T.push(function(r,a,n){var i=arguments,o=t.replaceTarget?"replaceWith":"html";e(t.target)[o](r).each(function(){j.apply(this,i)})})}else t.success&&(e.isArray(t.success)?e.merge(T,t.success):T.push(t.success));if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=T.length;i0,D="multipart/form-data",A=p.attr("enctype")===D||p.attr("encoding")===D,L=i.fileapi&&i.formdata;a("fileAPI :"+L);var F,E=(k||A)&&!L;!1!==t.iframe&&(t.iframe||E)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){F=c(x)}):F=c(x):F=(k||A)&&L?function(r){for(var a=new FormData,n=0;n0)&&(n={url:n,data:i,dataType:o},"function"==typeof s&&(n.success=s)),n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var u={s:this.selector,c:this.context};return!e.isReady&&u.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(u.s,u.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().on("submit.form-plugin",n,t).on("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.off("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r,a){var n=[];if(0===this.length)return n;var o,s=this[0],u=this.attr("id"),c=t||void 0===s.elements?s.getElementsByTagName("*"):s.elements;if(c&&(c=e.makeArray(c)),u&&(t||/(Edge|Trident)\//.test(navigator.userAgent))&&(o=e(':input[form="'+u+'"]').get()).length&&(c=(c||[]).concat(o)),!c||!c.length)return n;e.isFunction(a)&&(c=e.map(c,a));var l,f,d,p,m,h,v;for(l=0,h=c.length;l=5.3.3", - "michelf/php-markdown": "~1.4", - "fortawesome/font-awesome": "~4.3" - }, - "require-dev": { - "phpbb/epv": "dev-master" - }, - "autoload": { - "psr-4": { - "Michelf\\": "vendor/michelf/php-markdown/Michelf/" - } - }, - "extra": { - "display-name": "Upload Extensions", - "soft-require": { - "phpbb/phpbb": ">=3.1.0" - }, - "version-check": { - "host": "boardtools.github.io", - "directory": "/upload", - "filename": "upload.json" - } - } + "name": "boardtools/upload", + "type": "phpbb-extension", + "description": "Upload Extensions enables you to upload extensions' zip files or delete extensions' folders from the server. With this extension you can install/update/delete extensions without using FTP. If the uploaded extension already exists, it will be updated with the uploaded files. Upload Extensions also has other built-in features such as the manager for extensions' language packages and the manager for extensions' zip files.", + "homepage": "http://boardtools.github.io/upload/", + "version": "3.2.0-RC", + "keywords": ["boardtools", "forumhulp", "phpbb", "extension", "upload", "unzip", "zip", "delete", "unpack"], + "license": "GPL-2.0", + "authors": [ + { + "name": "Igor Lavrov", + "homepage": "https://github.com/lavigor", + "role": "Developer, maintainer" + }, + { + "name": "John Peskens", + "homepage": "http://forumhulp.com", + "email": "info@forumhulp.com", + "role": "Former developer" + } + ], + "require": { + "php": ">=5.3.3", + "michelf/php-markdown": "~1.4", + "fortawesome/font-awesome": "~4.3" + }, + "require-dev": { + "phpbb/epv": "dev-master" + }, + "autoload": { + "psr-4": { + "Michelf\\": "vendor/michelf/php-markdown/Michelf/" + } + }, + "extra": { + "display-name": "Upload Extensions", + "soft-require": { + "phpbb/phpbb": ">=3.1.0" + }, + "version-check": { + "host": "boardtools.github.io", + "directory": "/upload", + "filename": "upload.json" + } + } } diff --git a/includes/compatibility/base.php b/includes/compatibility/base.php index 334782e..4dc0dac 100644 --- a/includes/compatibility/base.php +++ b/includes/compatibility/base.php @@ -1,9 +1,9 @@ ' . substr($file, strrpos($file, '/') + 1) . '
' . highlight_string($string, true) . '
'; + echo '
' . substr($file, strrpos($file, '/') + 1) . '
' . highlight_string($string, true) . '
'; exit(); } return false; @@ -66,7 +66,7 @@ public static function php_file_tree_dir($directory, $uaction, $extensions = arr { if (!is_dir($directory . '/' . $file[$key])) { - $ext = substr($file[$key], strrpos($file[$key], '.') + 1); + $ext = substr($file[$key], strrpos($file[$key], '.') + 1); if (!in_array($ext, $extensions)) { unset($file[$key]); diff --git a/includes/functions/extensions.php b/includes/functions/extensions.php index fb28495..22cc592 100644 --- a/includes/functions/extensions.php +++ b/includes/functions/extensions.php @@ -195,7 +195,7 @@ public static function get_manager($ext_name) /** * Output the response. * @param array $data The name of the extension and the status of the process. - * The text of the error can also be provided if the status is 'error'. + * The text of the error can also be provided if the status is 'error'. */ protected static function response(array $data) { diff --git a/includes/functions/files.php b/includes/functions/files.php index ef058b1..21065d4 100644 --- a/includes/functions/files.php +++ b/includes/functions/files.php @@ -1,9 +1,9 @@ If my_function returns true, continue. - * Otherwise the result of my_function() is printed as an error string. + * Otherwise the result of my_function() is printed as an error string. * USAGE 2: files::catch_errors('MY_ERROR', my_function()); => If my_function returns true, continue. - * If my_function returns false, print the string MY_ERROR. + * If my_function returns false, print the string MY_ERROR. * USAGE 3: files::catch_errors('MY_ERROR'); => Print the string MY_ERROR. - * @param bool|string $error The text to display in the case of an error. True if there were no errors. - * @param bool $result The result of the function what we need to catch errors of. True if there were no errors. - * @return bool $result + * @param bool|string $error The text to display in the case of an error. True if there were no errors. + * @param bool $result The result of the function what we need to catch errors of. True if there were no errors. + * @return bool $result */ public static function catch_errors($error, $result = false) { @@ -84,9 +84,9 @@ public static function getComposer($dir) /** * Function to remove folders and files. - * @param string $dir The directory for removal. - * @param bool $no_errors Whether there were errors before. - * @return bool|string True if there are no errors, error string otherwise. + * @param string $dir The directory for removal. + * @param bool $no_errors Whether there were errors before. + * @return bool|string True if there are no errors, error string otherwise. */ public static function rrmdir($dir, $no_errors = true) { @@ -123,7 +123,7 @@ public static function rrmdir($dir, $no_errors = true) * Function to copy folders and files. * @param string $src The path 'from'. * @param string $dst The path 'to'. - * @return bool|string True if there are no errors, error string otherwise. + * @return bool|string True if there are no errors, error string otherwise. */ public static function rcopy($src, $dst) { @@ -170,7 +170,7 @@ public static function rcopy($src, $dst) * Saves the contents of a file or a directory in a zip archive file. * @param string $dest_file The path to the contents for adding to the zip file. * @param string $dest_name The name of the zip file. - * @param string $zip_dir The directory for saving zip files. + * @param string $zip_dir The directory for saving zip files. */ public static function save_zip_archive($dest_file, $dest_name, $zip_dir) { diff --git a/includes/functions/languages.php b/includes/functions/languages.php index e8acd07..4a10b6a 100644 --- a/includes/functions/languages.php +++ b/includes/functions/languages.php @@ -13,8 +13,8 @@ class languages { /** * Gets information about the language in the specified directory. - * @param string $path The path to the language directory without slash at the end. - * @param string $lang The ISO code of the language. + * @param string $path The path to the language directory without slash at the end. + * @param string $lang The ISO code of the language. * @return array */ public static function details($path, $lang) diff --git a/includes/sources/cache.php b/includes/sources/cache.php index f603585..c46af6d 100644 --- a/includes/sources/cache.php +++ b/includes/sources/cache.php @@ -1,9 +1,9 @@ upload->allowed_extensions) . ')$#i', $upload_url, $match) && !$upload_from_phpbb) { return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'URL_INVALID')); } $url = parse_url($upload_url); - - $host = $url['host']; - $path = $url['path']; - $port = (!empty($url['port'])) ? (int) $url['port'] : 80; - $upload_ary['type'] = 'application/octet-stream'; $url['path'] = explode('.', $url['path']); $ext = array_pop($url['path']); - $url['path'] = implode('', $url['path']); $upload_ary['name'] = utf8_basename($url['path']) . (($ext) ? '.' . $ext : ''); - $filename = $url['path']; - $filesize = 0; - $remote_max_filesize = $this->get_max_file_size(); - $errno = 0; - $errstr = ''; + // Initialize cURL + $ch = curl_init($upload_url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, $this->upload->upload_timeout); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_HEADER, true); - if (!($fsock = @fopen($upload_url, "r"))) - { - return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED')); - } + $data = curl_exec($ch); + $errNo = curl_errno($ch); + $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); + $headers = substr($data, 0, $header_size); + $body = substr($data, $header_size); + $filesize = strlen($body); - // Make sure $path not beginning with / - if (strpos($path, '/') === 0) - { - $path = substr($path, 1); - } - - $get_info = false; - $data = ''; - $length = false; - $timer_stop = time() + $this->upload->upload_timeout; + curl_close($ch); - while (!@feof($fsock)) + // Handle cURL errors + if ($errNo || empty($body)) { - if ($length) - { - // Don't attempt to read past end of file if server indicated length - $block = @fread($fsock, min($length - $filesize, 1024)); - } - else - { - $block = @fread($fsock, 1024); - } - - $filesize += strlen($block); - - if ($remote_max_filesize && $filesize > $remote_max_filesize) - { - $max_filesize = get_formatted_filesize($remote_max_filesize, false); - - return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit'])); - } - - $data .= $block; - - // Cancel upload if we exceed timeout - if (time() >= $timer_stop) - { - return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'REMOTE_UPLOAD_TIMEOUT'); - } + return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED')); } - @fclose($fsock); - if (empty($data)) + // Check for file size limit + if ($remote_max_filesize && $filesize > $remote_max_filesize) { - return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'EMPTY_REMOTE_DATA'); + $max_filesize = get_formatted_filesize($remote_max_filesize, false); + return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit'])); } + // Create a temporary file $tmp_path = (@is_writable('/tmp/')) ? '/tmp/' : $this->phpbb_root_path . 'cache/'; $filename = tempnam($tmp_path, unique_id() . '-'); @@ -164,11 +131,12 @@ protected function remote_upload($upload_url) return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'NOT_UPLOADED'); } - $upload_ary['size'] = fwrite($fp, $data); + fwrite($fp, $body); fclose($fp); - unset($data); + $upload_ary['size'] = $filesize; $upload_ary['tmp_name'] = $filename; + if ($upload_from_phpbb) { $upload_ary['name'] .= '.zip'; diff --git a/includes/upload/base.php b/includes/upload/base.php index cb38db1..9acc14f 100644 --- a/includes/upload/base.php +++ b/includes/upload/base.php @@ -73,9 +73,9 @@ protected function extract_zip($dest_file) /** * Original copyright information for the function from AutoMOD. * The function was almost totally changed by the authors of Upload Extensions. - * @package automod + * @package automod * @copyright (c) 2008 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License * * @param string $action Requested action. * @return \phpbb\files\filespec|\filespec|bool @@ -84,9 +84,9 @@ public function proceed_upload($action) { //$can_upload = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !@extension_loaded('zlib')) ? false : true; - objects::$user->add_lang('posting'); // For error messages + objects::$user->add_lang('posting'); // For error messages $upload = objects::$compatibility->get_upload_object(); - $upload->set_allowed_extensions(array('zip')); // Only allow ZIP files + $upload->set_allowed_extensions(array('zip')); // Only allow ZIP files // Make sure the ext/ directory exists and if it doesn't, create it if (!is_dir(objects::$phpbb_root_path . 'ext')) @@ -157,9 +157,9 @@ public function proceed_upload($action) /** * The function that uploads the specified extension. * - * @param string $action Requested action. - * @param \phpbb\files\filespec|\filespec $file Filespec object. - * @param string $upload_dir The directory for zip files storage. + * @param string $action Requested action. + * @param \phpbb\files\filespec|\filespec $file Filespec object. + * @param string $upload_dir The directory for zip files storage. * @return string|bool */ public function get_dest_file($action, $file, $upload_dir) diff --git a/includes/upload/lang.php b/includes/upload/lang.php index 2f1079f..ac05caa 100644 --- a/includes/upload/lang.php +++ b/includes/upload/lang.php @@ -17,8 +17,8 @@ class lang extends base /** * The function that uploads the specified language package for the extension. * - * @param string $action Requested action. - * @param string $ext_name The name of the extension. + * @param string $action Requested action. + * @param string $ext_name The name of the extension. * @param string $lang_name The ISO code of the language. * @return bool */ @@ -118,7 +118,7 @@ public function upload($action, $ext_name, $lang_name) $response_object = new \phpbb\json_response; $response_object->send(array( "LANGUAGE" => urlencode($lang_name), - "REFRESH" => true + "REFRESH" => true )); } objects::$template->assign_var('EXT_LANGUAGE_UPLOADED', objects::$user->lang('EXT_LANGUAGE_UPLOADED', $lang_name)); diff --git a/license.txt b/license.txt index ce992b2..d4791e9 100644 --- a/license.txt +++ b/license.txt @@ -1,82 +1,82 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This +software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to your programs, too. - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. - To protect your rights, we need to make restrictions that forbid + To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. - For example, if you distribute copies of such a program, whether + For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their rights. - We protect your rights with two steps: (1) copyright the software, and + We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. - Also, for each author's protection and ours, we want to make certain + Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we +software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any +program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. - The precise terms and conditions for copying, distribution and + The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains + 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, +under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of +covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. - 1. You may copy and distribute verbatim copies of the Program's + 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the @@ -87,35 +87,35 @@ along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - 2. You may modify your copy or copies of the Program or any portion + 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you +sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the @@ -131,32 +131,32 @@ with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - 3. You may copy and distribute the Program (or a work based on it, + 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source +making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a +control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the @@ -169,39 +169,39 @@ access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. - 6. Each time you redistribute the Program (or any work based on the + 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further +these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. - 7. If, as a consequence of a court judgment or allegation of patent + 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot +excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent +may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to @@ -216,7 +216,7 @@ It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is -implemented by public license practices. Many people have made +implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing @@ -226,48 +226,48 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - 8. If the distribution and/or use of the Program is restricted in + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates +countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of +Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. - 10. If you wish to incorporate parts of the Program into other free + 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free +to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals +make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING @@ -277,5 +277,5 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS diff --git a/vendor/michelf/php-markdown/Michelf/Markdown.php b/vendor/michelf/php-markdown/Michelf/Markdown.php index 5585d3c..aabcfca 100644 --- a/vendor/michelf/php-markdown/Michelf/Markdown.php +++ b/vendor/michelf/php-markdown/Michelf/Markdown.php @@ -776,14 +776,14 @@ protected function doHeaders($text) { # ... # ###### Header 6 # - $text = preg_replace_callback('{ - ^(\#{1,6}) # $1 = string of #\'s + $text = preg_replace_callback('[ + ^(\#[1,6]) # $1 = string of #\'s [ ]* (.+?) # $2 = Header text [ ]* \#* # optional closing #\'s (not counted) \n+ - }xm', + ]xm', array($this, '_doHeaders_callback_atx'), $text); return $text; @@ -794,7 +794,7 @@ protected function _doHeaders_callback_setext($matches) { if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1])) return $matches[0]; - $level = $matches[2]{0} == '=' ? 1 : 2; + $level = $matches[2][0] == '=' ? 1 : 2; # id attribute generation $idAtt = $this->_generateIdFromHeaderValue($matches[1]); @@ -1130,7 +1130,7 @@ protected function doItalicsAndBold($text) { } else { # Other closing marker: close one em or strong and # change current token state to match the other - $token_stack[0] = str_repeat($token{0}, 3-$token_len); + $token_stack[0] = str_repeat($token[0], 3-$token_len); $tag = $token_len == 2 ? "strong" : "em"; $span = $text_stack[0]; $span = $this->runSpanGamut($span); @@ -1155,7 +1155,7 @@ protected function doItalicsAndBold($text) { } else { # Reached opening three-char emphasis marker. Push on token # stack; will be handled by the special condition above. - $em = $token{0}; + $em = $token[0]; $strong = "$em$em"; array_unshift($token_stack, $token); array_unshift($text_stack, ''); @@ -1520,9 +1520,9 @@ protected function handleSpanToken($token, &$str) { # Handle $token provided by parseSpan by determining its nature and # returning the corresponding value that should replace it. # - switch ($token{0}) { + switch ($token[0]) { case "\\": - return $this->hashPart("&#". ord($token{1}). ";"); + return $this->hashPart("&#". ord($token[1]). ";"); case "`": # Search for end marker in remaining text. if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm', diff --git a/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php b/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php index 3107a79..23644ae 100644 --- a/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php +++ b/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php @@ -156,9 +156,9 @@ protected function doExtraAttributes($tag_name, $attr, $defaultIdValue = null) { $attributes = array(); $id = false; foreach ($elements as $element) { - if ($element{0} == '.') { + if ($element[0] == '.') { $classes[] = substr($element, 1); - } else if ($element{0} == '#') { + } else if ($element[0] == '#') { if ($id === false) $id = substr($element, 1); } else if (strpos($element, '=') > 0) { $parts = explode('=', $element, 2); @@ -429,7 +429,7 @@ protected function _hashHTMLBlocks_inMarkdown($text, $indent = 0, # # Check for: Indented code block. # - else if ($tag{0} == "\n" || $tag{0} == " ") { + else if ($tag[0] == "\n" || $tag[0] == " ") { # Indented code block: pass it unchanged, will be handled # later. $parsed .= $tag; @@ -438,7 +438,7 @@ protected function _hashHTMLBlocks_inMarkdown($text, $indent = 0, # Check for: Code span marker # Note: need to check this after backtick fenced code blocks # - else if ($tag{0} == "`") { + else if ($tag[0] == "`") { # Find corresponding end marker. $tag_re = preg_quote($tag); if (preg_match('{^(?>.+?|\n(?!\n))*?(?clean_tags_re.')\b}', $tag) || - $tag{1} == '!' || $tag{1} == '?') + $tag[1] == '!' || $tag[1] == '?') { # Need to parse tag and following text using the HTML parser. # (don't check for markdown attribute) @@ -495,8 +495,8 @@ protected function _hashHTMLBlocks_inMarkdown($text, $indent = 0, # # Increase/decrease nested tag count. # - if ($tag{1} == '/') $depth--; - else if ($tag{strlen($tag)-2} != '/') $depth++; + if ($tag[1] == '/') $depth--; + else if ($tag[strlen($tag)-2] != '/') $depth++; if ($depth < 0) { # @@ -600,7 +600,7 @@ protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) { # first character as filtered to prevent an infinite loop in the # parent function. # - return array($original_text{0}, substr($original_text, 1)); + return array($original_text[0], substr($original_text, 1)); } $block_text .= $parts[0]; # Text before current tag. @@ -612,7 +612,7 @@ protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) { # Comments and Processing Instructions. # if (preg_match('{^auto_close_tags_re.')\b}', $tag) || - $tag{1} == '!' || $tag{1} == '?') + $tag[1] == '!' || $tag[1] == '?') { # Just add the tag to the block as if it was text. $block_text .= $tag; @@ -623,8 +623,8 @@ protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) { # the tag's name match base tag's. # if (preg_match('{^header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null; @@ -1323,7 +1323,7 @@ protected function _doFencedCodeBlocks_callback($matches) { array($this, '_doFencedCodeBlocks_newlines'), $codeblock); if ($classname != "") { - if ($classname{0} == '.') + if ($classname[0] == '.') $classname = substr($classname, 1); $attr_str = ' class="'.$this->code_class_prefix.$classname.'"'; } else {