function rex_install_plugin($plugins, $pluginname, $installDump = true)
{
    global $REX, $I18N_COM;
    $state = true;
    $install_dir = rex_plugins_dir() . $pluginname;
    $install_file = $install_dir . '/install.inc.php';
    $install_sql = $install_dir . '/install.sql';
    $config_file = $install_dir . '/config.inc.php';
    // Prüfen des Addon Ornders auf Schreibrechte,
    // damit das Addon später wieder gelöscht werden kann
    $state = rex_is_writable($install_dir);
    if ($state === true) {
        if (is_readable($install_file)) {
            require $install_file;
            // Wurde das "install" Flag gesetzt, oder eine Fehlermeldung ausgegeben? Wenn ja, Abbruch
            $instmsg = OOPlugin::getProperty($pluginname, 'installmsg', '');
            if (!OOPlugin::isInstalled($pluginname) || $instmsg) {
                $state = $I18N_COM->msg('plugin_no_install', $pluginname) . '<br />';
                if ($instmsg == '') {
                    $state .= $I18N_COM->msg('plugin_no_reason');
                } else {
                    $state .= $instmsg;
                }
            } else {
                // check if config file exists
                if (is_readable($config_file)) {
                    if (!OOPlugin::isActivated($pluginname)) {
                        require $config_file;
                    }
                } else {
                    $state = $I18N_COM->msg('plugin_config_not_found');
                }
                if ($installDump === true && $state === true && is_readable($install_sql)) {
                    $state = rex_install_dump($install_sql);
                    if ($state !== true) {
                        $state = 'Error found in install.sql:<br />' . $state;
                    }
                }
                // Installation ok
                if ($state === true) {
                    // regenerate Addons file
                    $state = rex_generatePlugins($plugins);
                }
            }
        } else {
            $state = $I18N_COM->msg('plugin_install_not_found');
        }
    }
    if ($state !== true) {
        OOPlugin::setProperty($pluginname, 'install', 0);
    }
    return $state;
}
/**
 * Addon Funktionen
 * @package redaxo4
 * @version $Id: function_rex_addons.inc.php,v 1.3 2008/02/25 09:51:18 kills Exp $
 */
function rex_install_addon($addons, $addonname, $installDump = true)
{
    global $REX, $I18N;
    $state = true;
    $install_dir = $REX['INCLUDE_PATH'] . '/addons/' . $addonname;
    $install_file = $install_dir . '/install.inc.php';
    $install_sql = $install_dir . '/install.sql';
    $config_file = $install_dir . '/config.inc.php';
    // Prüfen des Addon Ornders auf Schreibrechte,
    // damit das Addon später wieder gelöscht werden kann
    $state = rex_is_writable($install_dir);
    if ($state === true) {
        if (is_readable($install_file)) {
            require $install_file;
            // Wurde das "install" Flag gesetzt, oder eine Fehlermeldung ausgegeben? Wenn ja, Abbruch
            if (!OOAddon::isInstalled($addonname) || !empty($REX['ADDON']['installmsg'][$addonname])) {
                $state = $I18N->msg('addon_no_install', $addonname) . '<br />';
                if ($REX['ADDON']['installmsg'][$addonname] == '') {
                    $state .= $I18N->msg('addon_no_reason');
                } else {
                    $state .= $REX['ADDON']['installmsg'][$addonname];
                }
            } else {
                // check if config file exists
                if (is_readable($config_file)) {
                    if (!OOAddon::isActivated($addonname)) {
                        require $config_file;
                    }
                } else {
                    $state = $I18N->msg('addon_config_not_found');
                }
                if ($installDump === true && $state === true && is_readable($install_sql)) {
                    $state = rex_install_dump($install_sql);
                    if ($state !== true) {
                        $state = 'Error found in install.sql:<br />' . $state;
                    }
                }
                // Installation ok
                if ($state === true) {
                    // regenerate Addons file
                    $state = rex_generateAddons($addons);
                }
            }
        } else {
            $state = $I18N->msg('addon_install_not_found');
        }
    }
    if ($state !== true) {
        $REX['ADDON']['install'][$addonname] = 0;
    }
    return $state;
}
/**
 * Addon Funktionen 
 * @package redaxo3
 * @version $Id: function_rex_addons.inc.php,v 1.2 2005/12/30 09:34:47 kills Exp $
 */
