/** * Shows latest uploaded images for display on main page */ function showLatest() { $database =& JFactory::getDBO(); $database->setQuery("SELECT file.gallery_id, file.ordering, file.id, file.name, file.descr" . " FROM #__rsgallery2_files file, #__rsgallery2_galleries gal" . " WHERE file.gallery_id=gal.id and gal.published=1" . " ORDER BY file.date DESC limit 3"); $rows = $database->loadObjectList(); HTML_RSGALLERY::showLatest($rows); }
/* Migration calls */ case 'showMigration': HTML_RSGALLERY::RSGalleryHeader('cpanel', JText::_('Migration options')); showMigration(); HTML_RSGALLERY::RSGalleryFooter(); break; case 'doMigration': doMigration(); break; case 'test': test(); break; default: HTML_RSGALLERY::RSGalleryHeader('cpanel', JText::_('MAINT_HEADER')); showMaintenanceCP($option); HTML_RSGALLERY::RSGalleryFooter(); break; } function test() { $gid = 1; $gallery = rsgGalleryManager::_get($gid); $images = $gallery->items(); foreach ($images as $image) { $imgname[] = $image->name; } $image = array_rand($imgname); echo "De image name is: " . $imgname[$image]; echo "<pre>"; var_dump($imgname); echo "</pre>";
/** * if there are no categories and a user has requested an action that * requires a category, this is the error message to display */ function requestCatCreation() { ?> <script> function submitbutton(pressbutton){ if (pressbutton != 'cancel'){ submitform( pressbutton ); return; } else { window.history.go(-1); return; } } </script> <table width="100%"> <tr> <td width="40%"> </td> <td align="center"> <table width=""100%"> <tr> <td><h3><?php echo JText::_('Create a category first!'); ?> </h3></td> <tr> <td> <div id='cpanel'> <?php $link = 'index2.php?option=com_rsgallery2&rsgOption=galleries'; HTML_RSGALLERY::quickiconButton($link, 'categories.png', JText::_('Manage Galleries')); ?> </td> </div> </tr> </table> </td> <td width="40%"> </td> </tr> </table> <div class='rsg2-clr'> </div> <?php }
function batchupload($option) { global $rsgConfig, $mainframe; $database = JFactory::getDBO(); $FTP_path = $rsgConfig->get('ftp_path'); //Retrieve data from submit form $batchmethod = rsgInstance::getVar('batchmethod', null); $uploaded = rsgInstance::getVar('uploaded', null); $selcat = rsgInstance::getInt('selcat', null); $zip_file = rsgInstance::getVar('zip_file', null, 'FILES'); $ftppath = rsgInstance::getVar('ftppath', null); $xcat = rsgInstance::getInt('xcat', null); //Check if a gallery exists, if not link to gallery creation $database->setQuery("SELECT id FROM #__rsgallery2_galleries"); $database->query(); if ($database->getNumRows() == 0) { HTML_RSGALLERY::requestCatCreation(); return; } //New instance of fileHandler $uploadfile = new fileHandler(); if (isset($uploaded)) { if ($batchmethod == "zip") { //Check if file is really a ZIP-file if (!eregi('.zip$', $zip_file['name'])) { $mainframe->redirect("index2.php?option=com_rsgallery2&task=batchupload", $zip_file['name'] . JText::_(' is not a valid archive format. Only ZIP-files are allowed!')); } else { //Valid ZIP-file, continue if ($uploadfile->checkSize($zip_file) == 1) { $ziplist = $uploadfile->handleZIP($zip_file); } else { //Error message $mainframe->redirect("index2.php?option=com_rsgallery2&task=batchupload", JText::_('ZIP-file is too big!')); } } } else { $ziplist = $uploadfile->handleFTP($ftppath); } html_rsg2_images::batchupload_2($ziplist, $uploadfile->extractDir); } else { html_rsg2_images::batchupload($option); } }
/** * @todo if thumbname size has changed, advise user to regenerate thumbs */ function saveConfig() { global $rsgConfig; $rsgConfig = new rsgConfig(); if ($rsgConfig->saveConfig($_REQUEST)) { HTML_RSGALLERY::printAdminMsg(JText::_('Configuration Saved')); // save successful, try creating some image directories if we were asked to if (rsgInstance::getVar('createImgDirs')) { HTML_RSGALLERY::printAdminMsg(JText::_('Creating Image directories not Implemented yet.'), true); } } else { HTML_RSGALLERY::printAdminMsg(JText::_('Error Saving Configuration')); } }