? GR0V Shell

GR0V shell

Linux www.koreapackagetour.com 2.6.32-042stab145.3 #1 SMP Thu Jun 11 14:05:04 MSK 2020 x86_64

Path : /home/admin/public_html/old/administrator/components/com_jckman/views/toolbar/
File Upload :
Current File : /home/admin/public_html/old/administrator/components/com_jckman/views/toolbar/view.html.php.new

<?php

/**
* @version		$Id: view.html.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @package		Joomla
* @subpackage	Config
* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

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

/**
 * HTML View class for the Plugins component
 *
 * @static
 * @package		Joomla
 * @subpackage	Plugins
 * @since 1.0
 */
 
class ToolbarsViewToolbar extends JViewLegacy
{
	function display( $tpl = null )
	{
		global $option, $mainframe;
		
		
    	JToolBarHelper::title( JText::_( 'Layout Manager' ) .': <small><small>[' .JText::_('Edit'). ']</small></small>', 'layout.png' );
    	JToolBarHelper::save();
    	JToolBarHelper::apply();
    	JToolBarHelper::cancel( 'cancelEdit', 'Close' );
 		
		$cid 	= JRequest::getVar( 'cid', array(0), '', 'array' );
		JArrayHelper::toInteger($cid, array(0));

		$lists 	= array();
		$user 	=& JFactory::getUser();		
		$row 	=& JCKHelper::getTable('toolbar');

		// load the row from the db table
		$row->load( $cid[0] );

		// fail if checked out not by 'me'

		if ($row->isCheckedOut( $user->get('id') ))
		{
			$msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The toolbar' ), $row->title );
			$this->setRedirect( 'index.php?option='. $option .'&view=Toolbars', $msg, 'error' );
			return false;
		}
		
		if ($cid[0])
		{
			$row->checkout( $user->get('id') );
    	} 
		else {
			$row->params  = '';
		}
			
		$db =& JFactory::getDBO();
			
		//set the default total number of plugin records
		$total = 0;
		$totalRows = 0;
		
		if ( $cid[0] ) {
		
			
			$total = 1;
				
			$query = 'SELECT p.id,p.name,p.title,p.icon,tp.row'
			. ' FROM #__jckplugins p'
			. ' JOIN #__jcktoolbarplugins tp ON tp.pluginid = p.id'
			. ' WHERE tp.state = 1'
			. ' AND tp.toolbarid = '.(int) $row->id
			. ' AND p.published = 1' 
			. ' ORDER BY tp.toolbarid ASC,tp.row ASC,tp.ordering ASC';
			$db->setQuery( $query );
			$toolbarplugins = $db->loadObjectList();
			
				
			// get the total number of plugin records
			$query = 'SELECT COUNT(*)'
			. ' FROM #__jcktoolbarplugins'
			. ' WHERE toolbarid ='.(int) $row->id;
			$db->setQuery( $query );
			$totalRows = $db->loadResult();
			
								
			if(!$totalRows) //lets get plugins from class file
			{
				require_once(CKEDITOR_LIBRARY.DS . 'toolbar.php');
				$CKfolder =  CKEDITOR_LIBRARY.DS . 'toolbar'; 
				$filename = $CKfolder.DS.$row->name.'.php';	
				require($filename);
				$classname = 'JCK'. ucfirst($row->name);
				$toolbar = new $classname();
				
				$query = 'SELECT id,title'
				. ' FROM #__jckplugins'
				. ' WHERE title != ""'
				. ' AND published = 1'
				;
				$db->setQuery( $query );
				$allplugins = $db->loadObjectList();
				
				
				$values = array();
				//fix toolbar values or they will get wiped out
				$l = 1;
				$n = 1;
				$j = 1;
				
				foreach (get_object_vars( $toolbar ) as $k => $v)
				{
					
					if($v) $n = ($n > $v ? $n :  $v);
					
					if($l < $n)
					{
						$l = $n;
						$j = 1;
					}	

					for($m = 0; $m< count($allplugins); $m++)
					{
						
						if($k == $allplugins[$m]->title)
						{
							$values[] = '('.(int)$row->id.','.(int)$allplugins[$m]->id.','.$n.','.$j.',1)';
							break;
						}	
						
						if(strpos($k,'brk_') !== false)
						{
							$id = preg_match('/[0-9]+$/',$k);
							$id = $id * -1;
							$values[] = '('.(int)$row->id.','.$id.','.$n.','.$j.',1)';
							$n++;
							break;
						}	
					}
					$j++;
				}
				
							
				if(!empty($values))
				{
					$query = 'INSERT INTO #__jcktoolbarplugins(toolbarid,pluginid,row,ordering,state) VALUES ' . implode(',',$values);
					$db->setQuery( $query );
					if(!$db->query()) 
					{
						JCKHelper::error( $db->ErrorMsg() );
					}
				}
			}
			
			
						
			$query = 'SELECT p.id,p.name,p.title,p.icon,p.row,p.iscore'
			. ' FROM #__jckplugins p'
			. ' LEFT JOIN #__jcktoolbarplugins tp ON tp.pluginid = p.id'
			. ' AND tp.toolbarid = '.(int) $row->id
			. ' WHERE tp.pluginid is null'
			. ' AND p.published = 1' 
			. ' AND p.title != ""'
			.'  ORDER by p.row ASC, p.id ASC';
			$db->setQuery( $query );
			$plugins = $db->loadObjectList();
			
			if(!empty($plugins))
			{	
			 	
				/*
				require_once(CKEDITOR_LIBRARY.DS . 'toolbar.php');
				$CKfolder =  CKEDITOR_LIBRARY.DS . 'toolbar'; 
				$filename = $CKfolder.DS.$row->name.'.php';	
				require($filename);
				$classname = 'JCK'. ucfirst($row->name);
				$toolbar = new $classname();
				
				$values = array();
				
				foreach($plugins as $plugin)
				{
				  if($plugin->iscore)
				 	continue;
					
				   $values[] = '('.(int)$row->id.','.(int)$plugin->id.','.$n.','.$j.',1)';
					
				}
				*/
			}
				
			$query = 'SELECT tp.pluginid AS id,p.name,p.title,p.icon,tp.row'
			. ' FROM #__jcktoolbarplugins tp'
			. ' LEFT JOIN #__jckplugins p ON tp.pluginid = p.id'
			. ' AND p.published = 1' 
			. ' WHERE tp.state = 1'
			. ' AND tp.toolbarid = '.(int) $row->id
		
			. ' ORDER BY tp.toolbarid ASC,tp.row ASC,tp.ordering ASC';
			$db->setQuery( $query );
			$toolbarplugins = $db->loadObjectList();
				
	
			$toolbarplugins = $this->_getSortRowToolbars($toolbarplugins);

			$this->assignRef('toolbarplugins',	$toolbarplugins);
			$this->assignRef('plugins',	$plugins );
			
		}	
			
					
		$this->assignRef('toolbar',		$row);
		$this->assignRef('total',		$total);
		
		
		parent::display($tpl);
	}
		
