function showMyGalleries() { global $rsgConfig, $mainframe; $my = JFactory::getUser(); $database = JFactory::getDBO(); //Check if My Galleries is enabled in config, if not .............. if (!$rsgConfig->get('show_mygalleries')) { die(JText::_('Unauthorized access attempt to My Galleries!')); } //Add gallery pathway items $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_('my galleries')); //Set limits for pagenav $limit = trim(rsgInstance::getInt('limit', 10)); $limitstart = trim(rsgInstance::getInt('limitstart', 0)); //Get total number of records for paging $database->setQuery("SELECT COUNT(1) FROM #__rsgallery2_files WHERE userid = '{$my->id}'"); $total = $database->loadResult(); //New instance of mosPageNav jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); //Get all images $database->setQuery("SELECT * FROM #__rsgallery2_files" . " WHERE userid = '{$my->id}'" . " ORDER BY date DESC" . " LIMIT {$pageNav->limitstart}, {$pageNav->limit}"); $images = $database->loadObjectList(); //Get all galleries based on hierarchy (up to 20 levels deep, with level property to show the level) $rows = myGalleries::recursiveGalleriesList(); if ($my->id) { //User is logged in, show it all! myGalleries::viewMyGalleriesPage($rows, $images, $pageNav); } else { //Not logged in, back to main page $mainframe->redirect(JRoute::_("index.php?option=com_rsgallery2"), JText::_('MY GALLERIES ACCESSIBLE FOR LOGGED ON USERS')); } }