/**
  * Constructor of class Joom_AdminMigration
  *
  * @return Joom_AdminMigration
  */
 function Joom_AdminMigration()
 {
     jimport('joomla.filesystem.file');
     require_once JPATH_COMPONENT . DS . 'adminclasses' . DS . 'admin.migration.class.php';
     $migration = Joom_mosGetParam('migration', '');
     $action = Joom_mosGetParam('migration_action', 'check');
     if ($migration != '') {
         if (JFile::exists(JPATH_COMPONENT . DS . 'adminclasses' . DS . 'admin.migrate' . $migration . '.class.php')) {
             require_once JPATH_COMPONENT . DS . 'adminclasses' . DS . 'admin.migrate' . $migration . '.class.php';
             $classname = 'Joom_Migrate_' . $migration;
             $migrateclass = new $classname($action);
         }
     }
     //check if not in running migration
     if ($action != 'start' && $action != 'continue') {
         //show migration manager
         require_once JPATH_COMPONENT . DS . 'includes' . DS . 'html' . DS . 'admin.migration.html.php';
         $files = JFolder::files(JPATH_COMPONENT . DS . 'adminclasses' . DS, '.php$');
         $other = array('admin.migration.class.php', 'admin.upload.class.php', 'admin.tabs.class.php');
         foreach ($files as $key => $file) {
             if (in_array($file, $other)) {
                 unset($files[$key]);
             }
         }
         $htmladminmigration = new HTML_Joom_AdminMigration($files);
     }
 }
 function Joom_Comments(&$func, &$id)
 {
     $user =& JFactory::getUser();
     // anstatt global $my;
     include_once JPATH_COMPONENT . DS . 'includes' . DS . 'html' . DS . 'joom.comments.html.php';
     $this->jg_code = Joom_FixUserEntrie2(Joom_mosGetParam('jg_code', '', 'post'));
     $this->cmtname = Joom_FixUserEntrie(Joom_mosGetParam('cmtname', '', 'post'));
     $this->cmttext = Joom_FixUserEntrie(Joom_mosGetParam('cmttext', '', 'post'));
     $this->jg_captcha_id = JRequest::getInt('jg_captcha_id', '', 'post');
     $this->cmtid = JRequest::getInt('cmtid', 0);
     $this->userid = $user->get('id');
     // do not save username when registered user:
     if ($this->userid > 0) {
         $this->cmtname = '';
     }
     $this->cmtpic = JRequest::getInt('cmtpic', 0, 'post');
     if ($this->cmtpic == '') {
         $this->cmtpic = JRequest::getInt('cmtpic', '');
     }
     switch ($func) {
         case 'commentpic':
             $this->Joom_CommentPic($id);
             break;
         case 'deletecomment':
             $this->Joom_DeleteComment();
             break;
     }
 }
 /**
  * Show all or specific comments in comment manager
  *
  */
 function Joom_ShowComments()
 {
     $database =& JFactory::getDBO();
     //Prepare pagelimit choices
     $limit = JRequest::getInt('limit', 10, 'post');
     $limitstart = JRequest::getInt('limitstart', 0, 'post');
     //Prepare search choices
     $search = trim(strtolower(Joom_mosGetParam('search', '', 'post')));
     $where = array();
     if ($search) {
         $where[] = "LOWER(cmttext) LIKE '%{$search}%' OR LOWER(u.username) LIKE '%{$search}%' OR LOWER(cmtname) LIKE '%{$search}%' ";
     }
     //Get total number of records
     $database->setQuery("SELECT count(*)\n        FROM #__joomgallery_comments AS a " . "LEFT JOIN #__users AS u ON userid = u.id " . (count($where) ? 'WHERE ' . implode(' AND ', $where) : ''));
     $total = $database->loadResult();
     echo $database->getErrorMsg();
     if ($limit > $total) {
         $limitstart = 0;
     }
     //new PageNavigation
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     // do the main database query
     $database->setQuery("SELECT *\n        FROM #__joomgallery_comments " . "LEFT JOIN #__users AS u ON userid = u.id " . (count($where) ? 'WHERE ' . implode(' AND ', $where) : '') . " ORDER BY cmtdate DESC", $pageNav->limitstart, $pageNav->limit);
     $rows = $database->loadObjectList();
     if ($database->getErrorNum()) {
         echo $database->stderr();
         return false;
     }
     //Bring it all to the screen
     HTML_Joom_AdminComments::Joom_ShowComments_HTML($rows, $search, $pageNav);
 }
 /**
  * Constructor for class Joom_AdminVotes
  * Vote manager
  *
  * @return Joom_AdminVotes
  */
 function Joom_AdminVotes()
 {
     $mainframe =& JFactory::getApplication('administrator');
     $database =& JFactory::getDBO();
     //cpanel
     echo "<script language = \"javascript\" type = \"text/javascript\">\n";
     echo "<!--\n";
     echo "function submitbutton(pressbutton) {\n";
     echo "  var form = document.adminForm;\n";
     echo "  if (pressbutton == 'cpanel') {\n";
     echo "    location.href = \"index.php?option=" . _JOOM_OPTION . "\";\n";
     echo "  }\n";
     echo "}\n";
     echo "//-->\n";
     echo "</script>\n";
     $sync = Joom_mosGetParam('votes_sync', '', 'post');
     $reset = Joom_mosGetParam('votes_reset', '', 'post');
     if ($sync) {
         //Synchronize user-votes
         $query = "DELETE v from #__joomgallery_votes AS v \n" . "LEFT JOIN #__users AS u ON v.userid = u.id \n" . "WHERE v.userid != 0 \n" . "AND u.id IS NULL";
         $database->setQuery($query);
         if (!$database->query()) {
             echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
             return false;
         }
         $query = "UPDATE #__joomgallery AS p set \n" . "p.imgvotes = \n" . "(select count(*) FROM #__joomgallery_votes as v \n" . "WHERE v.picid = p.id), \n" . "p.imgvotesum = \n" . "(select sum(vote) FROM #__joomgallery_votes as v \n" . "WHERE v.picid = p.id)";
         $database->setQuery($query);
         if (!$database->query()) {
             echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
             return false;
         }
         $mainframe->redirect('index.php?option=' . _JOOM_OPTION . '&act=votes', JText::_('JGA_USERVOTES_SYNCHRONIZED'));
     } else {
         if ($reset) {
             //delete all votes
             $query = "DELETE FROM #__joomgallery_votes";
             $database->setQuery($query);
             if (!$database->query()) {
                 echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
                 return false;
             }
             $query = "UPDATE #__joomgallery SET imgvotes = 0, imgvotesum = 0";
             $database->setQuery($query);
             if (!$database->query()) {
                 echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
                 return;
             }
             //done:
             $mainframe->redirect('index.php?option=' . _JOOM_OPTION . '&act=votes', JText::_('JGA_ALL_VOTES_DELETED'));
         }
     }
     require_once JPATH_COMPONENT . DS . 'includes' . DS . 'html' . DS . 'admin.votes.html.php';
     $htmladminvotes = new HTML_Joom_AdminVotes();
 }
 /**
  * Constructor
  *
  * @param string $task type of upload
  * @param int $catid destination category
  * @return Joom_Upload
  */
 function Joom_Upload($task, $catid)
 {
     $database =& JFactory::getDBO();
     $user =& JFactory::getUser();
     jimport('joomla.filesystem.file');
     $this->debug = JRequest::getInt('debug', 0);
     $this->batchul = JRequest::getInt('batchul', 0);
     $this->subdirectory = Joom_mosGetParam('subdirectory', DS, 'post');
     $this->gentitle = Joom_mosGetParam('gentitle', '', 'post');
     $this->gendesc = Joom_FixUserEntrie(Joom_mosGetParam('gendesc', ''));
     $this->photocred = Joom_FixUserEntrie(Joom_mosGetParam('photocred', ''));
     $this->filecounter = Joom_mosGetParam('filecounter', '', 'post');
     $this->file_delete = Joom_mosGetParam('file_delete', '', 'post');
     $this->original_delete = Joom_mosGetParam('original_delete', '', 'post');
     $this->create_special_gif = Joom_mosGetParam('create_special_gif', '', 'post');
     $this->arrscreenshot = Joom_mosGetParam('arrscreenshot', '', 'files');
     $this->zippack = Joom_mosGetParam('zippack', '', 'files');
     $this->ftpfiles = Joom_mosGetParam('ftpfiles', '', 'post');
     $this->imgname_separator = '_';
     switch ($task) {
         //Single upload
         case 'uploadhandler':
             $this->Upload_Singles_Backend($catid);
             break;
             //ZIP upload
         //ZIP upload
         case 'batchuploadhandler':
             $this->Upload_Batch($catid);
             break;
             //FTP upload
         //FTP upload
         case 'ftpuploadhandler':
             $this->Upload_FTP($catid);
             break;
             //JAVA upload
         //JAVA upload
         case 'juploadhandler_receive':
             $this->Upload_AppletReceive_Backend($catid);
             break;
         default:
             jexit('Wrong Task');
             break;
     }
 }
 /**
  * Constructor of class Joom_AdminCssEdit
  * editing indvidual CSS settings in backend and save them in joom.local.css
  *
  * @param string $task
  * @return Joom_AdminCssEdit
  */
 function Joom_AdminCssEdit($task)
 {
     $this->cssPath = JPATH_COMPONENT_SITE . DS . 'assets' . DS . 'css' . DS;
     $this->localCssFile = $this->cssPath . 'joom_local.css';
     $filecontent = Joom_mosGetParam("csscontent", '');
     switch ($task) {
         case "cancelcss":
             $this->cancelCss();
             break;
         case "savecss":
             $this->saveCss($filecontent);
             break;
         case "deletecss":
             $this->deleteCss();
             break;
         default:
             $this->displayCssEdit();
     }
 }
 function getJoomId($Itemid_modul = '')
 {
     $database =& JFactory::getDBO();
     $Itemid_param = JRequest::getInt('Itemid', '');
     if (trim(Joom_mosGetParam('option', '')) == 'com_joomgallery' && $Itemid_param != '' && $Itemid_param != 0 && $Itemid_param != 99999) {
         return "&amp;Itemid=" . $Itemid_param;
     } elseif ($Itemid_modul != '') {
         return "&amp;Itemid=" . $Itemid_modul;
     } else {
         $database->setQuery(" SELECT \n                              id \n                            FROM \n                              #__menu \n                            WHERE \n                              link LIKE '%com_joomgallery%' \n                              AND (published = '1' OR published = '0') \n                              AND access = '0' \n                            ORDER BY \n                              id DESC \n                            Limit 1\n                          ");
         $Itemid_jg = $database->loadResult();
         if ($Itemid_jg == '' || $Itemid_jg == NULL) {
             $database->setQuery(" SELECT \n                                id \n                              FROM \n                                #__menu \n                              WHERE \n                                link LIKE '%com_joomgallery%' \n                                AND (published = '1' OR published = '0') \n                                AND access = '1' \n                              ORDER BY \n                                id DESC \n                              Limit 1\n                            ");
             $Itemid_jg = $database->loadResult();
         }
         $Itemid_jg = $Itemid_jg == '' || $Itemid_jg == NULL ? "" : "&amp;Itemid=" . $Itemid_jg;
         return $Itemid_jg;
     }
 }
 /**
  * Constructor of class Joom_AdminUploads
  * single upload
  * batch upload (zip)
  * FTP upload
  * JAVA upload
  *
  * @param string $task
  * @return Joom_AdminUploads
  */
 function Joom_AdminUploads($task)
 {
     $this->debug = JRequest::getInt('debug', 0);
     $this->subdirectory = stripslashes(Joom_mosGetParam('subdirectory', DS, 'post'));
     switch ($task) {
         case 'upload':
             $this->Joom_ShowUpload();
             break;
         case 'batchupload':
             $this->Joom_ShowBatchUpload();
             break;
         case 'ftpupload':
             $this->Joom_ShowFTPUpload();
             break;
         case 'jupload':
             $this->Joom_ShowJUpload();
             break;
     }
 }
 function Joom_CategoryView(&$catid)
 {
     $database =& JFactory::getDBO();
     require_once JPATH_COMPONENT . DS . 'includes' . DS . 'html' . DS . 'joom.viewcategory.html.php';
     $this->catstartpage = JRequest::getInt('startpage', 0);
     $this->substartpage = JRequest::getInt('substartpage', 0);
     //User ordered view
     $this->order_dir = trim(Joom_mosGetParam('orderdir', ''));
     $this->order_by = trim(Joom_mosGetParam('orderby', ''));
     if ($this->order_dir == '') {
         $this->order_dir = trim(Joom_mosGetParam('orderdir', '', 'post'));
     }
     if ($this->order_by == '') {
         $this->order_by = trim(Joom_mosGetParam('orderby', '', 'post'));
     }
     $this->catid = $catid;
     $this->viewcategory_url = 'index.php?option=com_joomgallery&func=viewcategory&catid=';
     $this->assetsimages_url = _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/';
     //Cooliris
     $this->cooliris = JRequest::getInt('cooliris', 0);
 }
 /**
 * Class Joom_Upload
 * @param func
 * @param Category ID
 */
 function Joom_Upload($func, $catid)
 {
     $database =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $this->filecounter = Joom_mosGetParam('filecounter', '', 'post');
     $this->original_delete = Joom_mosGetParam('original_delete', '', 'post');
     $this->create_special_gif = Joom_mosGetParam('create_special_gif', '', 'post');
     $this->arrscreenshot = Joom_mosGetParam('arrscreenshot', '', 'files');
     if ($user->get('usertype') == 'Administrator' || $user->get('usertype') == 'Super Administrator') {
         $this->adminlogged = true;
     } else {
         $this->adminlogged = false;
     }
     switch ($func) {
         case 'uploadhandler':
             $this->Upload_Singles($catid);
             break;
         default:
             die('Wrong');
             break;
     }
 }
