DonatShell
Server IP : 180.180.241.3  /  Your IP : 216.73.216.252
Web Server : Microsoft-IIS/7.5
System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586
User : IUSR ( 0)
PHP Version : 5.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/AppServ/www/app/webroot/news/administrator/components/com_youtubegallery/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/AppServ/www/app/webroot/news/administrator/components/com_youtubegallery/models/categoryform.php
<?php
/**
 * Youtube Gallery Joomla! 1.5 Native Component
 * @version 3.8.3
 * @author Design COmpass corp <support@joomlaboat.com>
 * @link http://www.joomlaboat.com
 * @GNU General Public License
 **/


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

// Import Joomla! libraries
jimport('joomla.application.component.model');

class YouTubeGalleryModelCategoryForm extends JModel
{

	
    function __construct()
    {
		parent::__construct();
		$array = JRequest::getVar('cid',  0, '', 'array');

		$this->setId((int)$array[0]);
    }

	function setId($id)
	{
		// Set id and wipe data

		$this->_id	= $id;
		$this->_data	= null;
	}

	function &getData()
	{
		//echo 'fff='.$this->_id.'<br>';
		$row =& $this->getTable();
		$row->load( $this->_id );
		return $row;
	}

	function store()
	{
	    
	
		$row =& $this->getTable();
		// consume the post data with allow_html
		$data = JRequest::get( 'post',JREQUEST_ALLOWRAW);
		$post = array();

		if (!$row->bind($data))
		{
			return false;
		}

		// Make sure the  record is valid
		if (!$row->check())
		{
			return false;
		}

		// Store
		if (!$row->store())
		{
			return false;
		}

		//Create MySQL Table
		$db = &$this->getDBO();
		

		return true;
	}
	
	function ConfirmRemove()
        {
				JRequest::setVar('hidemainmenu', true);
				JToolBarHelper::title(JText::_( 'Youtube Gallery - Delete Category(ies)?' ));
		
				$cancellink='index.php?option=com_youtubegallery&controller=categories';
		
				$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
				
				
				
				
		
				if(count($cids)==0)
						return false;
		
				//Get Table Name
				$videoLists_found=false;
		
				if (count( $cids ))
				{
						echo '<p style="font-size:20px;">Category(ies): </p><ul>';
						
						$complete_cids=$cids;
						foreach($cids as $id)
						{
								$row=$this->getGategoryItem($id);
								echo '<li>'.$row->categoryname;
								
								$videolists=$this->getAllVideoList($id);
								if(count($videolists)>0)
								{
										echo '<p style="color:red;">There is Video Lists in this category:<ul>';
										foreach($videolists as $vl)
												echo '<li style="color:red;">'.$vl->listname.'</li>';
												
										echo '</ul></p>';
										$videoLists_found=true;
								}
								
								$children=$this->getAllChildren($id);
								if(count($children)!=0)
								{
										echo '<p style="font-weight:bold;">And all it\'s children:<ul>';
										foreach($children as $c_id)
										{
												$c_row=$this->getGategoryItem($c_id);
												echo '<li>'.$c_row->categoryname;
												
												$videolists=$this->getAllVideoList($c_id);
												if(count($videolists)>0)
												{
														echo '<p style="color:red;">There is Video Lists in this category:<ul>';
														foreach($videolists as $vl)
																echo '<li style="color:red;">'.$vl->listname.'</li>';
														
														echo '</ul></p>';
														$videoLists_found=true;
												}
												
												echo '</li>';
												
										}
										$complete_cids=array_merge($complete_cids,$children);
										echo '</ul></p>';
								}
								
								
								echo '</li>';
						}
						
						echo '</ul>';
						
						if(count($complete_cids)>1)
								echo '<p>Total '.count($complete_cids).' categories.</p>';
						
						if($videoLists_found)
						{
								echo '<p style="font-weight:bold;"><a href="'.$cancellink.'">Cancel</a></p>';
						}
						else
						{
						
								echo '<p style="font-weight:bold;"><a href="'.$cancellink.'">'.JText::_( 'No. Cancel.' ).'</a></p>
            <form action="index.php?option=com_youtubegallery&controller=categories" method="post" >
            <input type="hidden" name="task" value="remove_confirmed" />
';
								$i=0;
								foreach($complete_cids as $cid)
								        echo '<input type="hidden" id="cb'.$i.'" name="cid[]" value="'.$cid.'">';
            
								echo '
            <input type="submit" value="'.JText::_( 'Yes. Delete.' ).'" class="button" />
            </form>
';
						}
				}
				else
						echo '<p><a href="'.$cancellink.'">'.JText::_( 'Category(ies) not selected.' ).'</a></p>';
				
		
        }
		
