示例#1
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $model = $this->getModel();
     $document = JFactory::getDocument();
     $this->t['dw'] = PhocaDownloadRenderFront::renderPhocaDownload();
     $this->t['p'] = $app->getParams();
     $this->t['user'] = JFactory::getUser();
     $this->t['categories'] = $model->getCategoriesList();
     $this->t['mostvieweddocs'] = $model->getMostViewedDocsList($this->t['p']);
     $this->t['displaynew'] = $this->t['p']->get('display_new', 0);
     $this->t['displayhot'] = $this->t['p']->get('display_hot', 0);
     $this->t['displaymostdownload'] = $this->t['p']->get('display_most_download', 1);
     $this->t['displaynumdocsecs'] = $this->t['p']->get('display_num_doc_secs', 0);
     $this->t['displaynumdocsecsheader'] = $this->t['p']->get('display_num_doc_secs_header', 1);
     $this->t['file_icon_size_md'] = $this->t['p']->get('file_icon_size_md', 16);
     $this->t['download_metakey'] = $this->t['p']->get('download_metakey', '');
     $this->t['download_metadesc'] = $this->t['p']->get('download_metadesc', '');
     $this->t['description'] = $this->t['p']->get('description', '');
     $this->t['displaymaincatdesc'] = $this->t['p']->get('display_main_cat_desc', 0);
     $this->t['display_specific_layout'] = $this->t['p']->get('display_specific_layout', 0);
     PhocaDownloadRenderFront::renderAllCSS();
     $imagePath = PhocaDownloadPath::getPathSet('icon');
     $this->t['cssimgpath'] = str_replace('../', JURI::base(true) . '/', $imagePath['orig_rel_ds']);
     $filePath = PhocaDownloadPath::getPathSet('file');
     $this->t['absfilepath'] = $filePath['orig_abs_ds'];
     $this->_prepareDocument();
     parent::display($tpl);
 }
示例#2
0
			
			$pdFile = '<div class="pd-filenamebox">';
			if ($this->t['filename_or_name'] == 'filenametitle') {
				$pdFile .= '<div class="pd-title">'. $v->title . '</div>';
			}
			
			$pdFile .= '<div class="pd-filename">'. $imageFileName['filenamethumb']
				. '<div class="pd-document'.$this->t['file_icon_size'].'" '
				. $imageFileName['filenamestyle'].'>';
			
			$pdFile .= '<div class="pd-float">';
			$pdFile .= $l->getName($v->title, $v->filename);
			$pdFile .= '</div>';
			
			$pdFile .= PhocaDownloadRenderFront::displayNewIcon($v->date, $this->t['displaynew']);
			$pdFile .= PhocaDownloadRenderFront::displayHotIcon($v->hits, $this->t['displayhot']);
			
			// String Tags - title suffix
			$tagsS = $l->displayTagsString($v->tags_string);
			if ($tagsS != '') {
				$pdFile .= '<div class="pd-float">'.$tagsS.'</div>';
			}
			
			// Tags - title suffix - FILE VIEW = DOWNLOAD FILE
			if ($this->t['display_tags_links'] == 5 || $this->t['display_tags_links'] == 6) {
				$tags = $l->displayTags($v->id, 1);
				if ($tags != '') {
					$pdFile .= '<div class="pd-float">'.$tags.'</div>';
				}
			}
			
示例#3
0
			/// 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 btn-primary "', $mirrorOutput2);
				} else {
					$classMirror = 'pd-mirror-bp';
				}
			
				$pdMirrorLink2 = '<div class="'.$classMirror.'">'.$mirrorOutput2.'</div>';
			}
			
			// 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) {
				$tags2 = $l->displayTags($v->id);
				if ($tags2 != '') {
					$pdTags .= '<div class="pd-float">'.$tags2.'</div>';
				}
			}

			// RENDER	