function rex_install_addon($addons, $addonname)
{
    global $REX, $I18N;
    $state = true;
    $install_dir = $REX['INCLUDE_PATH'] . "/addons/{$addonname}";
    $install_file = $install_dir . "/install.inc.php";
    $config_file = $install_dir . "/config.inc.php";
    // Prüfen des Addon Ornders auf Schreibrechte,
    // damit das Addon später wieder gelöscht werden kann
    $state = rex_is_writable($install_dir);
    if ($state === true) {
        if (is_readable($install_file)) {
            include $install_file;
            // Wurde das "install" Flag gesetzt, oder eine Fehlermeldung ausgegeben? Wenn ja, Abbruch
            if (!OOAddon::isInstalled($addonname) || !empty($REX['ADDON']['installmsg'][$addonname])) {
                $state = $I18N->msg("addon_no_install", $addonname) . "<br/>";
                if ($REX['ADDON']['installmsg'][$addonname] == "") {
                    $state .= $I18N->msg("addon_no_reason");
                } else {
                    $state .= $REX['ADDON']['installmsg'][$addonname];
                }
            } else {
                // check if config file exists
                if (is_readable($config_file)) {
                    // skip config if it is a reinstall !
                    if (!OOAddon::isActivated($addonname)) {
                        // if config is broken installation prozess will be terminated -> no install -> no errors in redaxo
                        include $config_file;
                    }
                } else {
                    $state = $I18N->msg("addon_config_not_found");
                }
                // Installation ok
                if ($state === true) {
                    // regenerate Addons file
                    $state = rex_generateAddons($addons);
                }
            }
        } else {
            $state = $I18N->msg("addon_install_not_found");
        }
    }
    return $state;
}
/**
 * Hilfsfunktion zur Installation.
 *
 * @param int $step Installationsschritt
 * @return string
 */
function _a_63_install($step = 0)
{
    global $REX;
    /**
     * init
     */
    $error = '';
    $tmpFolder = $REX['MEDIAFOLDER'] . '/' . $REX['TEMP_PREFIX'] . '/';
    $mediaFolder = $REX['MEDIAFOLDER'] . '/' . $REX['TEMP_PREFIX'] . '/guestbook_63/';
    $cssPathSource = '/addons/guestbook/css/';
    $cssFile = 'guestbook.css';
    static $_a63_checkTabelle = '';
    switch ($step) {
        case 1:
            /**
             * pruefe config/ auf Schreibrechte
             */
            $error = rex_is_writable(dirname(__FILE__) . '/config');
            break;
        case 2:
            /**
             * pruefe config/status.txt auf Schreibrechte
             */
            $error = rex_is_writable(dirname(__FILE__) . '/config/status.txt');
            break;
        case 3:
            /**
             * das addon_framework muss installiert und aktiviert sein
             */
            if (!OOAddon::isAvailable('addon_framework')) {
                $error = 'Required addon "addon_framework" is either not installed or not activated!';
            }
            break;
        case 4:
            // erstelle tmp-Ordner, wenn nicht schon vorhanden
            if (!is_dir($tmpFolder) && !mkdir($tmpFolder)) {
                $error = 'Unable to create folder "' . $tmpFolder . '"';
            }
            @chmod($tmpFolder, $REX['DIRPERM']);
            break;
        case 5:
            // erstelle AddOn-Ordner im tmp-Ordner
            if (!is_dir($mediaFolder) && !mkdir($mediaFolder)) {
                $error = 'Unable to create folder "' . $mediaFolder . '"';
            }
            @chmod($mediaFolder, $REX['DIRPERM']);
            break;
        case 6:
            // kopiere CSS in Mediafolder
            $cssSrc = $REX['INCLUDE_PATH'] . $cssPathSource . $cssFile;
            $cssDst = $mediaFolder . $cssFile;
            if (!file_exists($cssDst) && !copy($cssSrc, $cssDst)) {
                $error = 'Unable to copy file to "' . $cssDst . '"';
            }
            // setze Rechte nach master.inc.php-Vorgabe
            @chmod($cssDst, $REX['FILEPERM']);
            break;
        case 7:
            // Gibt es die GB-Tabelle schon?
            $_a63_checkTabelle = rex_a63_CheckTabelle();
            // SQL wird nur ausgefuehrt, wenn die Tabelle noch nicht in der DB existiert.
            if (!$_a63_checkTabelle) {
                $error = rex_install_dump(dirname(__FILE__) . '/install_tabelle.sql', false);
            }
            break;
        case 8:
            // installiere die benoetigten Module und Aktionen
            // ToDo: eine Ueberpruefung ob die Module und Aktionen schon installiert ist waere notwendig
            // ToDo: aber dazu fehlen noch einige Vorraussetzungen in den Redaxotabellen selbst
            $error = rex_install_dump(dirname(__FILE__) . '/install_moduleaction.sql', false);
            break;
        case 9:
            // DB-Daten installiert? Dann hiermit weiter.
            include dirname(__FILE__) . '/install.php';
            // rex_a63_installAction2Modul(Name des Modules, Name der Action)
            $error = rex_a63_installAction2Modul('Gaestebuch - Eintragsliste', 'Gaestebuch - Eintragsliste StatusPerDatei');
            break;
        default:
            $error = $I18N_A63('Fehler bei der Installation. Kein passender Installationsschritt gefunden.');
            break;
    }
    return $error;
}
Esempio n. 5
0
<?php

