function Joom_DeleteComment_HTML()
    {
        $config = Joom_getConfig();
        $user =& JFactory::getUser();
        $mainframe =& JFactory::getApplication('site');
        $database =& JFactory::getDBO();
        Joom_GalleryHeader();
        // Main Part of Subfunction
        if ($user->get('gid') == 20 || $user->get('gid') == 24 || $user->get('gid') == 25) {
            if (isset($_REQUEST['submit']) && $_REQUEST['submit'] != '') {
                $database->setQuery(" DELETE\n                              FROM \n                                #__joomgallery_comments\n                              WHERE \n                                cmtid = '" . $this->cmtid . "'\n                            ");
                $database->query();
                $mainframe->redirect(JRoute::_('index.php?option=com_joomgallery&func=detail&id=' . $this->cmtpic . _JOOM_ITEMID, false), JText::_('JGS_ALERT_COMMENT_DELETED'));
            } else {
                ?>
  <div class="jg_clearboth"></div>
  <div class="sectiontableheader jg_cmtl">
    <?php 
                echo JText::_('JGS_AUTHOR');
                ?>
 
  </div>
  <div class="sectiontableheader jg_cmtr">
    <?php 
                echo JText::_('JGS_COMMENT');
                ?>
 
  </div>
<?php 
                $database->setQuery(" SELECT \n                                cmtid, \n                                cmtip, \n                                userid, \n                                cmtname, \n                                cmttext, \n                                cmtdate, \n                                cmtpic, \n                                username\n                              FROM \n                                #__joomgallery_comments AS cm\n                              LEFT JOIN \n                                #__users AS u ON cm.userid=u.id\n                              WHERE \n                                cmtid = '" . $this->cmtid . "'\n                            ");
                $result1 = $database->LoadRow();
                list($cmtid, $cmtip, $userid, $cmtname, $cmttext, $cmtdate, $cmtpic, $username) = $result1;
                ?>
  <div class="sectiontableentry1">
    <div class="jg_cmtl">
      <b>
<?php 
                if ($userid > 0) {
                    ?>
        <?php 
                    echo $username;
                    ?>
 
<?php 
                } else {
                    ?>
        <?php 
                    echo $cmtname;
                    ?>
 
<?php 
                }
                ?>
      </b>
      <br />
      <a href="http://openrbl.org/query?i=<?php 
                echo $cmtip;
                ?>
">
        <img src="<?php 
                echo _JOOM_LIVE_SITE;
                ?>
components/com_joomgallery/assets/images/ip.gif" alt="<?php 
                echo $cmtip;
                ?>
" title="<?php 
                echo $cmtip;
                ?>
" hspace="3" border="0" />
      </a>
    </div>
<?php 
                $signtime = strftime($config->jg_dateformat, $cmtdate);
                $origtext = $cmttext;
                ?>
    <div class="jg_cmtr small">
      <?php 
                echo JText::_('JGS_COMMENT_ADDED') . ": " . $signtime;
                ?>
<hr>
      <?php 
                echo $origtext;
                ?>
 
    </div>
  </div>
  <div class="jg_cmtronly">
    <form action="<?php 
                echo JRoute::_('index.php?option=com_joomgallery&func=deletecomment&cmtid=' . $cmtid . '&cmtpic=' . $cmtpic . _JOOM_ITEMID);
                ?>
" method="post">
      <input class="button" type="submit" name="submit" value="<?php 
                echo JText::_('JGS_DELETE_COMMENT');
                ?>
" />
    </form>
  </div>
<?php 
            }
        } else {
            ?>
  <p />
  <a href="<?php 
            echo JRoute::_('index.php?option=com_joomgallery' . _JOOM_ITEMID);
            ?>
">
    <?php 
            echo JText::_('JGS_BACK');
            ?>
 
  </a>
<?php 
        }
    }
 function Joom_Favourites($func, $id, $catid)
 {
     $mainframe =& JFactory::getApplication('site');
     $database = JFactory::getDBO();
     $user =& JFactory::getUser();
     $config = Joom_getConfig();
     $this->showfavourites_url = 'index.php?option=com_joomgallery&func=showfavourites';
     $this->viewcategory_url = 'index.php?option=com_joomgallery&func=viewcategory&catid=';
     $this->details_url = 'index.php?option=com_joomgallery&func=detail&id=';
     $access = true;
     if ($func == 'addpicture') {
         $database->setQuery(" SELECT \n                              id\n                            FROM \n                              #__joomgallery AS a\n                            LEFT JOIN \n                              #__joomgallery_catg AS c ON a.catid = c.cid\n                            WHERE \n                                  a.id= '" . $id . "' \n                              AND a.approved  = '1' \n                              AND a.published = '1'\n                              AND c.access   <= '" . $user->get('aid') . "' \n                              AND c.published = '1'\n                          ");
         if (!$database->loadResult()) {
             $access = false;
         }
     }
     // Berechtigung ueberpruefen
     if ($config->jg_showdetailfavourite == 0 && $user->get('aid') < 1 || $config->jg_showdetailfavourite == 1 && $user->get('aid') < 2 || $config->jg_usefavouritesforpubliczip == 1 && $user->get('id') < 1 || $config->jg_favourites == 0 || $access == false) {
         $mainframe->redirect(JRoute::_('index.php?option=com_joomgallery' . _JOOM_ITEMID, false), JText::_('JGS_ALERT_NOT_ALLOWED_VIEW_PICTURE'));
     }
     // Ueberpruefung, ob mit der Datenbank oder mit der Session gearbeitet wird
     if ($user->get('id') && $config->jg_usefavouritesforzip != 1) {
         $this->using_database = true;
         $this->output = 'JGS_FAV_';
         $database->setQuery(" SELECT \n                              uuserid \n                            FROM \n                              #__joomgallery_users \n                            WHERE \n                              uuserid = '" . $user->get('id') . "'\n                          ");
         if ($database->loadResult()) {
             $this->user_exists = true;
             $database->setQuery(" SELECT \n                                piclist,\n                                layout \n                              FROM \n                                #__joomgallery_users \n                              WHERE \n                                uuserid = '" . $user->get('id') . "'\n                            ");
             $row = $database->loadObject();
             $this->piclist = $row->piclist;
             $this->layout = $row->layout;
         } else {
             $this->user_exists = false;
             $this->piclist = NULL;
             $this->layout = 0;
         }
     } else {
         $this->using_database = false;
         $this->output = 'JGS_ZIP_';
         $this->piclist = $mainframe->getUserState('joom.favourites.pictures');
         $this->layout = $mainframe->getUserState('joom.favourites.layout');
     }
     switch ($func) {
         case 'addpicture':
             $this->Joom_Favourites_AddPicture($id, $catid);
             break;
         case 'removepicture':
             $this->Joom_Favourites_RemovePicture($id);
             break;
         case 'removeall':
             $this->Joom_Favourites_RemoveAll();
             break;
         case 'switchlayout':
             $this->Joom_Favourites_SwitchLayout();
             break;
         case 'createzip':
             Joom_GalleryHeader();
             $this->Joom_Favourites_CreateZip();
             break;
         case 'showfavourites':
             Joom_GalleryHeader();
             $this->Joom_ShowFavourites();
             break;
     }
 }
 case 'joomplu':
     include JPATH_COMPONENT . DS . 'includes' . DS . 'joom.viewminijoom.php';
     $minijoom = new Joom_ShowMiniJoom();
     return;
     // nothing else matters because the outputs above are usually shown in a popup window
     break;
 default:
     // include dTree script, dTree styles and treeview styles, if neccessary
     if ($config->jg_showsubsingalleryview) {
         $document->addStyleSheet(_JOOM_LIVE_SITE . 'components/com_joomgallery/assets/js/dTree/css/jg_dtree.css');
         $document->addStyleSheet(_JOOM_LIVE_SITE . 'components/com_joomgallery/assets/js/dTree/css/jg_treeview.css');
         $document->addScript(_JOOM_LIVE_SITE . 'components/com_joomgallery/assets/js/dTree/js/jg_dtree.js');
     }
     $func = '';
     // for some pollings later on
     Joom_GalleryHeader();
     // set default page title
     $document->setTitle(JText::_('JGS_GALLERY'));
     if (!$config->jg_showrmsmcats) {
         $access = "AND access <= '" . $user->get('aid') . "'";
     } else {
         $access = '';
     }
     # Feststellen der Anzahl der darstellbaren Kategorien
     $database->setQuery(" SELECT\n                            COUNT(cid)\n                          FROM\n                            #__joomgallery_catg\n                          WHERE\n                            published = '1'\n                            AND parent='0'\n                            {$access}\n                        ");
     $count2 = $database->loadResult();
     # Berechnen der Gesamtseiten
     if ($config->jg_catperpage == 0) {
         $config->jg_catperpage = 10;
     }
     $gesamtseiten = floor($count2 / $config->jg_catperpage);