/** * Constructor. * * @param array An optional associative array of configuration settings. * @see JController * @since 1.6 */ public function __construct($config = array()) { $this->input = JFactory::getApplication()->input; parent::__construct($config); // Guess the JText message prefix. Defaults to the option. if (empty($this->extension)) { $this->extension = JRequest::getCmd('extension', 'com_content'); } // If the joomla's version is more than or equal to 3.0 if (!COM_TZ_PORTFOLIO_JVERSION_COMPARE) { JHtml::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tz_portfolio/libraries/cms/html'); tzportfolioimport('cms/html/sidebar'); $doc = JFactory::getDocument(); //Add Script to the header $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/jquery.min.js'); $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/jquery-noconflict.js'); $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/bootstrap.min.js'); $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/chosen.jquery.min.js'); $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/jquery.ui.core.min.js'); $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/jquery.ui.sortable.min.js'); $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/sortablelist.js'); $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/js/template.min.js'); $doc->addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/css/chosen.min.css'); // $doc -> addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/jui/css/bootstrap.min.css'); // $doc -> addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/css/template.css'); $doc->addCustomTag('<link href="' . COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/css/template.min.css' . '" rel="stylesheet" type="text/css"/>'); } }
public function display($tpl = null) { if (!COM_TZ_PORTFOLIO_JVERSION_COMPARE) { tzportfolioimport('helper/content'); } $this->items = $this->get('Items'); $this->state = $this->get('State'); $this->pagination = $this->get('pagination'); JFactory::getLanguage()->load('com_templates'); TZ_PortfolioHelper::addSubmenu('templates'); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } $this->sidebar = JHtmlSidebar::render(); parent::display($tpl); }
function __construct($config = array()) { $this->input = JFactory::getApplication()->input; $params = JFactory::getApplication()->getParams(); // Article frontpage Editor pagebreak proxying: if (($this->input->get('view') == 'article' || $this->input->get('view') == 'p_article') && $this->input->get('layout') == 'pagebreak') { $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR; } elseif ($this->input->get('view') == 'articles' && $this->input->get('layout') == 'modal') { JHtml::_('stylesheet', 'system/adminlist.css', array(), true); $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR; } // If the joomla's version is more than or equal to 3.0 if (!COM_TZ_PORTFOLIO_JVERSION_COMPARE) { JHtml::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tz_portfolio/libraries/cms/html'); tzportfolioimport('cms/html/sidebar'); $doc = JFactory::getDocument(); //Add Script to the header if ($params->get('enable_jquery', 1)) { $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/js/jquery-1.9.1.js'); $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/js/jquery-noconflict.js'); $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/js/jquery-migrate-1.2.1.js'); } if ($params->get('enable_bootstrap', 1)) { $doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/bootstrap/js/bootstrap.min.js'); $doc->addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/bootstrap/css/bootstrap.min.css'); $doc->addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/bootstrap/css/bootstrap-responsive.min.css'); } // $doc -> addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/css/tz-portfolio.css'); // $doc -> addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/jui/js/chosen.jquery.min.js'); // $doc -> addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/jui/js/jquery.ui.core.min.js'); // $doc -> addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/jui/js/jquery.ui.sortable.min.js'); // $doc -> addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/jui/js/sortablelist.js'); // $doc -> addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/js/template.js'); // $doc -> addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/jui/css/chosen.css'); // $doc -> addCustomTag('<link href="'.COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/css/template.css'. // '" rel="stylesheet" type="text/css"/>'); } parent::__construct($config); }
function uploadImages($file, $currentImage = null) { if ($file) { $maxSize = 2 * 1024 * 1024; $arr = array('image/jpeg', 'image/jpg', 'image/bmp', 'image/gif', 'image/png', 'image/ico'); // Create folder $tzFolder = 'tz_portfolio'; $tzUserFolder = 'users'; $tzFolderPath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . $tzFolder; $tzUserFolderPath = $tzFolderPath . DIRECTORY_SEPARATOR . $tzUserFolder; if (!JFolder::exists($tzFolderPath)) { JFolder::create($tzFolderPath); if (!JFile::exists($tzFolderPath . DIRECTORY_SEPARATOR . 'index.html')) { JFile::write($tzFolderPath . DIRECTORY_SEPARATOR . 'index.html', htmlspecialchars_decode('<!DOCTYPE html><title></title>')); } } if (JFolder::exists($tzFolderPath)) { if (!JFolder::exists($tzUserFolderPath)) { JFolder::create($tzUserFolderPath); if (!JFile::exists($tzUserFolderPath . DIRECTORY_SEPARATOR . 'index.html')) { JFile::write($tzUserFolderPath . DIRECTORY_SEPARATOR . 'index.html', htmlspecialchars_decode('<!DOCTYPE html><title></title>')); } } } if (is_array($file)) { foreach ($file as $key => $val) { if (is_array($val)) { foreach ($val as $key2 => $val2) { $file[$key] = $val2; } } } //Upload image if (in_array($file['type'], $arr)) { if ($file['size'] <= $maxSize) { $desFileName = 'user_' . time() . uniqid() . '.' . JFile::getExt($file['name']); $desPath = $tzUserFolderPath . DIRECTORY_SEPARATOR . $desFileName; if (JFile::exists($file['tmp_name'])) { if (!JFile::copy($file['tmp_name'], $desPath)) { JError::raiseNotice(300, JText::_('COM_TZ_PORTFOLIO_CAN_NOT_UPLOAD_FILE')); } $image = new JImage(); $image->loadFile($desPath); $params = JComponentHelper::getParams('com_tz_portfolio'); if ($params->get('tz_user_image_width', 100)) { $width = $params->get('tz_user_image_width', 100); } $height = ceil($image->getHeight() * $width / $image->getWidth()); $image = $image->resize($width, $height); $type = $this->_getImageType($file['name']); $image->toFile($desPath, $type); $this->deleteImages($currentImage); return 'media/' . $tzFolder . '/' . $tzUserFolder . '/' . $desFileName; } } else { JError::raiseNotice(300, JText::_('COM_TZ_PORTFOLIO_IMAGE_SIZE_TOO_LARGE')); } } else { JError::raiseNotice(300, JText::_('COM_TZ_PORTFOLIO_IMAGE_FILE_NOT_SUPPORTED')); } } else { tzportfolioimport('HTTPFetcher'); tzportfolioimport('readfile'); $image = new Services_Yadis_PlainHTTPFetcher(); $image = $image->get($file); if (in_array($image->headers['Content-Type'], $arr)) { if ($image->headers['Content-Length'] > $maxSize) { $this->deleteImages($currentImage); $desFileName = 'user_' . time() . uniqid() . '.' . str_replace('image/', '', $image->headers['Content-Type']); $desPath = $tzUserFolderPath . DIRECTORY_SEPARATOR . $desFileName; if (JFolder::exists($tzFolderPath)) { if (!JFile::write($desPath, $image->body)) { $this->setError(JText::_('COM_TZ_PORTFOLIO_CAN_NOT_UPLOAD_FILE')); return false; } return 'media/' . $tzFolder . '/' . $tzUserFolder . '/' . $desFileName; } } else { JError::raiseNotice(300, JText::_('COM_TZ_PORTFOLIO_IMAGE_SIZE_TOO_LARGE')); } } else { JError::raiseNotice(300, JText::_('COM_TZ_PORTFOLIO_IMAGE_FILE_NOT_SUPPORTED')); } } } if ($currentImage) { return $currentImage; } return ''; }
# Websites: http://www.templaza.com # Technical Support: Forum - http://templaza.com/Forum -------------------------------------------------------------------------*/ // No direct access defined('_JEXEC') or die; jimport('joomla.application.component.modeladmin'); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); jimport('joomla.event.dispatcher'); //require_once JPATH_COMPONENT_ADMINISTRATOR.'/helpers/content.php'; define('TZ_IMAGE_SIZE', 10 * 1024 * 1024); //define('TZ_IMAGE_TYPE',array('image/jpeg','image/jpg','image/bmp','image/gif','image/png','image/ico')); tzportfolioimport('HTTPFetcher'); tzportfolioimport('readfile'); /** * Item Model for an Article. */ class TZ_PortfolioModelArticle extends JModelAdmin { /** * @var string The prefix to use with controller messages. * @since 1.6 */ protected $text_prefix = 'COM_CONTENT'; private $fieldsid = array(); private $imageUrl = 'media/tz_portfolio/article'; private $tzfolder = 'tz_portfolio'; private $attachUrl = 'attachments'; protected $audioFolder = 'audio';
<?php /** * @package Joomla.Libraries * @subpackage Layout * * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_BASE') or die; tzportfolioimport('cms/layout/layout'); /** * Base class for rendering a display layout * * @package Joomla.Libraries * @subpackage Layout * @since 3.0 */ class JLayoutBase implements JLayout { /** * Method to escape output. * * @param string $output The output to escape. * * @return string The escaped output. * * @since 3.0 */ public function escape($output) {
<?php /** * @package Joomla.Libraries * @subpackage HTML * * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; tzportfolioimport('cms/html/html'); /** * Utility class for Bootstrap elements. * * @package Joomla.Libraries * @subpackage HTML * @since 3.0 */ abstract class JHtmlBootstrap { /** * @var array Array containing information for loaded files * @since 3.0 */ protected static $loaded = array(); /** * Add javascript support for Bootstrap alerts * * @param string $selector Common class for the alerts * * @return void
<?php /** * @package Joomla.Libraries * @subpackage HTML * * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_BASE') or die; tzportfolioimport('/cms/layout/file'); /** * Utility class to render a list view sidebar * * @package Joomla.Libraries * @subpackage HTML * @since 3.0 */ abstract class JHtmlSidebar { /** * Menu entries * * @var array * @since 3.0 */ protected static $entries = array(); /** * Filters * * @var array
function uploadImages($file, $url = null) { if ($file) { $maxSize = 2 * 1024 * 1024; $arr = array('image/jpeg', 'image/jpg', 'image/bmp', 'image/gif', 'image/png', 'image/ico'); // Create folder $tzFolder = 'tz_portfolio'; $tzUserFolder = 'categories'; $tzFolderPath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . $tzFolder; $tzUserFolderPath = $tzFolderPath . DIRECTORY_SEPARATOR . $tzUserFolder; if (!JFolder::exists($tzFolderPath)) { JFolder::create($tzFolderPath); if (!JFile::exists($tzFolderPath . DIRECTORY_SEPARATOR . 'index.html')) { JFile::write($tzFolderPath . DIRECTORY_SEPARATOR . 'index.html', htmlspecialchars_decode('<!DOCTYPE html><title></title>')); } } if (JFolder::exists($tzFolderPath)) { if (!JFolder::exists($tzUserFolderPath)) { JFolder::create($tzUserFolderPath); if (!JFile::exists($tzUserFolderPath . DIRECTORY_SEPARATOR . 'index.html')) { JFile::write($tzUserFolderPath . DIRECTORY_SEPARATOR . 'index.html', htmlspecialchars_decode('<!DOCTYPE html><title></title>')); } } } $params = JComponentHelper::getParams('com_tz_portfolio'); if (!$url) { $image = new JImage(JPATH_SITE . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $file)); $desFileName = 'categories_' . time() . uniqid() . '.' . JFile::getExt($file); $desPath = $tzUserFolderPath . DIRECTORY_SEPARATOR . $desFileName; if ($params->get('tz_catimage_width', 400)) { $newWidth = $params->get('tz_catimage_width', 400); } $type = strtolower(JFile::getExt($file)); $_type = null; if ($type == 'gif') { $_type = IMAGETYPE_GIF; } elseif ($type == 'png') { $_type = IMAGETYPE_PNG; } $height = ceil($image->getHeight() * $newWidth / $image->getWidth()); $image = $image->resize($newWidth, $height); $image->toFile($desPath, $_type); return 'media/' . $tzFolder . '/' . $tzUserFolder . '/' . $desFileName; } else { tzportfolioimport('HTTPFetcher'); tzportfolioimport('readfile'); $image = new Services_Yadis_PlainHTTPFetcher(); $image = $image->get($file); if (!in_array($image->headers['Content-Type'], $arr)) { $this->setError(JText::_('COM_TZ_PORTFOLIO_INVALID_FILE')); return false; } if ($image->headers['Content-Length'] > $maxSize) { $this->setError(JText::_('COM_TZ_PORTFOLIO_IMAGE_SIZE_TOO_LARGE')); return false; } $desFileName = 'categories_' . time() . uniqid() . '.' . str_replace('image/', '', $image->headers['Content-Type']); $desPath = $tzUserFolderPath . DIRECTORY_SEPARATOR . $desFileName; if (JFolder::exists($tzFolderPath)) { if (!JFile::write($desPath, $image->body)) { $this->setError(JText::_('COM_TZ_PORTFOLIO_CAN_NOT_UPLOADED_FILEs')); return false; } $image = new JImage($desPath); $newWidth = $params->get('tz_catimage_width', 400); $newHeight = ceil($image->getHeight() * $newWidth / $image->getWidth()); $newImage = $image->resize((int) $neWidth, $newHeight, false); $type = strtolower(JFile::getExt($file)); $_type = $type == 'gif' ? IMAGETYPE_GIF : $type == 'png' ? IMAGETYPE_PNG : null; $newImage->toFile($desPath, $_type); return 'media/' . $tzFolder . '/' . $tzUserFolder . '/' . $desFileName; } } } return true; }
<?php /** * @package Joomla.Libraries * @subpackage Layout * * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_BASE') or die; tzportfolioimport('cms/layout/base'); /** * Base class for rendering a display layout * loaded from from a layout file * * @package Joomla.Libraries * @subpackage Layout * @since 3.0 */ class JLayoutFile extends JLayoutBase { /** * @var string Dot separated path to the layout file, relative to base path * @since 3.0 */ protected $layoutId = ''; /** * @var string Base path to use when loading layout files * @since 3.0 */ protected $basePath = null;