	function _getSortRowToolbars($toolbars)
	{
		$chunkSize1 = 24;
		$chunkSize2 = 10;
		$out = array();
		$count = 0;
		$outToolbars = array();
		$results = array();
		
	
		/*
		$spacer =  new stdclass;
		$spacer->title = 'spacer';
		$spacer->name = 'spacer';
		$spacer->id = 0;
		
		$rowNumber = 1;
		foreach($toolbars as $icon)
		{
			
			if($icon->row > $rowNumber)
				$out[] =  $spacer;
			$out[] = $icon;
			$rowNumber = $icon->row;  
		}
		$toolbars = $out;
		
		
	    $out = array();
		*/
		$j = 0;
		
		$richTextCombos = array ('stylescombo','font','format','fontsize');
		
		$chunkSize = $chunkSize1;
		
		$autoformat = true;
		
	    $breaks = 0;
		for($i = 0; $i < count($toolbars);$i++)
		{
		 	 			 
			 if($toolbars[$i]->id >= 0 )
			  {  
				$out[] = $toolbars[$i];
			  }
			  
			  if($toolbars[$i]->id < 0)
			  {
				$outToolbars[] = $out;
				$breaks++;
				$out = array();
				$autoformat = false;
			  }
		}
	
	
		if($breaks == 1)
			$autoformat = true;

		if($autoformat)
		{
			$out = array();
			$outToolbars = array();
			
			for($i = 0; $i < count($toolbars);$i++)
			{
			 
				if(in_array($toolbars[$i]->name,$richTextCombos))
					$chunkSize = $chunkSize2;

							 
				 if($j < $chunkSize)
				  {  
					$out[] = $toolbars[$i];
					$j++;
				  }
				  
				  if($j == $chunkSize)
				  {
					$outToolbars[] = $out;
					$out = array();
					$j = 0;
					$chunkSize = $chunkSize1;
				  }
			}
		}
		
		
		
		
		if(!empty($out))
		  $outToolbars[] = $out;	
		
		
		$results =  $outToolbars;
		
	
		
		
		/*
		 
		 $richTextCombos = array ('stylescombo','font','format','fontsize');
		
		for($k= 0; $k < count($outToolbars);$k++)
		{
			$chunkSize = $chunkSize1;
			$icons = $outToolbars[$k];
			for($j = 0;$j < count($icons);$j++)
			{
				if(in_array($icons[$j]->name,$richTextCombos))
				{
					$chunkSize = $chunkSize2;
					break;
				}	
			}
			
			$chunks = array_chunk($outToolbars[$k],$chunkSize);
			foreach($chunks as $chunk)
			{
				$results[] = $chunk;
			}	 
		}
		*/
		//lets add spacer to each row
	
		
		$spacer =  new stdclass;
		$spacer->title = 'spacer';
		$spacer->name = 'spacer';
		$spacer->id = 0;
		
			
		for($n= 0; $n < count($results);$n++)
		{
			$result = $results[$n];
			$out = array();
			$rowNumber = $results[$n][0]->row;
			foreach($result as $icon)
			{
				
				if($icon->row > $rowNumber)
					$out[] =  $spacer;
				$out[] = $icon;	
				$rowNumber = $icon->row;  
			}
			$results[$n] = $out;
		}
		
		return $results;
		
	}
	
}

T1KUS90T
  root-grov@210.1.60.28:~$