NexusLeads Webshell
NexusLeads


Server : LiteSpeed
System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : alsaif ( 1057)
PHP Version : 7.4.33
Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/alsaif/domains/alsaif.group/private_html/components/com_allvideoshare/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/alsaif/domains/alsaif.group/private_html/components/com_allvideoshare/models/category.php
<?php
/*
 * @version		$Id: category.php 3.5.0 2020-01-25 $
 * @package		All Video Share
 * @copyright   Copyright (C) 2012-2020 MrVinoth
 * @license     GNU/GPL http://www.gnu.org/licenses/gpl-2.0.html
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

class AllVideoShareModelCategory extends AllVideoShareModel {
	
	public function getItem() {
	
      	$db = JFactory::getDBO();
		 
		$slug = AllVideoShareUtils::getSlug();		 
        $query = "SELECT * FROM #__allvideoshare_categories WHERE published=1 AND slug=" . $db->Quote( $slug );
        $db->setQuery( $query );
        $item = $db->loadObject();
		 
        return $item;
		 
	}

	public function getVideos( $catid, $params, $limit ) {
	
		$app = JFactory::getApplication();	
		$db = JFactory::getDBO();
		 
		$limit = $app->getUserStateFromRequest( 'global.list.limit', 'limit', $limit, 'int' );
		$limitstart = $app->input->get( 'limitstart', '0', 'INT' );
		$limitstart = ( $limit != 0 ? ( floor( $limitstart / $limit ) * $limit ) : 0 );
 
		$this->setState( 'limit', $limit );
		$this->setState( 'limitstart', $limitstart );		 
         
        $query  = "SELECT v.*, c.name as category FROM #__allvideoshare_videos AS v";
		$query .= " LEFT JOIN #__allvideoshare_categories AS c ON v.catid = c.id";
		$query .= ' WHERE v.published=1 AND (v.catid=' . $catid . ' OR v.catids LIKE ' . $db->Quote( '% ' . $catid . ' %' ) . ')';
		 
		if ( 'featured' == $params->get( 'orderby' ) || 1 == $params->get( 'featured', 0 ) ) {
			$query .= " AND v.featured=1";
		}
			
		switch ( $params->get( 'orderby' ) ) {
		 	case 'latest' :
		 		$query .= " ORDER BY v.id DESC";
				break;
			case 'latest_by_date' :
		 		$query .= " ORDER BY v.created_date DESC";
				break;
			case 'popular' :
				$query .= " ORDER BY v.views DESC";
				break;
			case 'random' :
				$query .= " ORDER BY RAND()";
				break;
			default :
				$query .= " ORDER BY v.ordering";
		}
		 
        $db->setQuery( $query, $limitstart, $limit );
        $items = $db->loadObjectList();
		 
        return $items;
		 
	}
	
	public function getTotal( $catid, $params ) {
	
		$db = JFactory::getDBO();
         
        $query = 'SELECT COUNT(id) FROM #__allvideoshare_videos WHERE published=1 AND (catid=' . $catid . ' OR catids LIKE ' . $db->Quote( '% ' . $catid . ' %' ) . ')';
		
		if ( 'featured' == $params->get( 'orderby' ) || 1 == $params->get( 'featured', 0 ) ) {
			$query .= " AND featured=1";
		}
		
        $db->setQuery( $query );
        $total = $db->loadResult();
		 
        return $total;
		 
	}
	
	public function getVideosPagination( $catid, $params ) {
	
    	jimport( 'joomla.html.pagination' );
		$pagination = new JPagination( $this->getTotal( $catid, $params ), $this->getState( 'limitstart' ), $this->getState( 'limit' ) );
		 
        return $pagination;
		 
	}
	
	public function getSubCategories( $parent, $params ) {
	
        $db = JFactory::getDBO();
		 
        $query = "SELECT * FROM #__allvideoshare_categories WHERE published=1 AND parent=" . $db->Quote( $parent );
		 
		switch ( $params->get( 'orderby' ) ) {
		 	case 'latest' :
		 		$query .= " ORDER BY id DESC";
				break;
			case 'random' :
				$query .= " ORDER BY RAND()";
				break;
			default :
				$query .= " ORDER BY ordering";
		 }	

        $db->setQuery( $query );		 
        $items = $db->loadObjectList();
		 
        return $items;
		 
	}
	
}

NexusLeads