Joomla 3.1 template BT-Metro

Mais
12 anos 3 meses atrás #91113 por Aureo
Aureo replied the topic: Re: Joomla 3.1 template BT-Metro
Pastas 755 e arquivos 644

Please Entrar ou Registrar to join the conversation.

  • vicksilvac
  • Avatar de vicksilvac Autor do Tópico
  • Offline
  • JCB! Junior
  • JCB! Junior
Mais
12 anos 3 meses atrás #91114 por vicksilvac
vicksilvac replied the topic: Re: Joomla 3.1 template BT-Metro
Aureo, se vc quiser mando pra vc o login e a senha para vc mexer... pode ser?

Please Entrar ou Registrar to join the conversation.

  • vicksilvac
  • Avatar de vicksilvac Autor do Tópico
  • Offline
  • JCB! Junior
  • JCB! Junior
Mais
12 anos 3 meses atrás #91117 por vicksilvac
vicksilvac replied the topic: Re: Joomla 3.1 template BT-Metro
entao todos estao com essa permissão, agora coloquei algum arquivo com permissão diferente, mas tb nao deu certo <!-- s:x --><img src="{SMILIES_PATH}/icon_mad.gif" alt=":x" title="Furioso" /><!-- s:x -->

vc quer a login e senha pra dar uma olhada?

Please Entrar ou Registrar to join the conversation.

  • vicksilvac
  • Avatar de vicksilvac Autor do Tópico
  • Offline
  • JCB! Junior
  • JCB! Junior
Mais
12 anos 3 meses atrás #91122 por vicksilvac
vicksilvac replied the topic: Re: Joomla 3.1 template BT-Metro
ola mais uma vez... estou tentando d todas as formas...

no proprio components bt-portifolio tem um botao escrito assim REBUILD IMAGES COM UMA SETA VOLTAR.

cliquei nele e da o seguinte erro:



fui até esse codigo para ver
<?php
/**
 * @package 	bt_portfolio - BT Portfolio Component
 * @version		1.2.6
 * @created		Feb 2012
 * @author		BowThemes
 * @email		support@bowthems.com
 * @website		http://bowthemes.com
 * @support		Forum - http://bowthemes.com/forum/
 * @copyright	Copyright (C) 2012 Bowthemes. All rights reserved.
 * @license		http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');

/**
 * Portfolio Model
 */
class Bt_portfolioModelPortfolio extends JModelAdmin
{	
	protected $images_path;
	protected $params;
	/**
	 * Class constructor.
	 *
	 * @param	array	$config	A named array of configuration variables.
	 *
	 * @return	JControllerForm
	 * @since	1.6
	 */
	function __construct($config = array())
	{
		parent::__construct($config);
		$this->params = &JComponentHelper::getParams($this->option);
		$this->images_path = JPATH_SITE .'/'. $this->params->get('images_path','images/bt_portfolio').'/';
		$this->remove_original = $this->params->get('remove_original',0);
		$this->crop_image = $this->params->get('crop_image', 1);
		$this->crop_width =$this->params->get('crop_width', 600);
		$this->crop_height = $this->params->get('crop_height', 400);
		$this->thumb_width = $this->params->get('thumb_width', 336);
		$this->thumb_height = $this->params->get('thumb_height', 180);
		$this->ssthumb_width = $this->params->get('ss_thumb_width', 70);
		$this->ssthumb_height = $this->params->get('ss_thumb_height', 40);
		$this->crop_pos = $this->params->get('crop-position', 'c'); 
		$this->jpeg_com = $this->params->get('jpeg-compression', 100);
	}

	/**
	 * Returns a Table object, always creating it.
	 *
	 * @param	type	The table type to instantiate
	 * @param	string	A prefix for the table class name. Optional.
	 * @param	array	Configuration array for model. Optional.
	 *
	 * @return	JTable	A database object
	 */

	public function getTable($type = 'Portfolio', $prefix = 'Bt_portfolioTable', $config = array())
	{
		return JTable::getInstance($type, $prefix, $config);
	}

	public function getForm($data = array(), $loadData = true)
	{
		// Get the form.
		$form = $this->loadForm('com_bt_portfolio.portfolio', 'portfolio', array('control' => 'jform', 'load_data' => $loadData));
		if (empty($form))
		{
			return false;
		}
		return $form;

	}

