From 488a843a54d46e537f8b61eec2d0cca1febf57f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=81Z=C3=81R=20Imre=20AI=20Agent?= Date: Thu, 16 Jul 2026 11:30:01 +0200 Subject: [PATCH] feat(pkg): add Phoca Download 3.1.2 (pristine upstream) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pristine Phoca Download 3.1.2 manifest-mapped from github.com/PhocaCz/PhocaDownload @3.1.2 via lib/jmap.py. Signed-off-by: LÁZÁR Imre Assisted-by: claude-code@claude-opus-4-8 --- .../com_phocadownload/assets/index.html | 1 + .../assets/jquery/index.html | 1 + .../assets/jquery/jquery-1.6.4.min.js | 4 + .../com_phocadownload/controller.php | 39 ++ .../com_phocadownload/controllers/index.html | 1 + .../com_phocadownload/controllers/user.php | 147 +++++ .../com_phocadownload/helpers/index.html | 1 + .../components/com_phocadownload/index.html | 1 + .../com_phocadownload/models/categories.php | 260 ++++++++ .../com_phocadownload/models/category.php | 235 +++++++ .../com_phocadownload/models/download.php | 80 +++ .../com_phocadownload/models/file.php | 170 +++++ .../com_phocadownload/models/index.html | 1 + .../models/phocadownloadlinkcat.php | 81 +++ .../models/phocadownloadlinkfile.php | 214 +++++++ .../com_phocadownload/models/play.php | 169 +++++ .../com_phocadownload/models/ratingfilea.php | 53 ++ .../com_phocadownload/models/user.php | 580 ++++++++++++++++++ .../com_phocadownload/phocadownload.php | 54 ++ .../components/com_phocadownload/router.php | 228 +++++++ .../views/categories/index.html | 1 + .../views/categories/metadata.xml | 6 + .../views/categories/tmpl/default.php | 204 ++++++ .../views/categories/tmpl/default.xml | 30 + .../views/categories/tmpl/index.html | 1 + .../views/categories/view.html.php | 112 ++++ .../views/category/index.html | 1 + .../views/category/metadata.xml | 6 + .../views/category/tmpl/default.php | 126 ++++ .../views/category/tmpl/default.xml | 32 + .../category/tmpl/default_comments-fb.php | 42 ++ .../views/category/tmpl/default_files.php | 441 +++++++++++++ .../category/tmpl/default_pagination.php | 33 + .../views/category/tmpl/index.html | 1 + .../views/category/view.html.php | 301 +++++++++ .../views/download/index.html | 1 + .../views/download/metadata.xml | 6 + .../views/download/tmpl/default.php | 429 +++++++++++++ .../views/download/tmpl/default.xml | 13 + .../views/download/tmpl/index.html | 1 + .../views/download/view.html.php | 223 +++++++ .../com_phocadownload/views/feed/index.html | 1 + .../com_phocadownload/views/feed/metadata.xml | 4 + .../views/feed/tmpl/index.html | 1 + .../views/feed/view.feed.php | 147 +++++ .../com_phocadownload/views/file/index.html | 1 + .../com_phocadownload/views/file/metadata.xml | 6 + .../views/file/tmpl/default.php | 366 +++++++++++ .../views/file/tmpl/default.xml | 40 ++ .../views/file/tmpl/default_comments-fb.php | 42 ++ .../views/file/tmpl/index.html | 1 + .../views/file/view.html.php | 231 +++++++ .../com_phocadownload/views/index.html | 1 + .../views/phocadownloadlinkcat/index.html | 1 + .../phocadownloadlinkcat/tmpl/default.php | 95 +++ .../phocadownloadlinkcat/tmpl/index.html | 1 + .../views/phocadownloadlinkcat/view.html.php | 61 ++ .../views/phocadownloadlinkcats/index.html | 1 + .../phocadownloadlinkcats/tmpl/default.php | 65 ++ .../phocadownloadlinkcats/tmpl/index.html | 1 + .../views/phocadownloadlinkcats/view.html.php | 71 +++ .../views/phocadownloadlinkfile/index.html | 1 + .../phocadownloadlinkfile/tmpl/default.php | 398 ++++++++++++ .../phocadownloadlinkfile/tmpl/index.html | 1 + .../views/phocadownloadlinkfile/view.html.php | 128 ++++ .../views/phocadownloadlinks/index.html | 1 + .../views/phocadownloadlinks/tmpl/default.php | 20 + .../views/phocadownloadlinks/tmpl/index.html | 1 + .../views/phocadownloadlinks/view.html.php | 49 ++ .../views/phocadownloadlinkytb/index.html | 1 + .../phocadownloadlinkytb/tmpl/default.php | 56 ++ .../phocadownloadlinkytb/tmpl/index.html | 1 + .../views/phocadownloadlinkytb/view.html.php | 40 ++ .../com_phocadownload/views/play/index.html | 1 + .../com_phocadownload/views/play/metadata.xml | 4 + .../views/play/tmpl/default.php | 73 +++ .../views/play/tmpl/default.xml | 3 + .../views/play/tmpl/index.html | 1 + .../views/play/view.html.php | 70 +++ .../views/ratingfilea/index.html | 1 + .../views/ratingfilea/metadata.xml | 4 + .../views/ratingfilea/tmpl/default.php | 1 + .../views/ratingfilea/tmpl/default.xml | 3 + .../views/ratingfilea/tmpl/index.html | 1 + .../views/ratingfilea/view.json.php | 148 +++++ .../com_phocadownload/views/user/index.html | 1 + .../com_phocadownload/views/user/metadata.xml | 6 + .../views/user/tmpl/default.php | 43 ++ .../views/user/tmpl/default.xml | 22 + .../views/user/tmpl/default_files.php | 332 ++++++++++ .../views/user/tmpl/index.html | 1 + .../views/user/view.html.php | 312 ++++++++++ 92 files changed, 7191 insertions(+) create mode 100644 packages/phocadownload/components/com_phocadownload/assets/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/assets/jquery/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/assets/jquery/jquery-1.6.4.min.js create mode 100644 packages/phocadownload/components/com_phocadownload/controller.php create mode 100644 packages/phocadownload/components/com_phocadownload/controllers/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/controllers/user.php create mode 100644 packages/phocadownload/components/com_phocadownload/helpers/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/models/categories.php create mode 100644 packages/phocadownload/components/com_phocadownload/models/category.php create mode 100644 packages/phocadownload/components/com_phocadownload/models/download.php create mode 100644 packages/phocadownload/components/com_phocadownload/models/file.php create mode 100644 packages/phocadownload/components/com_phocadownload/models/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/models/phocadownloadlinkcat.php create mode 100644 packages/phocadownload/components/com_phocadownload/models/phocadownloadlinkfile.php create mode 100644 packages/phocadownload/components/com_phocadownload/models/play.php create mode 100644 packages/phocadownload/components/com_phocadownload/models/ratingfilea.php create mode 100644 packages/phocadownload/components/com_phocadownload/models/user.php create mode 100644 packages/phocadownload/components/com_phocadownload/phocadownload.php create mode 100644 packages/phocadownload/components/com_phocadownload/router.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/categories/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/categories/metadata.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/categories/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/categories/tmpl/default.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/categories/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/categories/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/category/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/category/metadata.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/category/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/category/tmpl/default.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_comments-fb.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_files.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_pagination.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/category/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/category/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/download/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/download/metadata.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/download/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/download/tmpl/default.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/download/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/download/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/feed/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/feed/metadata.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/feed/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/feed/view.feed.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/file/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/file/metadata.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/file/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/file/tmpl/default.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/file/tmpl/default_comments-fb.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/file/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/file/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/play/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/play/metadata.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/play/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/play/tmpl/default.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/play/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/play/view.html.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/ratingfilea/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/ratingfilea/metadata.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/default.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/ratingfilea/view.json.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/user/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/user/metadata.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/user/tmpl/default.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/user/tmpl/default.xml create mode 100644 packages/phocadownload/components/com_phocadownload/views/user/tmpl/default_files.php create mode 100644 packages/phocadownload/components/com_phocadownload/views/user/tmpl/index.html create mode 100644 packages/phocadownload/components/com_phocadownload/views/user/view.html.php diff --git a/packages/phocadownload/components/com_phocadownload/assets/index.html b/packages/phocadownload/components/com_phocadownload/assets/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/assets/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/assets/jquery/index.html b/packages/phocadownload/components/com_phocadownload/assets/jquery/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/assets/jquery/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/assets/jquery/jquery-1.6.4.min.js b/packages/phocadownload/components/com_phocadownload/assets/jquery/jquery-1.6.4.min.js new file mode 100644 index 00000000..3684c36b --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/assets/jquery/jquery-1.6.4.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */ +(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"":"")+""),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b
";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/controller.php b/packages/phocadownload/components/com_phocadownload/controller.php new file mode 100644 index 00000000..4f712b12 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/controller.php @@ -0,0 +1,39 @@ +get( 'enable_cache', 0 ); + $cachable = false; + if ($cache == 1) { + $cachable = true; + } + + $document = JFactory::getDocument(); + + $safeurlparams = array('catid'=>'INT','id'=>'INT','cid'=>'ARRAY','year'=>'INT','month'=>'INT','limit'=>'INT','limitstart'=>'INT', + 'showall'=>'INT','return'=>'BASE64','filter'=>'STRING','filter_order'=>'CMD','filter_order_Dir'=>'CMD','filter-search'=>'STRING','print'=>'BOOLEAN','lang'=>'CMD'); + + parent::display($cachable,$safeurlparams); + + return $this; + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/controllers/index.html b/packages/phocadownload/components/com_phocadownload/controllers/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/controllers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/controllers/user.php b/packages/phocadownload/components/com_phocadownload/controllers/user.php new file mode 100644 index 00000000..00b4440c --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/controllers/user.php @@ -0,0 +1,147 @@ +registerTask( 'unpublish', 'unpublish' ); + $app = JFactory::getApplication(); + $this->itemId = $app->input->get( 'Itemid', 0, 'int' ); + $this->loginUrl = JRoute::_('index.php?option=com_users&view=login', false); + $this->loginString = JText::_('COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION'); + $this->url = 'index.php?option=com_phocadownload&view=user&Itemid='. $this->itemId; + } + /* + function display() { + if ( ! JRequest::getCmd( 'view' ) ) { + $this->input->set('view', 'user' ); + } + parent::display(); + }*/ + + function unpublish() { + + $app = JFactory::getApplication(); + $post['id'] = $app->input->get( 'actionid', '', 'int', 0 ); + $post['limitstart'] = $app->input->get( 'limitstart', '', 'int', 0 ); + $model = $this->getModel('user'); + //$isOwnerCategory = 1;//$model->isOwnerCategoryImage((int)$this->_user->id, (int)$id); + // USER RIGHT - Delete - - - - - - - - - - - + // 2, 2 means that user access will be ignored in function getUserRight for display Delete button + $user = JFactory::getUser(); + $rightDisplayDelete = 0; + $catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int)$post['id']); + if (!empty($catAccess)) { + $rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + + if ($rightDisplayDelete) { + if(!$model->publish((int)$post['id'], 0)) { + $msg = JText::_('COM_PHOCADOWNLOAD_ERROR_UNPUBLISHING_ITEM'); + } else { + $msg = JText::_('COM_PHOCADOWNLOAD_SUCCESS_UNPUBLISHING_ITEM'); + } + } else { + $app->redirect($this->loginUrl, $this->loginString); + exit; + } + + $lSO = ''; + if ($post['limitstart'] != '') { + $lSO = '&limitstart='.(int)$post['limitstart']; + } + + $this->setRedirect( JRoute::_($this->url. $lSO, false), $msg ); + } + + function publish() { + $app = JFactory::getApplication(); + $post['id'] = $app->input->get( 'actionid', '', 'int', 0 ); + $post['limitstart'] = $app->input->get( 'limitstart', '', 'int', 0 ); + $model = $this->getModel('user'); + //$isOwnerCategory = 1;//$model->isOwnerCategoryImage((int)$this->_user->id, (int)$id); + + // USER RIGHT - Delete - - - - - - - - - - - + // 2, 2 means that user access will be ignored in function getUserRight for display Delete button + $user = JFactory::getUser(); + $rightDisplayDelete = 0; + $catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int)$post['id']); + + if (!empty($catAccess)) { + $rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + + if ($rightDisplayDelete) { + if(!$model->publish((int)$post['id'], 1)) { + $msg = JText::_('COM_PHOCADOWNLOAD_ERROR_PUBLISHING_ITEM'); + } else { + $msg = JText::_('COM_PHOCADOWNLOAD_SUCCESS_PUBLISHING_ITEM'); + } + } else { + $app->redirect($this->loginUrl, $this->loginString); + exit; + } + + $lSO = ''; + if ($post['limitstart'] != '') { + $lSO = '&limitstart='.(int)$post['limitstart']; + } + + $this->setRedirect( JRoute::_($this->url. $lSO, false), $msg ); + } + + function delete() { + + $app = JFactory::getApplication(); + $post['id'] = $app->input->get( 'actionid', '', 'int', 0 ); + $post['limitstart'] = $app->input->get( 'limitstart', '', 'int', 0 ); + $model = $this->getModel('user'); + //$isOwnerCategory = 1;//$model->isOwnerCategoryImage((int)$this->_user->id, (int)$id); + + // USER RIGHT - Delete - - - - - - - - - - - + // 2, 2 means that user access will be ignored in function getUserRight for display Delete button + $user = JFactory::getUser(); + $rightDisplayDelete = 0; + $catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int)$post['id']); + if (!empty($catAccess)) { + $rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + + if ($rightDisplayDelete) { + if(!$model->delete((int)$post['id'])) { + $msg = JText::_('COM_PHOCADOWNLOAD_ERROR_DELETING_ITEM'); + } else { + $msg = JText::_('COM_PHOCADOWNLOAD_SUCCESS_DELETING_ITEM'); + } + } else { + $app->redirect($this->loginUrl, $this->loginString); + exit; + } + + $lSO = ''; + if ($post['limitstart'] != '') { + $lSO = '&limitstart='.(int)$post['limitstart']; + } + + $this->setRedirect( JRoute::_($this->url. $lSO, false), $msg ); + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/helpers/index.html b/packages/phocadownload/components/com_phocadownload/helpers/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/helpers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/index.html b/packages/phocadownload/components/com_phocadownload/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/models/categories.php b/packages/phocadownload/components/com_phocadownload/models/categories.php new file mode 100644 index 00000000..08843ce8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/categories.php @@ -0,0 +1,260 @@ +setState('filter.language',$app->getLanguageFilter()); + } + + function getCategoriesList() { + if (empty($this->_categories)) { + $query = $this->_getCategoriesListQuery(); + + //$this->_categories = $this->_getList( $query ); + $categories = $this->_getList( $query ); + + if (!empty($categories)) { + + // Parent Only + foreach ($categories as $k => $v) { + if ($v->parent_id == 0) { + $this->_categories[$v->id] = $categories[$k]; + } + } + + // Subcategories + foreach ($categories as $k => $v) { + if (isset($this->_categories[$v->parent_id])) { + $this->_categories[$v->parent_id]->subcategories[] = $categories[$k]; + $this->_categories[$v->parent_id]->numsubcat++; + } + } + } + /* + $this->categories = $this->_getList( $query ); + if (!empty($this->categories)) { + foreach ($this->categories as $key => $value) { + $query = $this->getCategoriesListQuery( $value->id, $categoriesOrdering ); + $this->categories[$key]->subcategories = $this->_getList( $query ); + } + }*/ + + } + + return $this->_categories; + } + + + + /* + * Get only parent categories + */ + function _getCategoriesListQuery( ) { + + $wheres = array(); + $app = JFactory::getApplication(); + $params = $app->getParams(); + $user = JFactory::getUser(); + $userLevels = implode (',', $user->getAuthorisedViewLevels()); + + + $pQ = $params->get( 'enable_plugin_query', 0 ); + $display_categories = $params->get('display_categories', ''); + $hide_categories = $params->get('hide_categoriess', ''); + + if ( $display_categories != '' ) { + $wheres[] = " cc.id IN (".$display_categories.")"; + } + + if ( $hide_categories != '' ) { + $wheres[] = " cc.id NOT IN (".$hide_categories.")"; + } + //$wheres[] = " cc.parent_id = 0"; + $wheres[] = " cc.published = 1"; + $wheres[] = " cc.access IN (".$userLevels.")"; + + if ($this->getState('filter.language')) { + $wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + } + + $categoriesOrdering = $this->_getCategoryOrdering(); + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetCategoriesList', array (&$wheres, &$joins, $params)); + // END GWE MOD + } + + $query = " SELECT cc.id, cc.parent_id, cc.title, cc.alias, cc.access, cc.description, cc.accessuserid, COUNT(c.id) AS numdoc, 0 AS numsubcat" + . " FROM #__phocadownload_categories AS cc" + . " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id AND c.published = 1 AND c.textonly = 0" + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + . " WHERE " . implode( " AND ", $wheres ) + . " GROUP BY cc.id" + . " ORDER BY cc.".$categoriesOrdering; + + return $query; + } + + + /* + * Get only first level under parent categories + */ + function _getCategoryListQuery( $parentCatId ) { + + $wheres = array(); + $app = JFactory::getApplication(); + $params = $app->getParams(); + $user = JFactory::getUser(); + $userLevels = implode (',', $user->getAuthorisedViewLevels()); + + $pQ = $params->get( 'enable_plugin_query', 0 ); + $display_categories = $params->get('display_categories', ''); + $hide_categories = $params->get('hide_categoriess', ''); + + if ( $display_categories != '' ) { + $wheres[] = " cc.id IN (".$display_categories.")"; + } + + if ( $hide_categories != '' ) { + $wheres[] = " cc.id NOT IN (".$hide_categories.")"; + } + $wheres[] = " cc.parent_id = ".(int)$parentCatId; + $wheres[] = " cc.published = 1"; + $wheres[] = " cc.access IN (".$userLevels.")"; + + if ($this->getState('filter.language')) { + $wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + } + + $categoryOrdering = $this->_getCategoryOrdering(); + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetCategoryList', array (&$wheres, &$joins, $params)); + // END GWE MOD + } + + $query = " SELECT cc.id, cc.title, cc.alias, cc.access, cc.accessuserid, COUNT(c.id) AS numdoc" + . " FROM #__phocadownload_categories AS cc" + . " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id AND c.published = 1 AND c.textonly = 0" + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + . " WHERE " . implode( " AND ", $wheres ) + . " GROUP BY cc.id" + . " ORDER BY cc.".$categoryOrdering; + + return $query; + + + } + + function getMostViewedDocsList() { + + if (empty($this->_most_viewed_docs)) { + $query = $this->_getMostViewedDocsListQuery(); + $this->_most_viewed_docs = $this->_getList( $query ); + } + return $this->_most_viewed_docs; + } + + function _getMostViewedDocsListQuery() { + + $wheres = array(); + $app = JFactory::getApplication(); + $params = $app->getParams(); + $user = JFactory::getUser(); + $userLevels = implode (',', $user->getAuthorisedViewLevels()); + + $pQ = $params->get( 'enable_plugin_query', 0 ); + $most_viewed_docs_num = $params->get( 'most_viewed_docs_num', 5 ); + $display_categories = $params->get('display_categories', ''); + $hide_categories = $params->get('hide_categoriess', ''); + + if ( $display_categories != '' ) { + $wheres[] = " cc.id IN (".$display_categories.")"; + } + + if ( $hide_categories != '' ) { + $wheres[] = " cc.id NOT IN (".$hide_categories.")"; + } + + + $wheres[] = " c.catid= cc.id"; + $wheres[] = " c.published= 1"; + $wheres[] = " c.approved= 1"; + $wheres[] = " c.textonly= 0"; + $wheres[] = " cc.access IN (".$userLevels.")"; + $wheres[] = " c.access IN (".$userLevels.")"; + + + if ($this->getState('filter.language')) { + $wheres[] = ' c.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + $wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + } + + // Active + $jnow = JFactory::getDate(); + $now = $jnow->toSql(); + $nullDate = $this->_db->getNullDate(); + $wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )'; + $wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )'; + + + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetMostViewedDocs', array (&$wheres, &$joins, 0, $params)); + // END GWE MOD + } + + $query = " SELECT c.id, c.title, c.alias, c.filename, c.date, c.hits, c.image_filename, cc.id AS categoryid, cc.access as cataccess, cc.accessuserid as cataccessuserid, cc.title AS categorytitle, cc.alias AS categoryalias " + ." FROM #__phocadownload AS c, #__phocadownload_categories AS cc" + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + . " WHERE " . implode( " AND ", $wheres ) + . " ORDER BY c.hits DESC" + . " LIMIT ".(int)$most_viewed_docs_num; + return $query; + } + + function _getCategoryOrdering() { + if (empty($this->_category_ordering)) { + + $app = JFactory::getApplication(); + $params = $app->getParams(); + $ordering = $params->get( 'category_ordering', 1 ); + $this->_category_ordering = PhocaDownloadOrdering::getOrderingText($ordering); + + } + return $this->_category_ordering; + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/models/category.php b/packages/phocadownload/components/com_phocadownload/models/category.php new file mode 100644 index 00000000..d694a715 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/category.php @@ -0,0 +1,235 @@ +get( 'default_pagination', '20' ); + + // Get the pagination request variables + $this->setState('limit', $app->getUserStateFromRequest('com_phocadownload.limit', 'limit', $defaultPagination, 'int')); + $this->setState('limitstart', $app->input->get('limitstart', 0, 'int')); + + // In case limit has been changed, adjust limitstart accordingly + $this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0)); + + $this->setState('filter.language',$app->getLanguageFilter()); + + // Get the filter request variables + $this->setState('filter_order', JRequest::getCmd('filter_order', 'ordering')); + $this->setState('filter_order_dir', JRequest::getCmd('filter_order_Dir', 'ASC')); + + } + + function getPagination($categoryId, $tagId) { + if (empty($this->_pagination)) { + jimport('joomla.html.pagination'); + $this->_pagination = new PhocaDownloadPagination( $this->getTotal($categoryId, $tagId), $this->getState('limitstart'), $this->getState('limit') ); + } + return $this->_pagination; + } + + function getTotal($categoryId, $tagId) { + if (empty($this->_total)) { + $query = $this->_getFileListQuery($categoryId, $tagId); + $this->_total = $this->_getListCount($query); + } + return $this->_total; + } + + function getFileList($categoryId, $tagId) { + if (empty($this->_document)) { + $query = $this->_getFileListQuery( $categoryId, $tagId); + $this->_document= $this->_getList( $query ,$this->getState('limitstart'), $this->getState('limit')); + } + return $this->_document; + } + + function getCategory($categoryId) { + if (empty($this->_category)) { + $query = $this->_getCategoriesQuery( $categoryId, FALSE ); + $this->_category = $this->_getList( $query, 0, 1 ); + } + return $this->_category; + } + + function getSubcategories($categoryId) { + if (empty($this->_subcategories)) { + $query = $this->_getCategoriesQuery( $categoryId, TRUE ); + $this->_subcategories = $this->_getList( $query ); + } + return $this->_subcategories; + } + + function _getFileListQuery( $categoryId, $tagId = 0 ) { + + $wheres = array(); + $app = JFactory::getApplication(); + $params = $app->getParams(); + $user = JFactory::getUser(); + $userLevels = implode (',', $user->getAuthorisedViewLevels()); + + + $pQ = $params->get( 'enable_plugin_query', 0 ); + + if ((int)$tagId > 0) { + $wheres[] = ' t.tagid= '.(int)$tagId; + } else { + $wheres[] = ' c.catid= '.(int)$categoryId; + } + + $wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND c.access IN ('.$userLevels.') ) )'; + $wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND cc.access IN ('.$userLevels.') ) )'; + + $wheres[] = ' c.published = 1'; + $wheres[] = ' c.approved = 1'; + $wheres[] = ' cc.published = 1'; + + if ($this->getState('filter.language')) { + $wheres[] = ' c.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + $wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + } + + // Active + $jnow = JFactory::getDate(); + $now = $jnow->toSql(); + $nullDate = $this->_db->getNullDate(); + $wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )'; + $wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )'; + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetFileList', array (&$wheres, &$joins,$categoryId , $params)); + // END GWE MOD + } + + $fileOrdering = $this->_getFileOrdering(); + + $query = ' SELECT c.*, cc.id AS categoryid, cc.title AS categorytitle, cc.alias AS categoryalias, cc.access as cataccess, cc.accessuserid as cataccessuserid ' + .' FROM #__phocadownload AS c' + .' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = c.catid'; + if ((int)$tagId > 0) { + $query .= ' LEFT JOIN #__phocadownload_tags_ref AS t ON t.fileid = c.id'; + } + $query .= ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + . ' WHERE ' . implode( ' AND ', $wheres ) + . ' ORDER BY c.'.$fileOrdering; + + return $query; + } + + + + function _getCategoriesQuery( $categoryId, $subcategories = FALSE ) { + + $wheres = array(); + $app = JFactory::getApplication(); + $params = $app->getParams(); + $user = JFactory::getUser(); + $userLevels = implode (',', $user->getAuthorisedViewLevels()); + + $pQ = $params->get( 'enable_plugin_query', 0 ); + + + // Get the current category or get parent categories of the current category + if ($subcategories) { + $wheres[] = " cc.parent_id = ".(int)$categoryId; + $categoryOrdering = $this->_getCategoryOrdering(); + } else { + $wheres[] = " cc.id= ".(int)$categoryId; + } + + $wheres[] = " cc.access IN (".$userLevels.")"; + $wheres[] = " cc.published = 1"; + + if ($this->getState('filter.language')) { + $wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + } + + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetCategory', array (&$wheres, &$joins,$categoryId , $params)); + // END GWE MOD + } + + if ($subcategories) { + $query = " SELECT cc.id, cc.title, cc.alias, cc.access as cataccess, cc.accessuserid as cataccessuserid, COUNT(c.id) AS numdoc" + . " FROM #__phocadownload_categories AS cc" + . " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id AND c.published = 1 AND c.textonly = 0" + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + . " WHERE " . implode( " AND ", $wheres ) + . " GROUP BY cc.id" + . " ORDER BY cc.".$categoryOrdering; + } else { + $query = " SELECT cc.id, cc.title, cc.alias, cc.access as cataccess, cc.accessuserid as cataccessuserid, cc.description, cc.metakey, cc.metadesc, pc.title as parenttitle, cc.parent_id as parentid, pc.alias as parentalias" + . " FROM #__phocadownload_categories AS cc" + . " LEFT JOIN #__phocadownload_categories AS pc ON pc.id = cc.parent_id" + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + . " WHERE " . implode( " AND ", $wheres ) + . " ORDER BY cc.ordering"; + } + + return $query; + } + + + function _getFileOrdering() { + if (empty($this->_file_ordering)) { + $app = JFactory::getApplication(); + $params = $app->getParams(); + $ordering = $params->get( 'file_ordering', 1 ); + $this->_file_ordering = PhocaDownloadOrdering::getOrderingText($ordering); + + } + return $this->_file_ordering; + } + + function _getCategoryOrdering() { + if (empty($this->_category_ordering)) { + + + $app = JFactory::getApplication(); + $params = $app->getParams(); + $ordering = $params->get( 'category_ordering', 1 ); + $this->_category_ordering = PhocaDownloadOrdering::getOrderingText($ordering); + + } + return $this->_category_ordering; + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/models/download.php b/packages/phocadownload/components/com_phocadownload/models/download.php new file mode 100644 index 00000000..5b308df4 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/download.php @@ -0,0 +1,80 @@ +setState('filter.language',$app->getLanguageFilter()); + } + + function getFile( $downloadToken) { + if (empty($this->_file)) { + $query = $this->_getFileQuery( $downloadToken); + $this->_file = $this->_getList( $query, 0 , 1 ); + + // Don't display file if user has no access + // - - - - - - - - - - - - - - - + if (empty($this->_file)) { + return null; + } + // - - - - - - - - - - - - - - - - + } + return $this->_file; + } + + function _getFileQuery( $downloadToken ) { + + $app = JFactory::getApplication(); + $params = $app->getParams(); + $user = JFactory::getUser(); + + $pQ = $params->get( 'enable_plugin_query', 0 ); + + $wheres[] = " c.approved = 1"; + $wheres[] = " c.published = 1"; + $wheres[] = " c.token = " . $this->_db->Quote($downloadToken); + + + // Active + $jnow = JFactory::getDate(); + $now = $jnow->toSql(); + $nullDate = $this->_db->getNullDate(); + $wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )'; + $wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )'; + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetFile', array (&$wheres, &$joins, $fileId, $params)); + // END GWE MOD + } + + $query = ' SELECT c.*, lc.title AS licensetitle, lc.description AS licensetext, lc.id AS licenseid' + .' FROM #__phocadownload AS c' + .' LEFT JOIN #__phocadownload_licenses AS lc ON lc.id = c.confirm_license' + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + .' WHERE ' . implode( ' AND ', $wheres ) + .' ORDER BY c.ordering'; + + return $query; + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/models/file.php b/packages/phocadownload/components/com_phocadownload/models/file.php new file mode 100644 index 00000000..e4d7d597 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/file.php @@ -0,0 +1,170 @@ +setState('filter.language',$app->getLanguageFilter()); + } + + function getFile( $fileId, $limitstartUrl) { + if (empty($this->_file)) { + $query = $this->_getFileQuery( $fileId ); + $this->_file = $this->_getList( $query, 0 , 1 ); + + // Don't display file if user has no access + // - - - - - - - - - - - - - - - + if (empty($this->_file)) { + return null; + } + + if (isset($this->_file[0]->access)) { + $app = JFactory::getApplication(); + $user = JFactory::getUser(); + + + if (!in_array($this->_file[0]->access, $user->getAuthorisedViewLevels())) { + //$app->redirect(JRoute::_('index.php?option=com_user&view=login', false), JText::_("Please login to download the file")); + // Return URL + $return = 'index.php?option=com_phocadownload&view=file&id='.$this->_file[0]->id.':'.$this->_file[0]->alias. $limitstartUrl . '&Itemid='. $app->input->get('Itemid', 0, 'int'); + $returnUrl = 'index.php?option=com_users&view=login&return='.base64_encode($return); + $app->redirect(JRoute::_($returnUrl, false), JText::_('COM_PHOCADOWNLOAD_PLEASE_LOGIN_DOWNLOAD_FILE')); + return; + } + } else { + return null; + } + // - - - - - - - - - - - - - - - - + } + return $this->_file; + } + + function _getFileQuery( $fileId ) { + + $app = JFactory::getApplication(); + $params = $app->getParams(); + $user = JFactory::getUser(); + $userLevels = implode (',', $user->getAuthorisedViewLevels()); + + $pQ = $params->get( 'enable_plugin_query', 0 ); + + $categoryId = 0; + $category = $this->getCategory($fileId); + if (isset($category[0]->id)) { + $categoryId = $category[0]->id; + } + + $wheres[] = " c.catid= ".(int) $categoryId; + $wheres[] = " c.catid= cc.id"; + $wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND c.access IN ('.$userLevels.') ) )'; + $wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND cc.access IN ('.$userLevels.') ) )'; + $wheres[] = " c.published = 1"; + $wheres[] = " c.approved = 1"; + $wheres[] = " cc.published = 1"; + $wheres[] = " c.id = " . (int) $fileId; + + if ($this->getState('filter.language')) { + $wheres[] = ' c.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + $wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + } + + // Active + $jnow = JFactory::getDate(); + $now = $jnow->toSql(); + $nullDate = $this->_db->getNullDate(); + $wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )'; + $wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )'; + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetFile', array (&$wheres, &$joins, $fileId, $params)); + // END GWE MOD + } + + $query = ' SELECT c.*, cc.id AS categoryid, cc.title AS categorytitle, cc.alias AS categoryalias, cc.access as cataccess, cc.accessuserid as cataccessuserid, lc.title AS licensetitle, lc.description AS licensetext, lc.id AS licenseid' + .' FROM #__phocadownload AS c' + .' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = c.catid' + .' LEFT JOIN #__phocadownload_licenses AS lc ON lc.id = c.confirm_license' + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + .' WHERE ' . implode( ' AND ', $wheres ) + .' ORDER BY c.ordering'; + + return $query; + } + + function getCategory($fileId) { + if (empty($this->_category)) { + $query = $this->_getCategoryQuery( $fileId ); + $this->_category= $this->_getList( $query, 0, 1 ); + } + return $this->_category; + } + + function _getCategoryQuery( $fileId ) { + + $wheres = array(); + $app = JFactory::getApplication(); + $params = $app->getParams(); + $user = JFactory::getUser(); + $userLevels = implode (',', $user->getAuthorisedViewLevels()); + + $pQ = $params->get( 'enable_plugin_query', 0 ); + + + $wheres[] = " c.id= ".(int)$fileId; + $wheres[] = " cc.access IN (".$userLevels.")"; + $wheres[] = " cc.published = 1"; + + if ($this->getState('filter.language')) { + $wheres[] = ' c.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + $wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + } + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetCategory', array (&$wheres, &$joins, $fileId, $params)); + // END GWE MOD + } + + $query = " SELECT cc.id, cc.title, cc.alias, cc.description, cc.access as cataccess, cc.accessuserid as cataccessuserid" + . " FROM #__phocadownload_categories AS cc" + . " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id" + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + . " WHERE " . implode( " AND ", $wheres ) + . " ORDER BY cc.ordering"; + + + return $query; + } + +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/models/index.html b/packages/phocadownload/components/com_phocadownload/models/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/models/phocadownloadlinkcat.php b/packages/phocadownload/components/com_phocadownload/models/phocadownloadlinkcat.php new file mode 100644 index 00000000..be706234 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/phocadownloadlinkcat.php @@ -0,0 +1,81 @@ +_loadDataSec()) { + + } else { + $this->_initDataSec(); + } + return $this->_data_sec; + }*/ + + function &getDataCat($sectionList) { + if ($this->_loadDataCat($sectionList)) { + + } else { + $this->_initDataCat(); + } + return $this->_data_cat; + } + /* + function _loadDataSec() { + if (empty($this->_data_sec)) { + $query = 'SELECT s.id, s.title' + . ' FROM #__phocadownload_sections AS s' + . ' WHERE s.published = 1' + . ' ORDER BY s.ordering'; + $this->_db->setQuery($query); + $this->_data_sec = $this->_db->loadObjectList(); + return (boolean) $this->_data_sec; + } + return true; + }*/ + /* + function _loadDataCat($sectionList) { + if (empty($this->_data_cat)) { + $query = 'SELECT c.id, c.title, c.section' + .' FROM #__phocadownload_categories AS c' + .' WHERE c.section IN ( \''.$sectionList.'\' )' + .' AND c.published = 1' + .' ORDER BY c.ordering'; + $this->_db->setQuery($query); + $this->_data_cat = $this->_db->loadObjectList(); + return (boolean) $this->_data_cat; + } + return true; + }*/ + /* + function _initDataSec() { + if (empty($this->_data_sec)) { + return (boolean) array(); + } + return true; + }*/ + function _initDataCat() { + if (empty($this->_data_cat)) { + return (boolean) array(); + } + return true; + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/models/phocadownloadlinkfile.php b/packages/phocadownload/components/com_phocadownload/models/phocadownloadlinkfile.php new file mode 100644 index 00000000..a545932d --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/phocadownloadlinkfile.php @@ -0,0 +1,214 @@ +toString(); + + // Build the additional URL parameters string. + $params = ''; + + if (!empty($this->additionalUrlParams)) + { + foreach ($this->additionalUrlParams as $key => $value) + { + $params .= '&' . $key . '=' . $value; + } + } + + $data->all = new JPaginationObject(JText::_('JLIB_HTML_VIEW_ALL'), $this->prefix); + + if (!$this->viewall) + { + $data->all->base = '0'; + $data->all->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart='; + } + + // Set the start and previous data objects. + $data->start = new JPaginationObject(JText::_('JLIB_HTML_START'), $this->prefix); + $data->previous = new JPaginationObject(JText::_('JPREV'), $this->prefix); + + if ($this->pagesCurrent > 1) + { + $page = ($this->pagesCurrent - 2) * $this->limit; + + // Set the empty for removal from route + // @todo remove code: $page = $page == 0 ? '' : $page; + + + + $data->start->base = '0'; + $data->start->link = $uriS . '' . $params . '&' . $this->prefix . 'limitstart=0'; + $data->previous->base = $page; + $data->previous->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart=' . $page; + + + + } + + // Set the next and end data objects. + $data->next = new JPaginationObject(JText::_('JNEXT'), $this->prefix); + $data->end = new JPaginationObject(JText::_('JLIB_HTML_END'), $this->prefix); + + if ($this->pagesCurrent < $this->pagesTotal) + { + $next = $this->pagesCurrent * $this->limit; + $end = ($this->pagesTotal - 1) * $this->limit; + + $data->next->base = $next; + $data->next->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart=' . $next; + $data->end->base = $end; + $data->end->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart=' . $end; + } + + $data->pages = array(); + $stop = $this->pagesStop; + + for ($i = $this->pagesStart; $i <= $stop; $i++) + { + $offset = ($i - 1) * $this->limit; + + $data->pages[$i] = new JPaginationObject($i, $this->prefix); + + if ($i != $this->pagesCurrent || $this->viewall) + { + $data->pages[$i]->base = $offset; + $data->pages[$i]->link = $uriS . '' .$params . '&' . $this->prefix . 'limitstart=' . $offset; + } + else + { + $data->pages[$i]->active = true; + } + } + + return $data; + } +} + +class PhocaDownloadModelPhocaDownloadLinkFile extends JModelLegacy +{ + var $_data = null; + var $_total = null; + var $_pagination = null; + var $_context = 'com_phocadownload.phocadownloadlinkfile'; + + function __construct() { + parent::__construct(); + $app = JFactory::getApplication(); + // Get the pagination request variables + $limit = $app->getUserStateFromRequest( $this->_context.'.list.limit', 'limit', $app->getCfg('list_limit'), 'int' ); + $limitstart = $app->getUserStateFromRequest( $this->_context.'.limitstart', 'limitstart', 0, 'int' ); + // In case limit has been changed, adjust limitstart accordingly + $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); + + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + } + + function getData() { + if (empty($this->_data)) { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + return $this->_data; + } + + function getTotal() { + if (empty($this->_total)) { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + return $this->_total; + } + + function getPagination() { + if (empty($this->_pagination)) { + jimport('joomla.html.pagination'); + $this->_pagination = new PhocaDownloadViewPhocaDownloadLinkFilePagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + return $this->_pagination; + } + + function _buildQuery() { + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = ' SELECT a.*, cc.title AS categorytitle, ag.title AS access_level ' + . ' FROM #__phocadownload AS a ' + . ' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = a.catid ' + //. ' LEFT JOIN #__phocadownload_sections AS s ON s.id = a.sectionid ' + . ' LEFT JOIN #__viewlevels AS ag ON ag.id = a.access ' + . ' LEFT JOIN #__users AS u ON u.id = a.checked_out ' + . $where + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() { + $app = JFactory::getApplication(); + $filter_order = $app->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering','cmd' ); + $filter_order_Dir = $app->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); + + if ($filter_order == 'a.ordering'){ + $orderby = ' ORDER BY categorytitle, a.ordering '.$filter_order_Dir; + } else { + $orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.', categorytitle, a.ordering '; + } + return $orderby; + } + + function _buildContentWhere() { + $app = JFactory::getApplication(); + $filter_state = $app->getUserStateFromRequest( $this->_context.'.filter_state', 'filter_state', '', 'word' ); + $filter_catid = $app->getUserStateFromRequest( $this->_context.'.catid','catid',0, 'int' ); + //$filter_sectionid = $app->getUserStateFromRequest( $this->_context.'.filter_sectionid', 'filter_sectionid', 0, 'int' ); + $filter_order = $app->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering', 'cmd' ); + $filter_order_Dir = $app->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $search = $app->getUserStateFromRequest( $this->_context.'.search','search','','string' ); + $search = JString::strtolower( $search ); + + $where = array(); + + if ($filter_catid > 0) { + $where[] = 'a.catid = '.(int) $filter_catid; + } + if ($search) { + $where[] = 'LOWER(a.title) LIKE '.$this->_db->Quote('%'.$search.'%'); + } + if ( $filter_state ) { + if ( $filter_state == 'P' ) { + $where[] = 'a.published = 1'; + } else if ($filter_state == 'U' ) { + $where[] = 'a.published = 0'; + } + } + + + $where[] = 'a.published = 1'; + $where[] = 'a.approved = 1'; + $where[] = 'a.textonly <> 1'; + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + return $where; + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/models/play.php b/packages/phocadownload/components/com_phocadownload/models/play.php new file mode 100644 index 00000000..a45e6f86 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/play.php @@ -0,0 +1,169 @@ +setState('filter.language',$app->getLanguageFilter()); + + } + + function getFile( $fileId) { + if (empty($this->_file)) { + $query = $this->_getFileQuery( $fileId ); + $this->_file = $this->_getList( $query, 0 , 1 ); + + /* // Don't display file if user has no access + // - - - - - - - - - - - - - - - + if (empty($this->_file)) { + return null; + } + + if (isset($this->_file[0]->access)) { + if ($aid !== null) { + if ($this->_file[0]->access > (int) $aid) { + $app->redirect(JRoute::_('index.php?option=com_users&view=login', false), JText::_("Please login to download the file")); + exit; + } + } else { + return null; + } + } else { + return null; + } + // - - - - - - - - - - - - - - - -*/ + } + return $this->_file; + } + + function _getFileQuery( $fileId ) { + + $app = JFactory::getApplication(); + $params = $app->getParams(); + $categoryId = 0; + $category = $this->getCategory($fileId); + if (isset($category[0]->id)) { + $categoryId = $category[0]->id; + } + + $pQ = $params->get( 'enable_plugin_query', 0 ); + + $wheres[] = " c.catid= ".(int) $categoryId; + $wheres[] = " c.catid= cc.id"; + /*if ($aid !== null) { + + // Should be not displayed, only in case user will add direct url + // IF unaccessible file = 1 then display unaccessible file for all + // IF unaccessible file = 0 then display it only for them who have access to this file + $wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND c.access <= ' . (int) $aid.') )'; + $wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND cc.access <= ' . (int) $aid.') )'; + //$wheres[] = "c.access <= " . (int) $aid; + //$wheres[] = "cc.access <= " . (int) $aid; + }*/ + $wheres[] = " c.published = 1"; + $wheres[] = " c.approved = 1"; + $wheres[] = " cc.published = 1"; + + $wheres[] = " c.id = " . (int) $fileId; + + if ($this->getState('filter.language')) { + $wheres[] = ' c.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + $wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + } + + // Active + $jnow = JFactory::getDate(); + $now = $jnow->toSql(); + $nullDate = $this->_db->getNullDate(); + $wheres[] = ' ( c.publish_up = '.$this->_db->Quote($nullDate).' OR c.publish_up <= '.$this->_db->Quote($now).' )'; + $wheres[] = ' ( c.publish_down = '.$this->_db->Quote($nullDate).' OR c.publish_down >= '.$this->_db->Quote($now).' )'; + + + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetFile', array (&$wheres, &$joins, $fileId, $params)); + // END GWE MOD + } + + $query = ' SELECT c.*, cc.id AS categoryid, cc.title AS categorytitle, cc.alias AS categoryalias, cc.access as cataccess, cc.accessuserid as cataccessuserid, lc.title AS licensetitle, lc.description AS licensetext' + .' FROM #__phocadownload AS c' + .' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = c.catid' + .' LEFT JOIN #__phocadownload_licenses AS lc ON lc.id = c.confirm_license' + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + .' WHERE ' . implode( ' AND ', $wheres ) + .' ORDER BY c.ordering'; + + return $query; + } + + function getCategory($fileId) { + + if (empty($this->_category)) { + $query = $this->_getCategoryQuery( $fileId ); + $this->_category= $this->_getList( $query, 0, 1 ); + } + return $this->_category; + } + + function _getCategoryQuery( $fileId ) { + + $wheres = array(); + $app = JFactory::getApplication(); + $params = $app->getParams(); + $user = JFactory::getUser(); + $userLevels = implode (',', $user->getAuthorisedViewLevels()); + + $pQ = $params->get( 'enable_plugin_query', 0 ); + + $wheres[] = " c.id= ".(int)$fileId; + $wheres[] = " cc.access IN (".$userLevels.")"; + $wheres[] = " cc.published = 1"; + + if ($this->getState('filter.language')) { + $wheres[] = ' c.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + $wheres[] = ' cc.language IN ('.$this->_db->Quote(JFactory::getLanguage()->getTag()).','.$this->_db->Quote('*').')'; + } + + if ($pQ == 1) { + // GWE MOD - to allow for access restrictions + JPluginHelper::importPlugin("phoca"); + $dispatcher =& JDispatcher::getInstance(); + $joins = array(); + $results = $dispatcher->trigger('onGetCategory', array (&$wheres, &$joins,$categoryId, $params)); + // END GWE MOD + } + + $query = " SELECT cc.id, cc.title, cc.alias, cc.image, cc.image_position, cc.description" + . " FROM #__phocadownload_categories AS cc" + . " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id" + . ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD + . " WHERE " . implode( " AND ", $wheres ) + . " ORDER BY cc.ordering"; + return $query; + } + +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/models/ratingfilea.php b/packages/phocadownload/components/com_phocadownload/models/ratingfilea.php new file mode 100644 index 00000000..832c8bc2 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/ratingfilea.php @@ -0,0 +1,53 @@ +getTable('phocadownloadfilevotes'); + + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + $row->date = gmdate('Y-m-d H:i:s'); + + $row->published = 1; + + if (!$row->id) { + $where = 'fileid = ' . (int) $row->fileid ; + $row->ordering = $row->getNextOrder( $where ); + } + + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Update the Vote Statistics + if (!PhocaDownloadRate::updateVoteStatisticsFile( $data['fileid'])) { + return false; + } + + return true; + } +} +?> diff --git a/packages/phocadownload/components/com_phocadownload/models/user.php b/packages/phocadownload/components/com_phocadownload/models/user.php new file mode 100644 index 00000000..c6ccd36d --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/models/user.php @@ -0,0 +1,580 @@ +getUserStateFromRequest( $this->_context_files.'.list.limit', 'limit', 20, 'int' ); + $limitstart_files = $app->input->get('limitstart', 0, 'int'); + $limitstart_files = ($limit_files != 0 ? (floor($limitstart_files / $limit_files) * $limit_files) : 0); + $this->setState($this->_context_files.'.list.limit', $limit_files); + $this->setState($this->_context_files.'.list.limitstart', $limitstart_files); + + } + + function getDataFiles($userId) { + if (empty($this->_data_files)) { + $query = $this->_buildQueryFiles($userId); + $this->_data_files = $this->_getList($query, $this->getState($this->_context_files.'.list.limitstart'), $this->getState($this->_context_files.'.list.limit')); + + } + return $this->_data_files; + } + + function getTotalFiles($userId) { + if (empty($this->_total_files)) { + $query = $this->_buildQueryFiles($userId); + $this->_total_files = $this->_getListCount($query); + } + return $this->_total_files; + } + + function getPaginationFiles($userId) { + if (empty($this->_pagination_files)) { + jimport('joomla.html.pagination'); + $this->_pagination_files = new JPagination( $this->getTotalFiles($userId), $this->getState($this->_context_files.'.list.limitstart'), $this->getState($this->_context_files.'.list.limit') ); + } + return $this->_pagination_files; + } + + function _buildQueryFiles($userId) { + $where = $this->_buildContentWhereFiles($userId); + $orderby = $this->_buildContentOrderByFiles(); + + $query = ' SELECT a.*, cc.title AS categorytitle, u.name AS editor, ag.title AS access_level, us.id AS ownerid, us.username AS ownername ' + . ' FROM #__phocadownload AS a ' + . ' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = a.catid' + . ' LEFT JOIN #__viewlevels AS ag ON ag.id = a.access' + . ' LEFT JOIN #__users AS u ON u.id = a.checked_out' + . ' LEFT JOIN #__users AS us ON us.id = a.owner_id' + . $where + . $orderby; + return $query; + } + + + function _buildContentOrderByFiles() { + $app = JFactory::getApplication(); + $filter_order = $app->getUserStateFromRequest( $this->_context_files.'.filter_order', 'filter_order', 'a.ordering', 'cmd' ); + $filter_order_Dir = $app->getUserStateFromRequest( $this->_context_files.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); + + if ($filter_order == 'a.ordering'){ + $orderby = ' ORDER BY categorytitle, a.ordering '.$filter_order_Dir; + } else { + $orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.' , categorytitle, a.ordering '; + } + return $orderby; + } + + function _buildContentWhereFiles($userId) { + $app = JFactory::getApplication(); + $filter_state = $app->getUserStateFromRequest( $this->_context_files.'.filter_state','filter_state','', 'word' ); + $filter_catid = $app->getUserStateFromRequest( $this->_context_files.'.catid','catid',0,'int' ); + //$filter_sectionid = $app->getUserStateFromRequest( $this->_context_files.'.filter_sectionid', 'filter_sectionid', 0, 'int' ); + $filter_order = $app->getUserStateFromRequest( $this->_context_files.'.filter_order','filter_order','a.ordering','cmd' ); + $filter_order_Dir = $app->getUserStateFromRequest( $this->_context_files.'.filter_order_Dir','filter_order_Dir_files', '', 'word' ); + $search = $app->getUserStateFromRequest( $this->_context_files.'.search', 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + $where = array(); + + $where[] = 'a.owner_id = '.(int)$userId; + $where[] = 'a.owner_id > 0'; // Ignore -1 + + if ($filter_catid > 0) { + $where[] = 'a.catid = '.(int) $filter_catid; + } + if ($search) { + $where[] = 'LOWER(a.title) LIKE '.$this->_db->Quote('%'.$search.'%'); + } + if ( $filter_state ) { + if ( $filter_state == 'P' ) { + $where[] = 'a.published = 1'; + } else if ($filter_state == 'U' ) { + $where[] = 'a.published = 0'; + } + } + //if ( $filter_sectionid ) { + // $where[] = 'cc.section = '.(int)$filter_sectionid; + //} + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + return $where; + } + + + + + + /* + * Add Image + */ +/* + function storefile($data, $return, $edit = false) { + + if (!$edit) { + //If this file doesn't exists don't save it + if (!phocadownloadFile::existsFileOriginal($data['filename'])) { + $this->setError('File not exists'); + return false; + } + + $data['imgorigsize'] = phocadownloadFile::getFileSize($data['filename'], 0); + + //If there is no title and no alias, use filename as title and alias + if (!isset($data['title']) || (isset($data['title']) && $data['title'] == '')) { + $data['title'] = phocadownloadFile::getTitleFromFile($data['filename']); + } + + if (!isset($data['alias']) || (isset($data['alias']) && $data['alias'] == '')) { + $data['alias'] = phocadownloadFile::getTitleFromFile($data['filename']); + } + + //clean alias name (no bad characters) + $data['alias'] = phocadownloadText::getAliasName($data['alias']); + + } else { + $data['alias'] = phocadownloadText::getAliasName($data['title']); + } + + $row = $this->getTable('phocadownload'); + + + if(isset($data['id']) && $data['id'] > 0) { + if (!$row->load($data['id'])) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + // Bind the form fields to the Phoca gallery table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Create the timestamp for the date + $row->date = gmdate('Y-m-d H:i:s'); + + // if new item, order last in appropriate group + if (!$row->id) { + $where = 'catid = ' . (int) $row->catid ; + $row->ordering = $row->getNextOrder( $where ); + } + + // Make sure the Phoca gallery table is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the Phoca gallery table to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if(!$edit) { + //Create thumbnail small, medium, large + $returnFrontMessage = phocadownloadFileThumbnail::getOrCreateThumbnail($row->filename, $return, 1, 1, 1, 1); + + if ($returnFrontMessage == 'Success') { + return true; + } else { + return false; + } + } else { + if (isset($row->id)) { + return $row->id; + } else { + return false; + } + } + } + */ + + function singleFileUpload(&$errUploadMsg, $file, $post) { + + $app = JFactory::getApplication();; + JRequest::checkToken( 'request' ) or jexit( 'Invalid Token' ); + jimport('joomla.client.helper'); + $user = JFactory::getUser(); + $ftp = JClientHelper::setCredentialsFromRequest('ftp'); + $path = PhocaDownloadPath::getPathSet(); + $folder = $app->input->get( 'folder', '', '', 'path' ); + $format = $app->input->get( 'format', 'html', '', 'cmd'); + $return = $app->input->get( 'return-url', null, 'post', 'base64' ); + $viewBack = $app->input->get( 'viewback', '', 'post', 'string' ); + //$catid = $app->input->get( 'catid', '', '', 'int' ); + $paramsC = JComponentHelper::getParams('com_phocadownload') ; + + $overwriteExistingFiles = $paramsC->get( 'overwrite_existing_files', 0 ); + + // USER RIGHT - UPLOAD - - - - - - - - - - - + // 2, 2 means that user access will be ignored in function getUserRight for display Delete button + $rightDisplayUpload = 0; + $catAccess = PhocaDownloadAccess::getCategoryAccess((int)$post['catidfiles']); + if (!empty($catAccess)) { + $rightDisplayUpload = PhocaDownloadAccess::getUserRight('uploaduserid', $catAccess->uploaduserid, 2, array(0 => 2), $user->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + + + /*$post['sectionid'] = $this->getSection((int)$post['catidfiles']); + if(!$post['sectionid']) { + $errUploadMsg = JText::_('COM_PHOCADOWNLOAD_WRONG_SECTION'); + return false; + }*/ + + //$userFolder = substr(md5($user->username),0, 10); + $userFolder = htmlspecialchars(strip_tags($user->username)); + if ($rightDisplayUpload == 1) { + + // Make the filename safe + if (isset($file['name'])) { + $file['name'] = JFile::makeSafe($file['name']); + } + + if($file['tmp_name'] == '') { + $errUploadMsg = JText::_("COM_PHOCADOWNLOAD_ERROR_SERVER_NOT_ABLE_TO_STORE_FILE_TEMP_FOLDER"); + return false; + } + + if (isset($file['name'])) { + $filepath = JPath::clean($path['orig_abs_user_upload']. DS. $userFolder . DS.$file['name']); + $filepathUserFolder = JPath::clean($path['orig_abs_user_upload']. DS. $userFolder); + if (!PhocaDownloadFileUpload::canUpload( $file, $errUploadMsg, 'file', 2 )) { + + if ($errUploadMsg == 'COM_PHOCADOWNLOAD_WARNUSERFILESTOOLARGE') { + $errUploadMsg = JText::_($errUploadMsg) . ' ('.PhocaDownloadFile::getFileSizeReadable($file['size']).')'; + } else { + $errUploadMsg = JText::_($errUploadMsg); + } + + return false; + } + + if (JFile::exists($filepath) && $overwriteExistingFiles == 0) { + $errUploadMsg = JText::_("COM_PHOCADOWNLOAD_FILE_ALREADY_EXISTS"); + return false; + } + + // Overwrite file and add no new item to database + $fileExists = 0; + if (JFile::exists($filepath) && $overwriteExistingFiles == 1) { + $fileExists = 1; + } + + if (!JFile::upload($file['tmp_name'], $filepath)) { + $errUploadMsg = JText::_("COM_PHOCADOWNLOAD_UNABLE_TO_UPLOAD_FILE"); + return false; + } else { + + // Saving file name into database with relative path + if (!JFile::exists($filepathUserFolder . DS ."index.html")) { + $data = "\n\n\n"; + JFile::write($filepathUserFolder . DS ."index.html", $data); + } + $file['namepap'] = $file['name']; + $file['name'] = 'userupload/'.$userFolder.'/' . $file['name']; + $succeeded = false; + + // ================================================= + // Make a copy for play and preview + $papCopy = $paramsC->get( 'pap_copy', 0 ); + if ($papCopy == 1 || $papCopy == 3) { + $canPlay = PhocaDownloadFile::canPlay($file['namepap']); + $canPreview = PhocaDownloadFile::canPreview($file['namepap']); + $filepathPAP = JPath::clean($path['orig_abs_user_upload_pap']. DS. $userFolder . DS.$file['namepap']); + $filepathUserFolderPAP = JPath::clean($path['orig_abs_user_upload_pap']. DS. $userFolder); + + if ($canPlay || $canPreview) { + + $uploadPAP = 1;// upload file for preview and play + if (JFile::exists($filepathPAP) && $overwriteExistingFiles == 0) { + //$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_FILE_ALREADY_EXISTS"); + //return false; + $uploadPAP = 0; // don't upload if it exists, it is not main file, don't do false and exit + } + + // Overwrite file and add no new item to database + $fileExistsPAP = 0; + if (JFile::exists($filepathPAP) && $overwriteExistingFiles == 1) { + $fileExistsPAP = 1; + } + + if ($uploadPAP == 0) { + + } else { + if (!JFolder::exists($filepathUserFolderPAP)) { + if (JFolder::create($filepathUserFolderPAP)) { + $data = "\n\n\n"; + JFile::write($filepathUserFolderPAP . DS ."index.html", $data); + } + // else { + //$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_UNABLE_TO_CREATE_FOLDER"); + //return false; + //} + } + + if (!JFile::copy($filepath, $filepathPAP)) { + + //$errUploadMsg = JText::_("COM_PHOCADOWNLOAD_UNABLE_TO_UPLOAD_FILE"); + //return false; + } else { + // Saving file name into database with relative path + if (!JFile::exists($filepathUserFolderPAP . DS ."index.html")) { + $data = "\n\n\n"; + JFile::write($filepathUserFolderPAP . DS ."index.html", $data); + } + + if ($canPlay == 1) { + $post['filename_play'] = 'userupload/'.$userFolder.'/' . $file['namepap']; + } else if ($canPreview == 1) { + $post['filename_preview'] = 'userupload/'.$userFolder.'/' . $file['namepap']; + } + } + } + } + } + // ============================================== + + if ($this->_save($post, $file['name'], $errUploadMsg, $fileExists)) { + + return true; + } else { + return false; + } + } + } else { + $errUploadMsg = JText::_("COM_PHOCADOWNLOAD_WARNFILETYPE"); + $redirectUrl = $return; + return false; + } + } else { + $errUploadMsg = JText::_("COM_PHOCADOWNLOAD_NOT_AUTHORISED_TO_UPLOAD"); + + return false; + } + return false; + + + } + + function _save($data, $filename, &$errSaveMsg, $fileExists = 0) { + + $user = JFactory::getUser(); + $fileId = false; + if ($fileExists == 1) { + // We not only owerwrite the file but we must update it + if (isset($filename) && $filename != '') { + + $db = JFactory::getDBO(); + + $query = 'SELECT a.id AS id' + .' FROM #__phocadownload AS a' + .' WHERE a.filename = '.$db->Quote($filename); + + $db->setQuery($query, 0, 1); + $fileId = $db->loadObject(); + + if (!$db->query()) { + $this->setError($db->getErrorMsg()); + return false; + } + } + } + + $row = $this->getTable('phocadownload'); + + if (isset($fileId->id) && (int)$fileId->id > 0) { + $data['id'] = (int)$fileId->id; + } + + + + $data['filesize'] = PhocaDownloadFile::getFileSize($filename, 0); + + $data['userid'] = $user->id; + $data['author_email'] = $data['email']; + $data['author_url'] = $data['website']; + + $data['token'] = PhocaDownloadUtils::getToken($data['title'].$filename); + //$data['token'] = PhocaDownloadUtils::getToken($data['title'].$data['filename']); + + // Bind the form fields to the Phoca gallery table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + + + // Create the timestamp for the date + //$row->date = gmdate('Y-m-d H:i:s'); + //$row->publish_up = gmdate('Y-m-d H:i:s'); + //$jnow =JFactory::getDate(); + /*$jnowU = $jnow->toUnix(); + if (isset($jnowU)) { + $jnowU = (int)$jnowU - 2; // to not display pending because of 1 second + }*/ + + $unow = time(); + $unow = $unow - 2;//Frontend will display pending if standard $jnow->toSql(); will be used + $jnow = JFactory::getDate($unow);// the class JDate construct works with unix date + $now = $jnow->toSql(); + + $row->date = $now; + $row->publish_up = $now; //date('Y-m-d H:i:s', $jnowU); + $row->publish_down = null; + $row->filename = $filename; + $row->catid = $data['catidfiles']; + + // Lang + $userLang = PhocaDownloadUser::getUserLang(); + $row->language = $userLang['lang']; + + + // if new item, order last in appropriate group + if (!$row->id) { + $where = 'catid = ' . (int) $row->catid ; + $row->ordering = $row->getNextOrder( $where ); + } + + // Make sure the Phoca gallery table is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the Phoca gallery table to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + PhocaDownloadLog::log($row->id, 2); + + return true; + } + /* + function getSection($catid) { + + $query = 'SELECT c.section' + . ' FROM #__phocadownload_categories AS c' + . ' WHERE c.id = '.(int)$catid; + + $this->_db->setQuery( $query ); + $sectionId = $this->_db->loadObject(); + + if (isset($sectionId->section)) { + return $sectionId->section; + } + return false; + }*/ + + function isOwnerCategoryFile($userId, $fileId) { + + $query = 'SELECT cc.id' + . ' FROM #__phocadownload_categories AS cc' + . ' LEFT JOIN #__phocadownload AS a ON a.catid = cc.id' + . ' WHERE cc.owner_id = '.(int)$userId + . ' AND a.id = '.(int)$fileId; + + $this->_db->setQuery( $query ); + $ownerCategoryId = $this->_db->loadObject(); + if (isset($ownerCategoryId->id)) { + return $ownerCategoryId->id; + } + return false; + } + + function publish($id = 0, $publish = 1) { + + //$user = JFactory::getUser(); + $query = 'UPDATE #__phocadownload AS a' + //. ' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = a.catid ' + . ' SET a.published = '.(int) $publish + . ' WHERE a.id = '.(int)$id; + //. ' AND cc.owner_id = '.(int) $user->get('id'); + + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError('Database Error Publishing'); + return false; + } + return true; + } + + function delete($id = 0) { + + $paramsC = JComponentHelper::getParams('com_phocadownload'); + $deleteExistingFiles = $paramsC->get( 'delete_existing_files', 0 ); + + // - - - - - - - - - - - - - + // Get all filenames we want to delete from database, we delete all thumbnails from server of this file + $queryd = 'SELECT filename as filename FROM #__phocadownload WHERE id = '.(int)$id; + $this->_db->setQuery($queryd); + $fileObject = $this->_db->loadObjectList(); + // - - - - - - - - - - - - - + + $query = 'DELETE FROM #__phocadownload' + . ' WHERE id ='.(int)$id; + + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError('Database Error - Delete Files'); + return false; + } + + // Delete tags + $query = 'DELETE FROM #__phocadownload_tags_ref' + . ' WHERE fileid ='.(int)$id; + + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError('Database Error - Delete Tags (Files)'); + return false; + } + + // - - - - - - - - - - - - - - + // DELETE FILES ON SERVER + if ($deleteExistingFiles == 1) { + $path = PhocaDownloadPath::getPathSet(); + foreach ($fileObject as $key => $value) { + //The file can be stored in other category - don't delete it from server because other category use it + $querys = "SELECT id as id FROM #__phocadownload WHERE filename='".$value->filename."' "; + $this->_db->setQuery($querys); + $sameFileObject = $this->_db->loadObject(); + // same file in other category doesn't exist - we can delete it + if (!$sameFileObject) { + JFile::delete(JPath::clean($path['orig_abs_ds'].$value->filename)); + } + } + } + + return true; + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/phocadownload.php b/packages/phocadownload/components/com_phocadownload/phocadownload.php new file mode 100644 index 00000000..f9415d42 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/phocadownload.php @@ -0,0 +1,54 @@ +execute( JFactory::getApplication()->input->get('task') ); +$controller->redirect(); +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/router.php b/packages/phocadownload/components/com_phocadownload/router.php new file mode 100644 index 00000000..96bd3bcb --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/router.php @@ -0,0 +1,228 @@ +getMenu(); + $items = $menu->getItems('component', 'com_phocadownload'); + + } + + // Search for an appropriate menu item. + if (is_array($items)) + { + // If only the option and itemid are specified in the query, return that item. + if (!isset($query['view']) && !isset($query['id']) && !isset($query['catid']) && !isset($query['download']) && isset($query['Itemid'])) { + $itemid = (int) $query['Itemid']; + } + + + // ------------------------------------------------------ + // Search for a specific link based on the critera given. + if (!$itemid) + { + foreach ($items as $item) + { + // Check if this menu item links to this view. + if (isset($item->query['view']) && $item->query['view'] == 'category' + + && isset($query['view']) && $query['view'] != 'file' + && isset($query['view']) && $query['view'] != 'play' + && isset($item->query['id']) && isset($query['id']) && $item->query['id'] == $query['id']) { + $itemid = $item->id; + } + + else if (isset($item->query['view']) && $item->query['view'] == 'file' + && isset($query['view']) && $query['view'] != 'category' + + && isset($query['view']) && $query['view'] != 'play' + && isset($item->query['id']) && isset($query['id']) && $item->query['id'] == $query['id']) { + $itemid = $item->id; + } + else if (isset($item->query['view']) && $item->query['view'] == 'play' + && isset($query['view']) && $query['view'] != 'category' + + && isset($query['view']) && $query['view'] != 'file' + && isset($item->query['id']) && isset($query['id']) && $item->query['id'] == $query['id']) { + $itemid = $item->id; + } + } + + } + } + + // Check if the router found an appropriate itemid. + if (!$itemid) { + // Check if a category was specified + if (isset($query['id'])) { // Check if a id was specified. + if (isset($query['alias'])) { + $query['id'] .= ':'.$query['alias']; + } + + // Push the id onto the stack. + //$segments[] = $query['id']; + if(isset($query['view'])) {$segments[] = $query['view'];} + $segments[] = $query['id']; + unset($query['view']); + unset($query['id']); + unset($query['alias']); + unset($query['catid']); + unset($query['catalias']); + + } else { + // Categories view. + unset($query['view']); + } + } else { + $query['Itemid'] = $itemid; + // Remove the unnecessary URL segments. + unset($query['view']); + unset($query['id']); + unset($query['alias']); + } + + return $segments; +} + +/** + * Method to parse Route + * @param array $segments + */ +function PhocaDownloadParseRoute($segments) +{ + $vars = array(); + + //Get the active menu item + $app = JFactory::getApplication(); + $menu = $app->getMenu(); + $item = $menu->getActive(); + + + // Count route segments + $count = count($segments); + + //Standard routing + if(!isset($item)) { + if($count == 3 ) { + $vars['view'] = $segments[$count - 3]; + } else if ($count == 2) { + $vars['view'] = $segments[$count - 2]; + } else { + $vars['view'] = 'category'; + } + $vars['id'] = $segments[$count - 1]; + + } else { + //Handle View and Identifier + + switch($item->query['view']) + { + case 'categories' : + if($count == 1) { + $vars['view'] = 'categories'; + $vars['id'] = $segments[$count-1]; + } + + if($count == 2) { + $vars['view'] = $segments[$count-2]; + $vars['id'] = $segments[$count-1]; + } + break; + + + + case 'category' : + if($count == 1) { + $vars['view'] = 'category'; + } + + if($count == 2) { + $vars['view'] = $segments[$count-2]; + $vars['id'] = $segments[$count-1]; + } + break; + + case 'file' : + if($count == 1) { + $vars['view'] = 'file'; + } + + if($count == 2) { + $vars['view'] = $segments[$count-2]; + $vars['id'] = $segments[$count-1]; + } + + break; + case 'play' : + if($count == 1) { + $vars['view'] = 'play'; + } + + if($count == 2) { + $vars['view'] = $segments[$count-2]; + $vars['id'] = $segments[$count-1]; + } + + break; + + // Guestbook Report + case 'guestbook' : + if($count == 1) { + $vars['view'] = 'guestbook'; + } + + if($count == 2) { + $vars['view'] = $segments[$count-2]; + $vars['id'] = $segments[$count-1]; + } + + break; + case 'download' : + if($count == 1) { + $vars['view'] = 'download'; + } + + if($count == 2) { + $vars['view'] = $segments[$count-2]; + $vars['id'] = $segments[$count-1]; + } + + break; + + } + } + return $vars; +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/categories/index.html b/packages/phocadownload/components/com_phocadownload/views/categories/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/categories/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/categories/metadata.xml b/packages/phocadownload/components/com_phocadownload/views/categories/metadata.xml new file mode 100644 index 00000000..b6b62494 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/categories/metadata.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/categories/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/categories/tmpl/default.php new file mode 100644 index 00000000..c338343d --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/categories/tmpl/default.php @@ -0,0 +1,204 @@ +t['p']->get( 'pageclass_sfx' ).'">'; + +if ( $this->t['p']->get( 'show_page_heading' ) ) { + echo '