		protected function getAllVideoList($catid)
		{
				$db = JFactory::getDBO();
                $query = 'SELECT `id`, `listname` FROM `#__youtubegallery_videolists` WHERE `catid`='.$catid;
                
                $db->setQuery((string)$query);
                $rows = $db->loadObjectList();
                if (!$db->query())    die( $db->stderr());
				
				if(count($rows)==0)
						return array();
						
				return $rows;
		}
		
		protected function getGategoryItem($id)
		{
				$db = JFactory::getDBO();
                $query = 'SELECT `id`, `categoryname` FROM `#__youtubegallery_categories` WHERE `id`='.$id;
                
                $db->setQuery((string)$query);
                $rows = $db->loadObjectList();
                if (!$db->query())    die( $db->stderr());
				
				if(count($rows)==0)
						return array();
				return $rows[0];
		}
		
		protected function getAllChildren($parentid)
        {
                $children=array();
                if($parentid==0)
                        return $children;
                
                $db = JFactory::getDBO();
                $query = 'SELECT `id`, `parentid` FROM `#__youtubegallery_categories` WHERE `parentid`='.$parentid;
                
                $db->setQuery((string)$query);
                if (!$db->query())    die( $db->stderr());
                
                $rows = $db->loadObjectList();
                foreach($rows as $row)
                {
                        $children[]=$row->id;
                        $grand_children=$this->getAllChildren($row->id);
                        if(count($grand_children)>0)
                                $children=array_merge($children,$grand_children);
                }
                return $children;
        }

/*
	function ConfirmRemove()
	{
		JRequest::setVar('hidemainmenu', true);
		JToolBarHelper::title(JText::_( 'Youtube Gallery - Delete Category(s)' ));
		
		$cancellink='index.php?option=com_youtubegallery&controller=categories';
		
		$cid	= JRequest::getVar( 'cid', array(), 'post', 'array' );

		//Get Table Name
		$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
		if (count( $cids ))
		{
			echo '<p style="font-size:20px;">Category(s) ID: '.(count($cids)>1 ? implode(',',$cids) : $cids[0] ).'<br/><br/><a href="'.$cancellink.'">No. Cancel.</a></p>
			
		';
		
		echo '
            <form action="index.php?option=com_youtubegallery&controller=categories" method="post" >
            <input type="hidden" name="task" value="remove_confirmed" />
            ';
            $i=0;
            foreach($cids as $cid)
            {
                echo '<input type="hidden" id="cid'.$i.'" name="cid[]" value="'.$cid.'">';
            }
            
            echo '
            <input type="submit" value="'.JText::_( 'Yes. I want to delete.' ).'" class="button" />
            </form>
		';
		
		
		}
		else
		{
			
			echo '<p><a href="'.$cancellink.'">Select items first</a></p>';
		}
		
		
		
		
		

		
		
	}
	*/
	function delete($cids)
	{
		$db = & JFactory::getDBO();
		
		$row =& $this->getTable();

		if (count( $cids ))
		{
			foreach($cids as $cid)
			{
						
				
				if (!$row->delete( $cid ))
				{
					return false;
				}
			}
		}
		
		
		
		return true;
	}
	

	function copyItem($cid)
	{


	    $item =& $this->getTable();
	    
		
	    foreach( $cid as $id )
	    {
			
		
		$item->load( $id );
		$item->id 	= NULL;
		
			$old_title=$item->categoryname;
			$new_title='Copy of '.$old_title;
		
		$item->categoryname 	= $new_title;
			
	
		
		if (!$item->check()) {
			return false;
		}

		if (!$item->store()) {
			return false;
		}
		$item->checkin();
			
	    }
		
	

	    return true;
	}
	

	

}

?>

Anon7 - 2022
AnonSec Team