	public function featured($pks, $value = 0)
	{
		$pks = (array) $pks;
		JArrayHelper::toInteger($pks);
		try
		{
			$db = $this->getDbo();

			$db->setQuery('UPDATE #__bt_portfolios AS a' . ' SET a.featured = ' . (int) $value . ' WHERE a.id IN (' . implode(',', $pks) . ')');
			if (!$db->query())
			{
				throw new Exception($db->getErrorMsg());
			}
		}
		catch (Exception $e)
		{
			$this->setError($e->getMessage());
			return false;
		}

		return true;
	}

	protected function loadFormData()
	{
		// Check the session for previously entered form data.
		$data = JFactory::getApplication()->getUserState('com_bt_portfolio.edit.portfolio.data', array());
		if (empty($data) || JRequest::getVar('layout')=='edit_extrafields')
		{
			$data = $this->getItem();
			$data->vote_sum = $data->vote_count ? number_format($data->vote_sum / $data->vote_count, 1) : 0;
			$data->vote_sum .= '/5';
			$data->vote_sum .= ' (' . $data->vote_count . ' votes)';
		}
		return $data;
	}

	/**
	 * A protected method to get a set of ordering conditions.
	 *
	 * @param	object	A record object.
	 *
	 * @return	array	An array of conditions to add to add to ordering queries.
	 * @since	1.6
	 */
	protected function getReorderConditions($table)
	{
		$condition = array();
		return $condition;
	}