/**
 * fetches an update zip file from JoomGallery server and extracts it
 */
function Joom_AutoUpdate()
{
    $extension = Joom_mosGetParam('extension', 0, 'get');
    $extensions = Joom_CheckUpdate();
    if (!isset($extensions[$extension]['updatelink']) || !extension_loaded('curl')) {
        $mainframe =& JFactory::getApplication('administrator');
        $mainframe->redirect('index.php?option=' . _JOOM_OPTION, 'Could not fetch update zip', 'error');
    }
    //create curl resource
    $ch = curl_init($extensions[$extension]['updatelink']);
    //some settings for curl
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    //create the zip file
    jimport('joomla.filesystem.file');
    $config = Joom_getConfig();
    $output = curl_exec($ch);
    JFile::write(JPath::clean(JPATH_ROOT . DS . $config->jg_pathtemp . 'update.zip'), $output);
    //close curl resource to free up system resources
    curl_close($ch);
    //extract the zip file
    include JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'pcl' . DS . 'pclzip.lib.php';
    $zipfile = new PclZip(JPath::clean(JPATH_ROOT . DS . $config->jg_pathtemp . 'update.zip'));
    $folder = JPath::clean(JPATH_ROOT . DS . $config->jg_pathtemp . 'update');
    $zipfile->extract(PCLZIP_OPT_PATH, $folder);
    if ($zipfile->error_code != 1) {
        $mainframe =& JFactory::getApplication('administrator');
        $mainframe->redirect('index.php?option=' . _JOOM_OPTION, $zipfile->errorInfo(), 'error');
    }
    JError::raiseNotice('301', JText::_('JGA_REDIRECT_NOTE'));
    //let's ask Joomla! to do the rest
    ?>
  <form action="index.php" method="post" name="JoomUpdateForm">
    <input type="hidden" name="installtype" value="folder" />
    <input type="hidden" name="install_directory" value="<?php 
    echo $folder;
    ?>
" />
    <input type="hidden" name="task" value="doInstall" />
    <input type="hidden" name="option" value="com_installer" />
    <?php 
    echo JHTML::_('form.token');
    ?>
  </form>
  <script type="text/javascript">
    document.JoomUpdateForm.submit();
  </script>
<?php 
}
 /**
  * get all necessary data for creation of a new picture (NEW in picture manager)
  * and calls Joom_ShowNewPicture_HTML()
  */
 function Joom_ShowNewPicture()
 {
     $config = Joom_getConfig();
     $mainframe =& JFactory::getApplication('administrator');
     $database =& JFactory::getDBO();
     $user =& JFactory::getUser();
     jimport('joomla.filesystem.file');
     //If the category of picture or thumb had been changed the site will be
     //refreshed. Then get the new values from $_POST or $mainframe->getUserStateFromRequest
     //Title
     $this->imgtitle = Joom_mosGetParam('imgtitle', '', 'post');
     //Destination category
     $this->newcatid = $mainframe->getUserStateFromRequest("newcatid{" . _JOOM_OPTION . "}", 'catid', 0);
     //Description
     $this->imgtext = Joom_mosGetParam('imgtext', '', 'post');
     //Author
     $this->imgauthor = Joom_mosGetParam('imgauthor', '', 'post');
     // Owner
     $this->owner = Joom_mosGetParam('owner', '', 'post');
     //Source category for original and detail picture
     $this->pcatid = $mainframe->getUserStateFromRequest("pcatid{" . _JOOM_OPTION . "}", 'pcatid', 0);
     //Name of original and/or detail picture
     $this->imgfilename = Joom_mosGetParam('imgfilename', '', 'post');
     //Source category for thumbnail
     $this->tcatid = $mainframe->getUserStateFromRequest("tcatid{" . _JOOM_OPTION . "}", 'tcatid', 0);
     //Name of thumbnail
     $this->imgthumbname = Joom_mosGetParam('imgthumbname', '', 'post');
     //creation of dropdown list for new category
     $Lists['clist'] = Joom_ShowDropDownCategoryList($this->newcatid, 'catid', 'size="1"');
     //creation of dropdown list for original and detail picture
     $Lists['cplist'] = Joom_ShowDropDownCategoryList($this->pcatid, 'pcatid', "class=\"inputbox\" size=\"1\" " . "onchange=\"document.adminForm.submit();\"");
     //get path for original and detail picture
     $ppath = Joom_GetCatPath($this->pcatid);
     // Zusammensetzen des absoluten Kategorie-Pfades fuer Original- und Detailbild
     $pcatpath = JPATH_ROOT . DS . $config->jg_pathimages . $ppath;
     //read the folder for original and detail pictures
     $imgFiles = JFolder::files($pcatpath);
     //array of pictures
     $images = array(JHTML::_('select.option', '', JText::_('JGA_PLEASE_SELECT_IMAGE')));
     foreach ($imgFiles as $file) {
         // if prefix one of bmp, gif, jpg, png, jpeg oder jpe hat...
         if (eregi("bmp|gif|jpg|png|jpeg|jpe", $file)) {
             //add them to array
             $images[] = JHTML::_('select.option', $file);
         }
     }
     $Lists['imagelist'] = JHTML::_('select.genericlist', $images, 'imgfilename', "class=\"inputbox\" size=\"1\" " . "onchange=\"javascript:" . "if (document.forms[0].imgfilename.options[selectedIndex].value!='') {" . "document.imagelib2.src='../" . $config->jg_pathimages . $ppath . "' " . "+ document.forms[0].imgfilename.options[selectedIndex].value;" . "document.adminForm.submit();" . "} else {" . "document.imagelib2.src='../images/M_images/blank.png'" . "}\"", 'value', 'text', $this->imgfilename);
     //if original exists
     if (JFile::exists(JPATH_ROOT . DS . $config->jg_pathoriginalimages . $ppath . $this->imgfilename)) {
         //show them as existent
         $original_message = 1;
     } else {
         if (!JFile::exists(JPATH_ROOT . DS . $config->jg_pathoriginalimages . $ppath . $this->imgfilename)) {
             //or not existent
             $original_message = 0;
         }
     }
     //drop down list for choosing original
     $yesno[] = JHTML::_('select.option', '1', JText::_('YES'));
     $yesno[] = JHTML::_('select.option', '0', JText::_('NO'));
     $Lists['copy_original'] = JHTML::_('select.genericlist', $yesno, 'copy_original', 'class="inputbox" size="1"', 'value', 'text', $this->copy_original);
     //categorie drop down for thumbnail
     $Lists['ctlist'] = Joom_ShowDropDownCategoryList($this->tcatid, 'tcatid', 'class="inputbox" size="1" "
                                                  ."onchange="document.adminForm.submit();"');
     //catpath for thumbnail
     $tpath = Joom_GetCatPath($this->tcatid);
     //compose absolute catpath to thumbnail
     $tcatpath = JPATH_ROOT . DS . $config->jg_paththumbs . $tpath;
     //read folder of thumbails
     $thuFiles = JFolder::files($tcatpath);
     $thumbs = array(JHTML::_('select.option', '', JText::_('JGA_PLEASE_SELECT_THUMBNAIL')));
     foreach ($thuFiles as $tfile) {
         //if extension one of bmp, gif, jpg, png, jpeg oder jpe ...
         if (eregi("bmp|gif|jpg|png|jpeg|jpe", $tfile)) {
             //add them to array
             $thumbs[] = JHTML::_('select.option', $tfile);
         }
     }
     $Lists['thumblist'] = JHTML::_('select.genericlist', $thumbs, 'imgthumbname', "class=\"inputbox\" size=\"1\"" . " onchange=\"javascript:" . "if (document.forms[0].imgthumbname.options[selectedIndex].value!='') {" . "document.imagelib.src='../" . $config->jg_paththumbs . $tpath . "' " . "+ document.forms[0].imgthumbname.options[selectedIndex].value" . "} else {" . "document.imagelib.src='../images/M_images/blank.png'" . "}\"", 'value', 'text', $this->imgthumbname);
     // Build User select list
     $selname = $config->jg_realname ? "name" : "username";
     $sql = "SELECT id as value, {$selname} as text" . "\n FROM #__users" . "\n ORDER BY {$selname}";
     $database->setQuery($sql);
     if (!$database->query()) {
         echo $database->stderr();
         return;
     }
     // set owner to current admin user, if none set:
     $owner = $this->owner ? $this->owner : $user->get('id');
     $Lists['users'] = JHTML::_('select.genericlist', $database->loadObjectList(), 'owner', 'class="inputbox" size="1"', 'value', 'text', $owner);
     HTML_Joom_AdminPictures::Joom_ShowNewPicture_HTML($Lists, $original_message);
 }
 /**
  * Read any changed configuration variables from $_POST
  *
  */
 function Joom_LoadConfigPost_and_SaveConfig()
 {
     $mainframe =& JFactory::getApplication('administrator');
     //read existing configuration
     $config = Joom_getConfig();
     foreach ($config as $key => $value) {
         $this->{$key} = $value;
     }
     jimport('joomla.filesystem.file');
     //read from $_POST
     //Description of Tabs in german
     //*** Grundlegende Einstellungen ***
     //Grundlegende Einstellungen->Pfade und Verzeichnisse
     if (isset($_POST['jg_pathimages'])) {
         $this->jg_pathimages = Joom_FixPathEntrie(Joom_FixAdminEntrie(Joom_mosGetParam('jg_pathimages', 'components/' . _JOOM_OPTION . '/img_pictures/', 'post')));
     }
     if (isset($_POST['jg_pathoriginalimages'])) {
         $this->jg_pathoriginalimages = Joom_FixPathEntrie(Joom_FixAdminEntrie(Joom_mosGetParam('jg_pathoriginalimages', 'components/' . _JOOM_OPTION . '/img_originals/', 'post')));
     }
     if (isset($_POST['jg_paththumbs'])) {
         $this->jg_paththumbs = Joom_FixPathEntrie(Joom_FixAdminEntrie(Joom_mosGetParam('jg_paththumbs', 'components/' . _JOOM_OPTION . '/img_thumbnails/', 'post')));
     }
     if (isset($_POST['jg_pathftpupload'])) {
         $this->jg_pathftpupload = Joom_FixPathEntrie(Joom_FixAdminEntrie(Joom_mosGetParam('jg_pathftpupload', 'components/' . _JOOM_OPTION . '/ftp_upload/', 'post')));
     }
     if (isset($_POST['jg_pathtemp'])) {
         $this->jg_pathtemp = Joom_FixPathEntrie(Joom_FixAdminEntrie(Joom_mosGetParam('jg_pathtemp', 'administrator/components/' . _JOOM_OPTION . '/temp/', 'post')));
     }
     if (isset($_POST['jg_wmpath'])) {
         $this->jg_wmpath = Joom_FixPathEntrie(Joom_FixAdminEntrie(Joom_mosGetParam('jg_wmpath', 'components/' . _JOOM_OPTION . '/assets/images/', 'post')));
     }
     if (isset($_POST['jg_wmfile'])) {
         $this->jg_wmfile = Joom_FixAdminEntrie(Joom_mosGetParam('jg_wmfile', 'watermark.png', 'post'));
     }
     if (isset($_POST['jg_dateformat'])) {
         $this->jg_dateformat = Joom_mosGetParam('jg_dateformat', '%d-%m-%Y%H:%M:%S', 'post');
     }
     if (isset($_POST['jg_checkupdate'])) {
         $this->jg_checkupdate = JRequest::getInt('jg_checkupdate', 1, 'post');
     }
     //Grundlegende Einstellungen->Ersetzungen
     if (isset($_POST['jg_filenamewithjs'])) {
         $this->jg_filenamewithjs = JRequest::getInt('jg_filenamewithjs', 1, 'post');
     }
     if (isset($_POST['jg_filenamesearch'])) {
         $this->jg_filenamesearch = Joom_mosGetParam('jg_filenamesearch', '', 'post');
     }
     if (isset($_POST['jg_filenamereplace'])) {
         $this->jg_filenamereplace = Joom_mosGetParam('jg_filenamereplace', '', 'post');
     }
     //Grundlegende Einstellungen->Bildmanipulation
     if (isset($_POST['jg_thumbcreation'])) {
         $this->jg_thumbcreation = Joom_mosGetParam('jg_thumbcreation', 'gd2', 'post');
     }
     if (isset($_POST['jg_fastgd2thumbcreation'])) {
         $this->jg_fastgd2thumbcreation = JRequest::getInt('jg_fastgd2thumbcreation', 1, 'post');
     }
     if (isset($_POST['jg_impath'])) {
         $this->jg_impath = Joom_mosGetParam('jg_impath', '', 'post');
     }
     if (isset($_POST['jg_resizetomaxwidth'])) {
         $this->jg_resizetomaxwidth = JRequest::getInt('jg_resizetomaxwidth', 1, 'post');
     }
     if (isset($_POST['jg_maxwidth'])) {
         $this->jg_maxwidth = JRequest::getInt('jg_maxwidth', 400, 'post');
     }
     if (isset($_POST['jg_picturequality'])) {
         $this->jg_picturequality = JRequest::getInt('jg_picturequality', 100, 'post');
     }
     if (isset($_POST['jg_useforresizedirection'])) {
         $this->jg_useforresizedirection = JRequest::getInt('jg_useforresizedirection', 0, 'post');
     }
     if (isset($_POST['jg_thumbwidth'])) {
         $this->jg_thumbwidth = JRequest::getInt('jg_thumbwidth', 133, 'post');
     }
     if (isset($_POST['jg_thumbheight'])) {
         $this->jg_thumbheight = JRequest::getInt('jg_thumbheight', 100, 'post');
     }
     if (isset($_POST['jg_thumbquality'])) {
         $this->jg_thumbquality = JRequest::getInt('jg_thumbquality', 75, 'post');
     }
     //Grundlegende Einstellungen->Backend-Upload
     if (isset($_POST['jg_uploadorder'])) {
         $this->jg_uploadorder = JRequest::getInt('jg_uploadorder', 0, 'post');
     }
     if (isset($_POST['jg_useorigfilename'])) {
         $this->jg_useorigfilename = JRequest::getInt('jg_useorigfilename', 0, 'post');
     }
     if (isset($_POST['jg_filenamenumber'])) {
         $this->jg_filenamenumber = JRequest::getInt('jg_filenamenumber', 0, 'post');
     }
     if (isset($_POST['jg_delete_original'])) {
         $this->jg_delete_original = JRequest::getInt('jg_delete_original', 0, 'post');
     }
     if (isset($_POST['jg_wrongvaluecolor'])) {
         $this->jg_wrongvaluecolor = Joom_FixAdminEntrie(Joom_mosGetParam('jg_wrongvaluecolor', 'red', 'post'));
     }
     if (isset($_POST['jg_filenamewithjs'])) {
         $this->jg_filenamewithjs = JRequest::getInt('jg_filenamewithjs', 1, 'post');
     }
     if (isset($_POST['jg_filenamesearch'])) {
         $this->jg_filenamesearch = Joom_mosGetParam('jg_filenamesearch', '', 'post');
     }
     if (isset($_POST['jg_filenamereplace'])) {
         $this->jg_filenamereplace = Joom_mosGetParam('jg_filenamereplace', '', 'post');
     }
     //Grundlegende Einstellungen->Zusaetzliche Funktionen
     if (isset($_POST['jg_combuild'])) {
         $this->jg_combuild = JRequest::getInt('jg_combuild', 0, 'post');
     }
     if (isset($_POST['jg_realname'])) {
         $this->jg_realname = JRequest::getInt('jg_realname', 0, 'post');
     }
     if (isset($_POST['jg_bridge'])) {
         $this->jg_bridge = JRequest::getInt('jg_bridge', 0, 'post');
     }
     if (isset($_POST['jg_cooliris'])) {
         $this->jg_cooliris = JRequest::getInt('jg_cooliris', 0, 'post');
     }
     if (isset($_POST['jg_coolirislink'])) {
         $this->jg_coolirislink = JRequest::getInt('jg_coolirislink', 0, 'post');
     }
     //*** Benutzer-Rechte ***
     //Benutzer-Rechte->Benutzer-Upload ueber "Meine Galerie"
     if (isset($_POST['jg_userspace'])) {
         $this->jg_userspace = JRequest::getInt('jg_userspace', 0, 'post');
     }
     if (isset($_POST['jg_approve'])) {
         $this->jg_approve = JRequest::getInt('jg_approve', 1, 'post');
     }
     if (isset($_POST['jg_usercat'])) {
         $this->jg_usercat = JRequest::getInt('jg_usercat', 0, 'post');
     }
     if (isset($_POST['jg_usercategory'])) {
         $this->jg_usercategory = array();
         $usercats = Joom_mosGetParam('jg_usercategory', 0, 'post');
         foreach ($usercats as $usercat) {
             $usercat = intval($usercat);
             if ($usercat > 0) {
                 array_push($this->jg_usercategory, $usercat);
             }
         }
         $this->jg_usercategory = implode(',', $this->jg_usercategory);
     }
     if (isset($_POST['jg_usercatacc'])) {
         $this->jg_usercatacc = JRequest::getInt('jg_usercatacc', 0, 'post');
     }
     if (isset($_POST['jg_maxusercat'])) {
         $this->jg_maxusercat = JRequest::getInt('jg_maxusercat', 10, 'post');
     }
     if (isset($_POST['jg_userowncatsupload'])) {
         $this->jg_userowncatsupload = JRequest::getInt('jg_userowncatsupload', 400, 'post');
     }
     if (isset($_POST['jg_maxuserimage'])) {
         $this->jg_maxuserimage = JRequest::getInt('jg_maxuserimage', 400, 'post');
     }
     if (isset($_POST['jg_maxfilesize'])) {
         $this->jg_maxfilesize = JRequest::getInt('jg_maxfilesize', 2000000, 'post');
     }
     if (isset($_POST['jg_category'])) {
         $this->jg_category = array();
         $cats = Joom_mosGetParam('jg_category', '', 'post');
         foreach ($cats as $cat) {
             $cat = intval($cat);
             if ($cat > 0) {
                 array_push($this->jg_category, $cat);
             }
         }
         $this->jg_category = implode(',', $this->jg_category);
     }
     if (isset($_POST['jg_maxuploadfields'])) {
         $this->jg_maxuploadfields = JRequest::getInt('jg_maxuploadfields', 3, 'post');
     }
     if (isset($_POST['jg_useruploadnumber'])) {
         $this->jg_useruploadnumber = JRequest::getInt('jg_useruploadnumber', 0, 'post');
     }
     if (isset($_POST['jg_special_gif_upload'])) {
         $this->jg_special_gif_upload = JRequest::getInt('jg_special_gif_upload', 0, 'post');
     }
     if (isset($_POST['jg_delete_original_user'])) {
         $this->jg_delete_original_user = JRequest::getInt('jg_delete_original_user', 0, 'post');
     }
     if (isset($_POST['jg_newpiccopyright'])) {
         $this->jg_newpiccopyright = JRequest::getInt('jg_newpiccopyright', 0, 'post');
     }
     if (isset($_POST['jg_newpicnote'])) {
         $this->jg_newpicnote = JRequest::getInt('jg_newpicnote', 0, 'post');
     }
     //Benutzer-Rechte->Bewertungen
     if (isset($_POST['jg_showrating'])) {
         $this->jg_showrating = JRequest::getInt('jg_showrating', 0, 'post');
     }
     if (isset($_POST['jg_maxvoting'])) {
         $this->jg_maxvoting = JRequest::getInt('jg_maxvoting', 5, 'post');
     }
     if (isset($_POST['jg_onlyreguservotes'])) {
         $this->jg_onlyreguservotes = JRequest::getInt('jg_onlyreguservotes', 1, 'post');
     }
     //Benutzer-Rechte->Kommentare
     if (isset($_POST['jg_showcomment'])) {
         $this->jg_showcomment = JRequest::getInt('jg_showcomment', 0, 'post');
     }
     if (isset($_POST['jg_anoncomment'])) {
         $this->jg_anoncomment = JRequest::getInt('jg_anoncomment', 0, 'post');
     }
     if (isset($_POST['jg_namedanoncomment'])) {
         $this->jg_namedanoncomment = JRequest::getInt('jg_namedanoncomment', 0, 'post');
     }
     if (isset($_POST['jg_approvecom'])) {
         $this->jg_approvecom = JRequest::getInt('jg_approvecom', 2, 'post');
     }
     if (isset($_POST['jg_secimages'])) {
         $this->jg_secimages = JRequest::getInt('jg_secimages', 2, 'post');
     }
     if (isset($_POST['jg_bbcodesupport'])) {
         $this->jg_bbcodesupport = JRequest::getInt('jg_bbcodesupport', 0, 'post');
     }
     if (isset($_POST['jg_smiliesupport'])) {
         $this->jg_smiliesupport = JRequest::getInt('jg_smiliesupport', 0, 'post');
     }
     if (isset($_POST['jg_anismilie'])) {
         $this->jg_anismilie = JRequest::getInt('jg_anismilie', 0, 'post');
     }
     if (isset($_POST['jg_smiliescolor'])) {
         $this->jg_smiliescolor = Joom_mosGetParam('jg_smiliescolor', 'grey', 'post');
     }
     //*** Frontend Einstellungen ***
     //Frontend Einstellungen->Anordnung der Bilder
     if (isset($_POST['jg_firstorder'])) {
         $this->jg_firstorder = Joom_mosGetParam('jg_firstorder', 'ordering ASC', 'post');
     }
     if (isset($_POST['jg_secondorder'])) {
         $this->jg_secondorder = Joom_mosGetParam('jg_secondorder', 'imgdate DESC', 'post');
     }
     if (isset($_POST['jg_thirdorder'])) {
         $this->jg_thirdorder = Joom_mosGetParam('jg_thirdorder', 'imgtitle DESC', 'post');
     }
     //Frontend Einstellungen->Seitentitel
     if (isset($_POST['jg_pagetitle_cat'])) {
         $this->jg_pagetitle_cat = Joom_mosGetParam('jg_pagetitle_cat', '', 'post');
     }
     if (isset($_POST['jg_pagetitle_detail'])) {
         $this->jg_pagetitle_detail = Joom_mosGetParam('jg_pagetitle_detail', '', 'post');
     }
     //Frontend Einstellungen->Kopf- und Fussbereich
     if (isset($_POST['jg_showgalleryhead'])) {
         $this->jg_showgalleryhead = JRequest::getInt('jg_showgalleryhead', 1, 'post');
     }
     if (isset($_POST['jg_showpathway'])) {
         $this->jg_showpathway = JRequest::getInt('jg_showpathway', 1, 'post');
     }
     if (isset($_POST['jg_completebreadcrumbs'])) {
         $this->jg_completebreadcrumbs = JRequest::getInt('jg_completebreadcrumbs', 0, 'post');
     }
     if (isset($_POST['jg_search'])) {
         $this->jg_search = JRequest::getInt('jg_search', 1, 'post');
     }
     if (isset($_POST['jg_showallpics'])) {
         $this->jg_showallpics = JRequest::getInt('jg_showallpics', 0, 'post');
     }
     if (isset($_POST['jg_showallhits'])) {
         $this->jg_showallhits = JRequest::getInt('jg_showallhits', 0, 'post');
     }
     if (isset($_POST['jg_showbacklink'])) {
         $this->jg_showbacklink = JRequest::getInt('jg_showbacklink', 0, 'post');
     }
     if (isset($_POST['jg_suppresscredits'])) {
         $this->jg_suppresscredits = JRequest::getInt('jg_suppresscredits', 1, 'post');
     }
     //Frontend Einstellungen->Meine Galerie
     if (isset($_POST['jg_showuserpanel'])) {
         $this->jg_showuserpanel = JRequest::getInt('jg_showuserpanel', 1, 'post');
     }
     if (isset($_POST['jg_showallpicstoadmin'])) {
         $this->jg_showallpicstoadmin = JRequest::getInt('jg_showallpicstoadmin', 0, 'post');
     }
     if (isset($_POST['jg_showminithumbs'])) {
         $this->jg_showminithumbs = JRequest::getInt('jg_showminithumbs', 1, 'post');
     }
     //Frontend Einstellungen->Toplisten
     if (isset($_POST['jg_showtoplist'])) {
         $this->jg_showtoplist = JRequest::getInt('jg_showtoplist', 1, 'post');
     }
     if (isset($_POST['jg_toplist'])) {
         $this->jg_toplist = JRequest::getInt('jg_toplist', 10, 'post');
     }
     if (isset($_POST['jg_topthumbalign'])) {
         $this->jg_topthumbalign = JRequest::getInt('jg_topthumbalign', 1, 'post');
     }
     if (isset($_POST['jg_toptextalign'])) {
         $this->jg_toptextalign = JRequest::getInt('jg_toptextalign', 1, 'post');
     }
     if (isset($_POST['jg_whereshowtoplist'])) {
         $this->jg_whereshowtoplist = JRequest::getInt('jg_whereshowtoplist', 0, 'post');
     }
     if (isset($_POST['jg_toplistcols'])) {
         $this->jg_toplistcols = JRequest::getInt('jg_toplistcols', 0, 'post');
     }
     if (isset($_POST['jg_showrate'])) {
         $this->jg_showrate = JRequest::getInt('jg_showrate', 1, 'post');
     }
     if (isset($_POST['jg_showlatest'])) {
         $this->jg_showlatest = JRequest::getInt('jg_showlatest', 1, 'post');
     }
     if (isset($_POST['jg_showcom'])) {
         $this->jg_showcom = JRequest::getInt('jg_showcom', 1, 'post');
     }
     if (isset($_POST['jg_showthiscomment'])) {
         $this->jg_showthiscomment = JRequest::getInt('jg_showthiscomment', 1, 'post');
     }
     if (isset($_POST['jg_showmostviewed'])) {
         $this->jg_showmostviewed = JRequest::getInt('jg_showmostviewed', 1, 'post');
     }
     //Frontend Einstellungen->PopUp-Funktionen
     if (isset($_POST['jg_openjs_padding'])) {
         $this->jg_openjs_padding = JRequest::getInt('jg_openjs_padding', 10, 'post');
     }
     if (isset($_POST['jg_openjs_background'])) {
         $this->jg_openjs_background = Joom_FixAdminEntrie(Joom_mosGetParam('jg_openjs_background', '#fff', 'post'));
     }
     if (isset($_POST['jg_dhtml_border'])) {
         $this->jg_dhtml_border = Joom_FixAdminEntrie(Joom_mosGetParam('jg_dhtml_border', '#808080', 'post'));
     }
     if (isset($_POST['jg_show_title_in_dhtml'])) {
         $this->jg_show_title_in_dhtml = JRequest::getInt('jg_show_title_in_dhtml', 0, 'post');
     }
     if (isset($_POST['jg_show_description_in_dhtml'])) {
         $this->jg_show_description_in_dhtml = JRequest::getInt('jg_show_description_in_dhtml', 0, 'post');
     }
     if (isset($_POST['jg_lightbox_speed'])) {
         $this->jg_lightbox_speed = JRequest::getInt('jg_lightbox_speed', 5, 'post');
     }
     if (isset($_POST['jg_lightbox_slide_all'])) {
         $this->jg_lightbox_slide_all = JRequest::getInt('jg_lightbox_slide_all', 0, 'post');
     }
     if (isset($_POST['jg_resize_js_image'])) {
         $this->jg_resize_js_image = JRequest::getInt('jg_resize_js_image', 1, 'post');
     }
     if (isset($_POST['jg_disable_rightclick_original'])) {
         $this->jg_disable_rightclick_original = JRequest::getInt('jg_disable_rightclick_original', 1, 'post');
     }
     //*** Galerie-Ansicht ***
     //Galerie-Ansicht->Generelle Einstellungen
     if (isset($_POST['jg_showgallerysubhead'])) {
         $this->jg_showgallerysubhead = JRequest::getInt('jg_showgallerysubhead', 1, 'post');
     }
     if (isset($_POST['jg_showallcathead'])) {
         $this->jg_showallcathead = JRequest::getInt('jg_showallcathead', 1, 'post');
     }
     if (isset($_POST['jg_colcat'])) {
         $this->jg_colcat = JRequest::getInt('jg_colcat', 1, 'post');
     }
     if (isset($_POST['jg_catperpage'])) {
         $this->jg_catperpage = JRequest::getInt('jg_catperpage', 10, 'post');
     }
     if (isset($_POST['jg_ordercatbyalpha'])) {
         $this->jg_ordercatbyalpha = JRequest::getInt('jg_ordercatbyalpha', 0, 'post');
     }
     if (isset($_POST['jg_showgallerypagenav'])) {
         $this->jg_showgallerypagenav = JRequest::getInt('jg_showgallerypagenav', 1, 'post');
     }
     if (isset($_POST['jg_showcatcount'])) {
         $this->jg_showcatcount = JRequest::getInt('jg_showcatcount', 1, 'post');
     }
     if (isset($_POST['jg_showcatthumb'])) {
         $this->jg_showcatthumb = JRequest::getInt('jg_showcatthumb', 1, 'post');
     }
     if (isset($_POST['jg_showrandomcatthumb'])) {
         $this->jg_showrandomcatthumb = JRequest::getInt('jg_showrandomcatthumb', 2, 'post');
     }
     if (isset($_POST['jg_ctalign'])) {
         $this->jg_ctalign = JRequest::getInt('jg_ctalign', 1, 'post');
     }
     if (isset($_POST['jg_showtotalcathits'])) {
         $this->jg_showtotalcathits = JRequest::getInt('jg_showtotalcathits', 1, 'post');
     }
     if (isset($_POST['jg_showcatasnew'])) {
         $this->jg_showcatasnew = JRequest::getInt('jg_showcatasnew', 0, 'post');
     }
     if (isset($_POST['jg_catdaysnew'])) {
         $this->jg_catdaysnew = JRequest::getInt('jg_catdaysnew', 7, 'post');
     }
     if (isset($_POST['jg_rmsm'])) {
         $this->jg_rmsm = JRequest::getInt('jg_rmsm', 1, 'post');
     }
     if (isset($_POST['jg_showrmsmcats'])) {
         $this->jg_showrmsmcats = JRequest::getInt('jg_showrmsmcats', 0, 'post');
     }
     if (isset($_POST['jg_showsubsingalleryview'])) {
         $this->jg_showsubsingalleryview = JRequest::getInt('jg_showsubsingalleryview', 0, 'post');
     }
     //*** Kategorie-Ansicht ***
     //Kategorie-Ansicht->Generelle Einstellungen
     if (isset($_POST['jg_showcathead'])) {
         $this->jg_showcathead = JRequest::getInt('jg_showcathead', 1, 'post');
     }
     if (isset($_POST['jg_usercatorder'])) {
         $this->jg_usercatorder = JRequest::getInt('jg_usercatorder', 0, 'post');
     }
     if (isset($_POST['jg_usercatorderlist'])) {
         $this->jg_usercatorderlist = implode(',', Joom_mosGetParam('jg_usercatorderlist', 'date,title', 'post'));
     }
     if (isset($_POST['jg_showcatdescriptionincat'])) {
         $this->jg_showcatdescriptionincat = JRequest::getInt('jg_showcatdescriptionincat', 0, 'post');
     }
     if (isset($_POST['jg_showpagenav'])) {
         $this->jg_showpagenav = JRequest::getInt('jg_showpagenav', 1, 'post');
     }
     if (isset($_POST['jg_showpiccount'])) {
         $this->jg_showpiccount = JRequest::getInt('jg_showpiccount', 1, 'post');
     }
     if (isset($_POST['jg_perpage'])) {
         $this->jg_perpage = JRequest::getInt('jg_perpage', 9, 'post');
     }
     if (isset($_POST['jg_catthumbalign'])) {
         $this->jg_catthumbalign = JRequest::getInt('jg_catthumbalign', 1, 'post');
     }
     if (isset($_POST['jg_colnumb'])) {
         $this->jg_colnumb = JRequest::getInt('jg_colnumb', 3, 'post');
     }
     if (isset($_POST['jg_detailpic_open'])) {
         $this->jg_detailpic_open = JRequest::getInt('jg_detailpic_open', 0, 'post');
     }
     if (isset($_POST['jg_lightboxbigpic'])) {
         $this->jg_lightboxbigpic = JRequest::getInt('jg_lightboxbigpic', 0, 'post');
     }
     if (isset($_POST['jg_showtitle'])) {
         $this->jg_showtitle = JRequest::getInt('jg_showtitle', 1, 'post');
     }
     if (isset($_POST['jg_showpicasnew'])) {
         $this->jg_showpicasnew = JRequest::getInt('jg_showpicasnew', 0, 'post');
     }
     if (isset($_POST['jg_daysnew'])) {
         $this->jg_daysnew = JRequest::getInt('jg_daysnew', 7, 'post');
     }
     if (isset($_POST['jg_showhits'])) {
         $this->jg_showhits = JRequest::getInt('jg_showhits', 1, 'post');
     }
     if (isset($_POST['jg_showauthor'])) {
         $this->jg_showauthor = JRequest::getInt('jg_showauthor', 1, 'post');
     }
     if (isset($_POST['jg_showowner'])) {
         $this->jg_showowner = JRequest::getInt('jg_showowner', 1, 'post');
     }
     if (isset($_POST['jg_showcatcom'])) {
         $this->jg_showcatcom = JRequest::getInt('jg_showcatcom', 1, 'post');
     }
     if (isset($_POST['jg_showcatrate'])) {
         $this->jg_showcatrate = JRequest::getInt('jg_showcatrate', 1, 'post');
     }
     if (isset($_POST['jg_showcatdescription'])) {
         $this->jg_showcatdescription = JRequest::getInt('jg_showcatdescription', 1, 'post');
     }
     if (isset($_POST['jg_showcategorydownload'])) {
         $this->jg_showcategorydownload = JRequest::getInt('jg_showcategorydownload', 0, 'post');
     }
     if (isset($_POST['jg_showcategoryfavourite'])) {
         $this->jg_showcategoryfavourite = JRequest::getInt('jg_showcategoryfavourite', 0, 'post');
     }
     //Kategorie-Ansicht->Unterkategorien
     if (isset($_POST['jg_showsubcathead'])) {
         $this->jg_showsubcathead = JRequest::getInt('jg_showsubcathead', 1, 'post');
     }
     if (isset($_POST['jg_showsubcatcount'])) {
         $this->jg_showsubcatcount = JRequest::getInt('jg_showsubcatcount', 1, 'post');
     }
     if (isset($_POST['jg_colsubcat'])) {
         $this->jg_colsubcat = JRequest::getInt('jg_colsubcat', 3, 'post');
     }
     if (isset($_POST['jg_subperpage'])) {
         $this->jg_subperpage = JRequest::getInt('jg_subperpage', 2, 'post');
     }
     if (isset($_POST['jg_showpagenavsubs'])) {
         $this->jg_showpagenavsubs = JRequest::getInt('jg_showpagenavsubs', 1, 'post');
     }
     if (isset($_POST['jg_subcatthumbalign'])) {
         $this->jg_subcatthumbalign = JRequest::getInt('jg_subcatthumbalign', 1, 'post');
     }
     if (isset($_POST['jg_showsubthumbs'])) {
         $this->jg_showsubthumbs = JRequest::getInt('jg_showsubthumbs', 2, 'post');
     }
     if (isset($_POST['jg_showrandomsubthumb'])) {
         $this->jg_showrandomsubthumb = JRequest::getInt('jg_showrandomsubthumb', 3, 'post');
     }
     if (isset($_POST['jg_ordersubcatbyalpha'])) {
         $this->jg_ordersubcatbyalpha = JRequest::getInt('jg_ordersubcatbyalpha', 0, 'post');
     }
     if (isset($_POST['jg_subcatdetailsalign'])) {
         $this->jg_subcatdetailsalign = JRequest::getInt('jg_subcatdetailsalign', 0, 'post');
     }
     if (isset($_POST['jg_showtotalsubcathits'])) {
         $this->jg_showtotalsubcathits = JRequest::getInt('jg_showtotalsubcathits', 1, 'post');
     }
     //*** Detail-Ansicht ***
     //Detail-Ansicht->Generelle Einstellungen
     if (isset($_POST['jg_showdetailpage'])) {
         $this->jg_showdetailpage = JRequest::getInt('jg_showdetailpage', 1, 'post');
     }
     if (isset($_POST['jg_showdetailnumberofpics'])) {
         $this->jg_showdetailnumberofpics = JRequest::getInt('jg_showdetailnumberofpics', 1, 'post');
     }
     if (isset($_POST['jg_cursor_navigation'])) {
         $this->jg_cursor_navigation = JRequest::getInt('jg_cursor_navigation', 1, 'post');
     }
     if (isset($_POST['jg_disable_rightclick_detail'])) {
         $this->jg_disable_rightclick_detail = JRequest::getInt('jg_disable_rightclick_detail', 1, 'post');
     }
     if (isset($_POST['jg_showdetailtitle'])) {
         $this->jg_showdetailtitle = JRequest::getInt('jg_showdetailtitle', 1, 'post');
     }
     if (isset($_POST['jg_showdetail'])) {
         $this->jg_showdetail = JRequest::getInt('jg_showdetail', 1, 'post');
     }
     if (isset($_POST['jg_showdetailaccordion'])) {
         $this->jg_showdetailaccordion = JRequest::getInt('jg_showdetailaccordion', 0, 'post');
     }
     if (isset($_POST['jg_showdetaildescription'])) {
         $this->jg_showdetaildescription = JRequest::getInt('jg_showdetaildescription', 1, 'post');
     }
     if (isset($_POST['jg_showdetaildatum'])) {
         $this->jg_showdetaildatum = JRequest::getInt('jg_showdetaildatum', 1, 'post');
     }
     if (isset($_POST['jg_showdetailhits'])) {
         $this->jg_showdetailhits = JRequest::getInt('jg_showdetailhits', 1, 'post');
     }
     if (isset($_POST['jg_showdetailrating'])) {
         $this->jg_showdetailrating = JRequest::getInt('jg_showdetailrating', 1, 'post');
     }
     if (isset($_POST['jg_showdetailfilesize'])) {
         $this->jg_showdetailfilesize = JRequest::getInt('jg_showdetailfilesize', 1, 'post');
     }
     if (isset($_POST['jg_showdetailauthor'])) {
         $this->jg_showdetailauthor = JRequest::getInt('jg_showdetailauthor', 1, 'post');
     }
     if (isset($_POST['jg_showoriginalfilesize'])) {
         $this->jg_showoriginalfilesize = JRequest::getInt('jg_showoriginalfilesize', 1, 'post');
     }
     if (isset($_POST['jg_showdetaildownload'])) {
         $this->jg_showdetaildownload = JRequest::getInt('jg_showdetaildownload', 1, 'post');
     }
     if (isset($_POST['jg_downloadfile'])) {
         $this->jg_downloadfile = JRequest::getInt('jg_downloadfile', 1, 'post');
     }
     if (isset($_POST['jg_downloadwithwatermark'])) {
         $this->jg_downloadwithwatermark = JRequest::getInt('jg_downloadwithwatermark', 1, 'post');
     }
     if (isset($_POST['jg_watermark'])) {
         $this->jg_watermark = JRequest::getInt('jg_watermark', 1, 'post');
     }
     if (isset($_POST['jg_watermarkpos'])) {
         $this->jg_watermarkpos = JRequest::getInt('jg_watermarkpos', 9, 'post');
     }
     if (isset($_POST['jg_bigpic'])) {
         $this->jg_bigpic = JRequest::getInt('jg_bigpic', 1, 'post');
     }
     if (isset($_POST['jg_bigpic_open'])) {
         $this->jg_bigpic_open = JRequest::getInt('jg_bigpic_open', 0, 'post');
     }
     if (isset($_POST['jg_bbcodelink'])) {
         $this->jg_bbcodelink = JRequest::getInt('jg_bbcodelink', 3, 'post');
     }
     if (isset($_POST['jg_showcommentsunreg'])) {
         $this->jg_showcommentsunreg = JRequest::getInt('jg_showcommentsunreg', 1, 'post');
     }
     if (isset($_POST['jg_showcommentsarea'])) {
         $this->jg_showcommentsarea = JRequest::getInt('jg_showcommentsarea', 3, 'post');
     }
     if (isset($_POST['jg_send2friend'])) {
         $this->jg_send2friend = JRequest::getInt('jg_send2friend', 1, 'post');
     }
     //Detail-Ansicht->Motiongallery
     if (isset($_POST['jg_minis'])) {
         $this->jg_minis = JRequest::getInt('jg_minis', 1, 'post');
     }
     if (isset($_POST['jg_motionminis'])) {
         $this->jg_motionminis = JRequest::getInt('jg_motionminis', 1, 'post');
     }
     if (isset($_POST['jg_motionminiWidth'])) {
         $this->jg_motionminiWidth = JRequest::getInt('jg_motionminiWidth', 400, 'post');
     }
     if (isset($_POST['jg_motionminiHeight'])) {
         $this->jg_motionminiHeight = JRequest::getInt('jg_motionminiHeight', 50, 'post');
     }
     if (isset($_POST['jg_miniWidth'])) {
         $this->jg_miniWidth = JRequest::getInt('jg_miniWidth', 30, 'post');
     }
     if (isset($_POST['jg_miniHeight'])) {
         $this->jg_miniHeight = JRequest::getInt('jg_miniHeight', 30, 'post');
     }
     if (isset($_POST['jg_minisprop'])) {
         $this->jg_minisprop = JRequest::getInt('jg_minisprop', 0, 'post');
     }
     //Detail-Ansicht->Namensschilder
     if (isset($_POST['jg_nameshields'])) {
         $this->jg_nameshields = JRequest::getInt('jg_nameshields', 0, 'post');
     }
     if (isset($_POST['jg_nameshields_unreg'])) {
         $this->jg_nameshields_unreg = JRequest::getInt('jg_nameshields_unreg', 0, 'post');
     }
     if (isset($_POST['jg_show_nameshields_unreg'])) {
         $this->jg_show_nameshields_unreg = JRequest::getInt('jg_show_nameshields_unreg', 0, 'post');
     }
     if (isset($_POST['jg_nameshields_height'])) {
         $this->jg_nameshields_height = JRequest::getInt('jg_nameshields_height', 12, 'post');
     }
     if (isset($_POST['jg_nameshields_width'])) {
         $this->jg_nameshields_width = JRequest::getInt('jg_nameshields_width', 8, 'post');
     }
     //Detail-Ansicht->Slideshow
     if (isset($_POST['jg_slideshow'])) {
         $this->jg_slideshow = JRequest::getInt('jg_slideshow', 1, 'post');
     }
     if (isset($_POST['jg_slideshow_timer'])) {
         $this->jg_slideshow_timer = JRequest::getInt('jg_slideshow_timer', 5, 'post');
     }
     if (isset($_POST['jg_slideshow_usefilter'])) {
         $this->jg_slideshow_usefilter = JRequest::getInt('jg_slideshow_usefilter', 1, 'post');
     }
     if (isset($_POST['jg_slideshow_filterbychance'])) {
         $this->jg_slideshow_filterbychance = JRequest::getInt('jg_slideshow_filterbychance', 1, 'post');
     }
     if (isset($_POST['jg_slideshow_filtertimer'])) {
         $this->jg_slideshow_filtertimer = JRequest::getInt('jg_slideshow_filtertimer', 3, 'post');
     }
     if (isset($_POST['jg_showsliderepeater'])) {
         $this->jg_showsliderepeater = JRequest::getInt('jg_showsliderepeater', 1, 'post');
     }
     //Detail-Ansicht->Exif-Daten
     if (isset($_POST['jg_showexifdata'])) {
         $this->jg_showexifdata = JRequest::getInt('jg_showexifdata', 0, 'post');
     }
     if (isset($_POST['jg_subifdtags'])) {
         $this->jg_subifdtags = array();
         $subifdtags = Joom_mosGetParam('jg_subifdtags', '', 'post');
         if ($subifdtags != NULL) {
             foreach ($subifdtags as $subifdtag) {
                 $subifdtag = intval($subifdtag);
                 if ($subifdtag > 0) {
                     array_push($this->jg_subifdtags, $subifdtag);
                 }
             }
             $this->jg_subifdtags = implode(',', $this->jg_subifdtags);
         }
     }
     if (isset($_POST['jg_ifdotags'])) {
         $this->jg_ifdotags = array();
         $ifdotags = Joom_mosGetParam('jg_ifdotags', '', 'post');
         if ($ifdotags != NULL) {
             foreach ($ifdotags as $ifdotag) {
                 $ifdotag = intval($ifdotag);
                 if ($ifdotag > 0) {
                     array_push($this->jg_ifdotags, $ifdotag);
                 }
             }
             $this->jg_ifdotags = implode(',', $this->jg_ifdotags);
         }
     }
     if (isset($_POST['jg_gpstags'])) {
         $this->jg_gpstags = array();
         $gpstags = Joom_mosGetParam('jg_gpstags', '', 'post');
         if ($gpstags != NULL) {
             foreach ($gpstags as $gpstag) {
                 $gpstag = intval($gpstag);
                 if ($gpstag >= 0) {
                     array_push($this->jg_gpstags, $gpstag);
                 }
             }
             $this->jg_gpstags = implode(',', $this->jg_gpstags);
         }
     }
     //Detail-Ansicht->IPTC-Daten
     if (isset($_POST['jg_showiptcdata'])) {
         $this->jg_showiptcdata = JRequest::getInt('jg_showiptcdata', 0, 'post');
     }
     if (isset($_POST['jg_iptctags'])) {
         $this->jg_iptctags = array();
         $iptctags = Joom_mosGetParam('jg_iptctags', '', 'post');
         if ($iptctags != NULL) {
             foreach ($iptctags as $iptctag) {
                 $iptctag = intval($iptctag);
                 if ($iptctag >= 0) {
                     array_push($this->jg_iptctags, $iptctag);
                 }
             }
             $this->jg_iptctags = implode(',', $this->jg_iptctags);
         }
     }
     //*** Favouriten ***
     //Favouriten->Generelle Einstellungen
     if (isset($_POST['jg_favourites'])) {
         $this->jg_favourites = JRequest::getInt('jg_favourites', 0, 'post');
     }
     if (isset($_POST['jg_showdetailfavourite'])) {
         $this->jg_showdetailfavourite = JRequest::getInt('jg_showdetailfavourite', 0, 'post');
     }
     if (isset($_POST['jg_favouritesshownotauth'])) {
         $this->jg_favouritesshownotauth = JRequest::getInt('jg_favouritesshownotauth', 0, 'post');
     }
     if (isset($_POST['jg_maxfavourites'])) {
         $this->jg_maxfavourites = JRequest::getInt('jg_maxfavourites', 30, 'post');
     }
     if (isset($_POST['jg_zipdownload'])) {
         $this->jg_zipdownload = JRequest::getInt('jg_zipdownload', 1, 'post');
     }
     if (isset($_POST['jg_usefavouritesforpubliczip'])) {
         $this->jg_usefavouritesforpubliczip = JRequest::getInt('jg_usefavouritesforpubliczip', 1, 'post');
     }
     if (isset($_POST['jg_usefavouritesforzip'])) {
         $this->jg_usefavouritesforzip = JRequest::getInt('jg_usefavouritesforzip', 0, 'post');
     }
     // write CSS-File
     if (!$this->Joom_SaveCSS()) {
         $error = JText::_('JGA_CSS_NOT_WRITEABLE');
         $mainframe->redirect('index.php?option=' . _JOOM_OPTION . '&act=config', $error, 'error');
     }
     //Grundlegende Einstellungen
     //Grundlegende Einstellungen->Pfade und Verzeichnisse
     if (!isset($this->jg_pathimages) || $this->jg_pathimages == '') {
         $this->jg_pathimages = 'components/' . _JOOM_OPTION . '/img_pictures/';
     }
     if (!isset($this->jg_pathoriginalimages) || $this->jg_pathoriginalimages == '') {
         $this->jg_pathoriginalimages = 'components/' . _JOOM_OPTION . '/img_originals/';
     }
     if (!isset($this->jg_paththumbs) || $this->jg_paththumbs == '') {
         $this->jg_paththumbs = 'components/' . _JOOM_OPTION . '/img_thumbnails/';
     }
     if (!isset($this->jg_pathftpupload) || $this->jg_pathftpupload == '') {
         $this->jg_pathftpupload = 'components/' . _JOOM_OPTION . '/ftp_upload/';
     }
     if (!isset($this->jg_pathtemp) || $this->jg_pathtemp == '') {
         $this->jg_pathtemp = 'administrator/components/' . _JOOM_OPTION . '/temp/';
     }
     if (!isset($this->jg_wmpath) || $this->jg_wmpath == '') {
         $this->jg_wmpath = 'components/' . _JOOM_OPTION . '/images/';
     }
     if (!isset($this->jg_wmfile) || $this->jg_wmfile == '') {
         $this->jg_wmfile = 'watermark.png';
     }
     if (!isset($this->jg_dateformat)) {
         $this->jg_dateformat = '%d-%m-%Y %H:%M:%S';
     }
     if (!isset($this->jg_checkupdate)) {
         $this->jg_checkupdate = 1;
     }
     //Grundlegende Einstellungen->Ersetzungen
     if (!isset($this->jg_filenamewithjs)) {
         $this->jg_filenamewithjs = 1;
     }
     if (!isset($this->jg_filenamesearch)) {
         $this->jg_filenamesearch = '';
     }
     if (!isset($this->jg_filenamereplace)) {
         $this->jg_filenamereplace = '';
     }
     //Grundlegende Einstellungen->Bildmanipulation
     if (!isset($this->jg_thumbcreation)) {
         $this->jg_thumbcreation = 'gd2';
     }
     if (!isset($this->jg_fastgd2thumbcreation)) {
         $this->jg_fastgd2thumbcreation = 1;
     }
     if (!isset($this->jg_impath)) {
         $this->jg_impath = '';
     }
     if (!isset($this->jg_resizetomaxwidth)) {
         $this->jg_resizetomaxwidth = 1;
     }
     if (!isset($this->jg_maxwidth) || $this->jg_maxwidth == 0) {
         $this->jg_maxwidth = 400;
     }
     if (!isset($this->jg_picturequality) || $this->jg_picturequality == 0) {
         $this->jg_picturequality = 100;
     }
     if (!isset($this->jg_useforresizedirection)) {
         $this->jg_useforresizedirection = 0;
     }
     if (!isset($this->jg_thumbwidth) || $this->jg_thumbwidth == 0) {
         $this->jg_thumbwidth = 133;
     }
     if (!isset($this->jg_thumbheight) || $this->jg_thumbheight == 0) {
         $this->jg_thumbheight = 100;
     }
     if (!isset($this->jg_thumbquality) || $this->jg_thumbquality == 0) {
         $this->jg_thumbquality = 75;
     }
     //Grundlegende Einstellungen->Backend-Upload
     if (!isset($this->jg_uploadorder)) {
         $this->jg_uploadorder = 0;
     }
     if (!isset($this->jg_useorigfilename)) {
         $this->jg_useorigfilename = 0;
     }
     if (!isset($this->jg_filenamenumber)) {
         $this->jg_filenamenumber = 0;
     }
     if (!isset($this->jg_delete_original)) {
         $this->jg_delete_original = 0;
     }
     if (!isset($this->jg_wrongvaluecolor) || $this->jg_wrongvaluecolor == '') {
         $this->jg_wrongvaluecolor = 'red';
     }
     //Grundlegende Einstellungen->Zusaetzliche Funktionen
     if (!isset($this->jg_combuild)) {
         $this->jg_combuild = 0;
     }
     if (!isset($this->jg_realname)) {
         $this->jg_realname = 0;
     }
     if (!isset($this->jg_bridge)) {
         $this->jg_bridge = 0;
     }
     if (!isset($this->jg_cooliris)) {
         $this->jg_cooliris = 0;
     }
     if (!isset($this->jg_coolirislink)) {
         $this->jg_coolirislink = 0;
     }
     //Benutzer-Rechte
     //Benutzer-Rechte->Benutzer-Upload ueber "Meine Galerie"
     if (!isset($this->jg_userspace)) {
         $this->jg_userspace = 0;
     }
     if (!isset($this->jg_approve)) {
         $this->jg_approve = 1;
     }
     if (!isset($this->jg_usercat)) {
         $this->jg_usercat = 0;
     }
     if (!isset($this->jg_maxusercat) || $this->jg_maxusercat == 0) {
         $this->jg_maxusercat = 10;
     }
     if (!isset($this->jg_userowncatsupload)) {
         $this->jg_userowncatsupload = 0;
     }
     if (!isset($this->jg_maxuserimage) || $this->jg_maxuserimage == 0) {
         $this->jg_maxuserimage = 400;
     }
     if (!isset($this->jg_maxfilesize) || $this->jg_maxfilesize == 0) {
         $this->jg_maxfilesize = 2000000;
     }
     if (!isset($this->jg_category)) {
         $this->jg_category = '';
     }
     if (!isset($this->jg_usercategory)) {
         $this->jg_usercategory = '';
     }
     if (!isset($this->jg_usercatacc)) {
         $this->jg_usercatacc = 0;
     }
     if (!isset($this->jg_maxuploadfields) || $this->jg_maxuploadfields == 0) {
         $this->jg_maxuploadfields = 3;
     }
     if (!isset($this->jg_useruploadnumber)) {
         $this->jg_useruploadnumber = 0;
     }
     if (!isset($this->jg_special_gif_upload)) {
         $this->jg_special_gif_upload = 0;
     }
     if (!isset($this->jg_delete_original_user)) {
         $this->jg_delete_original_user = 0;
     }
     if (!isset($this->jg_newpiccopyright)) {
         $this->jg_newpiccopyright = 0;
     }
     if (!isset($this->jg_newpicnote)) {
         $this->jg_newpicnote = 0;
     }
     //Benutzer-Rechte->Bewertungen
     if (!isset($this->jg_showrating)) {
         $this->jg_showrating = 0;
     }
     if (!isset($this->jg_maxvoting) || $this->jg_maxvoting == 0) {
         $this->jg_maxvoting = 5;
     }
     if (!isset($this->jg_onlyreguservotes)) {
         $this->jg_onlyreguservotes = 1;
     }
     //Benutzer-Rechte->Kommentare
     if (!isset($this->jg_showcomment)) {
         $this->jg_showcomment = 0;
     }
     if (!isset($this->jg_anoncomment)) {
         $this->jg_anoncomment = 0;
     }
     if (!isset($this->jg_namedanoncomment)) {
         $this->jg_namedanoncomment = 0;
     }
     if (!isset($this->jg_approvecom)) {
         $this->jg_approvecom = 2;
     }
     if (!isset($this->jg_secimages)) {
         $this->jg_secimages = 2;
     }
     if (!isset($this->jg_bbcodesupport)) {
         $this->jg_bbcodesupport = 0;
     }
     if (!isset($this->jg_smiliesupport)) {
         $this->jg_smiliesupport = 0;
     }
     if (!isset($this->jg_anismilie)) {
         $this->jg_anismilie = 0;
     }
     if (!isset($this->jg_smiliescolor) || $this->jg_smiliescolor == '') {
         $this->jg_smiliescolor = 'grey';
     }
     //Frontend Einstellungen
     //Frontend Einstellungen->Anordnung der Bilder
     if (!isset($this->jg_firstorder)) {
         $this->jg_firstorder = 'ordering ASC';
     }
     if (!isset($this->jg_secondorder)) {
         $this->jg_secondorder = 'imgdate DESC';
     }
     if (!isset($this->jg_thirdorder)) {
         $this->jg_thirdorder = 'imgtitle DESC';
     }
     //Frontend Einstellungen->Seitentitel
     if (!isset($this->jg_pagetitle_cat)) {
         $this->jg_pagetitle_cat = '[! JGS_CATEGORY!]: #cat';
     }
     if (!isset($this->jg_pagetitle_detail)) {
         $this->jg_pagetitle_detail = '[! JGS_CATEGORY!]: #cat - [! JGS_PICTURE!]:  #img';
     }
     //Frontend Einstellungen->Kopf- und Fussbereich
     if (!isset($this->jg_showgalleryhead)) {
         $this->jg_showgalleryhead = 1;
     }
     if (!isset($this->jg_showpathway)) {
         $this->jg_showpathway = 1;
     }
     if (!isset($this->jg_completebreadcrumbs)) {
         $this->jg_completebreadcrumbs = 1;
     }
     if (!isset($this->jg_search)) {
         $this->jg_search = 1;
     }
     if (!isset($this->jg_showallpics)) {
         $this->jg_showallpics = 0;
     }
     if (!isset($this->jg_showallhits)) {
         $this->jg_showallhits = 0;
     }
     if (!isset($this->jg_showbacklink)) {
         $this->jg_showbacklink = 0;
     }
     if (!isset($this->jg_suppresscredits)) {
         $this->jg_suppresscredits = 1;
     }
     //Frontend Einstellungen->Meine Galerie
     if (!isset($this->jg_showuserpanel)) {
         $this->jg_showuserpanel = 1;
     }
     if (!isset($this->jg_showallpicstoadmin)) {
         $this->jg_showallpicstoadmin = 0;
     }
     if (!isset($this->jg_showminithumbs)) {
         $this->jg_showminithumbs = 1;
     }
     //Frontend Einstellungen->PopUp-Funktionen
     if (!isset($this->jg_openjs_padding) || $this->jg_openjs_padding == 0) {
         $this->jg_openjs_padding = 10;
     }
     if (!isset($this->jg_openjs_background) || $this->jg_openjs_background == '') {
         $this->jg_openjs_background = '#ffffff';
     }
     if (!isset($this->jg_dhtml_border) || $this->jg_dhtml_border == '') {
         $this->jg_dhtml_border = '#808080';
     }
     if (!isset($this->jg_show_title_in_dhtml)) {
         $this->jg_show_title_in_dhtml = 0;
     }
     if (!isset($this->jg_show_description_in_dhtml)) {
         $this->jg_show_description_in_dhtml = 0;
     }
     if (!isset($this->jg_lightbox_speed) || $this->jg_lightbox_speed == 0) {
         $this->jg_lightbox_speed = 5;
     }
     if (!isset($this->jg_lightbox_slide_all)) {
         $this->jg_lightbox_slide_all = 0;
     }
     if (!isset($this->jg_resize_js_image)) {
         $this->jg_resize_js_image = 1;
     }
     if (!isset($this->jg_disable_rightclick_original)) {
         $this->jg_disable_rightclick_original = 1;
     }
     //Galerie-Ansicht
     //Galerie-Ansicht->Generelle Einstellungen
     if (!isset($this->jg_showgallerysubhead)) {
         $this->jg_showgallerysubhead = 1;
     }
     if (!isset($this->jg_showallcathead)) {
         $this->jg_showallcathead = 1;
     }
     if (!isset($this->jg_colcat)) {
         $this->jg_colcat = 1;
     }
     if (!isset($this->jg_catperpage) || $this->jg_catperpage == 0) {
         $this->jg_catperpage = 10;
     }
     if (!isset($this->jg_ordercatbyalpha)) {
         $this->jg_ordercatbyalpha = 0;
     }
     if (!isset($this->jg_showgallerypagenav)) {
         $this->jg_showgallerypagenav = 1;
     }
     if (!isset($this->jg_showcatcount)) {
         $this->jg_showcatcount = 1;
     }
     if (!isset($this->jg_showcatthumb)) {
         $this->jg_showcatthumb = 1;
     }
     if (!isset($this->jg_showrandomcatthumb)) {
         $this->jg_showrandomcatthumb = 2;
     }
     if (!isset($this->jg_ctalign)) {
         $this->jg_ctalign = 1;
     }
     if (!isset($this->jg_showtotalcathits)) {
         $this->jg_showtotalcathits = 1;
     }
     if (!isset($this->jg_showcatasnew)) {
         $this->jg_showcatasnew = 0;
     }
     if (!isset($this->jg_catdaysnew) || $this->jg_catdaysnew == 0) {
         $this->jg_catdaysnew = 7;
     }
     if (!isset($this->jg_rmsm)) {
         $this->jg_rmsm = 1;
     }
     if (!isset($this->jg_showrmsmcats)) {
         $this->jg_showrmsmcats = 0;
     }
     if (!isset($this->jg_showsubsingalleryview)) {
         $this->jg_showsubsingalleryview = 0;
     }
     //Kategorie-Ansicht
     //Kategorie-Ansicht->Generelle Einstellungen
     if (!isset($this->jg_showcathead)) {
         $this->jg_showcathead = 1;
     }
     if (!isset($this->jg_usercatorder)) {
         $this->jg_usercatorder = 0;
     }
     if (!isset($this->jg_usercatorderlist) || $this->jg_usercatorderlist == '') {
         $this->jg_usercatorderlist = 'date, title';
     }
     if (!isset($this->jg_showcatdescriptionincat)) {
         $this->jg_showcatdescriptionincat = 0;
     }
     if (!isset($this->jg_showpagenav)) {
         $this->jg_showpagenav = 1;
     }
     if (!isset($this->jg_showpiccount)) {
         $this->jg_showpiccount = 1;
     }
     if (!isset($this->jg_perpage) || $this->jg_perpage == 0) {
         $this->jg_perpage = 9;
     }
     if (!isset($this->jg_catthumbalign)) {
         $this->jg_catthumbalign = 1;
     }
     if (!isset($this->jg_colnumb) || $this->jg_colnumb == 0) {
         $this->jg_colnumb = 3;
     }
     if (!isset($this->jg_detailpic_open)) {
         $this->jg_detailpic_open = 0;
     }
     if (!isset($this->jg_lightboxbigpic)) {
         $this->jg_lightboxbigpic = 0;
     }
     if (!isset($this->jg_showtitle)) {
         $this->jg_showtitle = 1;
     }
     if (!isset($this->jg_showpicasnew)) {
         $this->jg_showpicasnew = 0;
     }
     if (!isset($this->jg_daysnew) || $this->jg_daysnew == 0) {
         $this->jg_daysnew = 7;
     }
     if (!isset($this->jg_showhits)) {
         $this->jg_showhits = 1;
     }
     if (!isset($this->jg_showauthor)) {
         $this->jg_showauthor = 1;
     }
     if (!isset($this->jg_showowner)) {
         $this->jg_showowner = 1;
     }
     if (!isset($this->jg_showcatcom)) {
         $this->jg_showcatcom = 1;
     }
     if (!isset($this->jg_showcatrate)) {
         $this->jg_showcatrate = 1;
     }
     if (!isset($this->jg_showcatdescription)) {
         $this->jg_showcatdescription = 1;
     }
     if (!isset($this->jg_showcategorydownload)) {
         $this->jg_showcategorydownload = 0;
     }
     if (!isset($this->jg_showcategoryfavourite)) {
         $this->jg_showcategoryfavourite = 0;
     }
     //Kategorie-Ansicht->Unterkategorien
     if (!isset($this->jg_showsubcathead)) {
         $this->jg_showsubcathead = 1;
     }
     if (!isset($this->jg_showsubcatcount)) {
         $this->jg_showsubcatcount = 1;
     }
     if (!isset($this->jg_colsubcat)) {
         $this->jg_colsubcat = 3;
     }
     if (!isset($this->jg_subperpage) || $this->jg_subperpage == 0) {
         $this->jg_subperpage = 2;
     }
     if (!isset($this->jg_showpagenavsubs)) {
         $this->jg_showpagenavsubs = 1;
     }
     if (!isset($this->jg_subcatthumbalign)) {
         $this->jg_subcatthumbalign = 1;
     }
     if (!isset($this->jg_showsubthumbs)) {
         $this->jg_showsubthumbs = 2;
     }
     if (!isset($this->jg_showrandomsubthumb)) {
         $this->jg_showrandomsubthumb = 3;
     }
     if (!isset($this->jg_ordersubcatbyalpha)) {
         $this->jg_ordersubcatbyalpha = 0;
     }
     if (!isset($this->jg_showtotalsubcathits)) {
         $this->jg_showtotalsubcathits = 1;
     }
     //Detail-Ansicht
     //Detail-Ansicht->Generelle Einstellungen
     if (!isset($this->jg_showdetailpage)) {
         $this->jg_showdetailpage = 1;
     }
     if (!isset($this->jg_showdetailnumberofpics)) {
         $this->jg_showdetailnumberofpics = 1;
     }
     if (!isset($this->jg_cursor_navigation)) {
         $this->jg_cursor_navigation = 1;
     }
     if (!isset($this->jg_disable_rightclick_detail)) {
         $this->jg_disable_rightclick_detail = 1;
     }
     if (!isset($this->jg_showdetailtitle)) {
         $this->jg_showdetailtitle = 1;
     }
     if (!isset($this->jg_showdetail)) {
         $this->jg_showdetail = 1;
     }
     if (!isset($this->jg_showdetailaccordion)) {
         $this->jg_showdetailaccordion = 0;
     }
     if (!isset($this->jg_showdetaildescription)) {
         $this->jg_showdetaildescription = 1;
     }
     if (!isset($this->jg_showdetaildatum)) {
         $this->jg_showdetaildatum = 1;
     }
     if (!isset($this->jg_showdetailhits)) {
         $this->jg_showdetailhits = 1;
     }
     if (!isset($this->jg_showdetailrating)) {
         $this->jg_showdetailrating = 1;
     }
     if (!isset($this->jg_showdetailfilesize)) {
         $this->jg_showdetailfilesize = 1;
     }
     if (!isset($this->jg_showdetailauthor)) {
         $this->jg_showdetailauthor = 1;
     }
     if (!isset($this->jg_showoriginalfilesize)) {
         $this->jg_showoriginalfilesize = 1;
     }
     if (!isset($this->jg_showdetaildownload)) {
         $this->jg_showdetaildownload = 1;
     }
     if (!isset($this->jg_downloadfile)) {
         $this->jg_downloadfile = 1;
     }
     if (!isset($this->jg_downloadwithwatermark)) {
         $this->jg_downloadwithwatermark = 1;
     }
     if (!isset($this->jg_watermark)) {
         $this->jg_watermark = 1;
     }
     if (!isset($this->jg_watermarkpos) || $this->jg_watermarkpos == 0) {
         $this->jg_watermarkpos = 9;
     }
     if (!isset($this->jg_bigpic)) {
         $this->jg_bigpic = 1;
     }
     if (!isset($this->jg_bigpic_open)) {
         $this->jg_bigpic_open = 0;
     }
     if (!isset($this->jg_bbcodelink)) {
         $this->jg_bbcodelink = 3;
     }
     if (!isset($this->jg_showcommentsunreg)) {
         $this->jg_showcommentsunreg = 1;
     }
     if (!isset($this->jg_showcommentsarea)) {
         $this->jg_showcommentsarea = 3;
     }
     if (!isset($this->jg_send2friend)) {
         $this->jg_send2friend = 1;
     }
     //Detail-Ansicht->Motiongallery
     if (!isset($this->jg_minis)) {
         $this->jg_minis = 1;
     }
     if (!isset($this->jg_motionminis)) {
         $this->jg_motionminis = 1;
     }
     if (!isset($this->jg_motionminiWidth) || $this->jg_motionminiWidth == 0) {
         $this->jg_motionminiWidth = 400;
     }
     if (!isset($this->jg_motionminiHeight) || $this->jg_motionminiHeight == 0) {
         $this->jg_motionminiHeight = 50;
     }
     if (!isset($this->jg_miniWidth) || $this->jg_miniWidth == 0) {
         $this->jg_miniWidth = 28;
     }
     if (!isset($this->jg_miniHeight) || $this->jg_miniHeight == 0) {
         $this->jg_miniHeight = 28;
     }
     if (!isset($this->jg_minisprop)) {
         $this->jg_minisprop = 0;
     }
     //Detail-Ansicht->Namensschilder
     if (!isset($this->jg_nameshields)) {
         $this->jg_nameshields = 0;
     }
     if (!isset($this->jg_nameshields_unreg)) {
         $this->jg_nameshields_unreg = 0;
     }
     if (!isset($this->jg_show_nameshields_unreg)) {
         $this->jg_show_nameshields_unreg = 0;
     }
     if (!isset($this->jg_nameshields_height)) {
         $this->jg_nameshields_height = 12;
     }
     if (!isset($this->jg_nameshields_width)) {
         $this->jg_nameshields_width = 8;
     }
     //Detail-Ansicht->Slideshow
     if (!isset($this->jg_slideshow)) {
         $this->jg_slideshow = 1;
     }
     if (!isset($this->jg_slideshow_timer) || $this->jg_slideshow_timer == 0) {
         $this->jg_slideshow_timer = 5;
     }
     if (!isset($this->jg_slideshow_usefilter)) {
         $this->jg_slideshow_usefilter = 1;
     }
     if (!isset($this->jg_slideshow_filterbychance)) {
         $this->jg_slideshow_filterbychance = 1;
     }
     if (!isset($this->jg_slideshow_filtertimer) || $this->jg_slideshow_filtertimer == 0) {
         $this->jg_slideshow_filtertimer = 3;
     }
     if (!isset($this->jg_showsliderepeater)) {
         $this->jg_showsliderepeater = 1;
     }
     //Detail-Ansicht->Exif-Daten
     if (!isset($this->jg_showexifdata)) {
         $this->jg_showexifdata = 0;
     }
     //For all array based variables, e.g. EXIF
     //1. when there are changes in one or more of the tags, $jg_*tags will be an array and filled with the $_POST content
     //   $jg_*tags2 contains the actualized activated tags in a string formerly read and changed to string
     //   from $jg_*tags
     //   so use the content of $jg_*tags2 for writing in config file
     //
     //2. when there are now changes in the data $jg_*tags2 will be empty
     //   and $jg_*tags is an string including the formerly read config not an array
     //   so use the content of $jg_*tags for writing in config file
     if (!isset($this->jg_subifdtags)) {
         $this->jg_subifdtags = '';
     }
     if (!isset($this->jg_ifdotags)) {
         $this->jg_ifdotags = '';
     }
     if (!isset($this->jg_gpstags)) {
         $this->jg_gpstags = '';
     }
     //Detail-Ansicht->IPTC-Daten
     if (!isset($this->jg_showiptcdata)) {
         $this->jg_showiptcdata = 0;
     }
     if (!isset($this->jg_iptctags)) {
         $this->jg_iptctags = '';
     }
     //Toplisten
     //Toplisten->Generelle Einstellungen
     if (!isset($this->jg_showtoplist)) {
         $this->jg_showtoplist = 1;
     }
     if (!isset($this->jg_toplist) || $this->jg_toplist == 0) {
         $this->jg_toplist = 10;
     }
     if (!isset($this->jg_topthumbalign)) {
         $this->jg_topthumbalign = 1;
     }
     if (!isset($this->jg_toptextalign)) {
         $this->jg_toptextalign = 1;
     }
     if (!isset($this->jg_toplistcols) || $this->jg_toplistcols == 0) {
         $this->jg_toplistcols = 3;
     }
     if (!isset($this->jg_whereshowtoplist)) {
         $this->jg_whereshowtoplist = 0;
     }
     if (!isset($this->jg_showrate)) {
         $this->jg_showrate = 1;
     }
     if (!isset($this->jg_showlatest)) {
         $this->jg_showlatest = 1;
     }
     if (!isset($this->jg_showcom)) {
         $this->jg_showcom = 1;
     }
     if (!isset($this->jg_showthiscomment)) {
         $this->jg_showthiscomment = 1;
     }
     if (!isset($this->jg_showmostviewed)) {
         $this->jg_showmostviewed = 1;
     }
     //Favourites
     //Favouriten->Generelle Einstellungen
     if (!isset($this->jg_favourites)) {
         $this->jg_favourites = 0;
     }
     if (!isset($this->jg_showdetailfavourite)) {
         $this->jg_showdetailfavourite = 0;
     }
     if (!isset($this->jg_favouritesshownotauth)) {
         $this->jg_favouritesshownotauth = 0;
     }
     if (!isset($this->jg_maxfavourites)) {
         $this->jg_maxfavourites = 30;
     }
     if (!isset($this->jg_zipdownload)) {
         $this->jg_zipdownload = 1;
     }
     if (!isset($this->jg_usefavouritesforpubliczip)) {
         $this->jg_usefavouritesforpubliczip = 1;
     }
     if (!isset($this->jg_usefavouritesforzip)) {
         $this->jg_usefavouritesforzip = 0;
     }
     //save in database and redirect
     $this->Joom_SaveConfig($this);
     $mainframe->redirect('index.php?option=' . _JOOM_OPTION . '&act=configuration', JText::_('JGA_SETTINGS_SAVED'));
 }
**   JoomGallery  1.5                                                         **
**   By: JoomGallery::ProjectTeam                                             **
**   Copyright (C) 2008 - 2009  M. Andreas Boettcher                          **
**   Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam                  **
**   Released under GNU GPL Public License                                    **
**   License: http://www.gnu.org/copyleft/gpl.html or have a look             **
**   at administrator/components/com_joomgallery/LICENSE.TXT                  **
\******************************************************************************/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
include_once JPATH_COMPONENT . DS . 'includes' . DS . 'html' . DS . 'joom.viewspecial.html.php';
//Parameter
$sorting = trim(Joom_mosGetParam('sorting', ''));
//Suche
$sstring = trim(Joom_mosGetParam('sstring', '', 'post'));
if ($sstring == '') {
    $sstring = trim(Joom_mosGetParam('sstring', ''));
}
function strtolower_utf8($inputstring)
{
    $outputString = utf8_decode($inputstring);
    $outputString = strtolower($outputString);
    $outputString = utf8_encode($outputString);
    return $outputString;
}
switch ($sorting) {
    case 'find':
        $searchstring = trim(strtolower_utf8($sstring));
        $searchstring2 = htmlentities(trim(strtolower_utf8($sstring)), ENT_QUOTES, 'UTF-8');
        $query1 = " SELECT \n                a.*,\n                a.owner AS owner,\n                u.username, \n                ca.name AS name\n              FROM \n                #__joomgallery AS a, \n                #__joomgallery_catg AS ca, \n                #__users AS u\n              WHERE \n                    a.catid = ca.cid \n                AND a.owner = u.id \n                AND (u.username LIKE '%{$searchstring}%'\n                  OR a.imgtitle LIKE '%{$searchstring}%'\n                  OR a.imgtext  LIKE '%{$searchstring2}%')\n                AND a.published   = '1' \n                AND ca.published  = '1' \n                AND a.approved    = '1' \n                AND ca.access    <= " . $user->get('aid') . "\n              GROUP BY \n                a.id\n              ORDER BY \n                a.id DESC \n            ";
        $tl_title = JText::_('JGS_SEARCH_RESULTS') . "<b> {$sstring}</b>";
        break;
    /**
     * New Category
     *
     * @param string $publist
     * @param string $glist
     * @param string $Lists
     * @param string $orderlist
     * @param string $jg_wrongvaluecolor
     */
    function Joom_ShowNewCategory_HTML(&$publist, $glist, $Lists, $orderlist, $jg_wrongvaluecolor)
    {
        //TODO need of this values?
        $name = Joom_FixUserEntrie(Joom_mosGetParam('name', ''));
        $description = Joom_mosGetParam('description', '');
        ?>
<script language="javascript" type="text/javascript">
  function submitbutton(pressbutton) {
    var form = document.adminForm;
    if (pressbutton == 'cancelcatg') {
      submitform(pressbutton);
      return;
    }
    // do field validation
    form.name.style.backgroundColor = '';
    var ffwrong = '<?php 
        echo $jg_wrongvaluecolor;
        ?>
';
    try {
    document.adminForm.onsubmit();
    }
    catch(e){}
    if (form.name.value == '' || form.name.value == null) {
      alert('<?php 
        echo JText::_('JGA_ALERT_CATEGORY_MUST_HAVE_TITLE', true);
        ?>
');
      form.name.style.backgroundColor = ffwrong;
      form.name.focus();
    }
    else {
      <?php 
        $editor =& JFactory::getEditor();
        echo $editor->getContent('description');
        ?>
      submitform(pressbutton);
    }
  }
</script>
<form action="index.php" method="post" name="adminForm">
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
  <tr class="row0">
    <td width="200">
    <?php 
        echo JText::_('JGA_TITLE') . ':';
        ?>
    </td>
    <td>
      <input class="inputbox" type="text" name="name" size="25"
       value="<?php 
        echo $name;
        ?>
" />
    </td>
  </tr>
  <tr class="row1">
    <td valign="top" >
      <?php 
        echo JText::_('JGA_PARENT_CATEGORY') . ':';
        ?>
    </td>
    <td nowrap >
      <?php 
        echo $Lists["catgs"];
        ?>
    </td>
  </tr>
  <tr class="row0">
    <td valign="top">
      <?php 
        echo JText::_('JGA_DESCRIPTION') . ':';
        ?>
    </td>
    <td>
<?php 
        // parameters : areaname, content, hidden field, width, height, rows, cols
        echo $editor->display('description', str_replace('&', '&amp;', $description), '620', '200', '70', '10', false);
        ?>
    </td>
  </tr>
  <tr class="row1">
    <td valign="top" >
      <?php 
        echo JText::_('JGA_HIT') . ':';
        ?>
    </td>
    <td nowrap>
      <?php 
        echo $glist;
        ?>
    </td>
  </tr>
  <tr class="row0">
    <td valign="top" >
      <?php 
        echo JText::_('JGA_PUBLISHED') . ':';
        ?>
    </td>
    <td nowrap>
      <?php 
        echo $publist;
        ?>
    </td>
  </tr>
  <tr class="row1">
    <td valign="top" >
      <?php 
        echo JText::_('JGA_ORDERING') . ':';
        ?>
    </td>
    <td nowrap >
      <?php 
        echo $orderlist;
        ?>
    </td>
  </tr>
</table>

<input type="hidden" name="task" value="" />
<input type="hidden" name="option" value="<?php 
        echo _JOOM_OPTION;
        ?>
" />
<input type="hidden" name="catimage" value="" />
</form>
<?php 
    }
    /**
     * Class constructor
     *
     */
    function Joom_DetailView()
    {
        include_once JPATH_COMPONENT . DS . 'includes' . DS . 'html' . DS . 'joom.viewdetails.html.php';
        jimport('joomla.filesystem.file');
        $this->_mainframe =& JFactory::getApplication('site');
        $database =& JFactory::getDBO();
        $user =& JFactory::getUser();
        $config = Joom_getConfig();
        $this->id = JRequest::getInt('id', 0);
        $this->slideshow = trim(Joom_mosGetParam('jg_slideshow', '', 'post'));
        if ($config->jg_showdetailaccordion) {
            $this->toggler = 'class="joomgallery-toggler"';
            $this->slider = 'class="joomgallery-slider"';
        } else {
            $this->toggler = 'class="joomgallery-notoggler"';
            $this->slider = '';
        }
        $database->setQuery(" SELECT\n                            c.access AS access,\n                            c.name AS name,\n                            c.cid AS cid\n                          FROM\n                            #__joomgallery_catg AS c\n                          LEFT JOIN\n                            #__joomgallery AS a ON a.catid = c.cid\n                          WHERE\n                            a.id = {$this->id}\n                        ");
        if (!($catinfo = $database->loadObject())) {
            $this->_mainframe->redirect(JRoute::_('index.php?option=com_joomgallery&view=gallery' . _JOOM_ITEMID, false), JText::_('JGS_ALERT_NOT_ALLOWED_VIEW_PICTURE'));
        }
        $this->c_access = $catinfo->access;
        $this->cattitle = $catinfo->name;
        if ($user->get('aid') < $this->c_access) {
            $this->_mainframe->redirect(JRoute::_('index.php?option=com_joomgallery&view=gallery' . _JOOM_ITEMID, false), JText::_('JGS_ALERT_NOT_ALLOWED_VIEW_PICTURE'));
        }
        $database->setQuery(" SELECT\n                            a.id,\n                            a.catid,\n                            a.imgtitle,\n                            a.imgauthor,\n                            a.imgtext,\n                            a.imgdate,\n                            a.imgcounter,\n                            a.imgvotes,\n                            a.imgvotesum,\n                            a.published,\n                            a.imgfilename,\n                            a.imgthumbname,\n                            a.checked_out,\n                            a.owner,\n                            a.approved,\n                            a.useruploaded,\n                            a.ordering,\n                            u.username,\n                            ROUND(imgvotesum/imgvotes, 2) AS rating\n                          FROM\n                            #__joomgallery AS a\n                          LEFT JOIN\n                            #__users AS u ON u.id = a.owner\n                          WHERE\n                                a.id        = " . $this->id . "\n                            AND a.approved  = '1'\n                            AND a.published = '1'\n                        ");
        $result1 = $database->loadObject();
        $this->id = $result1->id;
        $this->catid = $result1->catid;
        $this->imgtitle = $result1->imgtitle;
        $this->imgauthor = $result1->imgauthor;
        $this->imgtext = $result1->imgtext;
        $this->imgdate = $result1->imgdate;
        $this->imgcounter = $result1->imgcounter;
        $this->imgvotes = $result1->imgvotes;
        $this->imgvotesum = $result1->imgvotesum;
        $this->published = $result1->published;
        $this->imgfilename = $result1->imgfilename;
        $this->imgthumbname = $result1->imgthumbname;
        $this->checked_out = $result1->checked_out;
        $this->imgowner = $result1->owner;
        $this->approved = $result1->approved;
        $this->useruploaded = $result1->useruploaded;
        $this->ordering = $result1->ordering;
        $this->imgownerid = $result1->username;
        $this->rating = $result1->rating;
        if ($this->published != 1 && $this->approved != 1) {
            $this->_mainframe->redirect(JRoute::_('index.php?option=com_joomgallery&view=gallery' . _JOOM_ITEMID, false), JText::_('JGS_ALERT_NOPICTURE_OR_NOTAPPROVED'));
        }
        $this->catpath = Joom_GetCatPath($this->catid);
        $this->joom_thumbnailpath = $config->jg_paththumbs . $this->catpath;
        $this->joom_picturepath = $config->jg_pathimages . $this->catpath;
        $this->joom_originalpath = $config->jg_pathoriginalimages . $this->catpath;
        $this->joom_thumbnailsource = $config->jg_paththumbs . $this->catpath . $this->imgfilename;
        $this->joom_picturesource = $config->jg_pathimages . $this->catpath . $this->imgfilename;
        $this->joom_originalsource = $config->jg_pathoriginalimages . $this->catpath . $this->imgfilename;
        $this->joom_componenturl = 'index.php?option=com_joomgallery';
        $this->joom_assetspath = 'components/com_joomgallery/assets/';
        $this->picture_src = '';
        if ($config->jg_watermark == 1) {
            $this->picture_src = _JOOM_LIVE_SITE . $this->joom_componenturl . '&amp;func=watermark&amp;catid=' . $this->catid . '&amp;id=' . $this->id . str_replace('&', '&amp;', _JOOM_ITEMID);
        } else {
            $this->picture_src = _JOOM_LIVE_SITE . $this->joom_picturesource;
        }
        if (JFile::exists(JPATH_ROOT . DS . $this->joom_originalsource)) {
            $imginfo_ori = getimagesize(JPath::clean(JPATH_ROOT . DS . $this->joom_originalsource));
            $this->originalimgsize = filesize(JPath::clean(JPATH_ROOT . DS . $this->joom_originalsource));
            $this->foriginalimgsize = number_format($this->originalimgsize / 1024, 2, ",", ".") . " KB";
        } else {
            $imginfo_ori[0] = 0;
            $imginfo_ori[1] = 0;
            $this->foriginalimgsize = JText::_('JGS_NO_ORIGINAL_FILE');
        }
        $imginfo = getimagesize(JPath::clean(JPATH_ROOT . DS . $this->joom_picturesource));
        $imgsize = filesize(JPath::clean(JPATH_ROOT . DS . $this->joom_picturesource));
        $this->fimgsize = number_format($imgsize / 1024, 2, ',', '.') . ' KB';
        $this->srcWidth_ori = $imginfo_ori[0];
        $this->srcHeight_ori = $imginfo_ori[1];
        $this->srcWidth = $imginfo[0];
        $this->srcHeight = $imginfo[1];
        $this->fimgdate = strftime($config->jg_dateformat, $this->imgdate);
        $this->frating = number_format($this->rating, 2, ',', '.');
        if ($config->jg_secondorder != '' && $config->jg_thirdorder == '') {
            $orderclause = $config->jg_firstorder . ', ' . $config->jg_secondorder;
        } elseif ($config->jg_secondorder != '' && $config->jg_thirdorder != '') {
            $orderclause = $config->jg_firstorder . ', ' . $config->jg_secondorder . ', ' . $config->jg_thirdorder;
        } else {
            $orderclause = $config->jg_firstorder;
        }
        $database->setQuery(" SELECT\n                            *\n                          FROM\n                            #__joomgallery\n                          WHERE\n                                    catid = " . $this->catid . "\n                            AND approved  = '1'\n                            AND published = '1'\n                          ORDER BY\n                            {$orderclause}\n                        ");
        $this->rows = $database->loadObjectList();
        ?>
  <a name="joomimg"></a>
<?php 
        if ($config->jg_showdetailtitle == 1) {
            HTML_Joom_Detail::Joom_ShowPictureTitle_HTML();
        }
        if (($config->jg_bigpic == 1 && $user->get('aid') > 0 || $config->jg_bigpic == 2) && !$this->slideshow && JFile::exists(JPATH_ROOT . DS . $this->joom_originalsource) && ($this->srcWidth_ori > $this->srcWidth && $this->srcHeight_ori > $this->srcHeight)) {
            $this->link = Joom_OpenImage($config->jg_bigpic_open, $this->id, $this->catpath, $this->catid, $this->imgfilename, $this->imgtitle, $this->imgtext);
        } else {
            $this->link = '';
        }
        if ($this->slideshow == false) {
            Joom_LightboxImages(0, 1, 0, $this->catid, $this->id);
        }
        $this->Joom_ShowPicture();
        if ($config->jg_slideshow) {
            $this->Joom_ShowSlideshow();
        }
        $this->Joom_PagingCategory();
        if (!$this->slideshow) {
            Joom_LightboxImages(0, 2, 0, $this->catid, $this->id);
        }
        if ($config->jg_minis) {
            $this->Joom_ShowMinis();
        }
        if ($config->jg_showdetailtitle == 2) {
            HTML_Joom_Detail::Joom_ShowPictureTitle_HTML();
        }
        $modules = Joom_getModules('detailbtm');
        if (count($modules)) {
            $document =& JFactory::getDocument();
            $renderer = $document->loadRenderer('module');
            $style = -2;
            $params = array('style' => $style);
            foreach ($modules as $module) {
                ?>
  <div class="jg_module">
<?php 
                if ($module->showtitle) {
                    ?>
    <div class="sectiontableheader">
      <h4>
        <?php 
                    echo $module->title;
                    ?>
&nbsp;
      </h4>
    </div>
<?php 
                }
                echo $renderer->render($module, $params);
                ?>
  </div>
<?php 
            }
        }
        if ($config->jg_showdetail) {
            $this->Joom_ShowPictureData();
        }
        # Update View counter
        $this->imgcounter++;
        if ($config->jg_watermark == 0) {
            $database->setQuery(" UPDATE\n                              #__joomgallery\n                            SET\n                              imgcounter = " . $this->imgcounter . "\n                            WHERE\n                              id = " . $this->id . "\n                          ");
            $database->query();
        }
        if ($config->jg_slideshow) {
            HTML_Joom_Detail::Joom_ShowSlideshow_HTML();
        }
        //******************************************************************************
        //wenn die Slideshow aktiviert ist, sind die folgenden Abfragen hinfaellig
        if ($this->slideshow) {
            return;
        }
        //******************************************************************************
        $modules = Joom_GetModules('detailpane');
        if (count($modules)) {
            HTML_Joom_Detail::Joom_ShowModules_HTML($modules);
        }
        if ($config->jg_showexifdata && extension_loaded('exif') && function_exists('exif_read_data')) {
            include_once JPATH_COMPONENT . DS . 'includes' . DS . 'exif' . DS . 'joom.exifdata.php';
        }
        if ($config->jg_showiptcdata) {
            include_once JPATH_COMPONENT . DS . 'includes' . DS . 'iptc' . DS . 'joom.iptcdata.php';
        }
        if ($config->jg_showrating) {
            HTML_Joom_Detail::Joom_ShowVotingArea_HTML();
        }
        if ($config->jg_bbcodelink) {
            $show_img = false;
            $show_url = false;
            if ($config->jg_bbcodelink == 1 || $config->jg_bbcodelink == 3) {
                $show_img = true;
            }
            if ($config->jg_bbcodelink == 2 || $config->jg_bbcodelink == 3) {
                $show_url = true;
            }
            HTML_Joom_Detail::Joom_ShowBBCodeLink_HTML($this->picture_src, $show_img, $show_url);
        }
        if ($config->jg_showcomment) {
            //darf der Besucher Kommentare eingeben
            if ($config->jg_anoncomment || !$config->jg_anoncomment && $user->get('id')) {
                $allowcomment = 1;
            } else {
                $allowcomment = 0;
            }
            HTML_Joom_Detail::Joom_ShowCommentsHead_HTML();
            if ($config->jg_showcommentsarea == 2) {
                HTML_Joom_Detail::Joom_ShowCommentsArea_HTML($allowcomment);
                HTML_Joom_Detail::Joom_BuildCommentsForm_HTML($allowcomment);
            } else {
                HTML_Joom_Detail::Joom_BuildCommentsForm_HTML($allowcomment);
                HTML_Joom_Detail::Joom_ShowCommentsArea_HTML($allowcomment);
            }
            HTML_Joom_Detail::Joom_ShowCommentsEnd_HTML();
        }
        if ($config->jg_send2friend) {
            HTML_Joom_Detail::Joom_ShowSend2FriendArea_HTML();
        }
    }
     //Kategorie Navi im Footer
     if ($config->jg_showpagenav == 2 || $config->jg_showpagenav == 3) {
         $categoryclass->Joom_ShowCategoryPageNav();
     }
     //title-tag
     $pagetitle = Joom_MakePagetitle($config->jg_pagetitle_cat, $categoryclass->catname, '');
     $document->setTitle(JText::_('JGS_GALLERY') . " - " . $pagetitle);
     break;
 case 'uploadhandler':
     include JPATH_COMPONENT . DS . 'classes' . DS . 'upload.class.php';
     $uploadclass = new Joom_Upload($func, $catid);
     break;
 case 'send2friend':
     //TODO
     $send2friendname = Joom_mosGetParam('send2friendname', '', 'post');
     $send2friendemail = Joom_mosGetParam('send2friendemail', '', 'post');
     #$from2friendname = Joom_mosGetParam( 'from2friendname', '', 'post' );
     #$from2friendemail = Joom_mosGetParam( 'from2friendemail', '', 'post' );
     #$id = JRequest::getInt( 'post', 'id', '' );
     $text = $user->get('name') . ' (' . $user->get('email') . ')' . ' ' . JText::_('JGS_INVITE_YOU_VIEW_PICTURE') . "\r \n";
     $text .= _JOOM_LIVE_SITE . 'index.php?option=com_joomgallery&func=detail&id=' . $id . _JOOM_ITEMID . "\r\n";
     $subject = $mainframe->getCfg('sitename') . ' - ' . JText::_('JGS_RECOMMENDED_PICTURE_FROM_FRIEND');
     JUtility::sendMail($mainframe->getCfg('mailfrom'), $mainframe->getCfg('fromname'), $send2friendemail, $subject, $text);
     $mainframe->redirect(JRoute::_('index.php?option=com_joomgallery&func=detail&id=' . $id . _JOOM_ITEMID, false), JText::_('JGS_MAIL_SENT'));
     break;
 case 'download':
     include JPATH_COMPONENT . DS . 'includes' . DS . 'joom.specialimages.php';
     $download = new Joom_SpecialImages();
     $download->Joom_CreateDownload($id, $orig, $catid);
     break;
 case 'addpicture':
/**
 * The following function was taken from admin.frontpage.php Joomla 1.0
 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
 * modification aHa - additional saveorder for categories
 * @see admin.joomgallery.php // only backend
 * @param int $cid
 * @param unknown_type $catg
 */
function Joom_SaveOrder(&$cid, &$catg)
{
    $mainframe =& JFactory::getApplication('administrator');
    $database =& JFactory::getDBO();
    $returntask = Joom_mosGetParam('returntask', null);
    if ($returntask == 'pictures') {
        $total = count($cid);
        $order = Joom_mosGetParam('order', array(0), 'post');
        for ($i = 0; $i < $total; $i++) {
            //get catid
            $database->setQuery("SELECT catid\n          FROM #__joomgallery\n          WHERE id={$cid[$i]}");
            $piccatid = $database->loadResult();
            $query = "UPDATE #__joomgallery\n          SET ordering = {$order[$i]}\n          WHERE id = {$cid[$i]}";
            $database->setQuery($query);
            if (!$database->query()) {
                echo "<script> alert('" . $database->getErrorMsg() . "');\n              window.history.go(-1); </script>\n";
                exit;
            }
            // update ordering
            $row = new mosjoomgallery($database);
            $row->load($cid[$i]);
            $row->reorder('catid=' . $piccatid);
        }
        $mainframe->redirect('index.php?option=' . _JOOM_OPTION . '&act=pictures', JText::_('JG_NEW_ORDERING_SAVED'));
    } else {
        $total = count($catg);
        $order = Joom_mosGetParam('order', array(0), 'post');
        for ($i = 0; $i < $total; $i++) {
            $query = "UPDATE #__joomgallery_catg\n          SET ordering = {$order[$i]}\n          WHERE cid = {$catg[$i]}";
            $database->setQuery($query);
            if (!$database->query()) {
                echo "<script> alert('" . $database->getErrorMsg() . "');\n              window.history.go(-1); </script>\n";
                exit;
            }
            // update ordering
            $row = new mosjoomgallery($database);
            $row->load($catg[$i]);
            $row->reorder('');
        }
        $mainframe->redirect('index.php?option=' . _JOOM_OPTION . '&act=categories', JText::_('JG_NEW_ORDERING_SAVED'));
    }
}