=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=/
+
+
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 .= '';
+ }
+ }
+
+ // 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 .= '';
+ }
+ }
+
+ // 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 = '';
+ } 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 = '';
+ } 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 '';
+?>
\ 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 .= '
';
+
+ // For users who have disabled Javascript
+ $o .= '';
+ } else {
+ // External link
+ if ($v->link_external != '') {
+ $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 .= '';
+ }
+
+ 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 .= '
';
+
+ // For users who have disabled Javascript
+ $o .= '';
+ } else {
+ // External link
+ if ($v->link_external != '') {
+ $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 .= '';
+ }
+
+ 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
+
+
+
+
+
+
+
+
+
+ COM_PHOCADOWNLOAD_HIDE
+ COM_PHOCADOWNLOAD_DISPLAY
+
+
+
+ COM_PHOCADOWNLOAD_HIDE
+ COM_PHOCADOWNLOAD_DISPLAY
+
+
+
+
+
\ 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 @@
+
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';
+}
+
+
+?>
+
+
+
+
+
+
+
+
+t['type'] == 0) {
+?>
+
+
+ t['type'] == 1 || $this->t['type'] == 2){
+ ?>
+
+
+
+ t['type'] == 3){
+ ?>
+
+
+
+ t['type'] == 4){
+ ?>
+
+
+
+
+
+
+
\ 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 '';
+ echo '';
+ echo JText::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
+ echo ' '. "\n";
+ } else if ($this->t['filetype'] == 'mp4') {
+ echo '';
+ echo '';
+ echo JText::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
+ echo ' '. "\n";
+ } else if ($this->t['filetype'] == 'ogg') {
+ echo '';
+ echo '';
+ echo JText::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
+ echo ' '. "\n";
+ } else if ($this->t['filetype'] == 'ogv') {
+ echo '';
+ echo '';
+ echo JText::_('COM_PHOCADOWNLOAD_BROWSER_DOES_NOT_SUPPORT_AUDIO_VIDEO_TAG');
+ 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) {
+
+
+?>
+
+
+
+
+
+
+
+state->folder) && $this->state->folder != '') {
+ $currentFolder = $this->state->folder;
+}
+?>
+
t['uploadmaxsizeread'].']';
+?>
+
+t['errorcatid'] != '') {
+ echo '
'
+ .'× ' . $this->t['errorcatid'] . '
';
+} ?>
+
+
+
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);
+ }
+}
+?>