	function getImages()
	{

		$db = $this->getDbo();
		$id = $this->getState($this->getName() . '.id', 0 );

		$db->setQuery('Select * from #__bt_portfolio_images WHERE id > 0 and item_id = ' . $id . ' order by ordering');
		return $db->loadObjectList();

	}
	function findKeyOld($id, $array)
	{
		foreach ($array as $key => $item)
		{
			if ($item->id == $id)
			{
				return $key;
			}
		}
		return -1;
	}
	function checkDiffImg($img, $image_order)
	{
		foreach ($image_order as $ordering => $id)
		{
			if ($img->id == $id)
			{
				if ($img->ordering == $ordering)
					return -1;
				else
					return $ordering;
			}
		}
		return -2;
	}
	public function save($data)
	{

		$db = $this->getDbo();


		// Alter the title for save as copy
		if (JRequest::getVar('task') == 'save2copy') {
			list($title,$alias) = $this->generateNewTitle($data&#91;'alias'&#93;, $data&#91;'title'&#93;);
			$data&#91;'title'&#93;	= $title;
			$data&#91;'alias'&#93;	= $alias;
		}

		if (!parent::save($data))
		{
			return false;
		}

		// process image gallery
		if (JRequest::getVar("task") == 'save2copy')
			return true;

		$pid = $this->getState($this->getName() . '.id');
		if($this->remove_original){
			$path_image_orig = $this->images_path. $pid . '/large/';
		}else{
			$path_image_orig = $this->images_path. $pid . '/original/';
		}	
		$path_image_thumb = $this->images_path . $pid . '/thumb/';
		$path_image_ssthumb =$this->images_path . $pid . '/ssthumb/';
		$path_image_large = $this->images_path . $pid . '/large/';
		$this->prepareFolders($pid);
		$this->cleanFiles('tmp');

		// reorder or delete old image
		$imageIds = JRequest::getVar('image_id', array(), 'POST', 'array');
		$imageTitles = JRequest::getVar('image_title', array(), 'POST', 'array');
		$imageNames = JRequest::getVar('image_filename', array(), 'POST', 'array');
		$imageOlds = self::getImages();

		foreach ($imageIds as $key => $id)
		{
			$keyOld = self::findKeyOld($id, $imageOlds);
			if ($keyOld >= 0)
			{
				$query = 'UPDATE #__bt_portfolio_images SET title=\'' . $db->escape($imageTitles&#91;$key&#93;) . '\', ordering =' . $key . ' WHERE id =' . $id;
				$db->setQuery($query);
				$db->query();
				unset($imageOlds&#91;$keyOld&#93;);
			}
			else
			{
				if ($id == 0)
				{
					$query = "INSERT INTO #__bt_portfolio_images SET " . "item_id = '" . $pid . "'," . "title = '" . $db->escape($imageTitles&#91;$key&#93;). "'," . "filename = '" . $db->escape($imageNames&#91;$key&#93;) . "',`default`=0, ordering=" . $key;
					$db->setQuery($query);
					$db->query();
					
					if(!$this->remove_original){
						$tmp = $this->images_path.'tmp/original/'. $imageNames&#91;$key&#93;;
						JFile::move($tmp, $path_image_orig . $imageNames&#91;$key&#93;);
					}
					$tmp = $this->images_path.'tmp/large/'. $imageNames&#91;$key&#93;;
					JFile::move($tmp, $path_image_large . $imageNames&#91;$key&#93;);

					$tmp = $this->images_path.'tmp/thumb/'. $imageNames&#91;$key&#93;;
					JFile::move($tmp, $path_image_thumb . $imageNames&#91;$key&#93;);
					
					$tmp = $this->images_path.'tmp/ssthumb/'. $imageNames&#91;$key&#93;;
					JFile::move($tmp, $path_image_ssthumb . $imageNames&#91;$key&#93;);
				}
			}
		}
		foreach ($imageOlds as $img)
		{
			if(!$this->remove_original)
			@unlink($path_image_orig . $img->filename);
			
			@unlink($path_image_large . $img->filename);
			@unlink($path_image_thumb . $img->filename);
			@unlink($path_image_ssthumb . $img->filename);

			$query = 'DELETE FROM #__bt_portfolio_images WHERE id =' . $img->id;
			$db->setQuery($query);
			$db->query();
		}

		// update default image
		$defaul_imageName = JRequest::getVar('default_image', '');

		$query = 'UPDATE #__bt_portfolio_images SET `default` = 0 WHERE item_id =' . $pid;
		$db->setQuery($query);
		$db->query();
		$query = 'UPDATE #__bt_portfolio_images SET `default` = 1 WHERE filename =\'' .$db->escape($defaul_imageName) . '\'';
		$db->setQuery($query);
		$db->query();

		//Save image
		$order = count($image_order);
		for ($i = 0; $i < sizeof($_FILES&#91;"images"&#93;&#91;"name"&#93;); $i++)
		{
			if ($_FILES&#91;"images"&#93;&#91;"name"&#93;&#91;$i&#93; != "")
			{

				$imgSource = $_FILES&#91;"images"&#93;&#91;"tmp_name"&#93;&#91;$i&#93;;
				$info = getimagesize($imgSource);
				$imageExt = str_replace('image/', '', $info&#91;'mime'&#93;);
				$imageName = md5($pid . strtotime("now") . $_FILES&#91;"images"&#93;&#91;"name"&#93;&#91;$i&#93;) . '.' . $imageExt;
				move_uploaded_file($imgSource, $path_image_orig . $imageName);
				BTImageHelper::resize($path_image_orig . $imageName, $path_image_large . $imageName, $this->crop_width, $this->crop_height, $this->crop_image, $this->crop_pos, $this->jpeg_com);
				BTImageHelper::resize($path_image_orig . $imageName, $path_image_thumb . $imageName, $this->thumb_width, $this->thumb_height, $this->crop_image, $this->crop_pos, $this->jpeg_com);
				BTImageHelper::resize($path_image_orig . $imageName, $path_image_ssthumb . $imageName, $this->ssthumb_width, $this->ssthumb_height, $this->crop_image, $this->crop_pos, $this->jpeg_com);

				$imageTitle = $_FILES&#91;"images"&#93;&#91;"name"&#93;&#91;$i&#93;;
				$query = "INSERT INTO #__bt_portfolio_images SET " . "item_id = '" . $pid . "'," . "title = '" . $imageTitle . "'," . "filename = '" . $imageName . "',`default`=0, ordering=" . $order;
				$db->setQuery($query);
				$db->query();
				$order++;
			}
		}
		// set default image
		$db->setQuery('Select count(*) from #__bt_portfolio_images WHERE `default` = 1 and item_id = ' . $pid);
		if (!$db->loadResult())
		{
			$query = 'UPDATE #__bt_portfolio_images SET `default` = 1 WHERE ordering = 0 and item_id =' . $pid;
			$db->setQuery($query);
			$db->query();
		}
		return true;
	}
	
	// delete function
	public function delete(&$pks){
		// IF delete successfully
		if(parent::delete($pks)){
		
			// DELETE IMAGES
			foreach($pks as $pk){
				$path_image = $this->images_path. $pk;
				JFolder::delete($path_image);
				$db = & $this->getDbo();
				$query = 'DELETE FROM #__bt_portfolio_images WHERE item_id = ' . $pk;
				$db->setQuery($query);
				$db->query();
			}
			
		}
	}
	
	// upload function
	function upload()
	{
            
		$pid = 'tmp';
		$allowedExtensions = array('jpg', 'jpeg', 'png', 'gif');

		if($this->remove_original){
			$path_image_orig = $this->images_path. $pid . '/large/';
		}else{
			$path_image_orig = $this->images_path. $pid . '/original/';
		}	
		$path_image_thumb =  $this->images_path. $pid . '/thumb/';
		$path_image_ssthumb =  $this->images_path. $pid . '/ssthumb/';
		$path_image_large =  $this->images_path. $pid . '/large/';
		$this->prepareFolders($pid);
		
		$validated = true;
		$objFile = new stdClass();

		$imgSource = $_FILES&#91;"Filedata"&#93;&#91;"tmp_name"&#93;;
		$info = getimagesize($imgSource);
		$imageExt = str_replace('image/', '', $info&#91;'mime'&#93;);
		$imageName = md5($pid . strtotime("now") . $_FILES&#91;"Filedata"&#93;&#91;"name"&#93;) . '.' . $imageExt;
		if (in_array($imageExt, $allowedExtensions))
		{

			if (!move_uploaded_file($imgSource, $path_image_orig . $imageName))
			{
				$result&#91;'message'&#93; = 'Could not save!';
				$validated = false;
			}
			else
			{
				BTImageHelper::resize($path_image_orig . $imageName, $path_image_large . $imageName, $this->crop_width, $this->crop_height, $this->crop_image, $this->crop_pos, $this->jpeg_com);
				BTImageHelper::resize($path_image_orig . $imageName, $path_image_thumb . $imageName, $this->thumb_width, $this->thumb_height, $this->crop_image, $this->crop_pos, $this->jpeg_com);
				BTImageHelper::resize($path_image_orig . $imageName, $path_image_ssthumb . $imageName, $this->ssthumb_width, $this->ssthumb_height, $this->crop_image, $this->crop_pos, $this->jpeg_com);
				$objFile->filename = $imageName;
				$objFile->title = $_FILES&#91;'Filedata'&#93;&#91;'name'&#93;;
			}

		}
		else
		{
			$result&#91;'message'&#93; = 'File extension invalid';
			$validated = false;
		}
		if ($validated)
		{
			$result&#91;"success"&#93; = true;
			$result&#91;"files"&#93; = $objFile;
		}
		echo json_encode($result);
	}
	function prepareFolders($pid)
	{
		self::createFolder( $this->images_path);
		self::createFolder($this->images_path . $pid . '/');
		$original = $this->images_path . $pid . '/original/';
		if(!$this->remove_original){
			self::createFolder($original);
		}
		else{
			if (is_dir($original))
			JFolder::delete($original);
		}
		self::createFolder($this->images_path . $pid . '/large/');
		self::createFolder($this->images_path . $pid . '/thumb/');
		self::createFolder($this->images_path . $pid . '/ssthumb/');	
	}
	function createFolder($path){
		if (!is_dir($path))
		{
			JFolder::create($path, 0777);
			$html = '<html><body bgcolor="#FFFFFF"></body></html>';
			JFile::write($path.'index.html', $html);
		}
		else
		{
			chmod($path, 0777);
		}
		
	
	}
	function cleanFiles($pid)
	{

		
		if($this->remove_original){
			$path_image_orig = $this->images_path. $pid . '/large/';
		}else{
			$path_image_orig = $this->images_path. $pid . '/original/';
		}	
		$path_image_thumb = $this->images_path. $pid . '/thumb/';
		$path_image_ssthumb = $this->images_path. $pid . '/ssthumb/';
		$path_image_large = $this->images_path. $pid . '/large/';
		$files = array();
		if(JFolder::exists($path_image_orig)){
			$files = JFolder::files($path_image_orig, '.', true);
		}
		foreach ($files as $file)
		{
			if (file_exists($path_image_orig . $file))
			{
				if (strtotime('now') - filemtime($path_image_orig . $file) > 24 * 3600)
				{
					if(!$this->remove_original)
					JFile::delete($path_image_orig . $file);
					
					JFile::delete($path_image_thumb . $file);
					JFile::delete($path_image_ssthumb . $file);
					JFile::delete($path_image_large . $file);
				}
			}
		}

	}
	function rebuild(){
		$building = JRequest::getVar('building');
        $session = JFactory::getSession();
        $db = JFactory::getDBO();
        if ($building) {
            $images = $session->get('rebuild-images');
            $output = $session->get('rebuild-output');
        } else {

            $db->setQuery('Select im.id,im.filename,im.title as image_title,im.item_id,pf.title from #__bt_portfolio_images as im inner join #__bt_portfolios as pf on im.item_id = pf.id order by pf.title desc');
            $images = $db->loadObjectList();
            $output = '<h3>Rebuild thumbnail & large images of portfolios:</h3>';
            $output .= '<b>Total: ' . count($images) . ' images</b><hr />';
        }
        if (count($images)) {
            $image = array_pop($images);
            $session->set('rebuild-images', $images);
					
            $path_image_thumb = $this->images_path. $image->item_id . '/thumb/';
            $path_image_ssthumb = $this->images_path. $image->item_id . '/ssthumb/';
            $path_image_large = $this->images_path. $image->item_id . '/large/';
			
			if($this->remove_original){
				$path_image_orig = $this->images_path.$image->item_id . '/large/';
			}else{
				$path_image_orig = $this->images_path. $image->item_id . '/original/';
				if(!is_file($path_image_orig . $image->filename) && is_file($path_image_large . $image->filename)){
					JFile::copy($path_image_large . $image->filename, $path_image_orig . $image->filename);	
				}
			}	
			
            if (!is_file($path_image_orig . $image->filename)) {
                @unlink($path_image_large . $image->filename);
                @unlink($path_image_thumb . $image->filename);
                @unlink($path_image_ssthumb . $image->filename);
                $query = 'DELETE FROM #__bt_portfolio_images WHERE id =' . $image->id;
                $db->setQuery($query);
                $db->query();
                $output .= $image->title . ':<i> ' . $image->image_title . '</i><font style="color:red"> - Image not found! Removed!</font><br />';
            } else {
                $this->prepareFolders($image->item_id);
                BTImageHelper::resize($path_image_orig . $image->filename, $path_image_large . $image->filename, $this->crop_width, $this->crop_height, $this->crop_image, $this->crop_pos, $this->jpeg_com);
                BTImageHelper::resize($path_image_orig . $image->filename, $path_image_thumb . $image->filename, $this->thumb_width, $this->thumb_height, $this->crop_image, $this->crop_pos, $this->jpeg_com);
                BTImageHelper::resize($path_image_orig . $image->filename, $path_image_ssthumb . $image->filename, $this->ssthumb_width, $this->ssthumb_height, $this->crop_image, $this->crop_pos, $this->jpeg_com);
                $output .= '' . $image->title . ':<i> ' . $image->image_title . '</i><br />';
            }
            echo '<html><head><title>Rebuilding images...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta HTTP-EQUIV="REFRESH" content="0; url=index.php?option=com_bt_portfolio&task=portfolios.rebuild&tmpl=component&building=true;"></head>';
            echo '<body>' . $output . '...</body></html>';
            $session->set('rebuild-output', $output);
            exit;
        } else {
           return $output;
		}
	}
	function generateNewTitle(&$alias, &$title)
	{
		// Alter the title & alias
		$catTable = JTable::getInstance('Portfolio', 'Bt_portfolioTable');
		while ($catTable->load(array('alias'=>$alias))) {
			$m = null;
			if (preg_match('#-(\d+)$#', $alias, $m)) {
				$alias = preg_replace('#-(\d+)$#', '-'.($m&#91;1&#93; + 1).'', $alias);
			} else {
				$alias .= '-2';
			}
			if (preg_match('#\((\d+)\)$#', $title, $m)) {
				$title = preg_replace('#\(\d+\)$#', '('.($m&#91;1&#93; + 1).')', $title);
			} else {
				$title .= ' (2)';
			}
		}

		return array($title, $alias);
	}
	
}

mudei o 777 para 755 e 755, aconteceu o msm erro, coloquei 755 e 644 tb nada.

acho q é isso q nao esta deixando fica a imagem.

o q devo fazer?

Please Entrar ou Registrar to join the conversation.

Mais
12 anos 3 meses atrás #91125 por Aureo
Aureo replied the topic: Re: Joomla 3.1 template BT-Metro
O erro que aparece é referente a permissão na pasta /administrator . Ou seja, está errado. Contate o seu servidor de hospedagem. Eu executo estes serviços, qualquer coisa entre em contato por PM e fazemos um orçamento gratuito.

Please Entrar ou Registrar to join the conversation.