Ejemplo n.º 1
0
function com_install()
{
    $database =& JFactory::getDBO();
    $lang =& JFactory::getLanguage();
    $lang->load('com_rsgallery2');
    require_once JPATH_ADMINISTRATOR . '/components/com_rsgallery2/includes/install.class.php';
    //Initialize install
    $rsgInstall = new rsgInstall();
    //Change the menu icon
    $rsgInstall->changeMenuIcon();
    //Initialize rsgallery migration
    $migrate_com_rsgallery = new migrate_com_rsgallery();
    //If previous version detected
    if ($migrate_com_rsgallery->detect()) {
        // now that we know a previous rsg2 was installed, we need to reload it's config
        global $rsgConfig;
        $rsgConfig = new rsgConfig();
        $rsgInstall->writeInstallMsg(JText::_('Migrating from RSGallery2') . ' ' . $rsgConfig->get('version'), 'ok');
        //Migrate from earlier version
        $result = $migrate_com_rsgallery->migrate();
        if ($result === true) {
            $rsgInstall->writeInstallMsg(JText::_('SUCCESS NOW USING RSGALLERY2') . ' ' . $rsgConfig->get('version'), 'ok');
        } else {
            $result = print_r($result, true);
            $rsgInstall->writeInstallMsg(JText::_('FAILURE-') . "\n<br><pre>{$result}\n</pre>", 'error');
        }
    } else {
        //No earlier version detected, do a fresh install
        $rsgInstall->freshInstall();
    }
}
Ejemplo n.º 2
0
 /**
  * @param string name of variable
  * @return the default value of requested variable
  */
 function getDefault($varname)
 {
     $defaultConfig = new rsgConfig(false);
     return $defaultConfig->get($varname);
 }
Ejemplo n.º 3
0
/**
 * @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'));
    }
}
Ejemplo n.º 4
0
//Set path globals for RSGallery2
define('JPATH_RSGALLERY2_SITE', JPATH_ROOT . '/components/com_rsgallery2');
if (!defined('JPATH_RSGALLERY2_ADMIN')) {
    //might also be defined in router.php is SEF is used
    define('JPATH_RSGALLERY2_ADMIN', JPATH_ROOT . '/administrator/components/com_rsgallery2');
}
define('JPATH_RSGALLERY2_LIBS', JPATH_ROOT . '/components/com_rsgallery2/lib');
$app = JFactory::getApplication();
define('JURI_SITE', $app->isSite() ? JURI::base() : JURI::root());
// check if this file has been included yet.
if (isset($rsgConfig)) {
    return;
}
// initialize the rsg config file
require_once JPATH_RSGALLERY2_ADMIN . '/includes/config.class.php';
$rsgConfig = new rsgConfig();
//Set image paths for RSGallery2
define('JPATH_ORIGINAL', JPATH_ROOT . str_replace('/', DS, $rsgConfig->get('imgPath_original')));
define('JPATH_DISPLAY', JPATH_ROOT . str_replace('/', DS, $rsgConfig->get('imgPath_display')));
define('JPATH_THUMB', JPATH_ROOT . str_replace('/', DS, $rsgConfig->get('imgPath_thumb')));
define('JPATH_WATERMARKED', JPATH_ROOT . str_replace('/', DS, $rsgConfig->get('imgPath_watermarked')));
$rsgOptions_path = JPATH_RSGALLERY2_ADMIN . '/options/';
$rsgClasses_path = JPATH_RSGALLERY2_ADMIN . '/includes/';
require_once JPATH_RSGALLERY2_ADMIN . '/includes/version.rsgallery2.php';
$rsgVersion = new rsgalleryVersion();
//include ACL class
require_once JPATH_RSGALLERY2_ADMIN . '/includes/access.class.php';
$rsgAccess = new rsgAccess();
// include rsgInstance
require_once JPATH_RSGALLERY2_ADMIN . '/includes/instance.class.php';
// require file utilities
Ejemplo n.º 5
0
/**
* This file contains the install class for RSGallery2
* @version $Id: install.class.php 1042 2011-09-19 10:48:06Z mirjam $
* @package RSGallery2
* @copyright (C) 2003 - 2011 RSGallery2
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* RSGallery is Free Software
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
global $rsgConfig;
if (!isset($rsgConfig)) {
    require_once JPATH_ADMINISTRATOR . "/components/com_rsgallery2/includes/config.class.php";
    require_once JPATH_ADMINISTRATOR . "/components/com_rsgallery2/includes/version.rsgallery2.php";
    $rsgVersion = new rsgalleryVersion();
    $rsgConfig = new rsgConfig(false);
    // report all errors if in debug mode
    if ($rsgConfig->get('debug')) {
        error_reporting(E_ALL);
    }
}
/**
* Install class
* @package RSGallery2
* @author Ronald Smit <*****@*****.**>
*/
class rsgInstall
{
    /** @var string RSGallery base directory */
    var $galleryDir;
    /** @var string Directory to hold original image */