/** * gets the DB rows for all images and calls the HTML output function * */ function Joom_ShowMinis() { $user =& JFactory::getUser(); $mainframe =& JFactory::getApplication('site'); // selected category $this->catid = $mainframe->getUserStateFromRequest('joom.button.catid', 'catid', 0, 'int'); // pagination $limitstart = JRequest::getInt('limitstart', 0); $limit = $mainframe->getUserStateFromRequest('joom.button.limit', 'limit', 50, 'int'); // ensure that image can be seen later on $where = "WHERE \n jgc.published = '1'\n AND jgc.access <= " . $user->get('aid') . "\n AND jg.published = '1'\n AND jg.approved = '1'"; if ($this->catid) { $where .= "\n AND jg.catid = '" . $this->catid . "'"; $this->catpath = Joom_getCatPath($this->catid); } // query $query = " SELECT \n jg.id, \n jg.catid, \n jg.imgtitle, \n jg.imgthumbname, \n jgc.name \n FROM \n #__joomgallery AS jg\n LEFT JOIN \n #__joomgallery_catg AS jgc ON jgc.cid = jg.catid\n " . $where; // execute the query if list_limit = 0 -> all pictures if ($limit == 0) { $this->_db->setQuery($query); $rows = $this->_db->loadObjectList(); $total = count($rows); } else { // take the query and replace the 'select *' with 'select count(jg.id)' -> $querycount // to count total rows for navigation $countquery = str_replace('SELECT jg.id, jg.catid, jg.imgtitle, jg.imgthumbname, jgc.name', 'SELECT COUNT(id)', $query); $this->_db->setQuery($countquery); $total = $this->_db->loadResult(); if ($total <= $limit) { $limitstart = 0; } $this->_db->setQuery($query, $limitstart, $limit); $rows = $this->_db->loadObjectList(); } jimport('joomla.html.pagination'); $this->_pagination = new JPagination($total, $limitstart, $limit); Joom_ShowMiniJoom_HTML::Joom_ShowMinis_HTML($rows); }
function Joom_ShowSubCategories_HTML(&$rows) { $config = Joom_getConfig(); $mainframe =& JFactory::getApplication('site'); $database =& JFactory::getDBO(); $user =& JFactory::getUser(); $pic_count = count($rows); $num_rows = ceil($pic_count / $config->jg_colsubcat); $index = 0; ?> <div class="jg_subcat"> <?php if ($config->jg_showsubcathead) { ?> <div class="sectiontableheader"> <?php echo JText::_('JGS_SUBCATEGORIES'); ?> </div> <?php } ?> </div> <?php //Ausrichtung entsprechend der globalen Vorgabe switch ($config->jg_subcatthumbalign) { case 1: $img_position = 'left'; break; case 2: $img_position = 'right'; break; case 3: $img_position = 'middle'; break; } for ($row_count = 0; $row_count < $num_rows; $row_count++) { $linecolor = ($row_count + 1) % 2 + 1; ?> <div class="jg_row <?php if ($linecolor == 1) { echo "sectiontableentry1"; } else { echo "sectiontableentry2"; } ?> "> <?php for ($col_count = 0; $col_count < $config->jg_colsubcat && $index < $pic_count; $col_count++) { $cur_name = $rows[$index]; if ($config->jg_showcatasnew) { $isnew = Joom_CheckNewCatg($cur_name->cid); } else { $isnew = ''; } $catpath = $cur_name->catpath . '/'; ?> <div class="jg_subcatelem_cat"> <?php if ($cur_name != NULL) { if ($config->jg_showsubthumbs != 0) { ?> <div class="jg_subcatelem_photo"> <?php } if ($config->jg_showsubthumbs == 1) { if ($user->get('aid') >= $cur_name->access && $cur_name->catimage != '') { ?> <a href="<?php echo JRoute::_($this->viewcategory_url . $cur_name->cid . _JOOM_ITEMID); ?> "> <img src="<?php echo _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $cur_name->catimage; ?> " align="<?php echo $img_position; ?> " hspace="4" vspace="0" class="jg_photo" alt="<?php echo $cur_name->name; ?> " /> </a> <?php } ?> </div> <div class="jg_subcatelem_txt"> <img src="<?php echo $this->assetsimages_url . 'arrow.png'; ?> " class="pngfile jg_icon" alt="arrow" /> <?php if ($user->get('aid') >= $cur_name->access) { ?> <a href="<?php echo JRoute::_($this->viewcategory_url . $cur_name->cid . _JOOM_ITEMID); ?> "> <?php echo $cur_name->name; ?> </a> <?php } else { ?> <span class="jg_no_access" onMouseOver="return overlib('<?php echo JText::_('JGS_ALERT_YOU_NOT_ACCESS_THIS_DIRECTORY', true); ?> ', CAPTION, '<?php echo addslashes($cur_name->name); ?> ', BELOW, RIGHT);" onmouseout="return nd();"> <?php echo $cur_name->name; ?> </span> <?php } ?> (<?php echo Joom_GetNumberOfLinks($cur_name->cid); ?> )<?php echo $isnew; ?> <?php } if ($config->jg_showsubthumbs == 0) { ?> <div class="jg_subcatelem_txt"> <ul> <li> <img src="<?php echo $this->assetsimages_url . 'arrow.png'; ?> " class="pngfile jg_icon" alt="arrow" /> <?php if ($user->get('aid') >= $cur_name->access) { ?> <a href="<?php echo JRoute::_($this->viewcategory_url . $cur_name->cid . _JOOM_ITEMID); ?> "> <?php echo $cur_name->name; ?> </a> <?php } else { ?> <span class="jg_no_access" onMouseOver="return overlib('<?php echo JText::_('JGS_ALERT_YOU_NOT_ACCESS_THIS_DIRECTORY', true); ?> ', CAPTION, '<?php echo addslashes($cur_name->name); ?> ', BELOW, RIGHT);" onmouseout="return nd();"> <?php echo $cur_name->name; ?> </span> <?php } ?> (<?php echo Joom_GetNumberOfLinks($cur_name->cid); ?> ) <?php echo $isnew; ?> </li> <?php } if ($config->jg_showsubthumbs == 2) { $allsubcats = Joom_GetAllSubCategories($cur_name->cid, $config->jg_showrandomsubthumb); if ($allsubcats) { mt_srand(); $randomsubcat = $allsubcats[mt_rand(0, count($allsubcats) - 1)]; } else { $randomsubcat = '0'; } } if ($config->jg_showtotalsubcathits) { if ($config->jg_showrandomsubthumb > 2 && $config->jg_showsubthumbs == 2) { $totalsubcats = $allsubcats; } else { $totalsubcats = Joom_GetAllSubCategories($cur_name->cid, 4); } $totalhits = Joom_GetTotalHits($totalsubcats); } if ($config->jg_showsubthumbs == 2) { //random pic nur, wenn auch $randomsubcat(s) vorhanden if ($config->jg_showrandomsubthumb == 1 || $config->jg_showrandomsubthumb >= 2 && $randomsubcat != '0') { $subcatid = $cur_name->cid; $query = " SELECT \n *,\n c.access \n FROM \n #__joomgallery AS p\n LEFT JOIN \n #__joomgallery_catg AS c ON c.cid = p.catid\n WHERE \n "; if ($config->jg_showrandomsubthumb == 1) { $query .= " p.catid = {$cur_name->cid}"; } elseif ($config->jg_showrandomsubthumb >= 2) { $query .= " p.catid = {$randomsubcat}"; $catpath = Joom_getCatPath($randomsubcat); } $query .= " AND p.published = '1' \n AND p.approved = '1' \n AND c.access <= " . $user->get('aid') . " \n AND c.published = '1'\n ORDER BY \n rand() \n LIMIT 1\n "; $database->setQuery($query); $rows2 = $database->loadObjectList(); $count = count($rows2); } else { $count = 0; } if ($count > 0) { $row3 = $rows2[0]; if ($row3->imgfilename != '') { ?> <a href="<?php echo JRoute::_($this->viewcategory_url . $cur_name->cid . _JOOM_ITEMID); ?> "> <img src="<?php echo _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $row3->imgfilename; /*// vorher $row3->catpath.'/' anstatt $catpath */ ?> " align="<?php echo $img_position; ?> " hspace="4" vspace="0" class="jg_photo" alt="<?php echo $cur_name->name . " :: " . $row3->imgtitle; ?> " /> </a> <?php } } ?> </div> <div class="jg_subcatelem_txt"> <ul> <li> <img src="<?php echo $this->assetsimages_url . 'arrow.png'; ?> " class="pngfile jg_icon" alt="arrow" /> <?php if ($user->get('aid') >= $cur_name->access) { ?> <a href="<?php echo JRoute::_($this->viewcategory_url . $cur_name->cid . _JOOM_ITEMID); ?> "> <?php echo $cur_name->name; ?> </a> <?php } else { ?> <span class="jg_no_access" onMouseOver="return overlib('<?php echo JText::_('JGS_ALERT_YOU_NOT_ACCESS_THIS_DIRECTORY', true); ?> ', CAPTION, '<?php echo addslashes($cur_name->name); ?> ', BELOW, RIGHT);" onmouseout="return nd();"> <?php echo $cur_name->name; ?> </span> <?php } ?> (<?php echo Joom_GetNumberOfLinks($cur_name->cid); ?> ) <?php echo $isnew; ?> </li> <?php } if ($config->jg_rmsm > 0) { if ($cur_name->access > 1) { ?> <li> <span class="jg_sm"> <?php echo JText::_('JGS_SPECIAL_MEMBERS'); ?> </span> </li> <?php } elseif ($cur_name->access > 0) { ?> <li> <span class="jg_rm"> <?php echo JText::_('JGS_REGISTERED_MEMBERS'); ?> </span> </li> <?php } } } if ($user->get('aid') >= $cur_name->access) { if ($config->jg_showtotalsubcathits) { ?> <li> <?php echo JText::_('JGS_HITS'); ?> : <?php echo $totalhits; ?> </li> <?php } if ($cur_name->description) { ?> <li> <?php echo $cur_name->description; ?> </li> <?php } } $mainframe->triggerEvent('onAfterDisplayJoomCatThumb', array($cur_name->cid)); ?> </ul> </div> </div> <?php $index++; } // for loop over cols in row ?> <div class="jg_clearboth"></div> </div> <?php } // for loop over rows }
function Joom_Favourites_CreateZip() { $mainframe =& JFactory::getApplication('site'); $database =& JFactory::getDBO(); $user =& JFactory::getUser(); $config = Joom_getConfig(); // Kontrollabfrage, ob der Zip-Download erlaubt ist if ($config->jg_zipdownload != 1 && ($user->get('id') || $config->jg_usefavouritesforpubliczip != 1)) { $mainframe->redirect(JRoute::_($this->showfavourites_url . _JOOM_ITEMID, false), JText::_('JGS_FAV_NOT_ALLOWED')); } // Einbinden der PclZip-Library if (file_exists(JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'pcl' . DS . 'pclzip.lib.php')) { require_once JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'pcl' . DS . 'pclzip.lib.php'; } else { $mainframe->redirect(JRoute::_($this->showfavourites_url . _JOOM_ITEMID, false), JText::_('JGS_FAV_ZIPLIBRARY_NOT_FOUND')); } // Name des Zip-Archivs $zipname = 'components/com_joomgallery/joomgallery_' . date('d_m_Y') . '__'; if ($user->get('id')) { $zipname .= $user->get('id') . '_'; } $zipname .= mt_rand(10000, 99999) . '.zip'; // Erstellen des Zip-Archivs $zipfile = new PclZip($zipname); if (!is_null($this->piclist)) { $picids = explode(',', $this->piclist); $files = array(); foreach ($picids as $picid) { $database->setQuery(" SELECT \n catid,imgfilename \n FROM \n #__joomgallery\n WHERE \n id = '" . $picid . "'\n "); $row = $database->loadObject(); $catpath = Joom_getCatPath($row->catid); if (file_exists(JPath::clean(JPATH_ROOT . DS . $config->jg_pathoriginalimages . $catpath . $row->imgfilename))) { array_push($files, $config->jg_pathoriginalimages . $catpath . $row->imgfilename); } elseif (file_exists(JPath::clean(JPATH_ROOT . DS . $config->jg_pathimages . $catpath . $row->imgfilename))) { array_push($files, $config->jg_pathimages . $catpath . $row->imgfilename); } } $createzip = $zipfile->create($files, PCLZIP_OPT_REMOVE_ALL_PATH); if ($createzip == 0) { // workaround for servers with wwwwrun problem Joom_Chmod(JPATH_ROOT . DS . 'components' . DS . 'com_joomgallery', 0777); $createzip = $zipfile->create($files, PCLZIP_OPT_REMOVE_ALL_PATH); Joom_Chmod(JPATH_ROOT . DS . 'components' . DS . 'com_joomgallery', 0755); } if ($user->get('id')) { if ($this->user_exists) { $database->setQuery(" SELECT \n zipname \n FROM \n #__joomgallery_users\n WHERE \n uuserid = '" . $user->get('id') . "'\n "); if ($old_zip = $database->loadResult()) { if (file_exists($old_zip)) { jimport('joomla.filesystem.file'); JFile::delete($old_zip); } } $database->setQuery(" UPDATE \n #__joomgallery_users\n SET \n time = NOW(),zipname = '" . $zipname . "'\n WHERE \n uuserid = '" . $user->get('id') . "'\n "); } else { $database->setQuery(" INSERT INTO \n #__joomgallery_users \n (uuserid,time,zipname)\n VALUES\n ('" . $user->get('id') . "', NOW(), '" . $zipname . "')\n "); } } else { $database->setQuery(" INSERT INTO \n #__joomgallery_users\n (time,zipname)\n VALUES\n (NOW(),'" . $zipname . "')\n "); } $database->query(); include_once JPATH_COMPONENT . DS . 'includes' . DS . 'html' . DS . 'joom.favourites.html.php'; if ($createzip != 0) { $zipsize = filesize($zipname); if ($zipsize < 1000000) { $zipsize = round($zipsize, -3) / 1000; $zipsize_string = $zipsize . ' KB'; } else { $zipsize = round($zipsize, -6) / 1000000; $zipsize_string = $zipsize . ' MB'; } HTML_Joom_Favourites::Joom_Favourites_CreateZip_HTML($zipname, $zipsize_string); } else { HTML_Joom_Favourites::Joom_Favourites_CreateZip_Error_HTML($zipfile); } } else { $mainframe->redirect(JRoute::_($this->showfavourites_url . _JOOM_ITEMID, false), $this->Output('NO_PICTURES')); } }