/**
 * Backenddashboard Addon
 *
 * @author markus[dot]staab[at]redaxo[dot]de Markus Staab
 * @author <a href="http://www.redaxo.de">www.redaxo.de</a>
 *
 * @package redaxo4
 * @version svn:$Id$
 */
$error = '';
if ($error == '') {
    $file = dirname(__FILE__) . '/settings';
    if (($state = rex_is_writable($file)) !== true) {
        $error = $state;
    }
}
if ($error != '') {
    $REX['ADDON']['installmsg']['be_dashboard'] = $error;
} else {
    $REX['ADDON']['install']['be_dashboard'] = true;
}
 function install($addonName, $installDump = TRUE)
 {
     global $REX;
     $state = TRUE;
     $install_dir = $this->baseFolder($addonName);
     $install_file = $install_dir . 'install.inc.php';
     $install_sql = $install_dir . 'install.sql';
     $config_file = $install_dir . 'config.inc.php';
     $files_dir = $install_dir . 'files';
     // Prüfen des Addon Ornders auf Schreibrechte,
     // damit das Addon später wieder gelöscht werden kann
     $state = rex_is_writable($install_dir);
     if ($state === TRUE) {
         if (is_readable($install_file)) {
             $this->includeInstaller($addonName, $install_file);
             // Wurde das "install" Flag gesetzt?
             // Fehlermeldung ausgegeben? Wenn ja, Abbruch
             $instmsg = $this->apiCall('getProperty', array($addonName, 'installmsg', ''));
             if (!$this->apiCall('isInstalled', array($addonName)) || $instmsg) {
                 $state = $this->I18N('no_install', $addonName) . '<br />';
                 if ($instmsg == '') {
                     $state .= $this->I18N('no_reason');
                 } else {
                     $state .= $instmsg;
                 }
             } else {
                 // check if config file exists
                 if (is_readable($config_file)) {
                     if (!$this->apiCall('isActivated', array($addonName))) {
                         $this->includeConfig($addonName, $config_file);
                     }
                 } else {
                     $state = $this->I18N('config_not_found');
                 }
                 if ($installDump === TRUE && $state === TRUE && is_readable($install_sql)) {
                     $state = rex_install_dump($install_sql);
                     if ($state !== TRUE) {
                         $state = 'Error found in install.sql:<br />' . $state;
                     }
                 }
                 // Installation ok
                 if ($state === TRUE) {
                     // regenerate Addons file
                     $state = $this->generateConfig();
                 }
             }
         } else {
             $state = $this->I18N('install_not_found');
         }
     }
     // Dateien kopieren
     if ($state === TRUE && is_dir($files_dir)) {
         if (!rex_copyDir($files_dir, $this->mediaFolder($addonName), $REX['MEDIAFOLDER'])) {
             $state = $this->I18N('install_cant_copy_files');
         }
     }
     if ($state !== TRUE) {
         $this->apiCall('setProperty', array($addonName, 'install', 0));
     }
     return $state;
 }
Esempio n. 7
0
<?php

/**
 * News Addon 
 * @author fuchs@d-mind.de Jens Fuchs
 * @package redaxo4
 * @version $Id: config.inc.php,v 1.0 2008/02/14 19:22:38 
 */
