Пример #1
0
    /**
     * Functions shows a warning box above the control panel is something is preventing
     * RSGallery2 from functioning properly
     */
    function writeWarningBox()
    {
        global $rsgConfig;
        require_once JPATH_RSGALLERY2_ADMIN . '/includes/img.utils.php';
        //Detect image libraries
        $html = '';
        $count = 0;
        if (!GD2::detect() and !imageMagick::detect() and !Netpbm::detect()) {
            $html .= "<p style=\"color: #CC0000;font-size:smaller;\"><img src=\"" . JURI_SITE . "/includes/js/ThemeOffice/warning.png\" alt=\"\">&nbsp;" . JText::_('NO_IMGLIBRARY') . "</p>";
        }
        //Check availability and writability of folders
        $folders = array($rsgConfig->get('imgPath_display'), $rsgConfig->get('imgPath_thumb'), $rsgConfig->get('imgPath_original'), '/images/rsgallery', '/media');
        foreach ($folders as $folder) {
            if (file_exists(JPATH_ROOT . $folder) && is_dir(JPATH_ROOT . $folder)) {
                $perms = substr(sprintf('%o', fileperms(JPATH_ROOT . $folder)), -4);
                if (!is_writable(JPATH_ROOT . $folder)) {
                    $html .= "<p style=\"color: #CC0000;font-size:smaller;\"><img src=\"" . JURI_SITE . "/includes/js/ThemeOffice/warning.png\" alt=\"\">&nbsp;<strong>" . JPATH_ROOT . $folder . "</strong> " . JText::_('is NOT writable!') . "({$perms})";
                }
            } else {
                $html .= "<p style=\"color: #CC0000;font-size:smaller;\"><img src=\"" . JURI_SITE . "/includes/js/ThemeOffice/warning.png\" alt=\"\">&nbsp;<strong>" . JPATH_ROOT . $folder . "</strong> " . JText::_('FOLDER_NOTEXIST');
            }
        }
        if ($html !== '') {
            ?>
			<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: 50%;">
			<p style="color: #CC0000;"><?php 
            echo JText::_('The following settings prevent RSGallery2 from working without errors:');
            ?>
</p>
			<?php 
            echo $html;
            ?>
			<p style="color: #CC0000;text-align:right;"><a href="index2.php?option=com_rsgallery2"><?php 
            echo JText::_('Refresh');
            ?>
</a></p>		
			</div>
			<div class='rsg2-clr'>&nbsp;</div>		
			<?php 
        }
    }
Пример #2
0
function showConfig()
{
    global $rsgConfig;
    $langs = array();
    //$imageLib   = array();
    $lists = array();
    // PRE-PROCESS SOME LISTS
    // -- Languages --
    /*
        if ($handle = opendir( JPATH_RSGALLERY2_ADMIN.'/language/' )) {
            $i=0;
            while (false !== ($file = readdir( $handle ))) {
                if (!strcasecmp(substr($file,-4),".php") && $file <> "." && $file <> ".." && strcasecmp(substr($file,-11),".ignore.php")) {
                    //$langs[] = mosHTML::makeOption( substr($file,0,-4) );
                }
            }
        }
        
    
        // sort list of languages
        sort( $langs );
        reset( $langs );
    */
    /**
     * detect available graphics libraries
     * @todo call imgUtils graphics lib detection when it is built
     */
    $graphicsLib = array();
    $result = GD2::detect();
    if ($result) {
        $graphicsLib[] = JHTML::_("select.option", 'gd2', $result);
    } else {
        $graphicsLib[] = JHTML::_("select.option", 'gd2', JText::_('GD2 not detected'));
    }
    $result = ImageMagick::detect();
    if ($result) {
        $graphicsLib[] = JHTML::_("select.option", 'imagemagick', $result);
    } else {
        $graphicsLib[] = JHTML::_("select.option", 'imagemagick', JText::_('ImageMagick not detected'));
    }
    $result = Netpbm::detect();
    if ($result) {
        $graphicsLib[] = JHTML::_("select.option", 'netpbm', $result);
    } else {
        $graphicsLib[] = JHTML::_("select.option", 'netpbm', JText::_('netPBM not detected'));
    }
    $lists['graphicsLib'] = JHTML::_("select.genericlist", $graphicsLib, 'graphicsLib', '', 'value', 'text', $rsgConfig->graphicsLib);
    html_rsg2_config::showconfig($lists);
}
Пример #3
0
 /**
  * generic image resize function
  * @param string full path of source image
  * @param string full path of target image
  * @param int width of target
  * @return true if successfull, false if error
  * @todo only writes in JPEG, this should be given as a user option
  */
 function resizeImage($source, $target, $targetWidth)
 {
     global $rsgConfig;
     switch ($rsgConfig->get('graphicsLib')) {
         case 'gd2':
             return GD2::resizeImage($source, $target, $targetWidth);
             break;
         case 'imagemagick':
             return ImageMagick::resizeImage($source, $target, $targetWidth);
             break;
         case 'netpbm':
             return Netpbm::resizeImage($source, $target, $targetWidth);
             break;
         default:
             JError::raiseNotice('ERROR_CODE', JText::_('INVALID GRAPHICS LIBRARY') . $rsgConfig->get('graphicsLib'));
             return false;
     }
 }