/** * asks user to choose what files to upload */ function showUploadStep3() { $catid = rsgInstance::getInt('catid', null); $uploadstep = rsgInstance::getInt('uploadstep', null); $numberOfUploads = rsgInstance::getInt('numberOfUploads', null); ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.form3; form.submit(); } </script> <form name="form3" action="index2.php?option=com_rsgallery2&task=upload" method="post" enctype="multipart/form-data"> <input type="hidden" name="uploadStep" value="4" /> <input type="hidden" name="catid" value="<?php echo $catid; ?> " /> <input type="hidden" name="numberOfUploads" value="<?php echo $numberOfUploads; ?> " /> <table width="100%"> <tr> <td width="300"> </td> <td> <table class="adminform"> <tr> <th colspan="2"><font size="4"><?php echo JText::_('Step 3'); ?> </font></td> </tr> <?php for ($t = 1; $t < $numberOfUploads + 1; $t++) { ?> <tr> <td colspan="2"> <table width="100%" cellpadding="1" cellspacing="1"> <tr> <td colspan="2"><strong><?php echo JText::_('Image'); echo " " . $t; ?> </strong></td> </tr> <tr> <td><?php echo JText::_('Gallery name'); ?> :</td> <td><strong><?php echo galleryUtils::getCatnameFromId($catid); ?> </strong></td> </tr> <tr> <td valign="top" width="100"><?php echo JText::_('Title') . " " . $t; ?> :</td> <td> <input name="imgTitle[]" type="text" class="inputbox" size="40" /> </td> </tr> <tr> <td valign="top"><?php echo JText::_('File') . " " . $t; ?> :</td> <td> <input class="inputbox" name="images[]" type="file" size="30" /> </td> </tr> <tr> <td valign="top"><?php echo JText::_('Description') . " " . $t; ?> </td> <td> <textarea class="inputbox" cols="35" rows="3" name="descr[]"></textarea> </td> </tr> <tr class="row1"> <th colspan="2"> </th> </tr> </table> </td> </tr> <?php } ?> </table> </td> <td width="300"> </td> </tr> </table> </form> <?php }
/** * deletes all elements of image on disk and in database * @param string name of image * @return true if success or notice and false if error */ function deleteAudio($name) { global $database, $rsgConfig; $original = JPATH_ORIGINAL . DS . $name; if (file_exists($original)) { if (!unlink($original)) { JError::raiseNotice('ERROR_CODE', JText::_('ERROR DELETING ORIGINAL IMAGE') . ": " . $original); return false; } } $database->setQuery("SELECT gallery_id FROM #__rsgallery2_files WHERE name = '{$name}'"); $gallery_id = $database->loadResult(); $database->setQuery("DELETE FROM #__rsgallery2_files WHERE name = '{$name}'"); if (!$database->query()) { JError::raiseNotice('ERROR_CODE', JText::_('ERROR DELETING DATABASE ENTRY FOR IMAGE') . ": " . $name); return false; } galleryUtils::reorderRSGallery('#__rsgallery2_files', "gallery_id = '{$gallery_id}'"); return true; }
/** * Uploads single images */ function uploadImage($option) { $database =& JFactory::getDBO(); //Check if there are galleries created $database->setQuery("SELECT id FROM #__rsgallery2_galleries"); $database->query(); if ($database->getNumRows() == 0) { HTML_RSGALLERY::requestCatCreation(); return; } //Create gallery selectlist $lists['gallery_id'] = galleryUtils::galleriesSelectList(NULL, 'gallery_id', false); html_rsg2_images::uploadImage($lists, $option); }
function batchupload_2($ziplist, $extractDir) { /* Info for javascript on input element names and values: Step 2 Button: Upload --> task=save_batchupload Delete checkbox name: delete[1] Item title field name: ptitle[] Gallery select name: category[] Description area name: descr[] */ global $rsgOption; JHTML::_('behavior.mootools'); $database = JFactory::getDBO(); //Get variables from form $selcat = rsgInstance::getInt('selcat', null); $ftppath = rsgInstance::getVar('ftppath', null); $xcat = rsgInstance::getInt('xcat', null); $batchmethod = rsgInstance::getVar('batchmethod', null); ?> <script language="javascript" type="text/javascript"> <!-- function submitbutton(pressbutton) { var form = document.adminForm, missingCat = false, categories = $$('#adminForm input[name^=category]', '#adminForm select[name^=category]'); for (i=0 ; i<categories.length ; i++) { if (categories[i].value <= 0) { alert("<?php echo JText::_('All images must be part of a galery'); ?> "+' (#'+i+')'); return; missingCat = true; break; } } if (pressbutton == 'save_batchupload'){ if (missingCat == true) { alert("<?php echo JText::_('All images must be part of a galery'); ?> "); } else { form.submit(); } } } //--> </script> <form action="index2.php" method="post" name="adminForm" id="adminForm"> <table class="adminform"> <tr> <th colspan="5" class="sectionname"><font size="4"><?php echo JText::_('Step 2'); ?> </font></th> </tr> <tr> <?php // Initialize k (the column reference) to zero. $k = 0; $i = 0; foreach ($ziplist as $filename) { $k++; //Check if filename is dir if (is_dir(JPATH_ROOT . '/media/' . $extractDir . '/' . $filename)) { continue; } else { //Check if file is allowed $allowed_ext = array('gif', 'jpg', 'png'); $allowedVideo_ext = array('flv', 'avi', 'mov'); $ext = fileHandler::getImageType(JPATH_ROOT . '/media/' . $extractDir . '/' . $filename); if (in_array($ext, $allowedVideo_ext)) { // build preview image $basePath = JPATH_SITE . '/media/' . $extractDir . '/'; require_once JPATH_RSGALLERY2_ADMIN . 'includes/video.utils.php'; Ffmpeg::capturePreviewImage($basePath . $filename, $basePath . $filename . '.png'); $displayImage = $filename . '.png'; $i++; } else { if (!in_array($ext, $allowed_ext)) { continue; } else { $displayImage = $filename; $i++; } } } ?> <td align="center" valign="top" bgcolor="#CCCCCC"> <table class="adminform" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> </th> </tr> <tr> <td colspan="2" align="right"><?php echo JText::_('Delete'); ?> #<?php echo $i - 1; ?> : <input type="checkbox" name="delete[<?php echo $i - 1; ?> ]" value="true" /></td> </tr> <tr> <td align="center" colspan="2"><img src="<?php echo JURI_SITE . "/media/" . $extractDir . "/" . $displayImage; ?> " alt="" border="1" width="100" align="center" /></td> </tr> <input type="hidden" value="<?php echo $filename; ?> " name="filename[]" /> <tr> <td><?php echo JText::_('Title'); ?> </td> <td> <input type="text" name="ptitle[]" size="15" /> </td> </tr> <tr> <td><?php echo JText::_('Gallery'); ?> </td> <td><?php if ($selcat == 1 && $xcat !== '0') { ?> <input type="text" name="cat_text" value="<?php echo htmlspecialchars(stripslashes(galleryUtils::getCatnameFromId($xcat))); ?> " readonly /> <input type="hidden" name="category[]" value="<?php echo $xcat; ?> " /> <?php } else { echo galleryUtils::galleriesSelectList(null, 'category[]', false); } ?> </td> </tr> <tr> <td><?php echo JText::_('Description'); ?> </td> <td><textarea cols="15" rows="2" name="descr[]"></textarea></td> </tr> </table> </td> <?php if ($k == 5) { echo "</tr><tr>"; $k = 0; } } ?> </table> <input type="hidden" name="teller" value="<?php echo $i; ?> " /> <input type="hidden" name="extractdir" value="<?php echo $extractDir; ?> " /> <input type="hidden" name="option" value="com_rsgallery2" /> <input type="hidden" name="rsgOption" value="<?php echo $rsgOption; ?> " /> <input type="hidden" name="task" value="save_batchupload" /> </form> <?php }
function __construct($row) { $this->row = $row; // bind db row to this object foreach ($row as $k => $v) { $this->{$k} = $row[$k]; } $this->params = $this->explode_assoc("=", "\n", $this->params); $this->thumb(); //Write status icons $this->status = galleryUtils::writeGalleryStatus($this); //Write owner name $this->owner = galleryUtils::genericGetUserName($this->get('uid')); //Write gallery name $this->url = JRoute::_("index.php?option=com_rsgallery2&gid=" . $this->get('id')); $this->galleryName = htmlspecialchars(stripslashes($this->get('name'))); //Write HTML for thumbnail $this->thumbHTML = "<div class=\"img-shadow\"><a href=\"" . $this->url . "\">" . galleryUtils::getThumb($this->get('id'), 0, 0, "") . "</a></div>"; //Write description jimport('joomla.filter.output'); $this->description = JFilterOutput::ampReplace($this->get('description')); }
/** * Shows a selectbox with the filenames in the selected gallery * @param int Gallery ID * @param int Currently selected thumbnail * @return HTML representation of a selectbox * @todo Also offer the possiblity to select thumbs from subgalleries */ function showThumbNames($id, $current_id, $selectname = 'thumb_id') { $database =& JFactory::getDBO(); if ($id == null) { echo JText::_('NO IMAGES IN GALLERY YET'); return; } $list = galleryUtils::getChildList($id); //$sql = "SELECT name, id FROM #__rsgallery2_files WHERE gallery_id in ($list)"; $sql = "SELECT a.name, a.id, b.name as gname FROM #__rsgallery2_files AS a " . "LEFT JOIN #__rsgallery2_galleries AS b ON a.gallery_id = b.id " . "WHERE gallery_id IN ({$list}) " . "ORDER BY gname, a.id ASC"; $database->setQuery($sql); $list = $database->loadObjectList(); if ($list == null) { echo JText::_('NO IMAGES IN GALLERY YET'); return; } $dropdown_html = "<select name=\"{$selectname}\"><option value=\"0\" SELECTED>- Random thumbnail -</option>\n"; if (!isset($current_id)) { $current_id = 0; } foreach ($list as $item) { $dropdown_html .= "<option value=\"{$item->id}\""; if ($item->id == $current_id) { $dropdown_html .= " SELECTED>"; } else { $dropdown_html .= ">"; } $dropdown_html .= $item->name . " (" . $item->gname . ")</option>\n"; } echo $dropdown_html . "</select>"; }
function consolidateDB($db_name, $file_display, $file_original, $file_thumb, $files_total) { global $rsgConfig; require_once JPATH_RSGALLERY2_ADMIN . '/config.rsgallery2.php'; $file_diff = array_diff($files_total, $db_name); ?> <script language="Javascript"> function db_create() { alert('Database creation does not work yet!'); } function db_createX() { var form = document.adminForm; form.t_id.value = t_id; form.g_id.value = g_id; form.submit(); } </script> <form method="post" action="index2.php?option=com_rsgallery2&rsgOption=maintenance&task=createDbEntries" name="adminForm"> <input type="hidden" name="t_id" value="" /> <input type="hidden" name="g_id" value="" /> <table width="100%" border="0"> <tr> <td width="15%"> </td> <td width="70%"> <table class="adminlist" border="0"> <tr> <td colspan="9" align="center"> <div style="clear: both; margin: 3px; margin-top: 10px; padding: 5px 15px; display: block; float: left; border: 1px solid #cc0000; background: #ffffcc; text-align: left; width: 80%;"> <p style="color: #CC0000;"> <img src="<?php echo JURI_SITE; ?> /includes/js/ThemeOffice/warning.png" alt="Warning icon" /> NOTICE:<br />Experimental at this stage. Single image regeneration works. <br /> Database entries do NOT work!. <?php //echo JText::_('CONSDB_NOTICE'); ?> </p> </div> <div class='rsg2-clr'> </div> </td> </tr> <tr> <th>#</th> <th><?php echo JText::_('Filename'); ?> </th> <th align="center"><?php echo JText::_('In<br>database'); ?> </th> <th align="center"><?php echo JText::_('Display<br>folder'); ?> </th> <th align="center"><?php echo JText::_('Original<br>folder'); ?> </th> <th align="center"><?php echo JText::_('Thumb<br>folder'); ?> </th> <th> </th> <th align="center"><?php echo JText::_('Image'); ?> </th> <th align="center"><?php echo JText::_('Action'); ?> </th> </tr> <tr> <td colspan="9"> </td> </tr> <?php $yes = "<td align=\"center\"><img src=\"" . JURI_SITE . "administrator/images/tick.png\" alt=\"" . JText::_('Image in folder') . "\" border=\"0\"></td>"; $no = "<td align=\"center\"><img src=\"" . JURI_SITE . "administrator/images/publish_x.png\" alt=\"" . JText::_('Image NOT in folder') . "\" border=\"0\"></td>"; $z = 0; $c = 0; //Check database and crossreference against filesystem foreach ($db_name as $name) { $c++; $i = 0; $fid = galleryUtils::getFileIdFromName($name); $html = "<tr><td><input type=\"checkbox\" id=\"cb{$c}\" name=\"xid[]\" value=\"{$name}\" onclick=\"isChecked(this.checked);\" /></td><td>{$name}</td>" . $yes; if (in_array($name, $file_display)) { $i++; $html .= $yes; $display = true; } else { $z++; $html .= $no; $display = false; } if (in_array($name, $file_original)) { $i++; $html .= $yes; $original = true; } else { $z++; $html .= $no; $original = false; } if (in_array($name, $file_thumb)) { $i++; $html .= $yes; $thumb = true; } else { $z++; $html .= $no; $thumb = false; } if ($i < 3) { echo $html; ?> <td> </td> <td> <img src="<?php echo imgUtils::getImgThumb($name); ?> " name="image" width="<?php echo $rsgConfig->get('thumb_width'); ?> " alt="<?php echo $name; ?> "/> </td> <td align="center"> <a href="index2.php?option=com_rsgallery2&rsgOption=maintenance&task=deleteImages&name=<?php echo $name; ?> "><?php echo '[ ' . JText::_('Delete_from_database') . ' ]'; ?> </a><br /> <?php if ($original == true or $display == true) { ?> <a href="index2.php?option=com_rsgallery2&rsgOption=maintenance&task=createImages&id=<?php echo $fid; ?> "><?php echo '[ ' . JText::_('Create_missing_images') . ' ]'; ?> </a> <?php } ?> </td></tr> <?php } else { continue; } } ?> </tr> <?php $zz = 0; $t = 0; //Check filesystem and crossreference against database foreach ($file_diff as $diff) { $t++; $y = 0; $html2 = "<tr><td><input type=\"checkbox\" id=\"cb{$t}\" name=\"xid[]\" value=\"{$t}\" onclick=\"isChecked(this.checked);\" /></td><td><font color=\"#FF0000\">{$diff}</font></td>{$no}"; if (in_array($diff, $file_display)) { $y++; $html2 .= $yes; $display2 = true; } else { $zz++; $html2 .= $no; $display2 = false; } if (in_array($diff, $file_original)) { $y++; $html2 .= $yes; $original2 = true; } else { $zz++; $html2 .= $no; $original2 = false; } if (in_array($diff, $file_thumb)) { $y++; $html2 .= $yes; $thumb2 = true; } else { $zz++; $html2 .= $no; $thumb2 = false; } if ($y < 4) { echo $html2; ?> <td> <?php echo galleryUtils::galleriesSelectList(NULL, 'gallery_id[]', false, false); ?> <input type="hidden" name="name[]" value="<?php echo $diff; ?> " /> </td> <td> <img src="<?php echo imgUtils::getImgThumb($diff); ?> " name="image" width="<?php echo $rsgConfig->get('thumb_width'); ?> " /> </td> <td align="center"> <a href="javascript:void();" onClick="javascript:db_create();"><?php echo '[ ' . JText::_('Create_Database_entry') . ' ]'; ?> </a><br /> <a href="index2.php?option=com_rsgallery2&rsgOption=maintenance&task=deleteImages&name=<?php echo $diff; ?> "><?php echo '[ ' . JText::_('Delete_images'), ' ]'; ?> </a> <?php if ($original2 == true and $display2 == true and $thumb2 == true) { continue; } else { ?> <br /><a href="index2.php?option=com_rsgallery2&rsgOption=maintenance&task=createImages&name=<?php echo $diff; ?> "><?php echo '[ ' . JText::_('Create missing images') . ' ]'; ?> </a> <?php } ?> </td> <?php } else { continue; } } if ($t == 0 and $z == 0) { echo "<tr><td colspan=\"8\"><font color=\"#008000\"><strong>" . JText::_('No inconsistencies in database') . "</strong></font></td>"; } ?> </tr> <tr> <th colspan="9" align="center"> <a href="index2.php?option=com_rsgallery2&rsgOption=maintenance&task=consolidateDB">Refresh</a> </th> </tr> <!-- <tr> <td colspan="2"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($db_name) + count($file_diff); ?> );" /></td> <td colspan="5"> With selection:<br /> <a href="javascript:void();" onClick="javascript:alert('<?php echo JText::_('Not working yet'); ?> ');"><?php echo JText::_('Delete from filesystem'); ?> </a> | <a href="javascript:void();" onClick="javascript:alert('<?php echo JText::_('Not working yet'); ?> ');"><?php echo JText::_('Create missing images'); ?> </a> | <a href="javascript:void();" onClick="javascript:alert('<?php echo JText::_('Not working yet'); ?> ');"><?php echo JText::_('Create database entries'); ?> </a> </td> </tr> --> </table> </td> <td width="15%"> </td> </tr> </table> </form> <?php }
/** * Shows the configuration page. * @todo get rid of patTemplate!!! **/ function showconfig(&$lists) { global $rsgConfig, $mainframe; $config = $rsgConfig; //Exif tags $exifTagsArray = array("resolutionUnit" => "Resolution unit", "FileName" => "Filename", "FileSize" => "Filesize", "FileDateTime" => "File Date", "FlashUsed" => "Flash used", "imageDesc" => "Image description", "make" => "Camera make", "model" => "Camera model", "xResolution" => "X Resolution", "yResolution" => "Y Resolution", "software" => "Software used", "fileModifiedDate" => "File modified date", "YCbCrPositioning" => "YCbCrPositioning", "exposureTime" => "Exposure time", "fnumber" => "f-Number", "exposure" => "Exposure", "isoEquiv" => "ISO equivalent", "exifVersion" => "EXIF version", "DateTime" => "Date & time", "dateTimeDigitized" => "Original date", "componentConfig" => "Component config", "jpegQuality" => "Jpeg quality", "exposureBias" => "Exposure bias", "aperture" => "Aperture", "meteringMode" => "Metering Mode", "whiteBalance" => "White balance", "flashUsed" => "Flash used", "focalLength" => "Focal lenght", "makerNote" => "Maker note", "subSectionTime" => "Subsection time", "flashpixVersion" => "Flashpix version", "colorSpace" => "Color Space", "Width" => "Width", "Height" => "Height", "GPSLatitudeRef" => "GPS Latitude reference", "Thumbnail" => "Thumbnail", "ThumbnailSize" => "Thumbnail size", "sourceType" => "Source type", "sceneType" => "Scene type", "compressScheme" => "Compress scheme", "IsColor" => "Color or B&W", "Process" => "Process", "resolution" => "Resolution", "color" => "Color", "jpegProcess" => "Jpeg process"); //Format selected items $exifSelected = explode("|", $config->exifTags); foreach ($exifSelected as $select) { $exifSelect[] = JHTML::_("select.option", $select, $select); } //Format values for dropdownbox foreach ($exifTagsArray as $key => $value) { $exif[] = JHTML::_("select.option", $key, $key); } //Format values for slideshow dropdownbox $folders = JFolder::folders(JPATH_RSGALLERY2_SITE . '/templates'); foreach ($folders as $folder) { if (preg_match("/slideshow/i", $folder)) { $current_slideshow[] = JHTML::_("select.option", $folder, $folder); } } // front display $display_thumbs_style[] = JHTML::_("select.option", 'table', JText::_('Table')); $display_thumbs_style[] = JHTML::_("select.option", 'float', JText::_('Float')); $display_thumbs_style[] = JHTML::_("select.option", 'magic', JText::_('Magic(not supported yet!)')); $display_thumbs_floatDirection[] = JHTML::_("select.option", 'left', JText::_('Left to Right')); $display_thumbs_floatDirection[] = JHTML::_("select.option", 'right', JText::_('Right to Left')); $thumb_style[] = JHTML::_("select.option", '0', JText::_('Proportional')); $thumb_style[] = JHTML::_("select.option", '1', JText::_('SQUARE')); $thum_order[] = JHTML::_("select.option", 'ordering', JText::_('Default')); $thum_order[] = JHTML::_("select.option", 'date', JText::_('Date')); $thum_order[] = JHTML::_("select.option", 'name', JText::_('Name')); $thum_order[] = JHTML::_("select.option", 'rating', JText::_('Rating')); $thum_order[] = JHTML::_("select.option", 'hits', JText::_('Hits')); $thum_order_direction[] = JHTML::_("select.option", 'ASC', JText::_('Ascending')); $thum_order_direction[] = JHTML::_("select.option", 'DESC', JText::_('Descending')); $resizeOptions[] = JHTML::_("select.option", '0', JText::_('Default Size')); $resizeOptions[] = JHTML::_("select.option", '1', JText::_('Resize larger pics')); $resizeOptions[] = JHTML::_("select.option", '2', JText::_('Resize smaller pics')); $resizeOptions[] = JHTML::_("select.option", '3', JText::_('Resize pics to fit')); $displayPopup[] = JHTML::_("select.option", '0', JText::_('No popup')); $displayPopup[] = JHTML::_("select.option", '1', JText::_('Normal popup')); $displayPopup[] = JHTML::_("select.option", '2', JText::_('Joomla Modal')); //Number of galleries dropdown field $dispLimitbox[] = JHTML::_("select.option", '0', JText::_('Never')); $dispLimitbox[] = JHTML::_("select.option", '1', JText::_('If more galleries than limit')); $dispLimitbox[] = JHTML::_("select.option", '2', JText::_('Always')); $galcountNrs[] = JHTML::_("select.option", '5', '5'); $galcountNrs[] = JHTML::_("select.option", '10', '10'); $galcountNrs[] = JHTML::_("select.option", '15', '15'); $galcountNrs[] = JHTML::_("select.option", '20', '20'); $galcountNrs[] = JHTML::_("select.option", '25', '25'); $galcountNrs[] = JHTML::_("select.option", '30', '30'); $galcountNrs[] = JHTML::_("select.option", '50', '50'); // watermark $watermarkAngles[] = JHTML::_("select.option", '0', '0'); $watermarkAngles[] = JHTML::_("select.option", '45', '45'); $watermarkAngles[] = JHTML::_("select.option", '90', '90'); $watermarkAngles[] = JHTML::_("select.option", '135', '135'); $watermarkAngles[] = JHTML::_("select.option", '180', '180'); $watermarkPosition[] = JHTML::_("select.option", '1', JText::_('Top left')); $watermarkPosition[] = JHTML::_("select.option", '2', JText::_('Top Center')); $watermarkPosition[] = JHTML::_("select.option", '3', JText::_('Top right')); $watermarkPosition[] = JHTML::_("select.option", '4', JText::_('Left')); $watermarkPosition[] = JHTML::_("select.option", '5', JText::_('Center')); $watermarkPosition[] = JHTML::_("select.option", '6', JText::_('Right')); $watermarkPosition[] = JHTML::_("select.option", '7', JText::_('Bottom left')); $watermarkPosition[] = JHTML::_("select.option", '8', JText::_('Bottom center')); $watermarkPosition[] = JHTML::_("select.option", '9', JText::_('Bottom right')); $watermarkFontSize[] = JHTML::_("select.option", '5', '5'); $watermarkFontSize[] = JHTML::_("select.option", '6', '6'); $watermarkFontSize[] = JHTML::_("select.option", '7', '7'); $watermarkFontSize[] = JHTML::_("select.option", '8', '8'); $watermarkFontSize[] = JHTML::_("select.option", '9', '9'); $watermarkFontSize[] = JHTML::_("select.option", '10', '10'); $watermarkFontSize[] = JHTML::_("select.option", '11', '11'); $watermarkFontSize[] = JHTML::_("select.option", '12', '12'); $watermarkFontSize[] = JHTML::_("select.option", '13', '13'); $watermarkFontSize[] = JHTML::_("select.option", '14', '14'); $watermarkFontSize[] = JHTML::_("select.option", '15', '15'); $watermarkFontSize[] = JHTML::_("select.option", '16', '16'); $watermarkFontSize[] = JHTML::_("select.option", '17', '17'); $watermarkFontSize[] = JHTML::_("select.option", '18', '18'); $watermarkFontSize[] = JHTML::_("select.option", '19', '19'); $watermarkFontSize[] = JHTML::_("select.option", '20', '20'); $watermarkFontSize[] = JHTML::_("select.option", '22', '22'); $watermarkFontSize[] = JHTML::_("select.option", '24', '24'); $watermarkFontSize[] = JHTML::_("select.option", '26', '26'); $watermarkFontSize[] = JHTML::_("select.option", '28', '28'); $watermarkFontSize[] = JHTML::_("select.option", '30', '30'); $watermarkFontSize[] = JHTML::_("select.option", '36', '36'); $watermarkFontSize[] = JHTML::_("select.option", '40', '40'); $watermarkTransparency[] = JHTML::_("select.option", '0', '0'); $watermarkTransparency[] = JHTML::_("select.option", '10', '10'); $watermarkTransparency[] = JHTML::_("select.option", '20', '20'); $watermarkTransparency[] = JHTML::_("select.option", '30', '30'); $watermarkTransparency[] = JHTML::_("select.option", '40', '40'); $watermarkTransparency[] = JHTML::_("select.option", '50', '50'); $watermarkTransparency[] = JHTML::_("select.option", '60', '60'); $watermarkTransparency[] = JHTML::_("select.option", '70', '70'); $watermarkTransparency[] = JHTML::_("select.option", '80', '80'); $watermarkTransparency[] = JHTML::_("select.option", '90', '90'); $watermarkTransparency[] = JHTML::_("select.option", '100', '100'); $watermarkType[] = JHTML::_("select.option", 'image', 'Image'); $watermarkType[] = JHTML::_("select.option", 'text', 'Text'); //Commenting options if (galleryUtils::isComponentInstalled('com_securityimages') == 1) { $security_notice = "<span style=\"color:#009933;font-weight:bold;\">" . JText::_('SecurityImages_component_detected') . " </span>"; } else { $security_notice = "<span style=\"color:#FF0000;font-weight:bold;\">" . JText::_('SECURITYIMAGES_COMPONENT_NOT_INSTALLED') . " </span>"; } /** * Routine checks if Freetype library is compiled with GD2 * @return boolean True or False */ if (function_exists('gd_info')) { $gd_info = gd_info(); $freetype = $gd_info['FreeType Support']; if ($freetype == 1) { $freeTypeSupport = "<div style=\"color:#009933;\">" . JText::_('(Freetype library installed, watermark is possible)') . "</div>"; } else { $freeTypeSupport = "<div style=\"color:#FF0000;\">" . JText::_('(Freetype library NOT installed! Watermark does not work)') . "</div>"; } } // in page.html joomla has a template for $tabs->func*() // couldn't figure out how to use it effectively however. // this is why the templates were broken up, so i could call echo $tabs->func*() between them jimport("joomla.html.pane"); $editor =& JFactory::getEditor(); $tabs =& JPane::getInstance("Tabs"); ?> <script type="text/javascript"> function submitbutton(pressbutton) { <?php echo $editor->save('intro_text'); ?> submitform( pressbutton ); } </script> <form action="index2.php" method="post" name="adminForm" id="adminForm"> <?php echo $tabs->startPane('rsgConfig', 'rsgConfig'); echo $tabs->startPanel(JText::_('General'), 'rsgConfig'); ?> <table border="0" width="100%"> <tr> <td valign="top"> <fieldset> <legend><?php echo JText::_('General settings'); ?> </legend> <table width="100%"> <tr> <td width="200"><?php echo JText::_('Version:'); ?> </td> <td><?php echo $config->version; ?> </td> </tr> <tr> <td><?php echo JText::_('Introduction Text:'); ?> </td> <td> <?php echo $editor->display('intro_text', $config->intro_text, '100%', '200', '10', '20', false); ?> </td> </tr> <tr> <td><?php echo JText::_('Debug:'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'debug', '', $config->debug); ?> </td> </tr> <!-- <tr> <td><?php //echo JText::_('Hide Root (create multiple independant galleries)'); ?> </td> <td><?php //echo JHTML::_("select.booleanlist",'hideRoot', '', $config->hideRoot); ?> </td> </tr> --> <tr> <td><?php echo JText::_('Advanced SEF (all category names and item titles must be unique)'); ?> </td> <td><?php //echo JHTML::_("select.booleanlist",'advancedSef', '', $config->advancedSef); $options = array(); $options[] = JHTML::_('select.option', '0', JText::_('No')); $options[] = JHTML::_('select.option', '1', JText::_('Yes')); $options[] = JHTML::_('select.option', '2', JText::_('Yes use number and name no need for unique names')); echo JHTML::_('select.radiolist', $options, 'advancedSef', '', 'value', 'text', $config->advancedSef); ?> </td> </tr> </table> </fieldset> </td> </tr> </table> <?php //$tmpl->displayParsedTemplate( 'configTableGeneral' ); echo $tabs->endPanel(); echo $tabs->startPanel(JText::_('Images'), 'rsgConfig'); ?> <table border="0" width="100%"> <tr> <td width="40%" valign="top"> <fieldset> <legend><?php echo JText::_('Image Manipulation'); ?> </legend> <table width="100%"> <tr> <td><?php echo JText::_('Display Picture Width:'); ?> </td> <td><input class="text_area" type="text" name="image_width" size="10" value="<?php echo $config->image_width; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Resize portrait images by height using Display Picture Width:'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'resize_portrait_by_height', '', $config->resize_portrait_by_height); ?> </td> </tr> <tr> <td><?php echo JText::_('Thumbnail Width:'); ?> </td> <td><input class="text_area" type="text" name="thumb_width" size="10" value="<?php echo $config->thumb_width; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Thumbnail Style:'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $thumb_style, 'thumb_style', '', 'value', 'text', $config->thumb_style); ?> </td> </tr> <tr> <td><?php echo JText::_('JPEG Quality Percentage'); ?> </td> <td><input class="text_area" type="text" name="jpegQuality" size="10" value="<?php echo $config->jpegQuality; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Allowed filetypes'); ?> </td> <td><input class="text_area" type="text" name="allowedFileTypes" size="30" value="<?php echo $config->allowedFileTypes; ?> "/></td> </tr> </table> </fieldset> <fieldset> <legend><?php echo JText::_('Image upload'); ?> </legend> <table width="100%"> <tr> <td><?php echo JHTML::tooltip(JText::_('RSG2_IPTC_TOOLTIP'), JText::_('RSG2_IPTC_TOOLTIP_TITLE'), '', 'RSG2_USE_IPTC'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'useIPTCinformation', '', $config->useIPTCinformation); ?> </td> </tr> </table> </fieldset> <!--end of addition--> </td> <td width="60%" valign="top"> <fieldset> <legend><?php echo JText::_('Graphics Library'); ?> </legend> <table width="100%"> <tr> <td width=185><?php echo JText::_('Graphics Library'); ?> </td> <td><?php echo $lists['graphicsLib']; ?> </td> </tr> <tr> <td colspan=2 ><span style="color:red;"><?php echo JText::_('Note'); ?> </span><?php echo JText::_('Leave the following fields empty unless you have problems.'); ?> </td> </tr> <tr> <td><?php echo JText::_('ImageMagick Path:'); ?> </td> <td><input class="text_area" type="text" name="imageMagick_path" size="50" value="<?php echo $config->imageMagick_path; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Netpbm Path:'); ?> </td> <td><input class="text_area" type="text" name="netpbm_path" size="50" value="<?php echo $config->netpbm_path; ?> "/></td> </tr> <tr> <td><?php echo JText::_('FTP Path:'); ?> </td> <td><input class="text_area" type="text" name="ftp_path" size="50" value="<?php echo $config->ftp_path; ?> "/>(<?php echo JText::_('HTML-root is'); ?> : <?php print $_SERVER['DOCUMENT_ROOT']; ?> )</td> </tr> <tr> <td><?php echo JText::_('Video converter path:'); ?> </td> <td><input class="text_area" type="text" name="videoConverter_path" size="50" value="<?php echo $config->videoConverter_path; ?> "/>(ex. "C:\ffmpeg\ffmpeg.exe")</td> </tr> <tr> <td><?php echo JText::_('Video converter parameters:'); ?> </td> <td><input class="text_area" type="text" name="videoConverter_param" size="100" value="<?php echo $config->videoConverter_param; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Thumbnail extraction parameters:'); ?> </td> <td><input class="text_area" type="text" name="videoConverter_thumbParam" size="100" value="<?php echo $config->videoConverter_thumbParam; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Video output type:'); ?> </td> <td><input class="text_area" type="text" name="videoConverter_extension" size="50" value="<?php echo $config->videoConverter_extension; ?> "/></td> </tr> </table> </fieldset> </td> </tr> </table> <table border="0" width="100%"> <tr> <td width="50%" valign="top"> <fieldset> <legend><?php echo JText::_('Image Storage'); ?> </legend> <table width="100%"> <tr> <td><?php echo JText::_('Keep original image:'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'keepOriginalImage', '', $config->keepOriginalImage); ?> </td> </tr> <tr> <td><?php echo JText::_('Original Image Path:'); ?> </td> <td><input class="text_area" style="width:300px;" type="text" name="imgPath_original" size="10" value="<?php echo $config->imgPath_original; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Display Image Path:'); ?> </td> <td><input class="text_area" style="width:300px;" type="text" name="imgPath_display" size="10" value="<?php echo $config->imgPath_display; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Thumb Path:'); ?> </td> <td><input class="text_area" style="width:300px;" type="text" name="imgPath_thumb" size="10" value="<?php echo $config->imgPath_thumb; ?> "/></td> </tr> <tr> <td><?php echo JText::_("Create directories if they don't exist:"); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'createImgDirs', '', $config->createImgDirs); ?> </td> </tr> </table> </fieldset> </td> <td width="50%" valign="top"> <fieldset> <legend><?php echo JText::_('Comments'); ?> </legend> <table width="100%"> <tr> <td><?php echo JText::_('Commenting enabled'); ?> </td> <td width="110px"><?php echo JHTML::_("select.booleanlist", 'comment', '', $config->comment); ?> </td> </tr> <tr> <td>Use <a href="http://www.waltercedric.com" target="_blank"><?php echo JText::_('SecurityImages_component'); ?> </a> <?php echo $security_notice; ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'comment_security', '', $config->comment_security && galleryUtils::isComponentInstalled('com_securityimages')); ?> </td> </tr> <tr> <td><?php echo JText::_('Allow public users to comment'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'comment_allowed_public', '', $config->comment_allowed_public); ?> </td> </tr> <tr> <td><?php echo JText::_('User can only comment once'); ?> (Not working yet!)</td> <td><?php echo JHTML::_("select.booleanlist", 'comment_once', '', $config->comment_once); ?> </td> </tr> </table> </fieldset> <fieldset> <legend><?php echo JText::_('Voting'); ?> </legend> <table width="100%"> <tr> <td><?php echo JText::_('Voting enabled'); ?> </td> <td width="110px"><?php echo JHTML::_("select.booleanlist", 'voting', '', $config->voting); ?> </td> </tr> <tr> <td><?php echo JText::_('User can only vote once(cookie based)'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'voting_once', '', $config->voting_once); ?> </td> </tr> <tr> <td><?php echo JText::_('Cookie prefix'); ?> </td> <td><input type="text" name="cookie_prefix" value="<?php echo $config->cookie_prefix; ?> "</td> </tr> </table> </fieldset> </td> </tr> </table> <?php //$tmpl->displayParsedTemplate( 'configTableImages' ); echo $tabs->endPanel(); echo $tabs->startPanel(JText::_('Display'), 'rsgConfig'); ?> <table border="0" width="100%"> <tr> <td width="40%" valign="top"> <fieldset> <legend><?php echo JText::_('Front Page'); ?> </legend> <table width="100%"> <tr> <td width="40%"><?php echo JText::_('Display Search'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displaySearch', '', $config->displaySearch); ?> </td> </tr> <tr> <td width="40%"><?php echo JText::_('Display Random'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayRandom', '', $config->displayRandom); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Latest'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayLatest', '', $config->displayLatest); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Branding'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayBranding', '', $config->displayBranding); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Downloadlink'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayDownload', '', $config->displayDownload); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Status Icons'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayStatus', '', $config->displayStatus); ?> </td> </tr> <tr> <td><?php echo JText::_('Display gallery limitbox'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $dispLimitbox, 'dispLimitbox', '', 'value', 'text', $config->dispLimitbox); ?> </td> </tr> <tr> <td><?php echo JText::_('Default number of galleries on frontpage'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $galcountNrs, 'galcountNrs', '', 'value', 'text', $config->galcountNrs); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Slideshow'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displaySlideshow', '', $config->displaySlideshow); ?> </td> </tr> <tr> <td><?php echo JText::_('Select slideshow'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $current_slideshow, 'current_slideshow', '', 'value', 'text', $config->current_slideshow); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Owner Information'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'showGalleryOwner', '', $config->showGalleryOwner); ?> </td> </tr> <tr> <td><?php echo JText::_('Display number of items in gallery'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'showGallerySize', '', $config->showGallerySize); ?> </td> </tr> <tr> <td><?php echo JText::_('Display creation date'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'showGalleryDate', '', $config->showGalleryDate); ?> </td> </tr> </table> </fieldset> </td> <td width="30%" valign="top"> <fieldset> <legend><?php echo JText::_('Image Display'); ?> </legend> <table width="100%"> <tr> <td width="40%"><?php echo JText::_('Popup style'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $displayPopup, 'displayPopup', '', 'value', 'text', $config->displayPopup); ?> </td> </tr> <tr> <td><?php echo JText::_('Resize Option'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $resizeOptions, 'display_img_dynamicResize', '', 'value', 'text', $config->display_img_dynamicResize); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Description'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayDesc', '', $config->displayDesc); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Hits'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayHits', '', $config->displayHits); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Voting'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayVoting', '', $config->displayVoting); ?> </td> </tr> <tr> <td><?php echo JText::_('Display Comments'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayComments', '', $config->displayComments); ?> </td> </tr> </table> </fieldset> <fieldset> <legend><?php echo JText::_('Image order'); ?> </legend> <table width="100%"> <tr> <td><?php echo JText::_('Order images by'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $thum_order, 'filter_order', '', 'value', 'text', $config->filter_order); ?> </td> </tr> <tr> <td><?php echo JText::_('Order direction'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $thum_order_direction, 'filter_order_Dir', '', 'value', 'text', $config->filter_order_Dir); ?> </td> </tr> </table> </filedset> </td> <td width="30%" valign="top"> <fieldset> <legend><?php echo JText::_('EXIF SETTINGS'); ?> </legend> <table width="100%"> <tr> <td><?php echo JText::_('Display EXIF Data'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'displayEXIF', '', $config->displayEXIF); ?> </td> </tr> <tr> <td valign="top"><?php echo JText::_('Select_EXIF_tags_to_display'); ?> </td> <td valign="top"> <label class="examples"></label> <?php echo JHTML::_("select.genericlist", $exif, 'exifTags[]', 'MULTIPLE size="15"', 'value', 'text', $exifSelect); ?> </td> </tr> </table> </fieldset> </td> </tr> <tr> <td width="40%" valign="top"> <fieldset> <legend><?php echo JText::_('Gallery View'); ?> </legend> <table width="100%"> <tr> <td width="40%"><?php echo JText::_('Thumbnail Style:<br>Use float for variable width templates.'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $display_thumbs_style, 'display_thumbs_style', '', 'value', 'text', $config->display_thumbs_style); ?> </td> </tr> <tr> <td><?php echo JText::_('Direction (only works for float):'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $display_thumbs_floatDirection, 'display_thumbs_floatDirection', '', 'value', 'text', $config->display_thumbs_floatDirection); ?> </td> </tr> <tr> <td><?php echo JText::_('Number of Thumbnail Columns (only for table):'); ?> </td> <td><?php echo JHTML::_("select.integerlist", 1, 19, 1, 'display_thumbs_colsPerPage', '', $config->display_thumbs_colsPerPage); ?> </td> </tr> <tr> <td><?php echo JText::_('Thumbnails per Page:'); ?> </td> <td><input class="text_area" type="text" name="display_thumbs_maxPerPage" size="10" value="<?php echo $config->display_thumbs_maxPerPage; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Show image name below thumbnail:'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'display_thumbs_showImgName', '', $config->display_thumbs_showImgName); ?> </td> </tr> </table> </fieldset> </td> <td colspan="2" valign="top"> <fieldset> <legend><?php echo JText::_('Image Watermark'); ?> </legend> <table width="100%"> <tr> <td colspan="2"> <strong><?php echo $freeTypeSupport; ?> </strong> </td> </tr> <tr> <td width="40%"><?php echo JText::_('Display Watermark'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'watermark', '', $config->watermark); ?> </td> </tr> <!-- <tr> <td width="40%">* Watermark type *</td> <td><?php // echo JHTML::_("select.genericlist",$watermarkType, 'watermark_type','','value', 'text', $config->watermark_type) ?> </td> </tr> <tr> <td valign="top" width="40%">* Watermark upload *</td> <td></td> </tr> --> <tr> <td width="40%"><?php echo JText::_('Font'); ?> </td> <td><?php echo galleryUtils::showFontList(); ?> </td> </tr> <tr> <td><?php echo JText::_('Watermark text'); ?> </td> <td><input class="text_area" type="text" name="watermark_text" size="50" value="<?php echo $config->watermark_text; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Watermark Font Size'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $watermarkFontSize, 'watermark_font_size', '', 'value', 'text', $config->watermark_font_size); ?> pts</td> </tr> <tr> <td><?php echo JText::_('Watermark text angle'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $watermarkAngles, 'watermark_angle', '', 'value', 'text', $config->watermark_angle); ?> </td> </tr> <tr> <td><?php echo JText::_('Watermark position'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $watermarkPosition, 'watermark_position', '', 'value', 'text', $config->watermark_position); ?> </td> </tr> <tr> <td><?php echo JText::_('Watermark transparency'); ?> </td> <td><?php echo JHTML::_("select.genericlist", $watermarkTransparency, 'watermark_transparency', '', 'value', 'text', $config->watermark_transparency); ?> <strong>%<strong></td> </tr> <tr> <td><?php echo JText::_('Watermarked image Path:'); ?> </td> <td><input class="text_area" style="width:300px;" type="text" name="imgPath_watermarked" size="10" value="<?php echo $config->imgPath_watermarked; ?> "/></td> </tr> </table> </fieldset> </td> </tr> </table> <?php //$tmpl->displayParsedTemplate( 'configTableFrontDisplay' ); echo $tabs->endPanel(); echo $tabs->startPanel(JText::_('Permissions'), 'rsgConfig'); ?> <table border="0" width="100%"> <tr> <td width="40%"> <fieldset> <legend><?php echo JText::_('Access Control Settings'); ?> </legend> <table width="100%"> <tr> <td width="60%"><?php echo JText::_('Enable Access Control'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'acl_enabled', '', $config->acl_enabled); ?> </td> </tr> <tr> <td><?php echo JText::_('Show My Galleries'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'show_mygalleries', '', $config->show_mygalleries); ?> </td> </tr> <tr> <td><?php echo JText::_('Can user create galleries?'); ?> </td> <td><?php echo JHTML::_("select.booleanlist", 'uu_createCat', '', $config->uu_createCat); ?> </td> </tr> </table> </fieldset> </td> <td width="60%"> </td> </tr> <tr> <td width="40%"> <fieldset> <legend><?php echo JText::_('User specific settings'); ?> </legend> <table width="100%"> <tr> <td width="60%"><?php echo JText::_('Maximum number of galleries a user can have:'); ?> </td> <td><input class="text_area" type="text" name="uu_maxCat" size="10" value="<?php echo $config->uu_maxCat; ?> "/></td> </tr> <tr> <td><?php echo JText::_('Max numbers of pictures a user can have:'); ?> </td> <td><input class="text_area" type="text" name="uu_maxImages" size="10" value="<?php echo $config->uu_maxImages; ?> "/></td> </tr> </table> </fieldset> </td> <td width="60%"> </td> </tr> </table> <?php //$tmpl->displayParsedTemplate( 'configTableUsers' ); echo $tabs->endPanel(); ?> <input type="hidden" name="option" value="com_rsgallery2" /> <input type="hidden" name="rsgOption" value="config" /> <input type="hidden" name="task" value="" /> </form> <!-- Fix for Firefox browser --> <div style='clear:both;line-height:0px;'> </div> <?php echo $tabs->endPane(); //$tmpl->displayParsedTemplate( 'configFinish' ); }
/** * This function will show the 5 last uploaded images */ function latestImages() { global $rows; $my = JFactory::getUser(); $database = JFactory::getDBO(); $lastweek = mktime(0, 0, 0, date("m"), date("d") - 7, date("Y")); $lastweek = date("Y-m-d H:m:s", $lastweek); $database->setQuery("SELECT * FROM #__rsgallery2_files WHERE date >= '{$lastweek}' and published=1 ORDER BY id DESC LIMIT 0,5"); $rows = $database->loadObjectList(); if (count($rows) > 0) { foreach ($rows as $row) { ?> <tr> <td><?php echo $row->name; ?> </td> <td><?php echo galleryUtils::getCatnameFromId($row->gallery_id); ?> </td> <td><?php echo $row->date; ?> </td> <td><?php echo galleryUtils::genericGetUsername($row->userid); ?> </td> </tr> <?php } } else { echo "<tr><td colspan=\"4\">" . JText::_('No new entries') . "</td></tr>"; } }
function editCat($rows = null) { //Mirjam: In v1.13 catid was used where since v1.14 gid is used, but locally in a function catid is fine global $rsgConfig; $my = JFactory::getUser(); $editor =& JFactory::getEditor(); //Load frontend toolbar class require_once JPATH_ROOT . '/includes/HTML_toolbar.php'; ?> <script type="text/javascript"> function submitbutton(pressbutton) { var form = document.form2; if (pressbutton == 'cancel') { form.reset(); history.back(); return; } <?php echo $editor->save('description'); ?> // do field validation if (form.parent.value < 0) { alert( "<?php echo JText::_('You must select a gallery.'); ?> " ); return; } if (form.catname1.value == "") { alert( "<?php echo JText::_('You must provide a gallery name.'); ?> " ); } else if (form.description.value == ""){ alert( "<?php echo JText::_('You must provide a description.'); ?> " ); } else{ form.submit(); } } </script> <?php if ($rows) { foreach ($rows as $row) { $catname = htmlspecialchars($row->name, ENT_QUOTES); $description = htmlspecialchars($row->description, ENT_QUOTES); $ordering = $row->ordering; $uid = $row->uid; $catid = $row->id; $published = $row->published; $user = $row->user; $parent = $row->parent; } } else { $catname = ""; $description = ""; $ordering = ""; $uid = ""; $catid = ""; $published = ""; $user = ""; $parent = ""; } ?> <form name="form2" id="form2" method="post" action="<?php echo JRoute::_("index.php?option=com_rsgallery2&rsgOption=myGalleries&task=saveCat"); ?> "> <table width="100%"> <tr> <td colspan="2"><h3><?php echo JText::_('Create Gallery'); ?> </h3></td> </tr> <tr> <td align="right"> <div style="float: right;"> <img onClick="submitbutton('save');" src="<?php echo JURI_SITE; ?> /administrator/images/save.png" alt="<?php echo JText::_('Upload'); ?> " name="upload" onMouseOver="document.upload.src='<?php echo JURI_SITE; ?> /administrator/images/save_f2.png';" onMouseOut="document.upload.src='<?php echo JURI_SITE; ?> /administrator/images/save.png';" /> <img onClick="submitbutton('cancel')" src="<?php echo JURI_SITE; ?> /administrator/images/cancel.png" alt="<?php echo JText::_('Cancel'); ?> " name="cancel" onMouseOver="document.cancel.src='<?php echo JURI_SITE; ?> /administrator/images/cancel_f2.png';" onMouseOut="document.cancel.src='<?php echo JURI_SITE; ?> /administrator/images/cancel.png';" /> </div> </td> </tr> </table> <input type="hidden" name="catid" value="<?php echo $catid; ?> " /> <input type="hidden" name="ordering" value="<?php echo $ordering; ?> " /> <table class="adminlist" border="1"> <tr> <th colspan="2"><?php echo JText::_('Create Gallery'); ?> </th> </tr> <tr> <td><?php echo JText::_('Top gallery'); ?> </td> <td> <?php //galleryUtils::showCategories(NULL, $my->id, 'parent'); ?> <?php echo galleryUtils::galleriesSelectList($parent, 'parent', false); ?> <?php //galleryUtils::createGalSelectList( NULL, $listName='parent', true ); ?> </td> </tr> <tr> <td><?php echo JText::_('Gallery name'); ?> </td> <td align="left"><input type="text" name="catname1" size="30" value="<?php echo $catname; ?> " /></td> </tr> <tr> <td colspan="2"><?php echo JText::_('Description'); ?> <?php echo $editor->display('description', $description, '600', '200', '35', '15'); ?> </td> </tr> <tr> <td><?php echo JText::_('Published'); ?> </td> <td align="left"><input type="checkbox" name="published" value="1" <?php if ($published == 1) { echo "checked"; } ?> /></td> </tr> </table> </form> <?php }
/** * recursively deletes a tree of galleries * @param id of the gallery * @todo this is a quick hack. galleryUtils and imgUtils need to be reorganized; and a rsgImage class created to do this proper */ function _deleteTree($galleries) { global $rsgAccess; $database =& JFactory::getDBO(); foreach ($galleries as $gallery) { rsgGalleryManager::_deleteTree($gallery->kids()); // delete images in gallery foreach ($gallery->items() as $item) { imgUtils::deleteImage(galleryUtils::getFileNameFromId($item->id)); } // delete gallery $id = $gallery->get('id'); if (!is_numeric($id)) { return false; } $query = "DELETE FROM #__rsgallery2_galleries WHERE id = {$id}"; echo "<br>deleting gallery {$id}"; $database->setQuery($query); if (!$database->query()) { echo $database->error(); } // Delete permissions here $rsgAccess->deletePermissions($id); } }
/** * @todo this alternate gallery view needs to be moved to an html file and added as a template parameter */ function _showBox($kids, $subgalleries) { ?> <div class="rsg_box_block"> <?php $i = 0; foreach ($kids as $kid) { $i++; if ($i > 3) { $i = 1; } ?> <div class="rsg_box_box_<?php echo $i; ?> "> <div class="rsg_galleryblock"> <div> <div class="rsg2-galleryList-status"><?php echo $kid->status; ?> </div> <?php echo $kid->galleryName; ?> <sup><span class='rsg2-galleryList-newImages'><?php echo galleryUtils::newImages($kid->get('id')); ?> </span></sup> <div class='rsg2-galleryList-totalImages'>(<?php echo galleryUtils::getFileCount($kid->get('id')) . JText::_(' Images'); ?> )</div> </div> <div> <div class="rsg2-galleryList-thumb_box"> <?php echo $kid->thumbHTML; ?> </div> <div class="rsg2-galleryList-text_box"> <?php echo $this->_showGalleryDetails($kid); ?> </div> </div> <div class="rsg2-galleryList-description_box"> <?php echo $kid->description; ?> </div> <div class="rsg_sub_url"><?php $this->_subGalleryList($kid); ?> </span> </div> </div> </div> <?php } ?> </div> <?php }
/** * Creates the initial permission list for the specified gallery * $param int Gallery ID * @return boolean True if succesfull, false if not. */ function createDefaultPermissions($gallery_id) { $database =& JFactory::getDBO(); $parent_id = galleryUtils::getParentId($gallery_id); $sql = "INSERT INTO {$this->_table} " . "(gallery_id, parent_id) VALUES " . "('{$gallery_id}','{$parent_id}')"; $database->setQuery($sql); if ($database->query()) { return true; } else { return false; } }
function showComments($item_id) { global $database; // Get the current JUser object $user =& JFactory::getUser(); $deleteComment = false; // user is admin or super admin and can delete the comment if ($user->get('gid') > 22) { $deleteComment = true; ?> <script type="text/javascript"> //<![CDATA[ function delComment(id, item_id, catid) { var delCom = confirm('<?php echo JText::_("Delete Comment"); ?> ' + id ); if (delCom) { window.location = '<?php echo JRoute::_("index.php?option=com_rsgallery2&rsgOption=rsgComments&task=delete", false); ?> &id='+id+'&item_id='+item_id+'&catid='+catid; } } //]]> </script> <?php } $comments = rsgComments::_getList($item_id); if (count($comments) > 0) { ?> <div id="comment"> <table width="100%" class="comment_table"> <tr> <td class="title" width="25%"><?php echo JText::_('Comments'); ?> </td> <td class="title" width="50%"><?php echo JText::_('comments added'); ?> </td> <td class="title"><div class="addcomment"><a class="special" href="#comment2"><?php echo JText::_('Add Comment'); ?> </a></div></td> </tr> </table> <br /> </div> <?php foreach ($comments as $comment) { $catid = galleryUtils::getCatIdFromFileId($comment['item_id']); ?> <div id="comment"> <table width="100%" class="comment_table"> <tr> <td colspan="2" class="title"><span class='posttitle'><?php echo $comment['subject']; ?> </span></td> </tr> <tr> <td valign="top" width="100"><span class="postusername"><?php echo $comment['user_name']; ?> </span></td></td> <td valign="top" class="content_area"> <?php echo JHTML::_("date", $comment['datetime']); ?> <hr /> <?php echo rsgComments::parse($comment['comment']); ?> <?php if ($deleteComment) { ?> <div style="float:right;"><a href="javascript:void(0);" onclick="javascript:delComment(<?php echo $comment['id']; ?> , <?php echo $comment['item_id']; ?> , <?php echo $catid; ?> );"><?php echo JText::_('Delete Comment'); ?> </a></div> <?php } ?> </td> </tr> </table> <br /> </div> <?php } } else { ?> <div id="comment"> <table width="100%" class="comment_table"> <tr> <td class="title"><span class='posttitle'><?php echo JText::_('No comments yet!'); ?> </span></td> </tr> </table> </div> <?php } }
function showResults($result, $searchtext) { global $rsgConfig; html_rsg2_search::showSearchBox(); //Format number of hits $count = count($result); $count = "<span style=\"font-weight:bold;\">" . $count . "</span>"; ?> <table width="100%" style="border-bottom: thin solid #CCCCCC;"> <tr> <td><div align="right"><a href="index.php?option=com_rsgallery2"><?php echo JText::_('Main gallery page'); ?> </a></div></td> </tr> <tr> <td><h3><?php echo JText::_('RSGallery2 Search Results'); ?> </h3></td> </tr> <tr> <td> <span style="font-style:italic;"> <?php echo JText::_('There are ') . $count . JText::_(' results for '); ?> <span style="font-weight:bold;";><?php echo $searchtext; ?> </span> <span> </td> </tr> </table> <br /> <?php if ($result) { foreach ($result as $match) { ?> <table width="100%" border="0" style="border-bottom: thin solid #CCCCCC;"> <tr> <td width="<?php echo $rsgConfig->get('thumb_width'); ?> "> <div class="img-shadow"> <a href="index.php?option=com_rsgallery2&page=inline&id=<?php echo $match->item_id; ?> "> <img border="0" src="<?php echo JURI_SITE . $rsgConfig->get('imgPath_thumb') . "/" . imgUtils::getImgNameThumb($match->itemname); ?> " alt="image" /> </a> </div> </td> <td valign="top"> <a href="index.php?option=com_rsgallery2&page=inline&id=<?php echo $match->item_id; ?> "> <span style="font-weight:bold;"><?php echo galleryUtils::highlight_keywords($match->title, $searchtext); ?> </span> </a> <p><?php echo galleryUtils::highlight_keywords($match->descr, $searchtext); ?> </p> <p style="color: #999999;font-size:10px;"> [<?php echo JText::_('Gallery name'); ?> :<a href="<?php echo JRoute::_("index.php?option=com_rsgallery2&gid=" . $match->gallery_id); ?> "><?php echo $match->name; ?> </a>] <?php if ($match->userid > 0) { echo "[" . JText::_('Owner') . ": " . galleryUtils::genericGetUsername($match->userid) . "]"; } ?> </p> </td> </tr> </table> <br /> <?php } } }
// Create HTML for image: get the url (with/without watermark) with img attributes if ($displayType == 1) { // *** display ***: $watermark = $rsgConfig->get('watermark'); //$imageUrl = $watermark ? waterMarker::showMarkedImage( $ItemIdxName ) : imgUtils::getImgDisplayPath( $ItemIdxName ); $imageUrl = $watermark ? waterMarker::showMarkedImage($ItemIdxName) : imgUtils::getImgDisplay($ItemIdxName); $HTML = '<img class="rsg2-displayImage" src="' . $imageUrl . '" alt="' . $ItemIdxName . '" title="' . $ItemIdxName . '" ' . $imgAttributes . '/>'; } elseif ($displayType == 2) { // *** original *** $watermark = $rsgConfig->get('watermark'); //$imageOriginalUrl = $watermark ? waterMarker::showMarkedImage( $ItemIdxName, 'original' ) : imgUtils::getImgOriginalPath( $ItemIdxName ); $imageOriginalUrl = $watermark ? waterMarker::showMarkedImage($ItemIdxName, 'original') : imgUtils::getImgOriginal($ItemIdxName); $HTML = '<img class="rsg2-displayImage" src="' . $imageOriginalUrl . '" alt="' . $ItemIdxName . '" title="' . $ItemIdxName . '" ' . $imgAttributes . '/>'; } else { // *** thumb *** $HTML = galleryUtils::getThumb($gallery->get('id'), $imageHeight, $imageWidth, "mod_rsgallery2_latest_galleries_img"); // thumbid, height, width, class } $name = $gallery->name; $date = $gallery->date; // Show it ?> <div class="mod_rsgallery2_latest_galleries_attributes" <?php echo $divAttributes; ?> > <div class="mod_rsgallery2_latest_galleries-cell"> <a href="<?php echo $gallery->url; ?> ">
/** * Used in the consolidate database function * Creates images based on an image id or an image name */ function regenerateImage() { global $mainframe; global $rsgConfig; $database =& JFactory::getDBO(); //Check if id or name is set if (isset($_REQUEST['id'])) { $id = rsgInstance::getInt('id', null); $name = galleryUtils::getFileNameFromId($id); } elseif (isset($_REQUEST['name'])) { $name = rsgInstance::getVar('name', null); } else { $mainframe->redirect("index2.php?option=com_rsgallery2&task=batchupload", JText::_('No fileinformation found. This should never happen!')); } //Just for readability of code $original = JPATH_ORIGINAL . '/' . $name; $display = JPATH_DISPLAY . '/' . imgUtils::getImgNameDisplay($name); $thumb = JPATH_THUMB . '/' . imgUtils::getImgNameThumb($name); if (file_exists($original)) { //Check if display image exists, if not make it. if (!file_exists($display)) { imgUtils::makeDisplayImage($original, NULL, $rsgConfig->get('image_width')); } if (!file_exists($thumb)) { imgUtils::makeThumbImage($original); } } else { if (file_exists($display)) { copy($display, $original); } if (!file_exists($thumb)) { imgUtils::makeThumbImage($display); } } }
function saveCat() { global $rsgConfig, $mainframe; $my = JFactory::getUser(); $database = JFactory::getDBO(); //If gallery creation is disabled, unauthorized attempts die here. if (!$rsgConfig->get('uu_createCat')) { die("User category creation is disabled by administrator."); } //Set redirect URL $redirect = JRoute::_("index.php?option=com_rsgallery2&rsgOption=myGalleries", false); $parent = rsgInstance::getVar('parent', 0); $id = rsgInstance::getInt('catid', null); $catname1 = rsgInstance::getstring('catname1', null); $description = rsgInstance::getVar('description', null, 'post', 'string', JREQUEST_ALLOWRAW); $published = rsgInstance::getInt('published', 0); $ordering = rsgInstance::getInt('ordering', null); $maxcats = $rsgConfig->get('uu_maxCat'); //escape strings for sql query $alias = $database->getEscaped(JFilterOutput::stringURLSafe($catname1)); $catname1 = $database->getEscaped($catname1); $description = $database->getEscaped($description); if ($id) { $database->setQuery("UPDATE #__rsgallery2_galleries SET " . "name = '{$catname1}', " . "description = '{$description}', " . "published = '{$published}', " . "parent = '{$parent}' " . "WHERE id = '{$id}' "); if ($database->query()) { $mainframe->redirect($redirect, JText::_('Gallery details updated!')); } else { $mainframe->redirect($redirect, JText::_('Could not update gallery details!')); } } else { //New category $userCatTotal = galleryUtils::userCategoryTotal($my->id); if (!isset($parent)) { $parent = 0; } if ($userCatTotal >= $maxcats) { ?> <script type="text/javascript"> //<![CDATA[ alert('<?php echo JText::_('MAX_USERCAT_ALERT'); ?> '); location = '<?php echo JRoute::_("index.php?option=com_rsgallery2&page=my_galleries", false); ?> '; //]]> </script> <?php //$mainframe->redirect( $redirect ,JText::_('MAX_USERCAT_ALERT')); } else { //Create ordering, start at last position $database->setQuery("SELECT MAX(ordering) FROM #__rsgallery2_galleries WHERE uid = '{$my->id}'"); $ordering = $database->loadResult() + 1; //Insert into database $database->setQuery("INSERT INTO #__rsgallery2_galleries " . "(name, description, alias, ordering, parent, published, user, uid, date) VALUES " . "('{$catname1}','{$description}','{$alias}','{$ordering}','{$parent}','{$published}','1' ,'{$my->id}', now())"); if ($database->query()) { //Create initial permissions for this gallery $database->setQuery("SELECT id FROM #__rsgallery2_galleries WHERE name = '{$catname1}' LIMIT 1"); $gallery_id = $database->loadResult(); $acl = new rsgAccess(); if ($acl->createDefaultPermissions($gallery_id)) { $mainframe->redirect($redirect, JText::_('New gallery created!')); } } else { $mainframe->redirect($redirect, JText::_('ALERT_NONEWCAT')); } } } //$mainframe->redirect( $redirect ); }