'. $this->escape($this->t['p']->get('page_heading')) . '

'; +} + +if ( $this->t['description'] != '') { + echo '
'. $this->t['description']. '
'; +} + + +if (!empty($this->t['categories'])) { + $i = 1; + foreach ($this->t['categories'] as $value) { + + // Categories + $numDoc = 0; + $numSubcat = 0; + $catOutput = ''; + if (!empty($value->subcategories)) { + foreach ($value->subcategories as $valueCat) { + + // USER RIGHT - Access of categories - - - - - + // ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users) + $rightDisplay = 0; + if (!empty($valueCat)) { + $rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $valueCat->accessuserid, $valueCat->access, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0); + + } + // - - - - - - - - - - - - - - - - - - - - - - + + if ($rightDisplay == 1) { + + $catOutput .= '
'; + $catOutput .= ''. $valueCat->title.''; + + if ($this->t['displaynumdocsecs'] == 1) { + $catOutput .=' ('.$valueCat->numdoc .')'; + } + $catOutput .= '
' . "\n"; + $numDoc = (int)$valueCat->numdoc + (int)$numDoc; + $numSubcat++; + } + } + } + + // Don't display parent category + // - if there is no catoutput + // - if there is no rigths for it + + // USER RIGHT - Access of parent category - - - - - + // ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users) + $rightDisplay = 0; + if (!empty($value)) { + $rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $value->accessuserid, $value->access, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0); + + } + // - - - - - - - - - - - - - - - - - - - - - - + + if ($rightDisplay == 1) { + +// ===================================================================================== +// BEGIN LAYOUT AREA +// ===================================================================================== + + $pdTitle = ''. $value->title.''; + + if ($this->t['displaynumdocsecsheader'] == 1) { + $numDocAll = (int)$numDoc + (int)$value->numdoc; + //$numDoc ... only files in subcategories + //$value->numdoc ... only files in the main category + //$numDocAll ... files in category and in subcategories + $pdTitle .= ' ('.$numSubcat.'/' . $numDocAll .')'; + } + + + $pdDesc = ''; + $pdSubcategories = ''; + if ($this->t['displaymaincatdesc'] == 1) { + $pdDesc .= $value->description; + } else { + if ($catOutput != '') { + $pdSubcategories .= $catOutput; + } else { + $pdSubcategories .= '
'.JText::_('COM_PHOCADOWNLOAD_NO_SUBCATEGORIES').'
'; + } + } + + $pdClear = ''; + if ($i%3==0) { + $pdClear .= '
'; + } + $i++; + + + + + // --------------------------------------------------- + //Convert + // --------------------------------------------------- + if ($this->t['display_specific_layout'] == 0) { + echo '
'; + echo '
'.$pdTitle.'
'; + if ($pdDesc != '') { echo '
'.$pdDesc.'
';} + echo $pdSubcategories; + echo '
'; + echo $pdClear; + } else { + $categoriesLayout = PhocaDownloadSettings::getLayoutText('categories'); + + /*'
+
{pdtitle}
+ {pdsubcategories} + {pdclear} +
'; + //
{pdDescription}
*/ + + $categoriesLayoutParams = PhocaDownloadSettings::getLayoutParams('categories'); + + $replace = array($pdTitle, $pdDesc, $pdSubcategories, $pdClear); + $output = str_replace($categoriesLayoutParams['search'], $replace, $categoriesLayout); + + echo $output; + } + } + } +} +echo '' + .'
'; + + +// - - - - - - - - - - +// Most viewed docs (files) +// - - - - - - - - - - +$outputFile = ''; + +if (!empty($this->t['mostvieweddocs']) && $this->t['displaymostdownload'] == 1) { + $l = new PhocaDownloadLayout(); + foreach ($this->t['mostvieweddocs'] as $value) { + // USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - - + // ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users) + $rightDisplay = 0; + if (!empty($value)) { + $rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $value->cataccessuserid, $value->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + + if ($rightDisplay == 1) { + // FILESIZE + if ($value->filename !='') { + $absFile = str_replace('/', DS, JPath::clean($this->t['absfilepath'] . $value->filename)); + if (JFile::exists($absFile)) { + $fileSize = PhocaDownloadFile::getFileSizeReadable(filesize($absFile)); + } else { + $fileSize = ''; + } + } + + // IMAGE FILENAME + //$imageFileName = ''; + //if ($value->image_filename !='') { + $imageFileName = $l->getImageFileName($value->image_filename, $value->filename, 2); + /*$thumbnail = false; + $thumbnail = preg_match("/phocathumbnail/i", $value->image_filename); + if ($thumbnail) { + $imageFileName = ''; + } else { + $imageFileName = 'style="background: url(\''.$this->t['cssimgpath'].$value->image_filename.'\') 0 center no-repeat;"'; + }*/ + //} + + //$outputFile .= '
'; + + $outputFile .= '
'. $imageFileName['filenamethumb'] + . '
'; + + $outputFile .= ''. $value->title.'' + .' (' .$value->categorytitle.')'; + + $outputFile .= PhocaDownloadRenderFront::displayNewIcon($value->date, $this->t['displaynew']); + $outputFile .= PhocaDownloadRenderFront::displayHotIcon($value->hits, $this->t['displayhot']); + + $outputFile .= '
' . "\n"; + } + } + + if ($outputFile != '') { + echo '
 
