PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/jairosvt/public_html/afmedios/modules/mod_jabulletin/
Server: Linux server2.noticiasdecolima.com 4.18.0-553.30.1.el8_10.x86_64 #1 SMP Tue Nov 26 02:30:26 EST 2024 x86_64
IP: 107.161.180.42
Choose File :

Url:
Dir : /home/jairosvt/public_html/afmedios/modules/mod_jabulletin/helper.php

<?php
/**
 * ------------------------------------------------------------------------
 * JA Bulletin module for Joomla 1.7
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * ------------------------------------------------------------------------
 */
// no direct access
defined ( '_JEXEC' ) or die ( 'Restricted access' );

require_once JPATH_SITE.'/components/com_content/helpers/route.php';
JModel::addIncludePath(JPATH_SITE.'/components/com_content/models');

//end check
if (! class_exists ( 'modJABulletin' )) {
	class modJABulletin {
		
		public function getListArticles($params)
		{
			// check cache was endable ?
			$app = &JFactory::getApplication();
			$use_cache = $app->getCfg("caching");
		    if ( $params->get('cache') == "1" && $use_cache == "1") {
				$cache =& JFactory::getCache();
				$cache->setCaching( true );
				$cache->setLifeTime( $params->get( 'cache_time', 30 ) * 60 );	
				$rows = $cache->get( array( $this , 'getAticles' ), array( $params ) ); 
			}
			else
			{
				$rows = $this->getAticles($params);
			}
			return $rows;
		}
		
		public function getAticles($params)
		{
			// Get the dbo
			$db = JFactory::getDbo();
	
			// Get an instance of the generic articles model
			$model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
			// Set application parameters in model
			$appParams = JFactory::getApplication()->getParams();
			$model->setState('params', $appParams);
	
			$model->setState('list.select', 'a.fulltext, a.id, a.title, a.alias, a.title_alias, a.introtext, a.state, a.catid, a.created, a.created_by, a.created_by_alias,' .
								' a.modified, a.modified_by,a.publish_up, a.publish_down, a.attribs, a.metadata, a.metakey, a.metadesc, a.access,' .
								' a.hits, a.featured, a.ordering, c.alias AS category_alias, ' .
								' LENGTH(a.fulltext) AS readmore');
			
			// Set the filters based on the module params
			$model->setState('list.start', 0);
			$model->setState('list.limit', (int)trim($params->get('count', 5)));		
			$model->setState('filter.published', 1);
	
			// Access filter
			$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
			$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
			$model->setState('filter.access', $access);
	
			// Category filter
			if($params->get('category')){								
				$model->setState('filter.category_id', $params->get('category'));
			}
			
			$featured = $params->get('show_featured', 1);
			if(!$featured){
				$model->setState('filter.featured', 'hide');
			}
			elseif($featured==2){
				$model->setState('filter.featured', 'only');
			}
			
			// Set ordering		
			$ordering = $params->get('type', 'latest');
			if($ordering=='latest'){
				// Set ordering
        		$order_map = array(
        			'm_dsc' => 'a.modified DESC, a.created',
        			'mc_dsc' => 'CASE WHEN (a.modified = '.$db->quote($db->getNullDate()).') THEN a.created ELSE a.modified END',
        			'c_dsc' => 'a.created',
        			'p_dsc' => 'a.publish_up',
        		);
        		$ordering = JArrayHelper::getValue($order_map, $params->get('ordering', 'm_dsc'), 'a.publish_up');
			}
			else{
				$ordering =  'a.hits';
			}			
			$dir = 'DESC';
			//echo $ordering;exit;
			$model->setState('list.ordering', $ordering);
			$model->setState('list.direction', $dir);
	
			$items = $model->getItems();//print_r($items);exit;
	
			if($items){
				
				$i = 0;
				$showHits = $params->get('show_hits',0);
				$showHits = $showHits == "1"?true:false;
				$showimg = $params->get ( 'show_image', 1 );
				$w = ( int ) $params->get ( 'width', 80 );
				$h = ( int ) $params->get ( 'height', 96 );
				$showdate = $params->get ( 'show_date', 1 );
			
				$thumbnailMode = $params->get( 'thumbnail_mode', 'crop' );
				$aspect 	   = $params->get( 'use_ratio', '1' );
				$crop = $thumbnailMode == 'crop' ? true:false;
				$lists = array ();
				$jaimage = JAImage::getInstance();
				
				
				foreach ($items as &$item) {
					$item->slug = $item->id.':'.$item->alias;
					$item->catslug = $item->catid.':'.$item->category_alias;
		
					if ($access || in_array($item->access, $authorised))
					{
						// We know that user has the privilege to view the article
						$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
					}
					else {
						$item->link = JRoute::_('index.php?option=com_user&view=login');
					}
					
					$item->introtext = JHtml::_('content.prepare', $item->introtext);
					$item->text = htmlspecialchars ( $item->title );
					
					if ($showdate) {
						$item->date = $item->modified == null||$item->modified==""||$item->modified=="0000-00-00 00:00:00" ? $item->created : $item->modified;
					}
					$item->image = '';
					if ($showimg) {
							$imageSource = $jaimage->parseImage( $item->introtext. $item->fulltext);
							if ( $imageSource ) { 
								if( $thumbnailMode != 'none' ) {
									$imageURL = $jaimage->resize( $imageSource, $w, $h, $crop, $aspect );
									if( $imageURL ){
										if ( $imageURL == $imageSource ) {
											$width = $w ? "width=\"$w\"" : "";
											$height = $h ? "height=\"$h\"" : "";
											$item->image = "<img src=\"$imageURL\" alt=\"{$item->text}\" title=\"{$item->text}\" $width $height />";
										} else {
											$item->image = "<img src=\"$imageURL\" alt=\"{$item->text}\" title=\"{$item->text}\" />";
										}
									} else {
										$item->image = '';
									}
								} else {
									$width = $w ? "width=\"$w\"" : "";
									$height = $h ? "height=\"$h\"" : "";
									$item->image = "<img src=\"$imageSource\" alt=\"{$item->text}\" title=\"{$item->text}\" $width $height />";	
								}	
							}
						}
						
						$item->creater = isset($item->author)?$item->author:$item->author_name;
						if($showHits)
						{
							$item->hits = isset($item->hits)?$item->hits:0;
						}
						else
						{
							$item->hits = null;
						}
				}
			}
			
			return $items;
		}				
	}
}