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 : /AppServ/www/news/administrator/components/com_youtubegallery/helpers/ |
Upload File : |
<?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 **/ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die( 'Restricted access' ); class JHTMLYGCategoryParent { function render($name, $value, &$node, $control_name) { $array = JRequest::getVar('cid', 0, '', 'array'); if(count($array)>0) $current_category_id=(int)$array[0]; else $current_category_id=0; $db = JFactory::getDBO(); $query='SELECT `id`, `categoryname`, `parentid` FROM `#__youtubegallery_categories`'; $db->setQuery((string)$query); if (!$db->query()) die( $db->stderr()); $recs = $db->loadAssocList(); $options = array(); $children=JHTMLYGCategoryParent::getAllChildren($current_category_id); if ($recs) { foreach($recs as $rec) { if($current_category_id==0) $options[] = $rec; else { if($rec['id']!=$current_category_id and $rec['parentid']!=$current_category_id and !in_array($rec['id'],$children)) $options[] = $rec; } } } $options[]=array('id'=>0,'categoryname'=>'- Root'); sort($options); return JHTML::_('select.genericlist', $options, $name, 'class="inputbox"', 'id', 'categoryname', $value); } 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=JHTMLYGCategoryParent::getAllChildren($row->id); if(count($grand_children)>0) $children=array_merge($children,$grand_children); } return $children; } }