'; + echo '
'; + echo '

'. JText::_('COM_PHOCADOWNLOAD_MOST_DOWNLOADED_FILES').'

'; + echo $outputFile; + echo '
'; + } +} +echo '
 
'; +echo $this->t['dw']; +?> diff --git a/packages/phocadownload/components/com_phocadownload/views/categories/tmpl/default.xml b/packages/phocadownload/components/com_phocadownload/views/categories/tmpl/default.xml new file mode 100644 index 00000000..13624692 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/categories/tmpl/default.xml @@ -0,0 +1,30 @@ + + + + + + + + + COM_PHOCADOWNLOAD_CATEGORIES_LIST_LAYOUT + COM_PHOCADOWNLOAD_CATEGORIES_LIST_LAYOUT_DESC + + +
+ + + + + + + + + + + + + +
+
+ +
\ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/categories/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/categories/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/categories/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/categories/view.html.php b/packages/phocadownload/components/com_phocadownload/views/categories/view.html.php new file mode 100644 index 00000000..23a55ea8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/categories/view.html.php @@ -0,0 +1,112 @@ +getModel(); + $document = JFactory::getDocument(); + $this->t['dw'] = PhocaDownloadRenderFront::renderPhocaDownload(); + $this->t['p'] = $app->getParams(); + $this->t['user'] = JFactory::getUser(); + $this->t['categories'] = $model->getCategoriesList(); + $this->t['mostvieweddocs'] = $model->getMostViewedDocsList($this->t['p']); + + $this->t['displaynew'] = $this->t['p']->get( 'display_new', 0 ); + $this->t['displayhot'] = $this->t['p']->get( 'display_hot', 0 ); + $this->t['displaymostdownload'] = $this->t['p']->get( 'display_most_download', 1 ); + $this->t['displaynumdocsecs'] = $this->t['p']->get( 'display_num_doc_secs', 0 ); + $this->t['displaynumdocsecsheader'] = $this->t['p']->get( 'display_num_doc_secs_header', 1 ); + $this->t['file_icon_size_md'] = $this->t['p']->get( 'file_icon_size_md', 16 ); + $this->t['download_metakey'] = $this->t['p']->get( 'download_metakey', '' ); + $this->t['download_metadesc'] = $this->t['p']->get( 'download_metadesc', '' ); + $this->t['description'] = $this->t['p']->get( 'description', '' ); + $this->t['displaymaincatdesc'] = $this->t['p']->get( 'display_main_cat_desc', 0 ); + $this->t['display_specific_layout'] = $this->t['p']->get( 'display_specific_layout', 0 ); + + PhocaDownloadRenderFront::renderAllCSS(); + + $imagePath = PhocaDownloadPath::getPathSet('icon'); + $this->t['cssimgpath'] = str_replace ( '../', JURI::base(true).'/', $imagePath['orig_rel_ds']); + $filePath = PhocaDownloadPath::getPathSet('file'); + $this->t['absfilepath'] = $filePath['orig_abs_ds']; + + $this->_prepareDocument(); + parent::display($tpl); + + } + + protected function _prepareDocument() { + + $app = JFactory::getApplication(); + $menus = $app->getMenu(); + $menu = $menus->getActive(); + $pathway = $app->getPathway(); + $title = null; + + $this->t['downloadmetakey'] = $this->t['p']->get( 'download_metakey', '' ); + $this->t['downloadmetadesc'] = $this->t['p']->get( 'download_metadesc', '' ); + + if ($menu) { + $this->t['p']->def('page_heading', $this->t['p']->get('page_title', $menu->title)); + } else { + $this->t['p']->def('page_heading', JText::_('JGLOBAL_ARTICLES')); + } +/* + $title = $this->t['p']->get('page_heading', ''); + if (empty($title)) { + $title = htmlspecialchars_decode($app->getCfg('sitename')); + } else if ($app->getCfg('sitename_pagetitles', 0)) { + $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title); + } + //$this->document->setTitle($title); + + if (empty($title) || (isset($title) && $title == '')) { + $title = $this->item->title; + } + $this->document->setTitle($title);*/ + + $title = $this->t['p']->get('page_title', ''); + if (empty($title)) { + $title = htmlspecialchars_decode($app->getCfg('sitename')); + } else if ($app->getCfg('sitename_pagetitles', 0) == 1) { + $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title); + } else if ($app->getCfg('sitename_pagetitles', 0) == 2) { + $title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('sitename'))); + } + $this->document->setTitle($title); + + + + if ($this->t['downloadmetadesc'] != '') { + $this->document->setDescription($this->t['downloadmetadesc']); + } else if ($this->t['p']->get('menu-meta_description', '')) { + $this->document->setDescription($this->t['p']->get('menu-meta_description', '')); + } + + if ($this->t['downloadmetakey'] != '') { + $this->document->setMetadata('keywords', $this->t['downloadmetakey']); + } else if ($this->t['p']->get('menu-meta_keywords', '')) { + $this->document->setMetadata('keywords', $this->t['p']->get('menu-meta_keywords', '')); + } + + if ($app->getCfg('MetaTitle') == '1' && $this->t['p']->get('menupage_title', '')) { + $this->document->setMetaData('title', $this->t['p']->get('page_title', '')); + } + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/category/index.html b/packages/phocadownload/components/com_phocadownload/views/category/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/category/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/category/metadata.xml b/packages/phocadownload/components/com_phocadownload/views/category/metadata.xml new file mode 100644 index 00000000..5c8f97c3 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/category/metadata.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default.php new file mode 100644 index 00000000..fb411570 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default.php @@ -0,0 +1,126 @@ +t['p']->get( 'pageclass_sfx' ).'">'; + +if ( $this->t['p']->get( 'show_page_heading' ) ) { + echo '

'. $this->escape($this->t['p']->get('page_heading')) . '

'; +} +// Search by tags - the category rights must be checked for every file +$this->checkRights = 1; +// ------------------------------------------------------------------- +if ((int)$this->t['tagid'] > 0) { + + echo $this->loadTemplate('files'); + $this->checkRights = 1; + if (count($this->files)) { + echo $this->loadTemplate('pagination'); + } +} else { + if (!empty($this->category[0])) { + echo '
'; + if ($this->t['display_up_icon'] == 1) { + + if (isset($this->category[0]->parentid)) { + if ($this->category[0]->parentid == 0) { + + $linkUp = JRoute::_(PhocaDownloadRoute::getCategoriesRoute()); + $linkUpText = JText::_('COM_PHOCADOWNLOAD_CATEGORIES'); + } else if ($this->category[0]->parentid > 0) { + $linkUp = JRoute::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->parentid, $this->category[0]->parentalias)); + $linkUpText = $this->category[0]->parenttitle; + } else { + $linkUp = '#'; + $linkUpText = ''; + } + echo ''; + } + } + } else { + echo '
'; + } + + if (!empty($this->category[0])) { + + // USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - - + // ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users) + $rightDisplay = 0; + if (!empty($this->category[0])) { + $rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $this->category[0]->cataccessuserid, $this->category[0]->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + if ($rightDisplay == 1) { + $this->checkRights = 0; + $l = new PhocaDownloadLayout(); + + echo '

'.$this->category[0]->title. '

'; + + // Description + /*if ($l->isValueEditor($this->category[0]->description)) { + echo '
'.$this->category[0]->description.'
'; + }*/ + + // Description + if ($l->isValueEditor($this->category[0]->description)) { + echo '
'; + echo JHTML::_('content.prepare', $this->category[0]->description); + echo '
'; + } + + // Subcategories + + if (!empty($this->subcategories)) { + foreach ($this->subcategories as $valueSubCat) { + + echo '
'; + echo ''. $valueSubCat->title.''; + echo ' ('.$valueSubCat->numdoc.')
' . "\n"; + $subcategory = 1; + } + + echo '
'; + } + + // ===================================================================================== + // BEGIN LAYOUT AREA + // ===================================================================================== + + echo $this->loadTemplate('files'); + + // ===================================================================================== + // END LAYOUT AREA + // ===================================================================================== + + if (count($this->category[0])) { + echo $this->loadTemplate('pagination'); + } + + if ($this->t['display_category_comments'] == 1) { + if (JComponentHelper::isEnabled('com_jcomments', true)) { + include_once(JPATH_BASE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php'); + echo JComments::showComments($this->category[0]->id, 'com_phocadownload', JText::_('COM_PHOCADOWNLOAD_CATEGORY') .' '. $this->category[0]->title); + } + } + + if ($this->t['display_category_comments'] == 2) { + echo '
'.$this->loadTemplate('comments-fb').'
'; + } + + } else { + echo '

'.JText::_('COM_PHOCADOWNLOAD_CATEGORY'). '

'; + echo '
'.JText::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY').'
'; + } + + echo '
'; + } else { + //echo '

 