示例#4
0
            }
            // IMAGE FILENAME
            //$imageFileName = '';
            //if ($value->image_filename !='') {
            $imageFileName = $l->getImageFileName($value->image_filename, $value->filename, 2);
            /*$thumbnail = false;
            		$thumbnail = preg_match("/phocathumbnail/i", $value->image_filename);
            		if ($thumbnail) {
            			$imageFileName 	= '';
            		} else {
            			$imageFileName = 'style="background: url(\''.$this->t['cssimgpath'].$value->image_filename.'\') 0 center no-repeat;"';
            		}*/
            //}
            //$outputFile .= '<div class="pd-document'.$this->t['file_icon_size_md'].'" '.$imageFileName.'>';
            $outputFile .= '<li class="bullet-item" ' . $imageFileName['filenamestyle'] . '>';
            $outputFile .= '<a href="' . JRoute::_(PhocaDownloadRoute::getCategoryRoute($value->categoryid, $value->categoryalias)) . '">' . $value->title . '</a>' . ' <span class="badge badge-info tip"> | <i class="fa fa-folder"></i> ' . $value->categorytitle . '</span>';
            $outputFile .= PhocaDownloadRenderFront::displayNewIcon($value->date, $this->t['displaynew']);
            $outputFile .= PhocaDownloadRenderFront::displayHotIcon($value->hits, $this->t['displayhot']);
            $outputFile .= '</li>' . "\n";
        }
    }
    if ($outputFile != '') {
        echo '<div class="pd-hr" style="clear:both">&nbsp;</div>';
        echo '<ul class="pricing-table">';
        echo '<li class="title">' . JText::_('COM_PHOCADOWNLOAD_MOST_DOWNLOADED_FILES') . '</li>';
        echo $outputFile;
        echo '</ul>';
    }
}
echo '<div class="pd-cb">&nbsp;</div>';
echo $this->t['pw'];
示例#5
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $uri = JFactory::getURI();
     $menus = $app->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'] .= '<br />' . $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 = '&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);
 }
示例#6
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $this->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('<script type="text/javascript" src="'.JURI::root().'components/com_phocadownload/assets/overlib/overlib_mini.js"></script>');
             		$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);
 }
示例#7
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $this->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('<script type="text/javascript" src="' . JURI::root() . 'components/com_phocadownload/assets/overlib/overlib_mini.js"></script>');
     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("<style type=\"text/css\"> \n" . " #sbox-window.phocadownloadplaywindow   {background-color:#fff;padding:2px} \n" . " #sbox-overlay.phocadownloadplayoverlay  {background-color:#000;} \n" . " </style> \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("<style type=\"text/css\"> \n" . " #sbox-window.phocadownloadpreviewwindow   {background-color:#fff;padding:2px} \n" . " #sbox-overlay.phocadownloadpreviewoverlay  {background-color:#000;} \n" . " </style> \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);
 }
示例#8
0
	function display($tpl = null){		
		
		$app					= JFactory::getApplication();
		$this->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('<script type="text/javascript" src="'.JURI::root().'components/com_phocadownload/assets/overlib/overlib_mini.js"></script>');
		$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::_('jquery.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]);
		}

		
		// Bootstrap 3 Layout
		$this->tmpl['display_bootstrap3_layout']	= $this->t['p']->get( 'display_bootstrap3_layout', 0 );
		
		if ($this->tmpl['display_bootstrap3_layout'] == 1) {
			
			JHtml::_('jquery.framework', false);
			JHTML::stylesheet('media/com_phocadownload/bootstrap/css/bootstrap.min.css' );
			JHTML::stylesheet('media/com_phocadownload/bootstrap/css/bootstrap.extended.css' );
			// Loaded by jquery.framework;
			//$document->addScript(JURI::root(true).'/media/com_phocadownload/bootstrap/js/bootstrap.min.js');
			/*$document->addScript(JURI::root(true).'/media/com_phocadownload/js/jquery.equalheights.min.js');
			$document->addScriptDeclaration(
			'jQuery(window).load(function(){
				jQuery(\'.ph-thumbnail\').equalHeights();
			});');*/
		}
		
		if ($this->tmpl['display_bootstrap3_layout'] == 1) {
			parent::display('bootstrap');	
		} else {
			parent::display($tpl);	
		}
		
	}