$config_file = $REX['INCLUDE_PATH'] . '/addons/news/conf/conf.php';
$template_dir = $REX['INCLUDE_PATH'] . '/addons/news/view/templates_c';
if (($state = rex_is_writable($config_file)) !== true) {
    $REX['ADDON']['installmsg']['news'] = 'Das Konfigurationsfile <strong>' . $config_file . '</strong> ist nicht beschreibbar';
    $REX['ADDON']['install']['news'] = 0;
}
if (($state = rex_is_writable($template_dir)) !== true) {
    $REX['ADDON']['installmsg']['news'] = 'Das Verzeichnis <strong>redaxo/include/addons/news/view/templates_c/</strong> ist nicht beschreibbar';
    $REX['ADDON']['install']['news'] = 0;
}
if (intval(PHP_VERSION) < 5) {
    $REX['ADDON']['installmsg']['news'] = 'Dieses Addon ben&ouml;tigt PHP 5!';
    $REX['ADDON']['install']['news'] = 0;
} else {
    $REX['ADDON']['install']['news'] = 1;
}
 * @version $Id class.rex_form.inc.php,v 1.3 2006/09/07 104351 kills Exp $
 */
$testMailer = new rex_mailer();
$fromname = rex_post('fromname', 'string', $testMailer->FromName);
$from = rex_post('from', 'string', $testMailer->From);
$confirmto = rex_post('confirmto', 'string', $testMailer->ConfirmReadingTo);
$mailer = rex_post('mailer', 'string', $testMailer->Mailer);
$host = rex_post('host', 'string', $testMailer->Host);
$charset = rex_post('charset', 'string', $testMailer->CharSet);
$wordwrap = rex_post('wordwrap', 'int', $testMailer->WordWrap);
$encoding = rex_post('encoding', 'string', $testMailer->Encoding);
$priority = rex_post('priority', 'int', $testMailer->Priority);
$message = '';
if (rex_post('btn_save', 'string') != '') {
    $file = $REX['INCLUDE_PATH'] . '/addons/phpmailer/classes/class.rex_mailer.inc.php';
    $message = rex_is_writable($file);
    if ($message === true) {
        $message = $I18N_A93->msg('config_saved_error');
        if ($hdl = fopen($file, 'r')) {
            $file_content = fread($hdl, filesize($file));
            fclose($hdl);
            $template = "// --- DYN\r\n      \$this->From             = '" . $from . "';\r\n      \$this->FromName         = '" . $fromname . "';\r\n      \$this->ConfirmReadingTo = '" . $confirmto . "';\r\n      \$this->Mailer           = '" . $mailer . "';\r\n      \$this->Host             = '" . $host . "';\r\n      \$this->CharSet          = '" . $charset . "';\r\n      \$this->WordWrap         = " . $wordwrap . ";\r\n      \$this->Encoding         = '" . $encoding . "';\r\n      \$this->Priority         = " . $priority . ";\r\n      // --- /DYN";
            $file_content = ereg_replace("(\\/\\/.---.DYN.*\\/\\/.---.\\/DYN)", $template, $file_content);
            if ($hdl = fopen($file, 'w+')) {
                if (fwrite($hdl, $file_content, strlen($file_content))) {
                    $message = $I18N_A93->msg('config_saved_successful');
                    fclose($hdl);
                }
            }
        }
    }
<?php

/**
 * PHPMailer Addon
 *
 * @author markus[dot]staab[at]redaxo[dot]de Markus Staab
 * 
 *
 * @package redaxo4
 * @version $Id: install.inc.php,v 1.1 2008/03/26 13:34:13 kills Exp $
 */
$error = '';
$settings_file = $REX['INCLUDE_PATH'] . '/addons/phpmailer/classes/class.rex_mailer.inc.php';
if (($state = rex_is_writable($settings_file)) !== true) {
    $error = $state;
}
if ($error != '') {
    $REX['ADDON']['installmsg']['phpmailer'] = $error;
} else {
    $REX['ADDON']['install']['phpmailer'] = true;
}
Esempio n. 10
0
    fclose($hdl);
    echo $license;
    echo "</div>";
    echo "<br><br><a href=index.php?page=setup&checkmodus=1&lang={$lang}>&raquo; " . $I18N->msg("setup_006") . "</a><br><br>";
    $checkmodus = 0;
}
// ---------------------------------- MODUS 1 | Versionscheck - Rechtecheck
if ($checkmodus == 1) {
    // -------------------------- VERSIONSCHECK
    if (version_compare(phpversion(), "4.2.0", "<") == 1) {
        $MSG['err'] .= $I18N->msg("setup_010") . "<br>";
    }
    // -------------------------- SCHREIBRECHTE
    $WRITEABLE = array($REX['INCLUDE_PATH'] . "/master.inc.php", $REX['INCLUDE_PATH'] . "/addons.inc.php", $REX['INCLUDE_PATH'] . "/clang.inc.php", $REX['INCLUDE_PATH'] . "/ctype.inc.php", $REX['INCLUDE_PATH'] . "/generated", $REX['INCLUDE_PATH'] . "/generated/articles", $REX['INCLUDE_PATH'] . "/generated/templates", $REX['INCLUDE_PATH'] . "/addons/stats/logs", $REX['INCLUDE_PATH'] . "/generated/files", $REX['INCLUDE_PATH'] . "/addons/import_export/files", $REX['INCLUDE_PATH'] . "/../../files");
    foreach ($WRITEABLE as $item) {
        if (($_msg = rex_is_writable($item)) !== true) {
            $MSG['err'] .= $_msg . "<br>";
        }
    }
}
if ($MSG['err'] == "" && $checkmodus == 1) {
    rex_setuptitle($I18N->msg("setup_step1"));
    echo $I18N->msg("setup_016");
    echo "<br><br><a href=index.php?page=setup&checkmodus=2&lang={$lang}>&raquo; " . $I18N->msg("setup_017") . "</a><br><br>";
} elseif ($MSG['err'] != "") {
    rex_setuptitle($I18N->msg("setup_step1"));
    echo "<b>" . $I18N->msg("setup_headline1") . "</b><br><br>" . $MSG['err'] . "\n                \n                  <br>" . $I18N->msg("setup_018") . "<br><br>\n                  <a href=index.php?page=setup&checkmodus=1&lang={$lang}>&raquo; " . $I18N->msg("setup_017") . "</a><br><br>";
}
// ---------------------------------- MODUS 2 | master.inc.php - Datenbankcheck
if ($checkmodus == 2 && $send == 1) {
    $h = @fopen($REX['INCLUDE_PATH'] . "/master.inc.php", "r");
Esempio n. 11
0
$autoinstall = array('addon_installer', 'modul_installer', 'zip_installer');
$msg = '';
$REX['ADDON']['install']['installer'] = true;
if (!extension_loaded('zLib')) {
    if (!dl('zlib.so')) {
        $REX['ADDON']['install']['installer'] = 0;
        $REX['ADDON']['installmsg']['installer'] = "Dieses Addon benötigt die zLib und kann ohne nicht installiert werden";
    }
} else {
}
if (version_compare(PHP_VERSION, '5.0.0', '>=')) {
} else {
    $REX['ADDON']['install']['installer'] = 0;
    $REX['ADDON']['installmsg']['installer'] = "Dieses Addon benötigt mindestens PHP 5.0.0 (5.3.0 empfohlen) , auf diesem System ist jedoch " . PHP_VERSION . " installiert.";
}
if (!rex_is_writable(dirname(__FILE__) . '/temp/')) {
    $REX['ADDON']['install']['installer'] = 0;
    $REX['ADDON']['installmsg']['installer'] = "Das Verzeichnis /temp/ im Addonverzeichnis hat keine Schreibrechte. Bitte wechsle ins Installer-Verzeichnis und setze die Schreibrechte für das Verzeichnis auf CHMOD 777";
}
// GET ALL ADDONS & PLUGINS
$all_addons = rex_read_addons_folder();
$all_plugins = array();
foreach ($all_addons as $_addon) {
    $all_plugins[$_addon] = rex_read_plugins_folder($_addon);
}
// DO AUTOINSTALL
$pluginManager = new rex_pluginManager($all_plugins, $addonname);
foreach ($autoinstall as $pluginname) {
    // INSTALL PLUGIN
    if (($instErr = $pluginManager->install($pluginname)) !== true) {
        $msg = $instErr;
Esempio n. 12
0
<?php

/**
 * Cronjob Addon
 *
 * @author gharlan[at]web[dot]de Gregor Harlan
 *
 * @package redaxo4
 * @version svn:$Id$
 */
$error = '';
$config_file = $REX['INCLUDE_PATH'] . '/addons/cronjob/config.inc.php';
if (($state = rex_is_writable($config_file)) !== true) {
    $error .= $state;
}
$log_folder = $REX['INCLUDE_PATH'] . '/addons/cronjob/logs/';
if (($state = rex_is_writable($log_folder)) !== true) {
    $error .= $state;
}
if ($error != '') {
    $REX['ADDON']['installmsg']['cronjob'] = $error;
} else {
    $REX['ADDON']['install']['cronjob'] = true;
}