'; + echo '
'; + } +} +echo '
 
'; +echo $this->t['dg']; +?> diff --git a/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default.xml b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default.xml new file mode 100644 index 00000000..84bd2e37 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default.xml @@ -0,0 +1,32 @@ + + + + + + + + COM_PHOCADOWNLOAD_CATEGORY_LIST_LAYOUT + COM_PHOCADOWNLOAD_CATEGORY_LIST_LAYOUT_DESC + +
+ + +
+
+ + +
+ + + + + + + + + + + +
+
+
\ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_comments-fb.php b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_comments-fb.php new file mode 100644 index 00000000..970b397b --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_comments-fb.php @@ -0,0 +1,42 @@ +
$value) { + $uri->delVar($value); + } + } + + if ($this->t['fb_comment_app_id'] == '') { + echo JText::_('COM_PHOCADOWNLOAD_ERROR_FB_APP_ID_EMPTY'); + } else { + + $cCount = ''; + if ((int)$this->t['fb_comment_count'] > 0) { + $cCount = 'numposts="'.$this->t['fb_comment_count'].'"'; + } + +?> width="t['fb_comment_width'] ?>"> +
+ + +
diff --git a/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_files.php b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_files.php new file mode 100644 index 00000000..2252b7c3 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_files.php @@ -0,0 +1,441 @@ +files)) { + foreach ($this->files as $v) { + + if ($this->checkRights == 1) { + // USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - - + // ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users) + $rightDisplay = 0; + if (isset($v->catid) && isset($v->cataccessuserid) && isset($v->cataccess)) { + $rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $v->cataccessuserid, $v->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + } else { + $rightDisplay = 1; + } + + if ($rightDisplay == 1) { + + // General + $linkDownloadB = ''; + $linkDownloadE = ''; + if ((int)$v->confirm_license > 0 || $this->t['display_file_view'] == 1) { + $linkDownloadB = ''; // we need pagination to go back + $linkDownloadE =''; + } else { + if ($v->link_external != '' && $v->directlink == 1) { + $linkDownloadB = ''; + $linkDownloadE =''; + } else { + $linkDownloadB = ''; + $linkDownloadE =''; + } + } + + // pdtextonly + $pdTextOnly = '
'.$v->description.'
' . "\n"; + + // pdfile + if ($v->filename != '') { + $imageFileName = $l->getImageFileName($v->image_filename, $v->filename); + + $pdFile = '
'; + if ($this->t['filename_or_name'] == 'filenametitle') { + $pdFile .= '
'. $v->title . '
'; + } + + $pdFile .= '
'. $imageFileName['filenamethumb'] + . '
'; + + $pdFile .= '
'; + $pdFile .= $linkDownloadB .$l->getName($v->title, $v->filename) .$linkDownloadE; + $pdFile .= '
'; + + $pdFile .= PhocaDownloadRenderFront::displayNewIcon($v->date, $this->t['displaynew']); + $pdFile .= PhocaDownloadRenderFront::displayHotIcon($v->hits, $this->t['displayhot']); + + //Specific icons + if (isset($v->image_filename_spec1) && $v->image_filename_spec1 != '') { + $pdFile .= '
'.$l->getImageDownload($v->image_filename_spec1).'
'; + } + if (isset($v->image_filename_spec2) && $v->image_filename_spec2 != '') { + $pdFile .= '
'.$l->getImageDownload($v->image_filename_spec2).'
'; + } + + $pdFile .= '
' . "\n"; + } + + // pdbuttonplay + $pdButtonPlay = ''; + if (isset($v->filename_play) && $v->filename_play != '') { + $fileExt = PhocaDownloadFile::getExtension($v->filename_play); + $canPlay = PhocaDownloadFile::canPlay($v->filename_play); + + if ($canPlay) { + // Special height for music only + $buttonPlOptions = $this->t['buttonpl']->options; + if ($fileExt == 'mp3' || $fileExt == 'ogg') { + $buttonPlOptions = $this->t['buttonpl']->optionsmp3; + } + $playLink = JRoute::_(PhocaDownloadRoute::getFileRoute($v->id,$v->catid,$v->alias, $v->categoryalias,0, 'play').$this->t['limitstarturl']); + $pdButtonPlay .= '
'; + if ($this->t['play_popup_window'] == 1) { + $pdButtonPlay .= ''. JText::_('COM_PHOCADOWNLOAD_PLAY').''; + } else { + $pdButtonPlay .= ''. JText::_('COM_PHOCADOWNLOAD_PLAY').''; + } + $pdButtonPlay .= '
'; + } + } + + // pdbuttonpreview + $pdButtonPreview = ''; + if (isset($v->filename_preview) && $v->filename_preview != '') { + $fileExt = PhocaDownloadFile::getExtension($v->filename_preview); + if ($fileExt == 'pdf' || $fileExt == 'jpeg' || $fileExt == 'jpg' || $fileExt == 'png' || $fileExt == 'gif') { + + $filePath = PhocaDownloadPath::getPathSet('filepreview'); + $filePath = str_replace ( '../', JURI::base(true).'/', $filePath['orig_rel_ds']); + $previewLink = $filePath . $v->filename_preview; + $pdButtonPreview .= '
'; + + if ($this->t['preview_popup_window'] == 1) { + $pdButtonPreview .= ''. JText::_('COM_PHOCADOWNLOAD_PREVIEW').''; + } else { + if ($fileExt == 'pdf') { + // Iframe - modal + $pdButtonPreview .= ''. JText::_('COM_PHOCADOWNLOAD_PREVIEW').''; + } else { + // Image - modal + $pdButtonPreview .= ''. JText::_('COM_PHOCADOWNLOAD_PREVIEW').''; + } + } + $pdButtonPreview .= '
'; + } + } + + // pdbuttondownload + $pdButtonDownload = '
'; + $pdButtonDownload .= str_replace('class=""', 'class="btn btn-success"', $linkDownloadB) . JText::_('COM_PHOCADOWNLOAD_DOWNLOAD') .$linkDownloadE; + $pdButtonDownload .= '
'; + + + + // pdbuttondetails + $d = ''; + + $pdTitle = ''; + if ($v->title != '') { + $pdTitle .= '
'.$v->title.'
'; + $d .= $pdTitle; + } + + $pdImage = ''; + if ($v->image_download != '') { + $pdImage .= '
'.$l->getImageDownload($v->image_download).'
'; + $d .= $pdImage; + } + + $pdFileSize = ''; + $fileSize = $l->getFilesize($v->filename); + if ($fileSize != '') { + $pdFileSize .= '
'.JText::_('COM_PHOCADOWNLOAD_FILESIZE').':
'; + $pdFileSize .= '
'.$fileSize.'
'; + $d .= $pdFileSize; + } + + $pdVersion = ''; + if ($v->version != '') { + $pdVersion .= '
'.JText::_('COM_PHOCADOWNLOAD_VERSION').':
'; + $pdVersion .= '
'.$v->version.'
'; + $d .= $pdVersion; + } + + $pdLicense = ''; + if ($v->license != '') { + if ($v->license_url != '') { + $pdLicense .= '
'.JText::_('COM_PHOCADOWNLOAD_LICENSE').':
'; + $pdLicense .= ''; + } else { + $pdLicense .= '
'.JText::_('COM_PHOCADOWNLOAD_LICENSE').':
'; + $pdLicense .= '
'.$v->license.'
'; + } + $d .= $pdLicense; + } + + $pdAuthor = ''; + if ($v->author != '') { + if ($v->author_url != '') { + $pdAuthor .= '
'.JText::_('COM_PHOCADOWNLOAD_AUTHOR').':
'; + $pdAuthor .= ''; + } else { + $pdAuthor .= '
'.JText::_('COM_PHOCADOWNLOAD_AUTHOR').':
'; + $pdAuthor .= '
'.$v->author.'
'; + } + $d .= $pdAuthor; + } + + $pdAuthorEmail = ''; + if ($v->author_email != '') { + $pdAuthorEmail .= '
'.JText::_('COM_PHOCADOWNLOAD_EMAIL').':
'; + $pdAuthorEmail .= '
'. $l->getProtectEmail($v->author_email).'
'; + $d .= $pdAuthorEmail; + } + + $pdFileDate = ''; + $fileDate = $l->getFileDate($v->filename, $v->date); + if ($fileDate != '') { + $pdFileDate .= '
'.JText::_('COM_PHOCADOWNLOAD_DATE').':
'; + $pdFileDate .= '
'.$fileDate.'
'; + $d .= $pdFileDate; + } + + $pdDownloads = ''; + if ($this->t['display_downloads'] == 1) { + $pdDownloads .= '
'.JText::_('COM_PHOCADOWNLOAD_DOWNLOADS').':
'; + $pdDownloads .= '
'.$v->hits.' x
'; + $d .= $pdDownloads; + } + + $pdDescription = ''; + if ($l->isValueEditor($v->description) && $this->t['display_description'] != 1 & $this->t['display_description'] != 2 & $this->t['display_description'] != 3) { + $pdDescription .= '
'.$v->description.'
'; + $d .= $pdDescription; + } + + $pdFeatures = ''; + if ($l->isValueEditor($v->features)) { + $pdFeatures .= '
'.JText::_('COM_PHOCADOWNLOAD_FEATURES').'
'; + $pdFeatures .= '
'.$v->features.'
'; + } + + $pdChangelog = ''; + if ($l->isValueEditor($v->changelog)) { + $pdChangelog .= '
'.JText::_('COM_PHOCADOWNLOAD_CHANGELOG').'
'; + $pdChangelog .= '
'.$v->changelog.'
'; + } + + $pdNotes = ''; + if ($l->isValueEditor($v->notes)) { + $pdNotes .= '
'.JText::_('COM_PHOCADOWNLOAD_NOTES').'
'; + $pdNotes .= '
'.$v->notes.'
'; + } + + + // pdfiledesc + $description = $l->isValueEditor($v->description); + + $pdFileDescTop = ''; + $pdFileDescBottom = ''; + $oFileDesc = ''; + + if ($description) { + switch($this->t['display_description']) { + + case 1: + $pdFileDescTop = '
'.$v->description.'
'; + break; + case 2: + $pdFileDescBottom = '
'.$v->description.'
'; + break; + case 3: + $oFileDesc = '
'.$v->description.'
'; + break; + case 4: + $pdFileDescTop = '
'.$v->description.'
'; + $oFileDesc = '
'.PhocaDownloadUtils::strTrimAll($d).'
'; + break; + case 5: + $pdFileDescBottom = '
'.$v->description.'
'; + $oFileDesc = '
'.PhocaDownloadUtils::strTrimAll($d).'
'; + break; + case 6: + $pdFileDescTop = '
'.$d.'
'; + $oFileDesc = '
'.PhocaDownloadUtils::strTrimAll($d).'
'; + break; + case 7: + $pdFileDescBottom = '
'.$d.'
'; + $oFileDesc = '
'.PhocaDownloadUtils::strTrimAll($d).'
'; + break; + + case 8: + $oFileDesc = '
'.PhocaDownloadUtils::strTrimAll($d).'
'; + break; + + default: + break; + } + } + + // Detail Button + if ($this->t['display_detail'] == 1) { + if ($oFileDesc != '') { + $overlibcontent = $oFileDesc; + } else { + $overlibcontent = $d; + } + + $overlibcontent = str_replace('"', '\'', $overlibcontent); + $sA = array(utf8_encode(chr(11)), utf8_encode(chr(160))); + $eA = array("\t", "\n", "\r", "\0"); + $overlibcontent = str_replace($sA, ' ', $overlibcontent); + $overlibcontent = str_replace($eA, '', $overlibcontent); + + $textO = htmlspecialchars(addslashes('
'.$overlibcontent.'
')); + $overlib = "\n\n" ."onmouseover=\"return overlib('".$textO."', CAPTION, '".JText::_('COM_PHOCADOWNLOAD_DETAILS')."', BELOW, RIGHT, CSSCLASS, TEXTFONTCLASS, 'fontPhocaPDClass', FGCLASS, 'fgPhocaPDClass', BGCLASS, 'bgPhocaPDClass', CAPTIONFONTCLASS,'capfontPhocaPDClass', CLOSEFONTCLASS, 'capfontclosePhocaPDClass', STICKY, MOUSEOFF, CLOSETEXT, '".JText::_('COM_PHOCADOWNLOAD_CLOSE')."');\""; + $overlib .= " onmouseout=\"return nd();\"" . "\n"; + + $pdButtonDetails = '
'; + $pdButtonDetails .= ''. JText::_('COM_PHOCADOWNLOAD_DETAILS').''; + $pdButtonDetails .= '
'; + } else if ($this->t['display_detail'] == 2) { + $buttonDOptions = $this->t['buttond']->options; + $detailLink = JRoute::_(PhocaDownloadRoute::getFileRoute($v->id,$this->category[0]->id,$v->alias, $v->categoryalias, 0, 'detail').$this->t['limitstarturl']); + $pdButtonDetails = '
'; + $pdButtonDetails .= ''. JText::_('COM_PHOCADOWNLOAD_DETAILS').''; + $pdButtonDetails .= '
'; + } else { + $pdButtonDetails = ''; + } + + + // pdmirrorlink1 + $pdMirrorLink1 = ''; + $mirrorOutput1 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror1link, $v->mirror1title, $v->mirror1target); + if ($mirrorOutput1 != '') { + + if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) { + $classMirror = 'pd-button-mirror1'; + $mirrorOutput1 = str_replace('class=""', 'class="btn"', $mirrorOutput1); + } else { + $classMirror = 'pd-mirror'; + } + + $pdMirrorLink1 = '
'.$mirrorOutput1.'
'; + } + + // pdmirrorlink2 + $pdMirrorLink2 = ''; + $mirrorOutput2 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror2link, $v->mirror2title, $v->mirror2target); + if ($mirrorOutput2 != '') { + if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) { + $classMirror = 'pd-button-mirror2'; + $mirrorOutput2 = str_replace('class=""', 'class="btn"', $mirrorOutput2); + } else { + $classMirror = 'pd-mirror'; + } + + $pdMirrorLink2 = '
'.$mirrorOutput2.'
'; + } + + // pdreportlink + $pdReportLink = PhocaDownloadRenderFront::displayReportLink(1, $v->title); + + + // pdrating + $pdRating = PhocaDownloadRate::renderRateFile($v->id, $this->t['display_rating_file']); + + // pdtags + $pdTags = ''; + if ($this->t['display_tags_links'] == 1 || $this->t['display_tags_links'] == 3) { + if ($l->displayTags($v->id) != '') { + $pdTags .= $l->displayTags($v->id); + } + + } + + //pdvideo + $pdVideo = $l->displayVideo($v->video_filename, 0); + + + // --------------------------------------------------- + //Convert + // --------------------------------------------------- + if ($v->textonly == 1) { + echo '
'. $pdTextOnly . '
'; + } else { + + if ($this->t['display_specific_layout'] == 0) { + echo '
'; + echo $pdFileDescTop; + echo $pdFile; + echo '
'.$pdButtonDownload.'
'; + + if ($this->t['display_detail'] == 1 || $this->t['display_detail'] == 2) { + echo '
'.$pdButtonDetails.'
'; + } + + if ($this->t['display_preview'] == 1 && $pdButtonPreview != '') { + echo '
'.$pdButtonPreview.'
'; + } + + if ($this->t['display_play'] == 1 && $pdButtonPlay != '') { + echo '
'.$pdButtonPlay.'
'; + } + + if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) { + if ($pdMirrorLink2 != '') { + echo '
'.$pdMirrorLink2.'
'; + } + if ($pdMirrorLink1 != '') { + echo '
'.$pdMirrorLink1.'
'; + } + + } else if ($this->t['display_mirror_links'] == 1 || $this->t['display_mirror_links'] == 3) { + echo '
'.$pdMirrorLink2.$pdMirrorLink1.'
'; + } + + if ($pdVideo != '') { + echo '
'.$pdVideo.'
'; + } + + if ($pdReportLink != '') { + echo '
'.$pdReportLink.'
'; + } + + if ($pdRating != '') { + echo '
'.$pdRating.'
'; + } + + if ($pdTags != '') { + echo '
'.$pdTags.'
'; + } + echo $pdFileDescBottom; + echo '
'; + echo '
'; + + } else { + + /*$categoryLayout = '
+ {pdfiledesctop} + {pdfile} +
{pdbuttondownload}
+
{pdbuttondetails}
+
{pdbuttonpreview}
+
{pdbuttonplay}
+
{pdmirrorlink2} {pdmirrorlink1}
+
{pdrating}
+
{pdtags}
+ {pdfiledescbottom} +
+
';*/ + + $categoryLayout = PhocaDownloadSettings::getLayoutText('category'); + $categoryLayoutParams = PhocaDownloadSettings::getLayoutParams('category'); + + $replace = array($pdTitle, $pdImage, $pdFile, $pdFileSize, $pdVersion, $pdLicense, $pdAuthor, $pdAuthorEmail, $pdFileDate, $pdDownloads, $pdDescription, $pdFeatures, $pdChangelog, $pdNotes, $pdMirrorLink1, $pdMirrorLink2, $pdReportLink, $pdRating, $pdTags, $pdFileDescTop, $pdFileDescBottom, $pdButtonDownload, $pdButtonDetails, $pdButtonPreview, $pdButtonPlay, $pdVideo ); + $output = str_replace($categoryLayoutParams['search'], $replace, $categoryLayout); + + echo $output; + } + // --------------------------------------------------- + } + } + } +} +?> diff --git a/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_pagination.php b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_pagination.php new file mode 100644 index 00000000..825b50ee --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/default_pagination.php @@ -0,0 +1,33 @@ +t['action'] = str_replace('&', '&', $this->t['action']); +//$this->t['action'] = str_replace('&', '&', $this->t['action']); +$this->t['action'] = htmlspecialchars($this->t['action']); + +echo '
'. "\n"; +echo '
 
'; +echo '
'. "\n"; + +//echo ''; +echo JHTML::_( 'form.token' ); +echo '
'; +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/category/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/category/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/category/view.html.php b/packages/phocadownload/components/com_phocadownload/views/category/view.html.php new file mode 100644 index 00000000..55e3f42b --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/category/view.html.php @@ -0,0 +1,301 @@ +t['p'] = $app->getParams(); + $this->t['user'] = JFactory::getUser(); + $uri = JFactory::getURI(); + $model = $this->getModel(); + $document = JFactory::getDocument(); + $this->t['categoryid'] = $app->input->get( 'id', 0, 'int' ); + $this->t['tagid'] = $app->input->get( 'tagid', 0, 'int' ); + $limitStart = $app->input->get( 'limitstart', 0, 'int' ); + $this->t['mediapath'] = PhocaDownloadPath::getPathMedia(); + + $this->category = $model->getCategory($this->t['categoryid']); + $this->subcategories = $model->getSubcategories($this->t['categoryid']); + $this->files = $model->getFileList($this->t['categoryid'], $this->t['tagid']); + $this->t['pagination'] = $model->getPagination($this->t['categoryid'], $this->t['tagid']); + + PhocaDownloadRenderFront::renderAllCSS(); + $document->addCustomTag(''); + + if ($limitStart > 0 ) { + $this->t['limitstarturl'] = '&start='.$limitStart; + } else { + $this->t['limitstarturl'] = ''; + } + + $this->t['download_external_link'] = $this->t['p']->get( 'download_external_link', '_self' ); + $this->t['filename_or_name'] = $this->t['p']->get( 'filename_or_name', 'filenametitle' ); + $this->t['display_downloads'] = $this->t['p']->get( 'display_downloads', 0 ); + $this->t['display_description'] = $this->t['p']->get( 'display_description', 3 ); + $this->t['display_detail'] = $this->t['p']->get( 'display_detail', 1 ); + $this->t['display_play'] = $this->t['p']->get( 'display_play', 0 ); + $this->t['playerwidth'] = $this->t['p']->get( 'player_width', 328 ); + $this->t['playerheight'] = $this->t['p']->get( 'player_height', 200 ); + $this->t['playermp3height'] = $this->t['p']->get( 'player_mp3_height', 30 ); + $this->t['previewwidth'] = $this->t['p']->get( 'preview_width', 640 ); + $this->t['previewheight'] = $this->t['p']->get( 'preview_height', 480 ); + $this->t['display_preview'] = $this->t['p']->get( 'display_preview', 0 ); + $this->t['play_popup_window'] = $this->t['p']->get( 'play_popup_window', 0 ); + $this->t['preview_popup_window'] = $this->t['p']->get( 'preview_popup_window', 0 ); + $this->t['file_icon_size'] = $this->t['p']->get( 'file_icon_size', 16 ); + $this->t['displaynew'] = $this->t['p']->get( 'display_new', 0 ); + $this->t['displayhot'] = $this->t['p']->get( 'display_hot', 0 ); + $this->t['display_up_icon'] = $this->t['p']->get( 'display_up_icon', 1 ); + $this->t['allowed_file_types'] = $this->t['p']->get( 'allowed_file_types', '' ); + $this->t['disallowed_file_types'] = $this->t['p']->get( 'disallowed_file_types', '' ); + $this->t['enable_user_statistics'] = $this->t['p']->get( 'enable_user_statistics', 1 ); + $this->t['display_category_comments']= $this->t['p']->get( 'display_category_comments', 0 ); + $this->t['display_date_type'] = $this->t['p']->get( 'display_date_type', 0 ); + $this->t['display_file_view'] = $this->t['p']->get('display_file_view', 0); + $this->t['download_metakey'] = $this->t['p']->get( 'download_metakey', '' ); + $this->t['download_metadesc'] = $this->t['p']->get( 'download_metadesc', '' ); + $this->t['display_rating_file'] = $this->t['p']->get( 'display_rating_file', 0 ); + $this->t['display_mirror_links'] = $this->t['p']->get( 'display_mirror_links', 0 ); + $this->t['display_report_link'] = $this->t['p']->get( 'display_report_link', 0 ); + $this->t['send_mail_download'] = $this->t['p']->get( 'send_mail_download', 0 );// not boolean but id of user + //$this->t['send_mail_upload'] = $this->t['p']->get( 'send_mail_upload', 0 ); + $this->t['display_tags_links'] = $this->t['p']->get( 'display_tags_links', 0 ); + $this->t['display_specific_layout'] = $this->t['p']->get( 'display_specific_layout', 0 ); + $this->t['fb_comment_app_id'] = $this->t['p']->get( 'fb_comment_app_id', '' ); + $this->t['fb_comment_width'] = $this->t['p']->get( 'fb_comment_width', '550' ); + $this->t['fb_comment_lang'] = $this->t['p']->get( 'fb_comment_lang', 'en_US' ); + $this->t['fb_comment_count'] = $this->t['p']->get( 'fb_comment_count', '' ); + $this->t['html5_play'] = $this->t['p']->get( 'html5_play', 0 ); + + + // Rating + if ($this->t['display_rating_file'] == 1 || $this->t['display_rating_file'] == 3) { + JHTML::_('behavior.framework', true); + PhocaDownloadRate::renderRateFileJS(1); + $this->t['display_rating_file'] = 1; + } else { + $this->t['display_rating_file'] = 0; + } + + $this->t['dg'] = PhocaDownloadRenderFront::renderPhocaDownload(); + + // DOWNLOAD + // - - - - - - - - - - - - - - - + $download = $app->input->get( 'download', array(0),'array' ); + $downloadId = (int) $download[0]; + if ($downloadId > 0) { + if (isset($this->category[0]->id) && (int)$this->category[0]->id > 0 ) { + $currentLink = 'index.php?option=com_phocadownload&view=category&id='.$this->category[0]->id.':'.$this->category[0]->alias.$this->t['limitstarturl'] . '&Itemid='. $app->input->get('Itemid', 0, 'int'); + } else { + $currentLink = $uri; + } + $fileData = PhocaDownloadDownload::getDownloadData($downloadId, $currentLink); + PhocaDownloadDownload::download($fileData, $downloadId, $currentLink); + } + // - - - - - - - - - - - - - - - + + // DETAIL + // - - - - - - - - - - - - - - - + if ($this->t['display_detail'] == 2) { + $this->t['buttond'] = new JObject(); + $this->t['buttond']->set('methodname', 'modal-button'); + $this->t['buttond']->set('name', 'detail'); + $this->t['buttond']->set('modal', true); + $this->t['buttond']->set('options', "{handler: 'iframe', size: {x: 600, y: 500}, overlayOpacity: 0.7, classWindow: 'phocadownloaddetailwindow', classOverlay: 'phocadownloaddetailoverlay'}"); + } + + JHTML::_('behavior.modal', 'a.pd-modal-button'); + // PLAY - - - - - - - - - - - - + $windowWidthPl = (int)$this->t['playerwidth'] + 20; + $windowHeightPl = (int)$this->t['playerheight'] + 20; + + if ($this->t['html5_play'] == 1) { + $windowWidthPl = (int)$this->t['playerwidth'] + 40; + } else { + $windowWidthPl = (int)$this->t['playerwidth'] + 50; + } + $windowHeightPlMP3 = (int)$this->t['playermp3height'] + 20; + if ($this->t['play_popup_window'] == 1) { + $this->t['buttonpl'] = new JObject(); + $this->t['buttonpl']->set('methodname', 'js-button'); + $this->t['buttonpl']->set('options', "window.open(this.href,'win2','width=".$windowWidthPl.",height=".$windowHeightPl.",scrollbars=yes,menubar=no,resizable=yes'); return false;"); + $this->t['buttonpl']->set('optionsmp3', "window.open(this.href,'win2','width=".$windowWidthPl.",height=".$windowHeightPlMP3.",scrollbars=yes,menubar=no,resizable=yes'); return false;"); + } else { + $document->addCustomTag( " \n"); + $this->t['buttonpl'] = new JObject(); + $this->t['buttonpl']->set('name', 'image'); + $this->t['buttonpl']->set('modal', true); + $this->t['buttonpl']->set('methodname', 'modal-button'); + $this->t['buttonpl']->set('options', "{handler: 'iframe', size: {x: ".$windowWidthPl.", y: ".$windowHeightPl."}, overlayOpacity: 0.7, classWindow: 'phocadownloadplaywindow', classOverlay: 'phocadownloadplayoverlay'}"); + $this->t['buttonpl']->set('optionsmp3', "{handler: 'iframe', size: {x: ".$windowWidthPl.", y: ".$windowHeightPlMP3."}, overlayOpacity: 0.7, classWindow: 'phocadownloadplaywindow', classOverlay: 'phocadownloadplayoverlay'}"); + } + // - - - - - - - - - - - - - - - + // PREVIEW - - - - - - - - - - - - + $windowWidthPr = (int)$this->t['previewwidth'] + 20; + $windowHeightPr = (int)$this->t['previewheight'] + 20; + if ($this->t['preview_popup_window'] == 1) { + $this->t['buttonpr'] = new JObject(); + $this->t['buttonpr']->set('methodname', 'js-button'); + $this->t['buttonpr']->set('options', "window.open(this.href,'win2','width=".$windowWidthPr.",height=".$windowHeightPr.",scrollbars=yes,menubar=no,resizable=yes'); return false;"); + } else { + $document->addCustomTag( " \n"); + $this->t['buttonpr'] = new JObject(); + $this->t['buttonpr']->set('name', 'image'); + $this->t['buttonpr']->set('modal', true); + $this->t['buttonpr']->set('methodname', 'modal-button'); + $this->t['buttonpr']->set('options', "{handler: 'iframe', size: {x: ".$windowWidthPr.", y: ".$windowHeightPr."}, overlayOpacity: 0.7, classWindow: 'phocadownloadpreviewwindow', classOverlay: 'phocadownloadpreviewoverlay'}"); + $this->t['buttonpr']->set('optionsimg', "{handler: 'image', size: {x: 200, y: 150}, overlayOpacity: 0.7, classWindow: 'phocadownloadpreviewwindow', classOverlay: 'phocadownloadpreviewoverlay'}"); + } + // - - - - - - - - - - - - - - - + + $imagePath = PhocaDownloadPath::getPathSet('icon'); + $this->t['cssimgpath'] = str_replace ( '../', JURI::base(true).'/', $imagePath['orig_rel_ds']); + $filePath = PhocaDownloadPath::getPathSet('file'); + $this->t['absfilepath'] = $filePath['orig_abs_ds']; + $this->t['action'] = $uri->toString(); + + if (isset($this->category[0]) && is_object($this->category[0])){ + $this->_prepareDocument($this->category[0]); + } + + parent::display($tpl); + + } + + protected function _prepareDocument($category) { + + $app = JFactory::getApplication(); + $menus = $app->getMenu(); + $pathway = $app->getPathway(); + //$this->t['p'] = &$app->getParams(); + $title = null; + + $this->t['downloadmetakey'] = $this->t['p']->get( 'download_metakey', '' ); + $this->t['downloadmetadesc'] = $this->t['p']->get( 'download_metadesc', '' ); + + + $menu = $menus->getActive(); + if ($menu) { + $this->t['p']->def('page_heading', $this->t['p']->get('page_title', $menu->title)); + } else { + $this->t['p']->def('page_heading', JText::_('JGLOBAL_ARTICLES')); + } + + /* + $title = $this->t['p']->get('page_title', ''); + + if (empty($title) || (isset($title) && $title == '')) { + $title = $this->item->title; + } + + if (empty($title) || (isset($title) && $title == '')) { + $title = htmlspecialchars_decode($app->getCfg('sitename')); + } else if ($app->getCfg('sitename_pagetitles', 0)) { + $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title); + } + //$this->document->setTitle($title); + + + $this->document->setTitle($title);*/ + + $title = $this->t['p']->get('page_title', ''); + $this->tmpl['display_cat_name_title'] = 1; + if (empty($title)) { + $title = htmlspecialchars_decode($app->getCfg('sitename')); + } else if ($app->getCfg('sitename_pagetitles', 0) == 1) { + $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title); + + if ($this->tmpl['display_cat_name_title'] == 1 && isset($category->title) && $category->title != '') { + $title = $title .' - ' . $category->title; + } + + } else if ($app->getCfg('sitename_pagetitles', 0) == 2) { + + if ($this->tmpl['display_cat_name_title'] == 1 && isset($category->title) && $category->title != '') { + $title = $title .' - ' . $category->title; + } + + $title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('sitename'))); + } + $this->document->setTitle($title); + + if ($category->metadesc != '') { + $this->document->setDescription($category->metadesc); + } else if ($this->t['downloadmetadesc'] != '') { + $this->document->setDescription($this->t['downloadmetadesc']); + } else if ($this->t['p']->get('menu-meta_description', '')) { + $this->document->setDescription($this->t['p']->get('menu-meta_description', '')); + } + + if ($category->metakey != '') { + $this->document->setMetadata('keywords', $category->metakey); + } else if ($this->t['downloadmetakey'] != '') { + $this->document->setMetadata('keywords', $this->t['downloadmetakey']); + } else if ($this->t['p']->get('menu-meta_keywords', '')) { + $this->document->setMetadata('keywords', $this->t['p']->get('menu-meta_keywords', '')); + } + + if ($app->getCfg('MetaTitle') == '1' && $this->t['p']->get('menupage_title', '')) { + $this->document->setMetaData('title', $this->t['p']->get('page_title', '')); + } + + // Breadcrumbs TODO (Add the whole tree) + /*$pathway = $app->getPathway(); + if (isset($this->category[0]->parentid)) { + if ($this->category[0]->parentid == 0) { + // $pathway->addItem( JText::_('COM_PHOCADOWNLOAD_CATEGORIES'), JRoute::_(PhocaDownloadRoute::getCategoriesRoute())); + } else if ($this->category[0]->parentid > 0) { + $pathway->addItem($this->category[0]->parenttitle, JRoute::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->parentid, $this->category[0]->parentalias))); + } + } + + if (!empty($this->category[0]->title)) { + $pathway->addItem($this->category[0]->title); + }*/ + + // Breadcrumbs TODO (Add the whole tree) + $pathway = $app->getPathway(); + if (isset($this->category[0]->parentid)) { + if ($this->category[0]->parentid == 0) { + // $pathway->addItem( JText::_('COM_PHOCADOWNLOAD_CATEGORIES'), JRoute::_(PhocaDownloadRoute::getCategoriesRoute())); + } else if ($this->category[0]->parentid > 0) { + $curpath = $pathway->getPathwayNames(); + if($this->category[0]->parenttitle != $curpath[count($curpath)-1]){ + $pathway->addItem($this->category[0]->parenttitle, JRoute::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->parentid, $this->category[0]->parentalias))); + } + } + } + + if (!empty($this->category[0]->title)) { + $curpath = $pathway->getPathwayNames(); + if($this->category[0]->title != $curpath[count($curpath)-1]){ + $pathway->addItem($this->category[0]->title); + } + } + + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/download/index.html b/packages/phocadownload/components/com_phocadownload/views/download/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/download/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/download/metadata.xml b/packages/phocadownload/components/com_phocadownload/views/download/metadata.xml new file mode 100644 index 00000000..81b20c70 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/download/metadata.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/download/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/download/tmpl/default.php new file mode 100644 index 00000000..86c2404a --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/download/tmpl/default.php @@ -0,0 +1,429 @@ +t['p']->get( 'pageclass_sfx' ).'" >'; +echo '
'; + +if ($this->t['found'] == 1) { + if(isset($this->file[0]->id) && (int)$this->file[0]->id > 0 && isset($this->file[0]->token) && $this->file[0]->token != '') { + + $v = $this->file[0]; + $downloadLink = PhocaDownloadRoute::getDownloadRoute((int)$v->id, (int)$v->catid, $v->token); + $l = new PhocaDownloadLayout(); + + //echo '

'.$l->getName($v->title, $v->filename, 1). '

'; + + $pdTitle = ''; + if ($v->title != '') { + $pdTitle .= '
'.$v->title.'
'; + } + + $pdImage = ''; + if ($v->image_download != '') { + $pdImage .= '
'.$l->getImageDownload($v->image_download).'
'; + } + + if ($v->filename != '') { + $imageFileName = $l->getImageFileName($v->image_filename, $v->filename); + + $pdFile = '
'; + if ($this->t['filename_or_name'] == 'filenametitle') { + $pdFile .= '
'. $v->title . '
'; + } + + $pdFile .= '
'. $imageFileName['filenamethumb'] + . '
'; + + $pdFile .= '
'; + $pdFile .= $l->getName($v->title, $v->filename); + $pdFile .= '
'; + + $pdFile .= PhocaDownloadRenderFront::displayNewIcon($v->date, $this->t['displaynew']); + $pdFile .= PhocaDownloadRenderFront::displayHotIcon($v->hits, $this->t['displayhot']); + + //Specific icons + if (isset($v->image_filename_spec1) && $v->image_filename_spec1 != '') { + $pdFile .= '
'.$l->getImageDownload($v->image_filename_spec1).'
'; + } + if (isset($v->image_filename_spec2) && $v->image_filename_spec2 != '') { + $pdFile .= '
'.$l->getImageDownload($v->image_filename_spec2).'
'; + } + + $pdFile .= '
' . "\n"; + } + echo ''; + + } +} else { + echo '
'.JText::_('COM_PHOCADOWNLOAD_FILE_NOT_FOUND').'
'; +} + +/* +if ( $this->t['p']->get( 'show_page_heading' ) ) { + echo '

'. $this->escape($this->t['p']->get('page_heading')) . '

'; +} + +if (!empty($this->category[0])) { + echo '
'; + if ($this->t['display_up_icon'] == 1 && $this->t['tmplr'] == 0) { + + if (isset($this->category[0]->id)) { + if ($this->category[0]->id > 0) { + $linkUp = JRoute::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->id, $this->category[0]->alias)); + $linkUpText = $this->category[0]->title; + } else { + $linkUp = '#'; + $linkUpText = ''; + } + echo ''; + } + } +} else { + +} + + +if (!empty($this->file[0])) { + $v = $this->file[0]; + + // USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - - + // ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users) + $rightDisplay = 0; + if (!empty($this->category[0])) { + $rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $v->cataccessuserid, $v->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + + if ($rightDisplay == 1) { + + $l = new PhocaDownloadLayout(); + + echo '

'.$l->getName($v->title, $v->filename, 1). '

'; + + +// ===================================================================================== +// BEGIN LAYOUT AREA +// ===================================================================================== + + // Is this direct menu link to File View + $directFv = 0; + $app = JFactory::getApplication(); + $itemId = $app->input->get('Itemid', 0, 'int'); + $menu = $app->getMenu(); + $item = $menu->getItem($itemId); + if (isset($item->query['view']) && $item->query['view'] == 'file') { + $directFv = 1; + } + // End direct menu link to File View + + if ((int)$this->t['display_file_view'] == 1 + || (int)$this->t['display_file_view'] == 2 + || (int)$v->confirm_license > 0 + || (int)$this->t['display_detail'] == 2 + || (int)$directFv == 1) { + + $pdTitle = ''; + if ($v->title != '') { + $pdTitle .= '
'.$v->title.'
'; + } + + $pdImage = ''; + if ($v->image_download != '') { + $pdImage .= '
'.$l->getImageDownload($v->image_download).'
'; + } + + $pdVideo = ''; + $pdVideo = $l->displayVideo($v->video_filename, 1); + + if ($v->filename != '') { + $imageFileName = $l->getImageFileName($v->image_filename, $v->filename); + + $pdFile = '
'; + if ($this->t['filename_or_name'] == 'filenametitle') { + $pdFile .= '
'. $v->title . '
'; + } + + $pdFile .= '
'. $imageFileName['filenamethumb'] + . '
'; + + $pdFile .= '
'; + $pdFile .= $l->getName($v->title, $v->filename); + $pdFile .= '
'; + + $pdFile .= PhocaDownloadRenderFront::displayNewIcon($v->date, $this->t['displaynew']); + $pdFile .= PhocaDownloadRenderFront::displayHotIcon($v->hits, $this->t['displayhot']); + + //Specific icons + if (isset($v->image_filename_spec1) && $v->image_filename_spec1 != '') { + $pdFile .= '
'.$l->getImageDownload($v->image_filename_spec1).'
'; + } + if (isset($v->image_filename_spec2) && $v->image_filename_spec2 != '') { + $pdFile .= '
'.$l->getImageDownload($v->image_filename_spec2).'
'; + } + + $pdFile .= '
' . "\n"; + } + + $pdFileSize = ''; + $fileSize = $l->getFilesize($v->filename); + if ($fileSize != '') { + $pdFileSize .= '
'.JText::_('COM_PHOCADOWNLOAD_FILESIZE').':
'; + $pdFileSize .= '
'.$fileSize.'
'; + } + + $pdVersion = ''; + if ($v->version != '') { + $pdVersion .= '
'.JText::_('COM_PHOCADOWNLOAD_VERSION').':
'; + $pdVersion .= '
'.$v->version.'
'; + } + + $pdLicense = ''; + if ($v->license != '') { + if ($v->license_url != '') { + $pdLicense .= '
'.JText::_('COM_PHOCADOWNLOAD_LICENSE').':
'; + $pdLicense .= ''; + } else { + $pdLicense .= '
'.JText::_('COM_PHOCADOWNLOAD_LICENSE').':
'; + $pdLicense .= '
'.$v->license.'
'; + } + } + + $pdAuthor = ''; + if ($v->author != '') { + if ($v->author_url != '') { + $pdAuthor .= '
'.JText::_('COM_PHOCADOWNLOAD_AUTHOR').':
'; + $pdAuthor .= ''; + } else { + $pdAuthor .= '
'.JText::_('COM_PHOCADOWNLOAD_AUTHOR').':
'; + $pdAuthor .= '
'.$v->author.'
'; + } + } + + $pdAuthorEmail = ''; + if ($v->author_email != '') { + $pdAuthorEmail .= '
'.JText::_('COM_PHOCADOWNLOAD_EMAIL').':
'; + $pdAuthorEmail .= '
'. $l->getProtectEmail($v->author_email).'
'; + } + + $pdFileDate = ''; + $fileDate = $l->getFileDate($v->filename, $v->date); + if ($fileDate != '') { + $pdFileDate .= '
'.JText::_('COM_PHOCADOWNLOAD_DATE').':
'; + $pdFileDate .= '
'.$fileDate.'
'; + } + + $pdDownloads = ''; + if ($this->t['display_downloads'] == 1) { + $pdDownloads .= '
'.JText::_('COM_PHOCADOWNLOAD_DOWNLOADS').':
'; + $pdDownloads .= '
'.$v->hits.' x
'; + } + + $pdDescription = ''; + if ($l->isValueEditor($v->description)) { + $pdDescription .= '
'.$v->description.'
'; + } + + $pdFeatures = ''; + if ($l->isValueEditor($v->features)) { + $pdFeatures .= '
'.JText::_('COM_PHOCADOWNLOAD_FEATURES').'
'; + $pdFeatures .= '
'.$v->features.'
'; + } + + $pdChangelog = ''; + if ($l->isValueEditor($v->changelog)) { + $pdChangelog .= '
'.JText::_('COM_PHOCADOWNLOAD_CHANGELOG').'
'; + $pdChangelog .= '
'.$v->changelog.'
'; + } + + $pdNotes = ''; + if ($l->isValueEditor($v->notes)) { + $pdNotes .= '
'.JText::_('COM_PHOCADOWNLOAD_NOTES').'
'; + $pdNotes .= '
'.$v->notes.'
'; + } + + + // pdmirrorlink1 + $pdMirrorLink1 = ''; + $mirrorOutput1 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror1link, $v->mirror1title, $v->mirror1target); + if ($mirrorOutput1 != '') { + + if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) { + $classMirror = 'pd-button-mirror1'; + } else { + $classMirror = 'pd-mirror'; + } + + $pdMirrorLink1 = '
'.$mirrorOutput1.'
'; + } + + // pdmirrorlink2 + $pdMirrorLink2 = ''; + $mirrorOutput2 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror2link, $v->mirror2title, $v->mirror2target); + if ($mirrorOutput2 != '') { + if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) { + $classMirror = 'pd-button-mirror2'; + } else { + $classMirror = 'pd-mirror'; + } + + $pdMirrorLink2 = '
'.$mirrorOutput2.'
'; + } + + // pdreportlink + $pdReportLink = PhocaDownloadRenderFront::displayReportLink(1, $v->title); + + + // pdrating + $pdRating = PhocaDownloadRate::renderRateFile($v->id, $this->t['display_rating_file']); + + // pdtags + $pdTags = ''; + if ($this->t['display_tags_links'] == 2 || $this->t['display_tags_links'] == 3) { + if ($l->displayTags($v->id) != '') { + $pdTags .= $l->displayTags($v->id); + } + + } + + + // --------------------------------------------------- + //Convert + // --------------------------------------------------- + if ($this->t['display_specific_layout'] == 0) { + echo '
'; + //echo $pdTitle; + echo $pdImage; + echo $pdFile; + echo $pdFileSize; + echo $pdVersion; + echo $pdLicense; + echo $pdAuthor; + echo $pdAuthorEmail; + echo $pdFileDate; + echo $pdDownloads; + echo $pdDescription; + echo $pdFeatures; + echo $pdChangelog; + echo $pdNotes; + if ($this->t['display_mirror_links'] == 5 || $this->t['display_mirror_links'] == 6) { + echo '
'.$pdMirrorLink2.'
'; + echo '
'.$pdMirrorLink1.'
'; + } else if ($this->t['display_mirror_links'] == 2 || $this->t['display_mirror_links'] == 3) { + echo '
'.$pdMirrorLink2.$pdMirrorLink1.'
'; + } + + echo '
'.$pdReportLink.'
'; + echo '
'.$pdRating.'
'; + echo '
'.$pdTags.'
'; + echo '
'.$pdVideo.'
'; + echo '
'; + echo '
'; + } else { + + /*$fileLayout = '
+ {pdimage} + {pdfile} + {pdfilesize} + {pdversion} + {pdlicense} + {pdauthor} + {pdauthoremail} + {pdfiledate} + {pddownloads} + {pddescription} + {pdfeatures} + {pdchangelog} + {pdnotes} +
{pdmirrorlink2} {pdmirrorlink1}
+
{pdreportlink}
+
{pdrating}
+
{pdtags}
+
+
'; + + + $fileLayout = PhocaDownloadSettings::getLayoutText('file'); + $fileLayoutParams = PhocaDownloadSettings::getLayoutParams('file'); + + $replace = array($pdTitle, $pdImage, $pdFile, $pdFileSize, $pdVersion, $pdLicense, $pdAuthor, $pdAuthorEmail, $pdFileDate, $pdDownloads, $pdDescription, $pdFeatures, $pdChangelog, $pdNotes, $pdMirrorLink1, $pdMirrorLink2, $pdReportLink, $pdRating, $pdTags, $pdVideo); + $output = str_replace($fileLayoutParams['search'], $replace, $fileLayout); + + echo $output; + } + + // --------------------------------------------------- + + + $o = '
 
'; + + if ((int)$v->confirm_license > 0) { + $o .= '

'.JText::_('COM_PHOCADOWNLOAD_LICENSE_AGREEMENT').'

'; + $o .= '
'.$v->licensetext.'
'; + + // External link + if ($v->link_external != '' && $v->directlink == 1) { + $o .= '
'; + $o .= ' '.JText::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').' '; + $o .= ''; + } else { + $o .= ''; + $o .= ' '.JText::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').' '; + $o .= ''; + $o .= ''; + $o .= ''; + } + $o .= '
'; + + // For users who have disabled Javascript + $o .= ''; + } else { + // External link + if ($v->link_external != '') { + $o .= '
'; + $o .= ''; + } else { + $o .= ''; + $o .= ''; + $o .= ''; + $o .= ''; + $o .= ''; + } + $o .= '
'; + } + + + if ($this->t['display_file_comments'] == 1) { + if (JComponentHelper::isEnabled('com_jcomments', true)) { + include_once(JPATH_BASE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php'); + $o .= JComments::showComments($v->id, 'com_phocadownload_files', JText::_('COM_PHOCADOWNLOAD_FILE') .' '. $v->title); + } + } + + if ($this->t['display_file_comments'] == 2) { + $o .= '
'.$this->loadTemplate('comments-fb').'
'; + } + + echo $o; + + } else { + echo '

'.JText::_('COM_PHOCADOWNLOAD_FILE') .'

'; + echo '
'.JText::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY').'
'; + } + } + echo '
 