示例#9
0
	function display($tpl = null)
	{		
		$app								= JFactory::getApplication();
		$model								= $this->getModel();
		$document							= JFactory::getDocument();
		$this->t['p'] 						= $app->getParams();
		$this->t['user'] 					= JFactory::getUser();	
		$this->t['categories']				= $model->getCategoriesList();
		$this->t['mostvieweddocs']			= $model->getMostViewedDocsList($this->t['p']);
		$this->t['dev']						= PhocaDownloadRenderFront::renderPhocaDownload();
		$this->t['displaynew']				= $this->t['p']->get( 'display_new', 0 );
		$this->t['displayhot']				= $this->t['p']->get( 'display_hot', 0 );
		$this->t['displaymostdownload']		= $this->t['p']->get( 'display_most_download', 1 );
		$this->t['displaynumdocsecs']		= $this->t['p']->get( 'display_num_doc_secs', 0 );
		$this->t['displaynumdocsecsheader']	= $this->t['p']->get( 'display_num_doc_secs_header', 1 );
		$this->t['file_icon_size_md'] 		= $this->t['p']->get( 'file_icon_size_md', 16 );
		$this->t['download_metakey'] 		= $this->t['p']->get( 'download_metakey', '' );
		$this->t['download_metadesc'] 		= $this->t['p']->get( 'download_metadesc', '' );
		$this->t['description']				= $this->t['p']->get( 'description', '' );
		$this->t['displaymaincatdesc']		= $this->t['p']->get( 'display_main_cat_desc', 0 );
		$this->t['display_specific_layout']	= $this->t['p']->get( 'display_specific_layout', 0 );
		
		

		
		// Bootstrap 3 Layout
		$this->tmpl['display_bootstrap3_layout']	= $this->t['p']->get( 'display_bootstrap3_layout', 0 );
		if ($this->tmpl['display_bootstrap3_layout'] == 1) {
			
			JHtml::_('jquery.framework', false);
			JHTML::stylesheet('media/com_phocadownload/bootstrap/css/bootstrap.min.css' );
			JHTML::stylesheet('media/com_phocadownload/bootstrap/css/bootstrap.extended.css' );
			// Loaded by jquery.framework;
			$document->addScript(JURI::root(true).'/media/com_phocadownload/bootstrap/js/bootstrap.min.js');
			
			
			$document->addScript(JURI::root(true).'/media/com_phocadownload/js/jquery.matchHeight.js');
			$document->addScriptDeclaration(
			'jQuery(window).load(function(){
				jQuery(\'.ph-thumbnail\').matchHeight();
			});');
			
			/*$document->addScript(JURI::root(true).'/media/com_phocadownload/js/jquery.equalheights.min.js');
			$document->addScriptDeclaration(
			'jQuery(window).load(function(){
				jQuery(\'.ph-thumbnail\').equalHeights();
			});');*/

		}
		
		PhocaDownloadRenderFront::renderAllCSS();
		
		$imagePath				= PhocaDownloadPath::getPathSet('icon');
		$this->t['cssimgpath']	= str_replace ( '../', JURI::base(true).'/', $imagePath['orig_rel_ds']);
		$filePath				= PhocaDownloadPath::getPathSet('file');
		$this->t['absfilepath']	= $filePath['orig_abs_ds'];

		$this->_prepareDocument();
		if ($this->tmpl['display_bootstrap3_layout'] == 1) {
			parent::display('bootstrap');	
		} else {
			parent::display($tpl);	
		}
		
	}