';// end of box +} else { + echo '
 
'; +} + +*/ + +echo '
 
'. $this->t['pw']; +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/download/tmpl/default.xml b/packages/phocadownload/components/com_phocadownload/views/download/tmpl/default.xml new file mode 100644 index 00000000..d9e6ab07 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/download/tmpl/default.xml @@ -0,0 +1,13 @@ + + + + + + + + + COM_PHOCADOWNLOAD_DOWNLOAD_LAYOUT + COM_PHOCADOWNLOAD_DOWNLOAD_LAYOUT_DESC + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/download/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/download/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/download/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/download/view.html.php b/packages/phocadownload/components/com_phocadownload/views/download/view.html.php new file mode 100644 index 00000000..ba46a330 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/download/view.html.php @@ -0,0 +1,223 @@ +t['p'] = $app->getParams(); + $this->t['user'] = JFactory::getUser(); + $uri = JFactory::getURI(); + $model = $this->getModel(); + $document = JFactory::getDocument(); + $downloadToken = $app->input->get('id', '', 'string');// Token string + $this->t['limitstart'] = $app->input->get( 'start', 0, 'int');// we need it for category back link + $this->t['tmpl'] = $app->input->get( 'tmpl', '', 'string' ); + $this->t['mediapath'] = PhocaDownloadPath::getPathMedia(); + + $this->t['tmplr'] = 0; + if ($this->t['tmpl'] == 'component') { + $this->t['tmplr'] = 1; + } + + if ($this->t['limitstart'] > 0 ) { + $this->t['limitstarturl'] = '&start='.$this->t['limitstart']; + } else { + $this->t['limitstarturl'] = ''; + } + + //$this->category = $model->getCategory($fileId); + //$this->file = $model->getFile($fileId, $this->t['limitstarturl']); + + // Params + $this->t['licenseboxheight'] = $this->t['p']->get( 'license_box_height', 300 ); + $this->t['filename_or_name'] = $this->t['p']->get( 'filename_or_name', 'filename' ); + $this->t['allowed_file_types'] = $this->t['p']->get( 'allowed_file_types', '' ); + $this->t['disallowed_file_types'] = $this->t['p']->get( 'disallowed_file_types', '' ); + $this->t['enable_user_statistics'] = $this->t['p']->get( 'enable_user_statistics', 1 ); + $this->t['file_icon_size'] = $this->t['p']->get( 'file_icon_size', 16 ); + $this->t['pw'] = PhocaDownloadRenderFront::renderPhocaDownload(); + $this->t['download_external_link'] = $this->t['p']->get( 'download_external_link', '_self' ); + $this->t['display_report_link'] = $this->t['p']->get( 'display_report_link', 0 ); + $this->t['send_mail_download'] = $this->t['p']->get( 'send_mail_download', 0 );// not boolean but id of user + $this->t['display_specific_layout'] = $this->t['p']->get( 'display_specific_layout', 0 ); + $this->t['displaynew'] = $this->t['p']->get( 'display_new', 0 ); + $this->t['displayhot'] = $this->t['p']->get( 'display_hot', 0 ); + $this->t['enable_token_download'] = $this->t['p']->get( 'enable_token_download', 0 ); + + PhocaDownloadRenderFront::renderAllCSS(); + + $this->t['found'] = 0; + if ($this->t['enable_token_download'] == 0) { + $this->t['found'] = 0; + } else if ($downloadToken == '') { + $this->t['found'] = 0; + + } else { + $this->file = $model->getFile($downloadToken); + if(isset($this->file[0]->id) && (int)$this->file[0]->id > 0 && isset($this->file[0]->token) && $this->file[0]->token != '') { + $this->t['found'] = 1; + } + + + /*$document->addCustomTag(''); + $js = 'var enableDownloadButtonPD = 0;' + .'function enableDownloadPD() {' + .' if (enableDownloadButtonPD == 0) {' + .' document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=false;' + .' enableDownloadButtonPD = 1;' + .' } else {' + .' document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=true;' + .' enableDownloadButtonPD = 0;' + .' }' + .'}'; + $document->addScriptDeclaration($js);*/ + + + + + + + + // DOWNLOAD + // - - - - - - - - - - - - - - - + $download = $app->input->get( 'download', 0, 'int' ); + //$licenseAgree = $app->input->get( 'license_agree', '', 'string' ); + $downloadId = (int) $this->file[0]->id; + if ($download == 1) { + if (isset($this->file[0]->id)) { + $currentLink = 'index.php?option=com_phocadownload&view=download&id='.htmlspecialchars($downloadToken). $this->t['limitstarturl'] . '&Itemid='. $app->input->get('Itemid', 0, 'int'); + } else { + $currentLink = 'index.php?option=com_phocadownload&view=categories&Itemid='. $app->input->get('Itemid', 0, 'int'); + } + + // Check Token + $token = JSession::getFormToken(); + if (!JRequest::getInt( $token, 0, 'get' )) { + //JError::raiseError(403, 'Request Forbidden'); + $app->redirect(JRoute::_('index.php', false), JText::_('COM_PHOCADOWNLOAD_INVALID_TOKEN')); + exit; + } + + // Check License Agreement + /*if (empty($licenseAgree)) { + $app->redirect(JRoute::_($currentLink, false), JText::_('COM_PHOCADOWNLOAD_WARNING_AGREE_LICENSE_TERMS')); + exit; + }*/ + + $fileData = PhocaDownloadDownload::getDownloadData($downloadId, $currentLink, 1); + + PhocaDownloadDownload::download($fileData, $downloadId, $currentLink, 1); + } + // - - - - - - - - - - - - - - - + + /*$imagePath = PhocaDownloadPath::getPathSet('icon'); + $this->t['cssimgpath'] = str_replace ( '../', JURI::base(true).'/', $imagePath['orig_rel_ds']); + $filePath = PhocaDownloadPath::getPathSet('file'); + $this->t['absfilepath'] = $filePath['orig_abs_ds']; + $this->t['action'] = $uri->toString(); + + if (isset($this->category[0]) && is_object($this->category[0]) && isset($this->file[0]) && is_object($this->file[0])){ + $this->_prepareDocument($this->category[0], $this->file[0]); + }*/ + } + + parent::display($tpl); + + } + + protected function _prepareDocument( $file) { + + $app = JFactory::getApplication(); + $menus = $app->getMenu(); + $menu = $menus->getActive(); + $pathway = $app->getPathway(); + $title = null; + + $this->t['downloadmetakey'] = $this->t['p']->get( 'download_metakey', '' ); + $this->t['downloadmetadesc'] = $this->t['p']->get( 'download_metadesc', '' ); + + if ($menu) { + $this->t['p']->def('page_heading', $this->t['p']->get('page_title', $menu->title)); + } else { + $this->t['p']->def('page_heading', JText::_('JGLOBAL_ARTICLES')); + } + + /*$title = $this->t['p']->get('page_title', ''); + if (empty($title) || (isset($title) && $title == '')) { + $title = $this->item->title; + } + if (empty($title) || (isset($title) && $title == '')) { + $title = htmlspecialchars_decode($app->getCfg('sitename')); + } else if ($app->getCfg('sitename_pagetitles', 0)) { + $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title); + } + //$this->document->setTitle($title); + + $this->document->setTitle($title);*/ + + $title = $this->t['p']->get('page_title', ''); + $this->tmpl['display_file_name_title'] = 1; + if (empty($title)) { + $title = htmlspecialchars_decode($app->getCfg('sitename')); + } else if ($app->getCfg('sitename_pagetitles', 0) == 1) { + $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title); + + if ($this->tmpl['display_file_name_title'] == 1 && isset($file->title) && $file->title != '') { + $title = $title .' - ' . $file->title; + } + + } else if ($app->getCfg('sitename_pagetitles', 0) == 2) { + + if ($this->tmpl['display_file_name_title'] == 1 && isset($file->title) && $file->title != '') { + $title = $title .' - ' . $file->title; + } + + $title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('sitename'))); + } + $this->document->setTitle($title); + + + if ($file->metadesc != '') { + $this->document->setDescription($file->metadesc); + } else if ($this->t['downloadmetadesc'] != '') { + $this->document->setDescription($this->t['downloadmetadesc']); + } else if ($this->t['p']->get('menu-meta_description', '')) { + $this->document->setDescription($this->t['p']->get('menu-meta_description', '')); + } + + if ($file->metakey != '') { + $this->document->setMetadata('keywords', $file->metakey); + } else if ($this->t['downloadmetakey'] != '') { + $this->document->setMetadata('keywords', $this->t['downloadmetakey']); + } else if ($this->t['p']->get('menu-meta_keywords', '')) { + $this->document->setMetadata('keywords', $this->t['p']->get('menu-meta_keywords', '')); + } + + if ($app->getCfg('MetaTitle') == '1' && $this->t['p']->get('menupage_title', '')) { + $this->document->setMetaData('title', $this->t['p']->get('page_title', '')); + } + + + + if (!empty($file->title)) { + $pathway->addItem($file->title); + } + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/feed/index.html b/packages/phocadownload/components/com_phocadownload/views/feed/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/feed/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/feed/metadata.xml b/packages/phocadownload/components/com_phocadownload/views/feed/metadata.xml new file mode 100644 index 00000000..23786134 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/feed/metadata.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/feed/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/feed/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/feed/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/feed/view.feed.php b/packages/phocadownload/components/com_phocadownload/views/feed/view.feed.php new file mode 100644 index 00000000..02d73680 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/feed/view.feed.php @@ -0,0 +1,147 @@ +getAuthorisedViewLevels()); + $db = JFactory::getDBO(); + $menu = $app->getMenu(); + $document = JFactory::getDocument(); + $params = $app->getParams(); + $moduleId = $app->input->get('id', 0, 'int'); + $table = &JTable::getInstance('module'); + + + if ((int)$moduleId > 0) { + $db = JFactory::getDBO(); + $query = 'SELECT a.params' + . ' FROM #__modules AS a' + . ' WHERE a.published = 1' + . ' AND a.id ='.(int)$moduleId + . ' ORDER BY a.ordering'; + + $db->setQuery( $query ); + if (!$db->query()) { + $this->setError($db->getErrorMsg()); + return false; + } + $module = $db->loadObject(); + if (isset($module->params) && $module->params != '') { + jimport( 'joomla.html.parameter' ); + $paramsM = new JRegistry; + $paramsM->loadString($module->params); + //$paramsM->loadJSON($module->params); + + // Params + $categories = $paramsM->get( 'category_ids', '' ); + $ordering = $paramsM->get( 'file_ordering', 6 ); + $fileCount = $paramsM->get( 'file_count', 5 ); + $feedTitle = $paramsM->get( 'feed_title', JText::_('COM_PHOCADOWNLOAD_DOWNLOAD') ); + $displayDateType = $paramsM->get( 'display_date_type', 1 ); + + $document->setTitle($this->escape( html_entity_decode($feedTitle))); + + $wheres = array(); + if (is_array($categories) && count($categories) > 0) { + JArrayHelper::toInteger($categories); + $categoriesString = implode(',', $categories); + $wheres[] = ' c.catid IN ( '.$categoriesString.' ) '; + } else if ((int)$categories > 0) { + $wheres[] = ' c.catid IN ( '.$categories.' ) '; + } + + $wheres[] = ' c.catid= cc.id'; + $wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND c.access IN ('.$userLevels.') ) )'; + $wheres[] = '( (unaccessible_file = 1 ) OR (unaccessible_file = 0 AND cc.access IN ('.$userLevels.') ) )'; + $wheres[] = ' c.published = 1'; + $wheres[] = ' c.approved = 1'; + $wheres[] = ' cc.published = 1'; + $wheres[] = ' c.textonly = 0'; + // Active + $jnow = JFactory::getDate(); + $now = $jnow->toSql(); + $nullDate = $db->getNullDate(); + $wheres[] = ' ( c.publish_up = '.$db->Quote($nullDate).' OR c.publish_up <= '.$db->Quote($now).' )'; + $wheres[] = ' ( c.publish_down = '.$db->Quote($nullDate).' OR c.publish_down >= '.$db->Quote($now).' )'; + $fileOrdering = PhocaDownloadOrdering::getOrderingText($ordering); + + $query = ' SELECT c.*, cc.id AS categoryid, cc.title AS categorytitle, cc.alias AS categoryalias, cc.access as cataccess, cc.accessuserid as cataccessuserid ' + . ' FROM #__phocadownload AS c' + . ' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = c.catid' + . ' WHERE ' . implode( ' AND ', $wheres ) + . ' ORDER BY c.'.$fileOrdering; + + + + $db->setQuery( $query , 0, $fileCount ); + $files = $db->loadObjectList( ); + + foreach ($files as $keyDoc => $valueDoc) { + + // USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - - + // ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users) + $rightDisplay = 0; + if (!empty($valueDoc)) { + $rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $valueDoc->cataccessuserid, $valueDoc->cataccess, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + if ($rightDisplay == 1) { + + + $item = new JFeedItem(); + + $title = $this->escape( $valueDoc->title . ' ('.PhocaDownloadFile::getTitleFromFilenameWithExt( $valueDoc->filename ).')' ); + $title = html_entity_decode( $title ); + $item->title = $title; + + $link = PhocaDownloadRoute::getCategoryRoute($valueDoc->categoryid, $valueDoc->categoryalias); + $item->link = JRoute::_($link); + + + // FILEDATE + $fileDate = ''; + if ((int)$displayDateType > 0) { + if ($valueDoc->filename !='') { + $fileDate = PhocaDownloadFile::getFileTime($valueDoc->filename, $displayDateType, "Y-m-d H:M:S"); + } + } else { + $fileDate = JHTML::Date($valueDoc->date, "Y-m-d H:i:s"); + } + + if ($fileDate != '') { + $item->date = $fileDate; + } + //$item->description = $valueDoc->description; + // $item->description = '
New file "' .$valueDoc->title . '" ('. $valueDoc->filename.') released on '. $dateDesc.' is available on Phoca download site
'.$valueDoc->description; + + $item->description = '
'.$valueDoc->description; + $item->category = $valueDoc->categorytitle; + // $item->section = $valueDoc->sectiontitle; + if ($valueDoc->author != '') { + $item->author = $valueDoc->author; + } + + $document->addItem( $item ); + } + } + } + } + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/file/index.html b/packages/phocadownload/components/com_phocadownload/views/file/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/file/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/file/metadata.xml b/packages/phocadownload/components/com_phocadownload/views/file/metadata.xml new file mode 100644 index 00000000..be637e3e --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/file/metadata.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/file/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/file/tmpl/default.php new file mode 100644 index 00000000..245784ab --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/file/tmpl/default.php @@ -0,0 +1,366 @@ +t['p']->get( 'pageclass_sfx' ).'" >'; + +if ( $this->t['p']->get( 'show_page_heading' ) ) { + echo '

'. $this->escape($this->t['p']->get('page_heading')) . '

'; +} + +if (!empty($this->category[0])) { + echo '
'; + if ($this->t['display_up_icon'] == 1 && $this->t['tmplr'] == 0) { + + if (isset($this->category[0]->id)) { + if ($this->category[0]->id > 0) { + $linkUp = JRoute::_(PhocaDownloadRoute::getCategoryRoute($this->category[0]->id, $this->category[0]->alias)); + $linkUpText = $this->category[0]->title; + } else { + $linkUp = '#'; + $linkUpText = ''; + } + echo ''; + } + } +} else { + echo '
'; +} + + +if (!empty($this->file[0])) { + $v = $this->file[0]; + + // USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - - + // ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users) + $rightDisplay = 0; + if (!empty($this->category[0])) { + $rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $v->cataccessuserid, $v->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + + if ($rightDisplay == 1) { + + $l = new PhocaDownloadLayout(); + + echo '

'.$l->getName($v->title, $v->filename, 1). '

'; + + +// ===================================================================================== +// BEGIN LAYOUT AREA +// ===================================================================================== + + // Is this direct menu link to File View + $directFv = 0; + $app = JFactory::getApplication(); + $itemId = $app->input->get('Itemid', 0, 'int'); + $menu = $app->getMenu(); + $item = $menu->getItem($itemId); + if (isset($item->query['view']) && $item->query['view'] == 'file') { + $directFv = 1; + } + // End direct menu link to File View + + if ((int)$this->t['display_file_view'] == 1 + || (int)$this->t['display_file_view'] == 2 + || (int)$v->confirm_license > 0 + || (int)$this->t['display_detail'] == 2 + || (int)$directFv == 1) { + + $pdTitle = ''; + if ($v->title != '') { + $pdTitle .= '
'.$v->title.'
'; + } + + $pdImage = ''; + if ($v->image_download != '') { + $pdImage .= '
'.$l->getImageDownload($v->image_download).'
'; + } + + $pdVideo = ''; + $pdVideo = $l->displayVideo($v->video_filename, 1); + + if ($v->filename != '') { + $imageFileName = $l->getImageFileName($v->image_filename, $v->filename); + + $pdFile = '
'; + if ($this->t['filename_or_name'] == 'filenametitle') { + $pdFile .= '
'. $v->title . '
'; + } + + $pdFile .= '
'. $imageFileName['filenamethumb'] + . '
'; + + $pdFile .= '
'; + $pdFile .= $l->getName($v->title, $v->filename); + $pdFile .= '
'; + + $pdFile .= PhocaDownloadRenderFront::displayNewIcon($v->date, $this->t['displaynew']); + $pdFile .= PhocaDownloadRenderFront::displayHotIcon($v->hits, $this->t['displayhot']); + + //Specific icons + if (isset($v->image_filename_spec1) && $v->image_filename_spec1 != '') { + $pdFile .= '
'.$l->getImageDownload($v->image_filename_spec1).'
'; + } + if (isset($v->image_filename_spec2) && $v->image_filename_spec2 != '') { + $pdFile .= '
'.$l->getImageDownload($v->image_filename_spec2).'
'; + } + + $pdFile .= '
' . "\n"; + } + + $pdFileSize = ''; + $fileSize = $l->getFilesize($v->filename); + if ($fileSize != '') { + $pdFileSize .= '
'.JText::_('COM_PHOCADOWNLOAD_FILESIZE').':
'; + $pdFileSize .= '
'.$fileSize.'
'; + } + + $pdVersion = ''; + if ($v->version != '') { + $pdVersion .= '
'.JText::_('COM_PHOCADOWNLOAD_VERSION').':
'; + $pdVersion .= '
'.$v->version.'
'; + } + + $pdLicense = ''; + if ($v->license != '') { + if ($v->license_url != '') { + $pdLicense .= '
'.JText::_('COM_PHOCADOWNLOAD_LICENSE').':
'; + $pdLicense .= ''; + } else { + $pdLicense .= '
'.JText::_('COM_PHOCADOWNLOAD_LICENSE').':
'; + $pdLicense .= '
'.$v->license.'
'; + } + } + + $pdAuthor = ''; + if ($v->author != '') { + if ($v->author_url != '') { + $pdAuthor .= '
'.JText::_('COM_PHOCADOWNLOAD_AUTHOR').':
'; + $pdAuthor .= ''; + } else { + $pdAuthor .= '
'.JText::_('COM_PHOCADOWNLOAD_AUTHOR').':
'; + $pdAuthor .= '
'.$v->author.'
'; + } + } + + $pdAuthorEmail = ''; + if ($v->author_email != '') { + $pdAuthorEmail .= '
'.JText::_('COM_PHOCADOWNLOAD_EMAIL').':
'; + $pdAuthorEmail .= '
'. $l->getProtectEmail($v->author_email).'
'; + } + + $pdFileDate = ''; + $fileDate = $l->getFileDate($v->filename, $v->date); + if ($fileDate != '') { + $pdFileDate .= '
'.JText::_('COM_PHOCADOWNLOAD_DATE').':
'; + $pdFileDate .= '
'.$fileDate.'
'; + } + + $pdDownloads = ''; + if ($this->t['display_downloads'] == 1) { + $pdDownloads .= '
'.JText::_('COM_PHOCADOWNLOAD_DOWNLOADS').':
'; + $pdDownloads .= '
'.$v->hits.' x
'; + } + + $pdDescription = ''; + if ($l->isValueEditor($v->description)) { + $pdDescription .= '
'.$v->description.'
'; + } + + $pdFeatures = ''; + if ($l->isValueEditor($v->features)) { + $pdFeatures .= '
'.JText::_('COM_PHOCADOWNLOAD_FEATURES').'
'; + $pdFeatures .= '
'.$v->features.'
'; + } + + $pdChangelog = ''; + if ($l->isValueEditor($v->changelog)) { + $pdChangelog .= '
'.JText::_('COM_PHOCADOWNLOAD_CHANGELOG').'
'; + $pdChangelog .= '
'.$v->changelog.'
'; + } + + $pdNotes = ''; + if ($l->isValueEditor($v->notes)) { + $pdNotes .= '
'.JText::_('COM_PHOCADOWNLOAD_NOTES').'
'; + $pdNotes .= '
'.$v->notes.'
'; + } + + + // pdmirrorlink1 + $pdMirrorLink1 = ''; + $mirrorOutput1 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror1link, $v->mirror1title, $v->mirror1target); + if ($mirrorOutput1 != '') { + + if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) { + $classMirror = 'pd-button-mirror1'; + } else { + $classMirror = 'pd-mirror'; + } + + $pdMirrorLink1 = '
'.$mirrorOutput1.'
'; + } + + // pdmirrorlink2 + $pdMirrorLink2 = ''; + $mirrorOutput2 = PhocaDownloadRenderFront::displayMirrorLinks(1, $v->mirror2link, $v->mirror2title, $v->mirror2target); + if ($mirrorOutput2 != '') { + if ($this->t['display_mirror_links'] == 4 || $this->t['display_mirror_links'] == 6) { + $classMirror = 'pd-button-mirror2'; + } else { + $classMirror = 'pd-mirror'; + } + + $pdMirrorLink2 = '
'.$mirrorOutput2.'
'; + } + + // pdreportlink + $pdReportLink = PhocaDownloadRenderFront::displayReportLink(1, $v->title); + + + // pdrating + $pdRating = PhocaDownloadRate::renderRateFile($v->id, $this->t['display_rating_file']); + + // pdtags + $pdTags = ''; + if ($this->t['display_tags_links'] == 2 || $this->t['display_tags_links'] == 3) { + if ($l->displayTags($v->id) != '') { + $pdTags .= $l->displayTags($v->id); + } + + } + + + // --------------------------------------------------- + //Convert + // --------------------------------------------------- + if ($this->t['display_specific_layout'] == 0) { + echo '
'; + //echo $pdTitle; + echo $pdImage; + echo $pdFile; + echo $pdFileSize; + echo $pdVersion; + echo $pdLicense; + echo $pdAuthor; + echo $pdAuthorEmail; + echo $pdFileDate; + echo $pdDownloads; + echo $pdDescription; + echo $pdFeatures; + echo $pdChangelog; + echo $pdNotes; + if ($this->t['display_mirror_links'] == 5 || $this->t['display_mirror_links'] == 6) { + echo '
'.$pdMirrorLink2.'
'; + echo '
'.$pdMirrorLink1.'
'; + } else if ($this->t['display_mirror_links'] == 2 || $this->t['display_mirror_links'] == 3) { + echo '
'.$pdMirrorLink2.$pdMirrorLink1.'
'; + } + + echo '
'.$pdReportLink.'
'; + echo '
'.$pdRating.'
'; + echo '
'.$pdTags.'
'; + echo '
'.$pdVideo.'
'; + echo '
'; + echo '
'; + } else { + + /*$fileLayout = '
+ {pdimage} + {pdfile} + {pdfilesize} + {pdversion} + {pdlicense} + {pdauthor} + {pdauthoremail} + {pdfiledate} + {pddownloads} + {pddescription} + {pdfeatures} + {pdchangelog} + {pdnotes} +
{pdmirrorlink2} {pdmirrorlink1}
+
{pdreportlink}
+
{pdrating}
+
{pdtags}
+
+
';*/ + + + $fileLayout = PhocaDownloadSettings::getLayoutText('file'); + $fileLayoutParams = PhocaDownloadSettings::getLayoutParams('file'); + + $replace = array($pdTitle, $pdImage, $pdFile, $pdFileSize, $pdVersion, $pdLicense, $pdAuthor, $pdAuthorEmail, $pdFileDate, $pdDownloads, $pdDescription, $pdFeatures, $pdChangelog, $pdNotes, $pdMirrorLink1, $pdMirrorLink2, $pdReportLink, $pdRating, $pdTags, $pdVideo); + $output = str_replace($fileLayoutParams['search'], $replace, $fileLayout); + + echo $output; + } + + // --------------------------------------------------- + + + $o = '
 
'; + + if ((int)$v->confirm_license > 0) { + $o .= '

'.JText::_('COM_PHOCADOWNLOAD_LICENSE_AGREEMENT').'

'; + $o .= '
'.$v->licensetext.'
'; + + // External link + if ($v->link_external != '' && $v->directlink == 1) { + $o .= '
'; + $o .= ' '.JText::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').' '; + $o .= ''; + } else { + $o .= ''; + $o .= ' '.JText::_('COM_PHOCADOWNLOAD_I_AGREE_TO_TERMS_LISTED_ABOVE').' '; + $o .= ''; + $o .= ''; + $o .= ''; + } + $o .= '
'; + + // For users who have disabled Javascript + $o .= ''; + } else { + // External link + if ($v->link_external != '') { + $o .= '
'; + $o .= ''; + } else { + $o .= ''; + $o .= ''; + $o .= ''; + $o .= ''; + $o .= ''; + } + $o .= '
'; + } + + + if ($this->t['display_file_comments'] == 1) { + if (JComponentHelper::isEnabled('com_jcomments', true)) { + include_once(JPATH_BASE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php'); + $o .= JComments::showComments($v->id, 'com_phocadownload_files', JText::_('COM_PHOCADOWNLOAD_FILE') .' '. $v->title); + } + } + + if ($this->t['display_file_comments'] == 2) { + $o .= '
'.$this->loadTemplate('comments-fb').'
'; + } + + echo $o; + + } else { + echo '

'.JText::_('COM_PHOCADOWNLOAD_FILE') .'

'; + echo '
'.JText::_('COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY').'
'; + } + } + echo '
 
';// end of box +} else { + echo '
 
'; +} +echo '
 
'. $this->t['pw']; +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/file/tmpl/default.xml b/packages/phocadownload/components/com_phocadownload/views/file/tmpl/default.xml new file mode 100644 index 00000000..81c73e53 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/file/tmpl/default.xml @@ -0,0 +1,40 @@ + + + + + + + + + COM_PHOCADOWNLOAD_FILE_LAYOUT + COM_PHOCADOWNLOAD_FILE_LAYOUT_DESC + +
+ + +
+
+ +
+ + + + + + + + + +
+
+ +
\ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/file/tmpl/default_comments-fb.php b/packages/phocadownload/components/com_phocadownload/views/file/tmpl/default_comments-fb.php new file mode 100644 index 00000000..970b397b --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/file/tmpl/default_comments-fb.php @@ -0,0 +1,42 @@ +
$value) { + $uri->delVar($value); + } + } + + if ($this->t['fb_comment_app_id'] == '') { + echo JText::_('COM_PHOCADOWNLOAD_ERROR_FB_APP_ID_EMPTY'); + } else { + + $cCount = ''; + if ((int)$this->t['fb_comment_count'] > 0) { + $cCount = 'numposts="'.$this->t['fb_comment_count'].'"'; + } + +?> width="t['fb_comment_width'] ?>"> +
+ + +
diff --git a/packages/phocadownload/components/com_phocadownload/views/file/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/file/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/file/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/file/view.html.php b/packages/phocadownload/components/com_phocadownload/views/file/view.html.php new file mode 100644 index 00000000..0255cc15 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/file/view.html.php @@ -0,0 +1,231 @@ +t['p'] = $app->getParams(); + $this->t['user'] = JFactory::getUser(); + $uri = JFactory::getURI(); + $model = $this->getModel(); + $document = JFactory::getDocument(); + $fileId = $app->input->get('id', 0, 'int'); + $this->t['limitstart'] = $app->input->get( 'start', 0, 'int');// we need it for category back link + $this->t['tmpl'] = $app->input->get( 'tmpl', '', 'string' ); + $this->t['mediapath'] = PhocaDownloadPath::getPathMedia(); + + $this->t['tmplr'] = 0; + if ($this->t['tmpl'] == 'component') { + $this->t['tmplr'] = 1; + } + + if ($this->t['limitstart'] > 0 ) { + $this->t['limitstarturl'] = '&start='.$this->t['limitstart']; + } else { + $this->t['limitstarturl'] = ''; + } + + $this->category = $model->getCategory($fileId); + $this->file = $model->getFile($fileId, $this->t['limitstarturl']); + + PhocaDownloadRenderFront::renderAllCSS(); + $document->addCustomTag(''); + $js = 'var enableDownloadButtonPD = 0;' + .'function enableDownloadPD() {' + .' if (enableDownloadButtonPD == 0) {' + .' document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=false;' + .' enableDownloadButtonPD = 1;' + .' } else {' + .' document.forms[\'phocadownloadform\'].elements[\'pdlicensesubmit\'].disabled=true;' + .' enableDownloadButtonPD = 0;' + .' }' + .'}'; + $document->addScriptDeclaration($js); + + + // Params + $this->t['licenseboxheight'] = $this->t['p']->get( 'license_box_height', 300 ); + $this->t['filename_or_name'] = $this->t['p']->get( 'filename_or_name', 'filename' ); + $this->t['display_up_icon'] = $this->t['p']->get( 'display_up_icon', 1 ); + $this->t['allowed_file_types'] = $this->t['p']->get( 'allowed_file_types', '' ); + $this->t['disallowed_file_types'] = $this->t['p']->get( 'disallowed_file_types', '' ); + $this->t['enable_user_statistics'] = $this->t['p']->get( 'enable_user_statistics', 1 ); + $this->t['display_file_comments'] = $this->t['p']->get( 'display_file_comments', 0 ); + $this->t['file_icon_size'] = $this->t['p']->get( 'file_icon_size', 16 ); + $this->t['display_file_view'] = $this->t['p']->get('display_file_view', 0); + $this->t['download_metakey'] = $this->t['p']->get( 'download_metakey', '' ); + $this->t['download_metadesc'] = $this->t['p']->get( 'download_metadesc', '' ); + $this->t['display_downloads'] = $this->t['p']->get( 'display_downloads', 0 ); + $this->t['display_date_type'] = $this->t['p']->get( 'display_date_type', 0 ); + $this->t['displaynew'] = $this->t['p']->get( 'display_new', 0 ); + $this->t['displayhot'] = $this->t['p']->get( 'display_hot', 0 ); + $this->t['pw'] = PhocaDownloadRenderFront::renderPhocaDownload(); + $this->t['download_external_link'] = $this->t['p']->get( 'download_external_link', '_self' ); + $this->t['display_report_link'] = $this->t['p']->get( 'display_report_link', 0 ); + $this->t['send_mail_download'] = $this->t['p']->get( 'send_mail_download', 0 );// not boolean but id of user + //$this->t['send_mail_upload'] = $this->t['p']->get( 'send_mail_upload', 0 ); + $this->t['display_rating_file'] = $this->t['p']->get( 'display_rating_file', 0 ); + $this->t['display_tags_links'] = $this->t['p']->get( 'display_tags_links', 0 ); + $this->t['display_mirror_links'] = $this->t['p']->get( 'display_mirror_links', 0 ); + $this->t['display_specific_layout'] = $this->t['p']->get( 'display_specific_layout', 0 ); + $this->t['display_detail'] = $this->t['p']->get( 'display_detail', 1); + $this->t['fb_comment_app_id'] = $this->t['p']->get( 'fb_comment_app_id', '' ); + $this->t['fb_comment_width'] = $this->t['p']->get( 'fb_comment_width', '550' ); + $this->t['fb_comment_lang'] = $this->t['p']->get( 'fb_comment_lang', 'en_US' ); + $this->t['fb_comment_count'] = $this->t['p']->get( 'fb_comment_count', '' ); + + // Rating + if ($this->t['display_rating_file'] == 2 || $this->t['display_rating_file'] == 3 ) { + JHTML::_('behavior.framework', true); + PhocaDownloadRate::renderRateFileJS(1); + $this->t['display_rating_file'] = 1; + } else { + $this->t['display_rating_file'] = 0; + } + + // DOWNLOAD + // - - - - - - - - - - - - - - - + $download = $app->input->get( 'download', array(0), 'array' ); + $licenseAgree = $app->input->get( 'license_agree', '', 'string' ); + $downloadId = (int) $download[0]; + if ($downloadId > 0) { + if (isset($this->file[0]->id)) { + $currentLink = 'index.php?option=com_phocadownload&view=file&id='.$this->file[0]->id.':'.$this->file[0]->alias. $this->t['limitstarturl'] . '&Itemid='. $app->input->get('Itemid', 0, 'int'); + } else { + $currentLink = 'index.php?option=com_phocadownload&view=categories&Itemid='. $app->input->get('Itemid', 0, 'int'); + } + + // Check Token + $token = JSession::getFormToken(); + if (!JRequest::getInt( $token, 0, 'post' )) { + //JError::raiseError(403, 'Request Forbidden'); + $app->redirect(JRoute::_('index.php', false), JText::_('COM_PHOCADOWNLOAD_INVALID_TOKEN')); + exit; + } + + // Check License Agreement + if (empty($licenseAgree)) { + $app->redirect(JRoute::_($currentLink, false), JText::_('COM_PHOCADOWNLOAD_WARNING_AGREE_LICENSE_TERMS')); + exit; + } + + $fileData = PhocaDownloadDownload::getDownloadData($downloadId, $currentLink); + PhocaDownloadDownload::download($fileData, $downloadId, $currentLink); + } + // - - - - - - - - - - - - - - - + + $imagePath = PhocaDownloadPath::getPathSet('icon'); + $this->t['cssimgpath'] = str_replace ( '../', JURI::base(true).'/', $imagePath['orig_rel_ds']); + $filePath = PhocaDownloadPath::getPathSet('file'); + $this->t['absfilepath'] = $filePath['orig_abs_ds']; + $this->t['action'] = $uri->toString(); + + if (isset($this->category[0]) && is_object($this->category[0]) && isset($this->file[0]) && is_object($this->file[0])){ + $this->_prepareDocument($this->category[0], $this->file[0]); + } + parent::display($tpl); + + } + + protected function _prepareDocument($category, $file) { + + $app = JFactory::getApplication(); + $menus = $app->getMenu(); + $menu = $menus->getActive(); + $pathway = $app->getPathway(); + $title = null; + + $this->t['downloadmetakey'] = $this->t['p']->get( 'download_metakey', '' ); + $this->t['downloadmetadesc'] = $this->t['p']->get( 'download_metadesc', '' ); + + if ($menu) { + $this->t['p']->def('page_heading', $this->t['p']->get('page_title', $menu->title)); + } else { + $this->t['p']->def('page_heading', JText::_('JGLOBAL_ARTICLES')); + } + + /*$title = $this->t['p']->get('page_title', ''); + if (empty($title) || (isset($title) && $title == '')) { + $title = $this->item->title; + } + if (empty($title) || (isset($title) && $title == '')) { + $title = htmlspecialchars_decode($app->getCfg('sitename')); + } else if ($app->getCfg('sitename_pagetitles', 0)) { + $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title); + } + //$this->document->setTitle($title); + + $this->document->setTitle($title);*/ + + $title = $this->t['p']->get('page_title', ''); + $this->tmpl['display_file_name_title'] = 1; + if (empty($title)) { + $title = htmlspecialchars_decode($app->getCfg('sitename')); + } else if ($app->getCfg('sitename_pagetitles', 0) == 1) { + $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title); + + if ($this->tmpl['display_file_name_title'] == 1 && isset($file->title) && $file->title != '') { + $title = $title .' - ' . $file->title; + } + + } else if ($app->getCfg('sitename_pagetitles', 0) == 2) { + + if ($this->tmpl['display_file_name_title'] == 1 && isset($file->title) && $file->title != '') { + $title = $title .' - ' . $file->title; + } + + $title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('sitename'))); + } + $this->document->setTitle($title); + + + if ($file->metadesc != '') { + $this->document->setDescription($file->metadesc); + } else if ($this->t['downloadmetadesc'] != '') { + $this->document->setDescription($this->t['downloadmetadesc']); + } else if ($this->t['p']->get('menu-meta_description', '')) { + $this->document->setDescription($this->t['p']->get('menu-meta_description', '')); + } + + if ($file->metakey != '') { + $this->document->setMetadata('keywords', $file->metakey); + } else if ($this->t['downloadmetakey'] != '') { + $this->document->setMetadata('keywords', $this->t['downloadmetakey']); + } else if ($this->t['p']->get('menu-meta_keywords', '')) { + $this->document->setMetadata('keywords', $this->t['p']->get('menu-meta_keywords', '')); + } + + if ($app->getCfg('MetaTitle') == '1' && $this->t['p']->get('menupage_title', '')) { + $this->document->setMetaData('title', $this->t['p']->get('page_title', '')); + } + + // Breadcrumbs TODO (Add the whole tree) + $pathway = $app->getPathway(); + if (isset($category->id)) { + if ($category->id > 0) { + $pathway->addItem($category->title, JRoute::_(PhocaDownloadRoute::getCategoryRoute($category->id, $category->alias))); + } + } + + if (!empty($file->title)) { + $pathway->addItem($file->title); + } + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/index.html b/packages/phocadownload/components/com_phocadownload/views/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/tmpl/default.php new file mode 100644 index 00000000..207eb450 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/tmpl/default.php @@ -0,0 +1,95 @@ + + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/view.html.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/view.html.php new file mode 100644 index 00000000..8bb2b143 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcat/view.html.php @@ -0,0 +1,61 @@ +isAdmin()) { + $tUri = JURI::base(); + + } + + $document = JFactory::getDocument(); + $uri = JFactory::getURI(); + JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' ); + + $eName = $app->input->get('e_name'); + $this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName ); + $this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename']; + + $model = $this->getModel(); + + // build list of categories + //$javascript = 'class="inputbox" size="1" onchange="submitform( );"'; + $javascript = 'class="inputbox" size="1"'; + $filter_catid = ''; + + $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' + . ' FROM #__phocadownload_categories AS a' + . ' WHERE a.published = 1' + //. ' AND a.approved = 1' + . ' ORDER BY a.ordering'; + $db->setQuery( $query ); + $phocadownloads = $db->loadObjectList(); + + $tree = array(); + $text = ''; + $tree = PhocaDownloadCategory::CategoryTreeOption($phocadownloads, $tree, 0, $text, -1); + array_unshift($tree, JHTML::_('select.option', '0', '- '.JText::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY').' -', 'value', 'text')); + $lists['catid'] = JHTML::_( 'select.genericlist', $tree, 'catid', $javascript , 'value', 'text', $filter_catid ); + //----------------------------------------------------------------------- + + $this->assignRef('lists', $lists); + $this->assignRef('tmpl', $this->t); + parent::display($tpl); + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/tmpl/default.php new file mode 100644 index 00000000..29b2211f --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/tmpl/default.php @@ -0,0 +1,65 @@ + + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/view.html.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/view.html.php new file mode 100644 index 00000000..2af15584 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkcats/view.html.php @@ -0,0 +1,71 @@ +isAdmin()) { + $tUri = JURI::base(); + + } + + $document = JFactory::getDocument(); + $uri = JFactory::getURI(); + JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' ); + + $eName = $app->input->get('e_name'); + $this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName ); + $this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename']; + + + // Category Tree + $db = JFactory::getDBO(); + $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' + . ' FROM #__phocadownload_categories AS a' + // . ' WHERE a.published = 1' You can hide not published and not authorized categories too + // . ' AND a.approved = 1' + . ' ORDER BY a.ordering'; + $db->setQuery( $query ); + $categories = $db->loadObjectList(); + + $tree = array(); + $text = ''; + $tree = PhocaDownloadCategory::CategoryTreeOption($categories, $tree, 0, $text, -1); + //----------------------------------------------------------------------- + + // Multiple + $ctrl = 'hidecategories'; + $attribs = ' '; + $attribs .= ' size="5"'; + //$attribs .= 'class="'.$v.'"'; + $attribs .= ' class="inputbox"'; + $attribs .= ' multiple="multiple"'; + $ctrl .= ''; + //$value = implode( '|', ) + + $categoriesOutput = JHTML::_('select.genericlist', $tree, $ctrl, $attribs, 'value', 'text', 0, 'hidecategories' ); + + $this->assignRef('categoriesoutput', $categoriesOutput); + $this->assignRef('tmpl', $this->t); + parent::display($tpl); + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/tmpl/default.php new file mode 100644 index 00000000..3f32f245 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/tmpl/default.php @@ -0,0 +1,398 @@ +lists['order'] == 'a.ordering'); + +JHTML::_('behavior.tooltip'); + +if ($this->t['type'] == 0) { + $view = 'file'; +} else if ($this->t['type'] == 1) { + $view = 'fileplaylink'; +} else if ($this->t['type'] == 2) { + $view = 'fileplay'; +} else if ($this->t['type'] == 3) { + $view = 'filepreviewlink'; +} else if ($this->t['type'] == 4) { + $view = 'filelist'; +} + + +?> + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/view.html.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/view.html.php new file mode 100644 index 00000000..9375a7bf --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkfile/view.html.php @@ -0,0 +1,128 @@ +isAdmin()) { + $tUri = JURI::base(); + + } + + JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' ); + + $eName = $app->input->get('e_name'); + $this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName ); + $this->t['type'] = $app->input->get( 'type', 1, '', 'int' ); + $this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename']; + + + $params = JComponentHelper::getParams('com_phocadownload') ; + + //Filter + $context = 'com_phocadownload.phocadownload.list.'; + //$sectionid = $app->input->get( 'sectionid', -1, '', 'int' ); + //$redirect = $sectionid; + $option = JRequest::getCmd( 'option' ); + + $filter_state = $app->getUserStateFromRequest( $this->_context.'.filter_state', 'filter_state', '', 'word' ); + $filter_catid = $app->getUserStateFromRequest( $this->_context.'.filter_catid', 'filter_catid', 0, 'int' ); + $catid = $app->getUserStateFromRequest( $this->_context.'.catid', 'catid', 0, 'int'); + // $filter_sectionid = $app->getUserStateFromRequest( $this->_context.'.filter_sectionid','filter_sectionid', -1, 'int'); + $filter_order = $app->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering', 'cmd' ); + $filter_order_Dir = $app->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $search = $app->getUserStateFromRequest( $this->_context.'.search','search', '', 'string' ); + $search = JString::strtolower( $search ); + + // Get data from the model + $items = $this->get( 'Data'); + $total = $this->get( 'Total'); + $pagination = $this->get( 'Pagination' ); + + // build list of categories + + if ($this->t['type'] != 4) { + $javascript = 'class="inputbox" size="1" onchange="submitform( );"'; + } else { + $javascript = ''; + } + // get list of categories for dropdown filter + $filter = ''; + + //if ($filter_sectionid > 0) { + // $filter = ' WHERE cc.section = '.$db->Quote($filter_sectionid); + //} + + // get list of categories for dropdown filter + $query = 'SELECT cc.id AS value, cc.title AS text' . + ' FROM #__phocadownload_categories AS cc' . + $filter . + ' ORDER BY cc.ordering'; + + if ($this->t['type'] != 4) { + $lists['catid'] = PhocaDownloadCategory::filterCategory($query, $catid, null, true, true); + } else { + $lists['catid'] = PhocaDownloadCategory::filterCategory($query, $catid, null, false, true); + } +/* + if ($this->t['type'] != 4) { + $lists['catid'] = PhocaDownloadCategory::filterCategory($query, $catid, null, true); + } else { + $lists['catid'] = PhocaDownloadCategory::filterCategory($query, $catid, null, false); + }*/ + + // sectionid + /*$query = 'SELECT s.title AS text, s.id AS value' + . ' FROM #__phocadownload_sections AS s' + . ' WHERE s.published = 1' + . ' ORDER BY s.ordering'; + + $lists['sectionid'] = PhocaDownloadCategory::filterSection($query, $filter_sectionid);*/ + + // state filter + $lists['state'] = JHTML::_('grid.state', $filter_state ); + + // table ordering + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + // search filter + $lists['search']= $search; + + + $user = JFactory::getUser(); + $uriS = $uri->toString(); + $this->assignRef('user', $user); + $this->assignRef('lists', $lists); + $this->assignRef('tmpl', $this->t); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + $this->assignRef('request_url', $uriS); + + parent::display($tpl); + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/tmpl/default.php new file mode 100644 index 00000000..41c0cf0d --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/tmpl/default.php @@ -0,0 +1,20 @@ +' +.'
' +.''.JText::_( 'COM_PHOCADOWNLOAD_SELECT_TYPE' ).'' +.'' +.'' +.'
' +.''; +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/view.html.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/view.html.php new file mode 100644 index 00000000..7b56f5eb --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinks/view.html.php @@ -0,0 +1,49 @@ +isAdmin()) { + $tUri = JURI::base(); + + } + + $document = JFactory::getDocument(); + $uri = JFactory::getURI(); + JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' ); + + $eName = $app->input->get('e_name'); + $eName = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName ); + + + $this->t['linkcategories'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinkcats&tmpl=component&e_name='.$eName; + $this->t['linkcategory'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinkcat&tmpl=component&e_name='.$eName; + $this->t['linkfile'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinkfile&tmpl=component&e_name='.$eName; + $this->t['linkytb'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinkytb&tmpl=component&e_name='.$eName; + + $this->assignRef('tmpl', $this->t); + parent::display($tpl); + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/tmpl/default.php new file mode 100644 index 00000000..f53e7cb3 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/tmpl/default.php @@ -0,0 +1,56 @@ + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/view.html.php b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/view.html.php new file mode 100644 index 00000000..5d9e4d08 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/phocadownloadlinkytb/view.html.php @@ -0,0 +1,40 @@ +isAdmin()) { + $tUri = JURI::base(); + + } + JHTML::stylesheet( 'media/com_phocadownload/css/administrator/phocadownload.css' ); + + $eName = $app->input->get('e_name'); + $this->t['ename'] = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName ); + $this->t['backlink'] = $tUri.'index.php?option=com_phocadownload&view=phocadownloadlinks&tmpl=component&e_name='.$this->t['ename']; + + $this->assignRef('tmpl', $this->t); + parent::display($tpl); + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/play/index.html b/packages/phocadownload/components/com_phocadownload/views/play/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/play/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/play/metadata.xml b/packages/phocadownload/components/com_phocadownload/views/play/metadata.xml new file mode 100644 index 00000000..23786134 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/play/metadata.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/play/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/play/tmpl/default.php new file mode 100644 index 00000000..ed12790a --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/play/tmpl/default.php @@ -0,0 +1,73 @@ +file[0])) { + $rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $this->file[0]->cataccessuserid, $this->file[0]->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0); +} +// - - - - - - - - - - - - - - - - - - - - - - + +if ($rightDisplay == 1) { + + if ($this->t['html5_play'] == 1 && $this->t['filetype'] != 'flv') { + if ($this->t['filetype'] == 'mp3') { + echo ''. "\n"; + } else if ($this->t['filetype'] == 'mp4') { + echo ''. "\n"; + } else if ($this->t['filetype'] == 'ogg') { + echo ''. "\n"; + } else if ($this->t['filetype'] == 'ogv') { + echo ''. "\n"; + } + + } else { + + //Flow Player + $versionFLP = '3.2.2'; + $versionFLPJS = '3.2.2'; + $document = JFactory::getDocument(); + $document->addScript($this->t['playerpath'].'flowplayer-'.$versionFLPJS.'.min.js'); + + ?> +
+
t['filetype'] == 'mp3') { + ?>
+ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/play/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/play/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/play/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/play/view.html.php b/packages/phocadownload/components/com_phocadownload/views/play/view.html.php new file mode 100644 index 00000000..edcad6ba --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/play/view.html.php @@ -0,0 +1,70 @@ +getParams(); + $this->t = array(); + $this->t['user'] = JFactory::getUser(); + $uri = JFactory::getURI(); + $model = $this->getModel(); + $document = JFactory::getDocument(); + $fileId = $app->input->get('id', 0, 'int'); + $file = $model->getFile($fileId); + + $fileExt = ''; + + $filePath = PhocaDownloadPath::getPathSet('fileplay'); + $filePath = str_replace ( '../', JURI::base(false).'', $filePath['orig_rel_ds']); + if (isset($file[0]->filename_play) && $file[0]->filename_play != '') { + + $fileExt = PhocaDownloadFile::getExtension($file[0]->filename_play); + $canPlay = PhocaDownloadFile::canPlay($file[0]->filename_play); + if ($canPlay) { + $this->t['playfilewithpath'] = $filePath . $file[0]->filename_play; + //$this->t['playerpath'] = JURI::base().'components/com_phocadownload/assets/jwplayer/'; + $this->t['playerpath'] = JURI::base().'components/com_phocadownload/assets/flowplayer/'; + $this->t['playerwidth'] = $params->get( 'player_width', 328 ); + $this->t['playerheight'] = $params->get( 'player_height', 200 ); + $this->t['html5_play'] = $params->get( 'html5_play', 0 ); + } else { + echo JText::_('COM_PHOCADOWNLOAD_ERROR_NO_CORRECT_FILE_TO_PLAY_FOUND');exit; + } + } else { + echo JText::_('COM_PHOCADOWNLOAD_ERROR_NO_FILE_TO_PLAY_FOUND');exit; + } + + $this->t['filetype'] = $fileExt; + if ($fileExt == 'mp3') { + $this->t['filetype'] = 'mp3'; + $this->t['playerheight'] = $params->get( 'player_mp3_height', 30 ); + } else if ($fileExt == 'ogg') { + $this->t['filetype'] = 'ogg'; + $this->t['playerheight'] = $params->get( 'player_mp3_height', 30 ); + } + + + $this->assignRef('file', $file); + $this->assignRef('tmpl', $this->t); + $this->assignRef('params', $params); + $uriT = $uri->toString(); + $this->assignRef('request_url', $uriT); + parent::display($tpl); + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/ratingfilea/index.html b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/ratingfilea/metadata.xml b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/metadata.xml new file mode 100644 index 00000000..23786134 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/metadata.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/default.php new file mode 100644 index 00000000..6cbee284 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/default.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/default.xml b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/default.xml new file mode 100644 index 00000000..9205b305 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/default.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/ratingfilea/view.json.php b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/view.json.php new file mode 100644 index 00000000..83ee2cf0 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/ratingfilea/view.json.php @@ -0,0 +1,148 @@ + '0', + 'error' => JText::_('JINVALID_TOKEN') + ); + echo json_encode($response); + return; + } + + $app = JFactory::getApplication(); + $params = $app->getParams(); + + + $ratingVote = $app->input->get( 'ratingVote', 0, 'post', 'int' ); + $ratingId = $app->input->get( 'ratingId', 0, 'post', 'int' );// ID of File + $format = $app->input->get( 'format', '', 'post', 'string' ); + $task = $app->input->get( 'task', '', 'get', 'string' ); + $view = $app->input->get( 'view', '', 'get', 'string' ); + $small = $app->input->get( 'small', 1, 'get', 'string' );//small or large rating icons + + $paramsC = JComponentHelper::getParams('com_phocadownload'); + $param['displayratingfile'] = $paramsC->get( 'display_rating_file', 0 ); + + // Check if rating is enabled - if not then user should not be able to rate or to see updated reating + + + + if ($task == 'refreshrate' && (int)$param['displayratingfile'] > 0) { + $ratingOutput = PhocaDownloadRate::renderRateFile((int)$ratingId, 1, $small, true);// ID of File + $response = array( + 'status' => '0', + 'message' => $ratingOutput); + echo json_encode($response); + return; + //return $ratingOutput; + + } else if ($task == 'rate') { + + $user = JFactory::getUser(); + //$view = $app->input->get( 'view', '', 'get', '', JREQUEST_NOTRIM ); + //$Itemid = $app->input->get( 'Itemid', 0, 'int'); + + $neededAccessLevels = PhocaDownloadAccess::getNeededAccessLevels(); + $access = PhocaDownloadAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels); + + + $post['fileid'] = (int)$ratingId; + $post['userid'] = $user->id; + $post['rating'] = (int)$ratingVote; + + + if ($format != 'json') { + $msg = JText::_('COM_PHOCADOWNLOAD_ERROR_WRONG_RATING') ; + $response = array( + 'status' => '0', + 'error' => $msg); + echo json_encode($response); + return; + } + + if ((int)$post['fileid'] < 1) { + $msg = JText::_('COM_PHOCADOWNLOAD_ERROR_FILE_NOT_EXISTS'); + $response = array( + 'status' => '0', + 'error' => $msg); + echo json_encode($response); + return; + } + + $model = $this->getModel(); + + $checkUserVote = PhocaDownloadRate::checkUserVoteFile( $post['fileid'], $post['userid'] ); + + // User has already rated this category + if ($checkUserVote) { + $msg = JText::_('COM_PHOCADOWNLOAD_RATING_ALREADY_RATED_FILE'); + $response = array( + 'status' => '0', + 'error' => '', + 'message' => $msg); + echo json_encode($response); + return; + } else { + if ((int)$post['rating'] < 1 || (int)$post['rating'] > 5) { + + $msg = JText::_('COM_PHOCADOWNLOAD_ERROR_WRONG_RATING'); + $response = array( + 'status' => '0', + 'error' => $msg); + echo json_encode($response); + return; + } + + if ($access > 0 && $user->id > 0) { + if(!$model->rate($post)) { + $msg = JText::_('COM_PHOCADOWNLOAD_ERROR_RATING_FILE'); + $response = array( + 'status' => '0', + 'error' => $msg); + echo json_encode($response); + return; + } else { + $msg = JText::_('COM_PHOCADOWNLOAD_SUCCESS_RATING_FILE'); + $response = array( + 'status' => '1', + 'error' => '', + 'message' => $msg); + echo json_encode($response); + return; + } + } else { + $msg = JText::_('COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION'); + $response = array( + 'status' => '0', + 'error' => $msg); + echo json_encode($response); + return; + } + } + } else { + $msg = JText::_('COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION'); + $response = array( + 'status' => '0', + 'error' => $msg); + echo json_encode($response); + return; + } + } +} +?> \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/user/index.html b/packages/phocadownload/components/com_phocadownload/views/user/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/user/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/user/metadata.xml b/packages/phocadownload/components/com_phocadownload/views/user/metadata.xml new file mode 100644 index 00000000..8895f921 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/user/metadata.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/user/tmpl/default.php b/packages/phocadownload/components/com_phocadownload/views/user/tmpl/default.php new file mode 100644 index 00000000..757fe855 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/user/tmpl/default.php @@ -0,0 +1,43 @@ +t['p']->get( 'page_heading' ) != '') { + $heading .= $this->t['p']->get( 'page_heading' ); +} + +if ($this->t['showpageheading'] != 0) { + if ( $heading != '') { + echo '

'. $this->escape($heading) . '

'; + } +} +$tab = 0; +switch ($this->t['tab']) { + case 'up': + $tab = 1; + break; + + case 'cc': + default: + $tab = 0; + break; +} + +echo '
 
'; + +if ($this->t['displaytabs'] > 0) { + echo '
'; + //$pane =& J Pane::getInstance('Tabs', array('startOffset'=> $this->t['tab'])); + //echo $pane->startPane( 'pane' ); + echo JHtml::_('tabs.start', 'config-tabs-com_phocadownload-user', array('useCookie'=>1, 'startOffset'=> $this->t['tab'])); + + //echo $pane->startPanel( JHTML::_( 'image .site', $this->t['pi'].'icon-document-16.png','', '', '', '', '') . ' '.JText::_('COM_PHOCADOWNLOAD_UPLOAD'), 'files' ); + echo JHtml::_('tabs.panel', JHtml::_( 'image', $this->t['pi'].'icon-document-16.png', '') . ' '.JText::_('COM_PHOCADOWNLOAD_UPLOAD'), 'files' ); + echo $this->loadTemplate('files'); + //echo $pane->endPanel(); + + //echo $pane->endPane(); + echo JHtml::_('tabs.end'); + echo '
'; +} +echo $this->t['pw']; +?> diff --git a/packages/phocadownload/components/com_phocadownload/views/user/tmpl/default.xml b/packages/phocadownload/components/com_phocadownload/views/user/tmpl/default.xml new file mode 100644 index 00000000..da13f000 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/user/tmpl/default.xml @@ -0,0 +1,22 @@ + + + + + + + + + COM_PHOCADOWNLOAD_USER_UPLOAD_LAYOUT + COM_PHOCADOWNLOAD_USER_UPLOAD_LAYOUT_DESC + +
+ + + + + + +
+
+ +
\ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/user/tmpl/default_files.php b/packages/phocadownload/components/com_phocadownload/views/user/tmpl/default_files.php new file mode 100644 index 00000000..3f2a8c1e --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/user/tmpl/default_files.php @@ -0,0 +1,332 @@ +getNullDate(); +$now = JFactory::getDate(); + +echo '
 
'; + +if ($this->t['displayupload'] == 1) { + + +?> + + + + +

+
+ + + +
+ + +
+ +
+listsfiles['catid'] ?> +
+
+ + + + + + + + + + + + + + + + + +t['filesitems'] ); +$rows = &$this->t['filesitems']; + +if (is_array($rows)) { + foreach ($rows as $row) { + + // USER RIGHT - Delete (Publish/Unpublish) - - - - - - - - - - - + // 2, 2 means that user access will be ignored in function getUserRight for display Delete button + // because we cannot check the access and delete in one time + $user = JFactory::getUser(); + $rightDisplayDelete = 0; + $catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int)$row->id); + + if (!empty($catAccess)) { + $rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0); + } + // - - - - - - - - - - - - - - - - - - - - - - + + ?>"> + + + + '; + if ($row->published == 1) { + if ($rightDisplayDelete) { + echo ''; + echo JHTML::_('image', $this->t['pi'].'icon-publish.png', JText::_('COM_PHOCADOWNLOAD_PUBLISHED')); + echo ''; + } else { + echo JHTML::_('image', $this->t['pi'].'icon-publish-g.png', JText::_('COM_PHOCADOWNLOAD_PUBLISHED')); + } + } + if ($row->published == 0) { + if ($rightDisplayDelete) { + echo ''; + echo JHTML::_('image', $this->t['pi'].'icon-unpublish.png', JText::_('COM_PHOCADOWNLOAD_UNPUBLISHED')); + echo ''; + } else { + echo JHTML::_('image', $this->t['pi'].'icon-unpublish-g.png', JText::_('COM_PHOCADOWNLOAD_UNPUBLISHED')); + } + } + echo ''; + + echo ''; + + echo ''; + + // Approved + echo ''; + + echo ''; + + + echo '' + //echo '' + .''; + + $k = 1 - $k; + $i++; + } +} +?> + + + + + +
listsfiles['order_Dir'], $this->listsfiles['order'], 'image'); ?>listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?>listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?>listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?>listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?>
title; ?>'; + if ($rightDisplayDelete) { + echo ''; + echo JHTML::_('image', $this->t['pi'].'icon-trash.png', JText::_('COM_PHOCADOWNLOAD_DELETE')); + echo ''; + } else { + echo JHTML::_('image', $this->t['pi'].'icon-trash-g.png', JText::_('COM_PHOCADOWNLOAD_DELETE')); + } + echo ''; + // User should get info about active/not active file (if e.g. admin change the active status) + $publish_up = JFactory::getDate($row->publish_up); + $publish_down = JFactory::getDate($row->publish_down); + $tz = new DateTimeZone($config->get('offset')); + $publish_up->setTimezone($tz); + $publish_down->setTimezone($tz); + + + if ( $now->toUnix() <= $publish_up->toUnix() ) { + $text = JText::_( 'COM_PHOCADOWNLOAD_PENDING' ); + } else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) ) { + $text = JText::_( 'COM_PHOCADOWNLOAD_ACTIVE' ); + } else if ( $now->toUnix() > $publish_down->toUnix() ) { + $text = JText::_( 'COM_PHOCADOWNLOAD_EXPIRED' ); + } + + $times = ''; + if (isset($row->publish_up)) { + if ($row->publish_up == $nullDate) { + $times .= JText::_( 'COM_PHOCADOWNLOAD_START') . ': '.JText::_( 'COM_PHOCADOWNLOAD_ALWAYS' ); + } else { + $times .= JText::_( 'COM_PHOCADOWNLOAD_START') .": ". $publish_up->format("D, d M Y H:i:s"); + } + } + if (isset($row->publish_down)) { + if ($row->publish_down == $nullDate) { + $times .= "
". JText::_( 'COM_PHOCADOWNLOAD_FINISH'). ': '. JText::_('COM_PHOCADOWNLOAD_NO_EXPIRY' ); + } else { + $times .= "
". JText::_( 'COM_PHOCADOWNLOAD_FINISH') .": ". $publish_up->format("D, d M Y H:i:s"); + } + } + + if ( $times ) { + echo '' + .''. $text.''; + } + + + echo '
'; + if ($row->approved == 1) { + echo JHTML::_('image', $this->t['pi'].'icon-publish.png', JText::_('COM_PHOCADOWNLOAD_APPROVED')); + } else { + echo JHTML::_('image', $this->t['pi'].'icon-unpublish.png', JText::_('COM_PHOCADOWNLOAD_NOT_APPROVED')); + } + echo ''. $row->date .''. $row->categorytitle .''. $row->id .'
+ + + + + + + + + + + + + + +
+ +state->folder) && $this->state->folder != '') { + $currentFolder = $this->state->folder; +} +?> +

t['uploadmaxsizeread'].']'; +?>

+ +t['errorcatid'] != '') { + echo '
' + .'' . $this->t['errorcatid'] . '
'; +} ?> + +
+ + + + + + t['errorfile'] != '') { + echo ''; + } ?> + + + + + + + + + + + + + + + + + + + + + + + + t['erroremail'] != '') { + echo ''; + } ?> + + + + + + + t['errorwebsite'] != '') { + echo ''; + } ?> + + + + + + + + + + + +
: + + +
' + .'' . $this->t['errorfile'] . '
:
:
  +
:
:
' + .'' . $this->t['erroremail'] . '
:
' + .'' . $this->t['errorwebsite'] . '
:
:
+ +
+ + */ ?> + + + + + + + + +
+
t['pi'].'icon-loading.gif', '') . JText::_('COM_PHOCADOWNLOAD_LOADING'); ?>
+ + '; + +?> diff --git a/packages/phocadownload/components/com_phocadownload/views/user/tmpl/index.html b/packages/phocadownload/components/com_phocadownload/views/user/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/user/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/phocadownload/components/com_phocadownload/views/user/view.html.php b/packages/phocadownload/components/com_phocadownload/views/user/view.html.php new file mode 100644 index 00000000..d22dce92 --- /dev/null +++ b/packages/phocadownload/components/com_phocadownload/views/user/view.html.php @@ -0,0 +1,312 @@ +getMenu(); + $menu = $menus->getActive(); + $this->t['p'] = $app->getParams(); + $user = JFactory::getUser(); + $db = JFactory::getDBO(); + $user = JFactory::getUser(); + $userLevels = implode (',', $user->getAuthorisedViewLevels()); + + $this->t['pi'] = 'media/com_phocadownload/images/'; + $this->t['pp'] = 'index.php?option=com_phocadownload&view=user&controller=user'; + $this->t['pl'] = 'index.php?option=com_users&view=login&return='.base64_encode($this->t['pp'].'&Itemid='. $app->input->get('Itemid', 0, 'int')); + + $neededAccessLevels = PhocaDownloadAccess::getNeededAccessLevels(); + $access = PhocaDownloadAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels); + + if (!$access) { + $app->redirect(JRoute::_($this->t['pl'], false), JText::_("COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION")); + return; + } + + PhocaDownloadRenderFront::renderAllCSS(); + + + // = = = = = = = = = = = + // PANE + // = = = = = = = = = = = + // - - - - - - - - - - + // ALL TABS + // - - - - - - - - - - + // UCP is disabled (security reasons) + if ((int)$this->t['p']->get( 'enable_user_cp', 0 ) == 0) { + $app->redirect(JURI::base(false), JText::_("COM_PHOCADOWNLOAD_USER_UPLOAD_DISABLED")); + exit; + } + + $this->t['tab'] = $app->input->get('tab', 0, 'string'); + $this->t['maxuploadchar'] = $this->t['p']->get( 'max_upload_char', 1000 ); + $this->t['enableuseruploadapprove'] = $this->t['p']->get( 'enable_user_upload_approve', 0 ); + $this->t['showpageheading'] = $this->t['p']->get( 'show_page_heading', 1 ); + $this->t['uploadmaxsize'] = $this->t['p']->get( 'user_file_upload_size', 3145728 ); + $this->t['uploadmaxsizeread'] = PhocaDownloadFile::getFileSizeReadable($this->t['uploadmaxsize']); + $this->t['userfilesmaxcount'] = $this->t['p']->get( 'user_files_max_count', 5 ); + $this->t['userfilesmaxsize'] = $this->t['p']->get( 'user_files_max_size', 20971520 ); + $this->t['send_mail_upload'] = $this->t['p']->get( 'send_mail_upload', 0 ); + $this->t['pw'] = PhocaDownloadRenderFront::renderPhocaDownload(); + //Subcateogry + //$this->t['parentid'] = $app->input->get('parentcategoryid', 0, 'int'); + + //$document->addScript(JURI::base(true).'/components/com_phocadownload/assets/js/comments.js'); + $document->addCustomTag(PhocaDownloadRenderFront::renderOnUploadJS()); + $document->addCustomTag(PhocaDownloadRenderFront::renderDescriptionUploadJS((int)$this->t['maxuploadchar'])); + $document->addCustomTag(PhocaDownloadRenderFront::userTabOrdering()); + $model = $this->getModel('user'); + + // Upload Form - - - - - - - - - - - - - - - + $ftp = !JClientHelper::hasCredentials('ftp');// Set FTP form + $session = JFactory::getSession(); + $this->assignRef('session', $session); + // END Upload Form - - - - - - - - - - - - - + + $this->t['displayupload'] = 1; + + + + // - - - - - - - - - - + // FORM + // - - - - - - - - - - + // No Controller because of returning back the values in case some form field is not OK + + // Set default for returning back + $formData = new JObject(); + $formData->set('title', ''); + $formData->set('description',''); + $formData->set('author',''); + $formData->set('email',''); + $formData->set('license',''); + $formData->set('website',''); + $formData->set('version',''); + + $this->t['errorcatid'] = ''; + $this->t['erroremail'] = ''; + $this->t['errorwebsite'] = ''; + $this->t['errorfile'] = ''; + + $task = $app->input->get( 'task', '', 'string' ); + if($task == 'upload') { + $post['title'] = $app->input->get( 'phocadownloaduploadtitle', '', 'string' ); + $post['description'] = $app->input->get( 'phocadownloaduploaddescription', '', 'string' ); + $post['catidfiles'] = $app->input->get( 'catidfiles', 0, 'int' ); + $post['description'] = substr($post['description'], 0, (int)$this->t['maxuploadchar']); + + $post['approved'] = 0; + $post['published'] = 1; + $post['owner_id'] = $user->id; + if ($this->t['enableuseruploadapprove'] == 0) { + $post['approved'] = 1; + } + $post['author'] = $app->input->get( 'phocadownloaduploadauthor', '', 'string' ); + $post['email'] = $app->input->get( 'phocadownloaduploademail', '', 'string' ); + $post['website'] = $app->input->get( 'phocadownloaduploadwebsite', '', 'string' ); + $post['license'] = $app->input->get( 'phocadownloaduploadlicense', '', 'string' ); + $post['version'] = $app->input->get( 'phocadownloaduploadversion', '', 'string' ); + + if ($post['title'] != '') {$formData->set('title', $post['title']);} + if ($post['description'] != '') {$formData->set('description', $post['description']);} + if ($post['author'] != '') {$formData->set('author', $post['author']);} + if ($post['email'] != '') {$formData->set('email', $post['email']);} + if ($post['website'] != '') {$formData->set('website', $post['website']);} + if ($post['license'] != '') {$formData->set('license', $post['license']);} + if ($post['version'] != '') {$formData->set('version', $post['version']);} + + //catid + $returnForm = 0; + if ($post['catidfiles'] < 1) { + $this->t['errorcatid'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_SELECT_CATEGORY'); + $returnForm = 1; + } + jimport('joomla.mail.helper'); + if ($post['email'] != '' && !JMailHelper::isEmailAddress($post['email']) ) { + $this->t['erroremail'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_ENTER_VALID_EMAIL_ADDRESS'); + $returnForm = 1; + } + if ($post['website'] != '' && !PhocaDownloadUtils::isURLAddress($post['website']) ) { + $this->t['errorwebsite'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_ENTER_VALID_WEBSITE'); + $returnForm = 1; + } + + // Upload + $errUploadMsg = ''; + $redirectUrl = ''; + $fileArray = JRequest::getVar('Filedata', '', 'files', 'array'); + + if(empty($fileArray) || (isset($fileArray['name']) && $fileArray['name'] == '')) { + $this->t['errorfile'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_ADD_FILE'); + $returnForm = 1; + } + + if ($post['title'] == '') { + $post['title'] = PhocaDownloadFile::removeExtension($fileArray['name']); + } + $post['alias'] = PhocaDownloadUtils::getAliasName($post['title']); + + + if ($returnForm == 0) { + $errorUploadMsg = ''; + if($model->singleFileUpload($errorUploadMsg, $fileArray, $post)) { + + if ($this->t['send_mail_upload'] > 0) { + PhocaDownloadMail::sendMail((int)$this->t['send_mail_upload'], $post['title'], 2); + } + + $Itemid = $app->input->get( 'Itemid', 0, 'int'); + $limitStart = $app->input->get( 'limitstart', 0, 'int'); + if ($limitStart > 0) { + $limitStartUrl = '&limitstart='.$limitStart; + } else { + $limitStartUrl = ''; + } + $link = 'index.php?option=com_phocadownload&view=user&Itemid='. $Itemid . $limitStartUrl; + $app->redirect(JRoute::_($link, false), JText::_("COM_PHOCADOWNLOAD_SUCCESS_FILE_UPLOADED")); + exit; + } else { + $this->t['errorfile'] = JText::_('COM_PHOCADOWNLOAD_ERROR_FILE_UPLOADED'); + if ($errorUploadMsg != '') { + $this->t['errorfile'] .= '
' . $errorUploadMsg; + } + } + + } + } + + + // - - - - - - - - - - - + // FILES + // - - - - - - - - - - - + $this->t['filesitems'] = $model->getDataFiles($user->id); + $this->t['filestotal'] = $model->getTotalFiles($user->id); + $this->t['filespagination'] = $model->getPaginationFiles($user->id); + + $filter_state_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_state','filter_state', '','word'); + $filter_catid_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_catid','filter_catid',0, 'int' ); + $catid_files = $app->getUserStateFromRequest( $this->_context_files. '.catid', 'catid', 0, 'int'); + //$filter_sectionid_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_sectionid', 'filter_sectionid', 0, 'int' ); + $filter_order_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_order','filter_order','a.ordering', 'cmd' ); + $filter_order_Dir_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_order_Dir','filter_order_Dir', '', 'word' ); + $search_files = $app->getUserStateFromRequest( $this->_context_files.'.search', 'search', '', 'string' ); + $search_files = JString::strtolower( $search_files ); + + // build list of categories + $javascript = 'class="inputbox" size="1" onchange="document.phocadownloadfilesform.submit();"'; + + // get list of categories for dropdown filter + $whereC = array(); + //if ($filter_sectionid_files > 0) { + // $whereC[] = ' cc.section = '.$db->Quote($filter_sectionid_files); + //} + //$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%".(int)$user->id."%')"; + //$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,{".(int)$user->id."}' OR cc.uploaduserid LIKE '{".(int)$user->id."},%' OR cc.uploaduserid LIKE '%,{".(int)$user->id."},%' OR cc.uploaduserid ={".(int)$user->id."} )"; + $whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,".(int)$user->id."' OR cc.uploaduserid LIKE '".(int)$user->id.",%' OR cc.uploaduserid LIKE '%,".(int)$user->id.",%' OR cc.uploaduserid =".(int)$user->id." )"; + $whereC = ( count( $whereC ) ? ' WHERE '. implode( ' AND ', $whereC ) : '' ); + + // get list of categories for dropdown filter + $query = 'SELECT cc.id AS value, cc.title AS text, cc.parent_id as parentid' . + ' FROM #__phocadownload_categories AS cc' . + $whereC. + ' ORDER BY cc.ordering'; + + $lists_files['catid'] = PhocaDownloadCategory::filterCategory($query, $catid_files, TRUE, TRUE, TRUE); + + /*$whereS = array(); + //$whereS[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%".(int)$user->id."%')"; + $whereS[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,".(int)$user->id."' OR cc.uploaduserid LIKE '".(int)$user->id.",%' OR cc.uploaduserid LIKE '%,".(int)$user->id.",%' OR cc.uploaduserid =".(int)$user->id." )"; + $whereS[] = 's.published = 1'; + $whereS = ( count( $whereS ) ? ' WHERE '. implode( ' AND ', $whereS ) : '' ); + // sectionid + $query = 'SELECT s.title AS text, s.id AS value' + . ' FROM #__phocadownload_sections AS s' + . ' LEFT JOIN #__phocadownload_categories AS cc ON cc.section = s.id' + . $whereS + . ' GROUP BY s.id' + . ' ORDER BY s.ordering'; + + + + // state filter + /* $state_files[] = JHTML::_('select.option', '', '- '. JText::_( 'Select State' ) .' -' ); + $state_files[] = JHTML::_('select.option', 'P', JText::_( 'Published' ) ); + $state_files[] = JHTML::_('select.option', 'U', JText::_( 'Unpublished') ); + $lists_image['state'] = JHTML::_('select.genericlist', $state_files, 'filter_state', 'class="inputbox" size="1" onchange="document.phocadownloadfilesform.submit();"', 'value', 'text', $filter_state );*/ + + //$lists_files['sectionid'] = PhocaDownloadCategory::filterSection($query, $filter_sectionid_files, TRUE); + + // state filter + $lists_files['state'] = JHTML::_('grid.state', $filter_state_files ); + + // table ordering + $lists_files['order_Dir'] = $filter_order_Dir_files; + $lists_files['order'] = $filter_order_files; + + // search filter + $lists_files['search']= $search_files; + + $this->t['catidfiles'] = $catid_files; + + $this->t['filestab'] = 1; + + // Tabs + $displayTabs = 0; + if ((int)$this->t['filestab'] == 0) { + $currentTab['files'] = -1; + } else { + $currentTab['files'] = $displayTabs; + $displayTabs++; + } + + $this->t['displaytabs'] = $displayTabs; + $this->t['currenttab'] = $currentTab; + + + // ACTION + $this->t['action'] = $uri->toString(); + // SEF problem + $isThereQM = false; + $isThereQM = preg_match("/\?/i", $this->t['action']); + if ($isThereQM) { + $amp = '&'; + } else { + $amp = '?'; + } + $this->t['actionamp'] = htmlspecialchars($this->t['action']) . $amp; + $this->t['istheretab'] = false; + $this->t['istheretab'] = preg_match("/tab=/i", $this->t['action']); + + + $this->t['ps'] = '&tab='. $this->t['currenttab']['files'] + . '&limitstart='.$this->t['filespagination']->limitstart; + + + // ASIGN + $this->assignRef( 'listsfiles', $lists_files); + $this->assignRef( 'formdata', $formData); + $this->assignRef( 'tmpl', $this->t); + $this->assignRef( 'params', $this->t['p']); + $session = JFactory::getSession(); + $this->assignRef('session', $session); + parent::display($tpl); + } +} +?>