function rex_uninstall_addon($addons, $addonname, $regenerate_addons = true)
{
    global $REX, $I18N;
    $state = true;
    $uninstall_file = $REX['INCLUDE_PATH'] . "/addons/{$addonname}/uninstall.inc.php";
    if (is_readable($uninstall_file)) {
        include $uninstall_file;
        // Wurde das "uninstall" Flag gesetzt, oder eine Fehlermeldung ausgegeben? Wenn ja, Abbruch
        if (OOAddon::isInstalled($addonname) || !empty($REX['ADDON']['installmsg'][$addonname])) {
            $state = $I18N->msg('addon_no_uninstall', $addonname) . '<br/>';
            if (empty($REX['ADDON']['installmsg'][$addonname])) {
                $state .= $I18N->msg('addon_no_reason');
            } else {
                $state .= $REX['ADDON']['installmsg'][$addonname];
            }
        } else {
            $state = rex_deactivate_addon($addons, $addonname);
            if ($state === true && $regenerate_addons) {
                // regenerate Addons file
                $state = rex_generateAddons($addons);
            }
        }
    } else {
        $state = $I18N->msg("addon_uninstall_not_found");
    }
    return $state;
}
Пример #2
0
function rex_setup_addons($uninstallBefore = false, $installDump = true)
{
    global $REX, $I18N;
    require_once $REX['INCLUDE_PATH'] . '/functions/function_rex_addons.inc.php';
    $state = true;
    $addonErr = '';
    $ADDONS = rex_read_addons_folder();
    foreach ($REX['SYSTEM_ADDONS'] as $systemAddon) {
        if ($state === true && $uninstallBefore) {
            $state = rex_uninstall_addon($ADDONS, $systemAddon);
        }
        if ($state === true && !OOAddon::isInstalled($systemAddon)) {
            $state = rex_install_addon($ADDONS, $systemAddon, $installDump);
        }
        if ($state === true && !OOAddon::isActivated($systemAddon)) {
            $state = rex_activate_addon($ADDONS, $systemAddon);
        }
        if ($state !== true) {
            $addonErr .= '<li>' . $systemAddon . '<ul><li>' . $state . '</li></ul></li>';
        }
    }
    if ($addonErr != '') {
        $addonErr = '<ul>
                   <li>
                     <h3>' . $I18N->msg('setup_011', '<span class="rex-error">', '</span>') . '</h3>
                     <ul>' . $addonErr . '</ul>
                   </li>
                 </ul>';
    }
    return $addonErr;
}
/**
* Schreibt Addoneigenschaften in die Datei include/addons.inc.php
* @param array Array mit den Namen der Addons aus dem Verzeichnis addons/
*/
function rex_generateAddons($ADDONS, $debug = false)
{
    global $REX;
    natsort($ADDONS);
    $content = "// --- DYN\n\n";
    foreach ($ADDONS as $cur) {
        if (!OOAddon::isInstalled($cur)) {
            $REX['ADDON']['install'][$cur] = 0;
        }
        if (!OOAddon::isActivated($cur)) {
            $REX['ADDON']['status'][$cur] = 0;
        }
        $content .= "\$REX['ADDON']['install']['{$cur}'] = " . $REX['ADDON']['install'][$cur] . ";\n" . "\$REX['ADDON']['status']['{$cur}'] = " . $REX['ADDON']['status'][$cur] . ";\n\n";
    }
    $content .= "// --- /DYN";
    $file = $REX['INCLUDE_PATH'] . "/addons.inc.php";
    // Sichergehen, dass die Datei existiert und beschreibbar ist
    if (is_writable($file)) {
        if (!($h = fopen($file, "r"))) {
            return 'Konnte Datei "' . $file . '" nicht lesen';
        }
        $fcontent = fread($h, filesize($file));
        $fcontent = ereg_replace("(\\/\\/.---.DYN.*\\/\\/.---.\\/DYN)", $content, $fcontent);
        fclose($h);
        if (!($h = fopen($file, "w+"))) {
            return 'Konnte Datei "' . $file . '" nicht zum schreiben oeffnen';
        }
        //if (!fwrite($h, $fcontent, strlen($fcontent))) {
        if (!fwrite($h, $fcontent, strlen($fcontent))) {
            return 'Konnte Inhalt nicht in Datei "' . $file . '" schreiben';
        }
        fclose($h);
        // alles ist gut gegangen
        return true;
    } else {
        return 'Datei "' . $file . '" hat keine Schreibrechte';
    }
}
/**
 * Schreibt Addoneigenschaften in die Datei include/addons.inc.php
 *
 * @param array Array mit den Namen der Addons aus dem Verzeichnis addons/
 *
 * @return TRUE bei Erfolg, sonst FALSE
 */
function rex_generateAddons($ADDONS)
{
    global $REX;
    natsort($ADDONS);
    $content = '';
    foreach ($ADDONS as $addon) {
        if (!OOAddon::isInstalled($addon)) {
            OOAddon::setProperty($addon, 'install', 0);
        }
        if (!OOAddon::isActivated($addon)) {
            OOAddon::setProperty($addon, 'status', 0);
        }
        foreach (array('install', 'status') as $prop) {
            $content .= sprintf("\$REX['ADDON']['%s']['%s'] = '%d';\n", $prop, $addon, OOAddon::getProperty($addon, $prop));
        }
        $content .= "\n";
    }
    // Da dieser Funktion öfter pro request aufgerufen werden kann,
    // hier die caches löschen
    clearstatcache();
    $file = $REX['INCLUDE_PATH'] . '/addons.inc.php';
    if (rex_replace_dynamic_contents($file, $content) === false) {
        return 'Datei "' . $file . '" hat keine Schreibrechte';
    }
    return true;
}
function rex_uninstall_addon($addons, $addonname)
{
    global $REX, $I18N;
    $state = true;
    $install_dir = $REX['INCLUDE_PATH'] . '/addons/' . $addonname;
    $uninstall_file = $install_dir . '/uninstall.inc.php';
    $uninstall_sql = $install_dir . '/uninstall.sql';
    if (is_readable($uninstall_file)) {
        require $uninstall_file;
        // Wurde das "uninstall" Flag gesetzt, oder eine Fehlermeldung ausgegeben? Wenn ja, Abbruch
        if (OOAddon::isInstalled($addonname) || !empty($REX['ADDON']['installmsg'][$addonname])) {
            $state = $I18N->msg('addon_no_uninstall', $addonname) . '<br/>';
            if (empty($REX['ADDON']['installmsg'][$addonname])) {
                $state .= $I18N->msg('addon_no_reason');
            } else {
                $state .= $REX['ADDON']['installmsg'][$addonname];
            }
        } else {
            $state = rex_deactivate_addon($addons, $addonname);
            if ($state === true && is_readable($uninstall_sql)) {
                $state = rex_install_dump($uninstall_sql);
                if ($state !== true) {
                    $state = 'Error found in uninstall.sql:<br />' . $state;
                }
            }
            if ($state === true) {
                // regenerate Addons file
                $state = rex_generateAddons($addons);
            }
        }
    } else {
        $state = $I18N->msg("addon_uninstall_not_found");
    }
    // Fehler beim uninstall -> Addon bleibt installiert
    if ($state !== true) {
        $REX['ADDON']['install'][$addonname] = 1;
    }
    return $state;
}
Пример #6
0
 foreach ($ADDONS as $cur) {
     if (OOAddon::isSystemAddon($cur)) {
         $delete = $I18N->msg("addon_systemaddon");
     } else {
         $delete = '<a href="index.php?page=addon&amp;addonname=' . $cur . '&amp;delete=1" onclick="return confirm(\'' . htmlspecialchars($I18N->msg('addon_delete_question', $cur)) . '\');">' . $I18N->msg("addon_delete") . '</a>';
     }
     if (OOAddon::isInstalled($cur)) {
         $install = $I18N->msg("addon_yes") . ' - <a href="index.php?page=addon&amp;addonname=' . $cur . '&amp;install=1">' . $I18N->msg("addon_reinstall") . '</a>';
         $uninstall = '<a href="index.php?page=addon&amp;addonname=' . $cur . '&amp;uninstall=1" onclick="return confirm(\'' . htmlspecialchars($I18N->msg("addon_uninstall_question", $cur)) . '\');">' . $I18N->msg("addon_uninstall") . '</a>';
     } else {
         $install = $I18N->msg("addon_no") . ' - <a href="index.php?page=addon&amp;addonname=' . $cur . '&amp;install=1">' . $I18N->msg("addon_install") . '</a>';
         $uninstall = $I18N->msg("addon_notinstalled");
     }
     if (OOAddon::isActivated($cur)) {
         $status = $I18N->msg("addon_yes") . ' - <a href="index.php?page=addon&amp;addonname=' . $cur . '&amp;activate=0">' . $I18N->msg("addon_deactivate") . '</a>';
     } elseif (OOAddon::isInstalled($cur)) {
         $status = $I18N->msg("addon_no") . ' - <a href="index.php?page=addon&amp;addonname=' . $cur . '&amp;activate=1">' . $I18N->msg("addon_activate") . '</a>';
     } else {
         $status = $I18N->msg("addon_notinstalled");
     }
     echo '
     <tr>
       <td class="rex-icon"><img src="media/addon.gif" alt="' . htmlspecialchars($cur) . '" title="' . htmlspecialchars($cur) . '"/></td>
       <td>' . htmlspecialchars($cur) . ' [<a href="index.php?page=addon&amp;spage=help&amp;addonname=' . $cur . '">?</a>]</td>
       <td>' . $install . '</td>
       <td>' . $status . '</td>
       <td>' . $uninstall . '</td>
       <td>' . $delete . '</td>
     </tr>' . "\n   ";
 }
 echo '</tbody>
Пример #7
0
$this_REX = $REX['VERSION'] . '.' . $REX['SUBVERSION'] . '.' . ($REX['MINORVERSION'] = "1");
if (version_compare($this_REX, $requiered_REX, '<')) {
    $REX['ADDON']['installmsg'][$mypage] = 'Dieses Addon ben&ouml;tigt Redaxo Version ' . $requiered_REX . ' oder h&ouml;her.';
    $REX['ADDON']['install'][$mypage] = 0;
    $do_install = false;
}
// CHECK PHP VERSION
////////////////////////////////////////////////////////////////////////////////
if (intval(PHP_VERSION) < $requiered_PHP) {
    $REX['ADDON']['installmsg'][$mypage] = 'Dieses Addon ben&ouml;tigt mind. PHP ' . $requiered_PHP . '!';
    $REX['ADDON']['install'][$mypage] = 0;
    $do_install = false;
}
// CHECK REQUIERED ADDONS
////////////////////////////////////////////////////////////////////////////////
foreach ($requiered_addons as $a) {
    if (!OOAddon::isInstalled($a)) {
        $REX['ADDON']['installmsg'][$mypage] = '<br />Addon "' . $a . '" ist nicht installiert.  >>> <a href="index.php?page=addon&addonname=' . $a . '&install=1">jetzt installieren</a> <<<';
        $do_install = false;
    } else {
        if (!OOAddon::isAvailable($a)) {
            $REX['ADDON']['installmsg'][$mypage] = '<br />Addon "' . $a . '" ist nicht aktiviert.  >>> <a href="index.php?page=addon&addonname=' . $a . '&activate=1">jetzt aktivieren</a> <<<';
            $do_install = false;
        }
    }
}
// DO INSTALL
////////////////////////////////////////////////////////////////////////////////
if ($do_install) {
    $REX['ADDON']['install'][$mypage] = 1;
}
 function isAvailable($addon)
 {
     return OOAddon::isInstalled($addon) && OOAddon::isActivated($addon);
 }
/**
* Schreibt Addoneigenschaften in die Datei include/addons.inc.php
* @param array Array mit den Namen der Addons aus dem Verzeichnis addons/
*/
function rex_generateAddons($ADDONS, $debug = false)
{
    global $REX;
    natsort($ADDONS);
    $content = "";
    foreach ($ADDONS as $cur) {
        if (!OOAddon::isInstalled($cur)) {
            $REX['ADDON']['install'][$cur] = 0;
        }
        if (!OOAddon::isActivated($cur)) {
            $REX['ADDON']['status'][$cur] = 0;
        }
        $content .= "\$REX['ADDON']['install']['{$cur}'] = " . $REX['ADDON']['install'][$cur] . ";\n" . "\$REX['ADDON']['status']['{$cur}'] = " . $REX['ADDON']['status'][$cur] . ";\n\n";
    }
    // Da dieser Funktion öfter pro request aufgerufen werden kann,
    // hier die caches löschen
    clearstatcache();
    $file = $REX['INCLUDE_PATH'] . "/addons.inc.php";
    if (!rex_replace_dynamic_contents($file, $content)) {
        return 'Datei "' . $file . '" hat keine Schreibrechte';
    }
    return true;
}
Пример #10
0
 }
 if (OOAddon::isInstalled($addon)) {
     $install = $I18N->msg('addon_yes') . ' - <a href="' . $addonurl . 'install=1">' . $I18N->msg('addon_reinstall') . '</a>';
     if (count(OOPlugin::getInstalledPlugins($addon)) > 0) {
         $uninstall = $I18N->msg('plugin_plugins_installed');
         $delete = $I18N->msg('plugin_plugins_installed');
     } else {
         $uninstall = '<a href="' . $addonurl . 'uninstall=1" onclick="return confirm(\'' . htmlspecialchars($I18N->msg('addon_uninstall_question', $addon)) . '\');">' . $I18N->msg('addon_uninstall') . '</a>';
     }
 } else {
     $install = $I18N->msg('addon_no') . ' - <a href="' . $addonurl . 'install=1">' . $I18N->msg('addon_install') . '</a>';
     $uninstall = $I18N->msg('addon_notinstalled');
 }
 if (OOAddon::isActivated($addon)) {
     $status = $I18N->msg('addon_yes') . ' - <a href="' . $addonurl . 'activate=0">' . $I18N->msg('addon_deactivate') . '</a>';
 } elseif (OOAddon::isInstalled($addon)) {
     $status = $I18N->msg('addon_no') . ' - <a href="' . $addonurl . 'activate=1">' . $I18N->msg('addon_activate') . '</a>';
 } else {
     $status = $I18N->msg('addon_notinstalled');
 }
 echo '
         <tr class="rex-addon">
             <td class="rex-icon rex-col-a"><span class="rex-i-element rex-i-addon"><span class="rex-i-element-text">' . htmlspecialchars($addon) . '</span></span></td>
             <td class="rex-col-b">' . htmlspecialchars($addon) . ' [<a href="index.php?page=addon&amp;subpage=help&amp;addonname=' . $addon . '">?</a>]</td>
             <td class="rex-col-c">' . $install . '</td>
             <td class="rex-col-d">' . $status . '</td>
             <td class="rex-col-e">' . $uninstall . '</td>
             <td class="rex-col-f">' . $delete . '</td>
         </tr>' . "\n   ";
 if (OOAddon::isAvailable($addon)) {
     foreach ($PLUGINS[$addon] as $plugin) {
Пример #11
0
$myself = 'seo42';
$myroot = $REX['INCLUDE_PATH'] . '/addons/' . $myself;
$error = array();
// append lang file
$I18N->appendFile($REX['INCLUDE_PATH'] . '/addons/seo42/lang/');
// includes
require_once $REX['INCLUDE_PATH'] . '/addons/seo42/classes/class.seo42_utils.inc.php';
// check redaxo version
if (version_compare($REX['VERSION'] . '.' . $REX['SUBVERSION'] . '.' . $REX['MINORVERSION'], '4.4.1', '<=')) {
    $error[] = $I18N->msg('seo42_install_rex_version');
}
// check for concurrent addons
$disable_addons = array('url_rewrite', 'yrewrite', 'rexseo', 'rexseo42', 'resource_includer');
foreach ($disable_addons as $a) {
    if (OOAddon::isInstalled($a) || OOAddon::isAvailable($a)) {
        $error[] = $I18N->msg('seo42_install_concurrent') . ' ' . $a;
    }
}
// auto install plugins
$returnmsg = seo42_utils::autoInstallPlugins('seo42', array());
// no plugins yet to auto install
if ($returnmsg != '') {
    $error[] = $returnmsg;
}
// setup seo db fields
if (count($error) == 0) {
    $sql = new rex_sql();
    //$sql->debugsql = true;
    // IMPORTANT: if adding/removing db fields here, check also for uninstall.inc.php and seo42_utils::afterDBImport() and seo42::emptySEODataAfterClangAdded()
    $sql->setQuery('ALTER TABLE `' . $REX['TABLE_PREFIX'] . 'article` ADD `seo_title` TEXT, ADD `seo_description` TEXT, ADD `seo_keywords` TEXT, ADD `seo_custom_url` TEXT, ADD `seo_canonical_url` TEXT, ADD `seo_noindex` VARCHAR(1), ADD `seo_ignore_prefix` VARCHAR(1)');
Пример #12
0
    $_SESSION['addonsAsObject'] = $getAddons;
} else {
    // Keine erneute Abfrage an Redaxo.de stellen
    // Array bereits in Session gespeichert
}
//print_r($result);
//print_r($_SESSION['addonsAsObject']);
if (is_array($_SESSION['addonsAsArray'])) {
    foreach (Installer_group_addons_by_id($_SESSION['addonsAsArray']) as $key => $addon) {
        // Damit nur die neueste Version in der Liste erscheint, müssen wir hier
        // noch mal eine Sortierungsfunktion aufrufen
        usort($addon, "cmp");
        $addon_status = '';
        if (OOAddon::isAvailable($addon[0]['addon_key'])) {
            $addon_status = '<img src="media/addons/installer/play.gif" title="Installert und aktiviert" alt="Installiert und aktiviert" />';
        } elseif (OOAddon::isInstalled($addon[0]['addon_key']) && !OOAddon::isActivated($addon[0]['addon_key'])) {
            $addon_status = '<img src="media/addons/installer/pause.gif" title="Installiert, jedoch nicht aktiviert" alt="Nicht aktiviert" />';
        } elseif (Installer_check_if_addon_exists($REX['INCLUDE_PATH'] . "/addons/" . $addon[0]['addon_key'])) {
            $addon_status = '<img src="media/addons/installer/on_server.gif" title="Im AddOn Ordner vorhanden" alt="Im AddOn Ordner vorhanden" />';
        } else {
            $addon_status = '<img src="media/addons/installer/addon.gif" title="Nicht auf Server vorhanden" alt="Nicht auf dem Server" />';
        }
        if (OOAddon::isAvailable($addon[0]['addon_key']) && !OOAddon::getVersion($addon[0]['addon_key'])) {
            $systemVersion = '<img src="media/addons/installer/no_version.gif" title="Versionsangabe in der config.inc.php fehlt" alt="Versionsangabe in der config.inc.php fehlt" />';
        } elseif (!OOAddon::isAvailable($addon[0]['addon_key'])) {
            $systemVersion = '-';
        } else {
            $systemVersion = OOAddon::getVersion($addon[0]['addon_key']);
        }
        $updateAvailable = "";
        if (checkAddonVersion(OOAddon::getVersion($addon[0]['addon_key']), $addon[0]['file_version'])) {
 public static function createWebsite($websiteId)
 {
     global $REX, $I18N, $curAddonCount, $curPluginCount;
     $sql = rex_sql::factory();
     $tablePrefix = rex_website::constructTablePrefix($websiteId);
     $generatedDir = rex_website::constructGeneratedDir($websiteId);
     $mediaDir = rex_website::constructMediaDir($websiteId);
     // init logger
     $logFile = WEBSITE_MANAGER_LOG_DIR;
     $log = KLogger::instance($logFile, KLogger::INFO);
     $log->logInfo('======================================== CREATE WEBSITE WITH ID = ' . $websiteId . ' ========================================');
     // just for security reasons
     if ($websiteId == rex_website::firstId) {
         $log->logError('Website ID = 1 detected --> Exit!');
         echo rex_warning($I18N->msg('website_manager_create_website_security_msg'));
         exit;
     }
     // include custom php file with additional userdefined stuff
     require_once WEBSITE_MANAGER_CUSTOM_DIR . 'create_website.before.inc.php';
     // extension point
     rex_register_extension_point('WEBSITE_BEFORE_CREATED', array('website_id' => $websiteId, 'sql_object' => $sql, 'table_prefix' => $tablePrefix, 'generated_dir' => $generatedDir, 'media_dir' => $mediaDir, 'log_object' => $log));
     // seo42 support
     if (OOAddOn::isAvailable('seo42') && !in_array('seo42', $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons'])) {
         $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons'][] = 'seo42';
     }
     // slice_status support
     if (OOAddOn::isAvailable('slice_status') && !in_array('slice_status', $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons'])) {
         $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons'][] = 'slice_status';
     }
     // ***************************************************************************************************
     // database tables
     // ***************************************************************************************************
     // users (always identical)
     rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . 'user AS SELECT * FROM rex_user');
     // articles (always different)
     rex_website_manager_utils::logQuery($log, $sql, 'CREATE TABLE `' . $tablePrefix . 'article` ( `pid` int(11) NOT NULL  auto_increment, `id` int(11) NOT NULL  , `re_id` int(11) NOT NULL  , `name` varchar(255) NOT NULL  , `catname` varchar(255) NOT NULL  , `catprior` int(11) NOT NULL  , `attributes` text NOT NULL  , `startpage` tinyint(1) NOT NULL  , `prior` int(11) NOT NULL  , `path` varchar(255) NOT NULL  , `status` tinyint(1) NOT NULL  , `createdate` int(11) NOT NULL  , `updatedate` int(11) NOT NULL  , `template_id` int(11) NOT NULL  , `clang` int(11) NOT NULL  , `createuser` varchar(255) NOT NULL  , `updateuser` varchar(255) NOT NULL  , `revision` int(11) NOT NULL  , PRIMARY KEY (`pid`)) ENGINE=MyISAM;');
     rex_website_manager_utils::logQuery($log, $sql, 'CREATE TABLE `' . $tablePrefix . 'article_slice` ( `id` int(11) NOT NULL  auto_increment, `clang` int(11) NOT NULL  , `ctype` int(11) NOT NULL  , `re_article_slice_id` int(11) NOT NULL  ,`value1` text  NULL  , `value2` text NULL  , `value3` text NULL  , `value4` text NULL  , `value5` text NULL  , `value6` text NULL  , `value7` text NULL  , `value8` text NULL  , `value9` text NULL  , `value10` text NULL  , `value11` text NULL  , `value12` text NULL  , `value13` text NULL  , `value14` text NULL  , `value15` text NULL  , `value16` text NULL  , `value17` text NULL  , `value18` text NULL  , `value19` text NULL  , `value20` text NULL  , `file1` varchar(255) NULL  , `file2` varchar(255) NULL  , `file3` varchar(255) NULL  , `file4` varchar(255) NULL  , `file5` varchar(255) NULL  , `file6` varchar(255) NULL  , `file7` varchar(255) NULL  , `file8` varchar(255) NULL  , `file9` varchar(255) NULL  , `file10` varchar(255) NULL  , `filelist1` text NULL  , `filelist2` text NULL  , `filelist3` text NULL  , `filelist4` text NULL  , `filelist5` text NULL  , `filelist6` text NULL  , `filelist7` text NULL  , `filelist8` text NULL  , `filelist9` text NULL  , `filelist10` text NULL  , `link1` varchar(10) NULL  , `link2` varchar(10) NULL  , `link3` varchar(10) NULL  , `link4` varchar(10) NULL  , `link5` varchar(10) NULL  , `link6` varchar(10) NULL  , `link7` varchar(10) NULL  , `link8` varchar(10) NULL  , `link9` varchar(10) NULL  , `link10` varchar(10) NULL  , `linklist1` text NULL  , `linklist2` text NULL  , `linklist3` text NULL  , `linklist4` text NULL  , `linklist5` text NULL  , `linklist6` text NULL  , `linklist7` text NULL  , `linklist8` text NULL  , `linklist9` text NULL  , `linklist10` text NULL  , `php` text NULL  , `html` text NULL  ,`article_id` int(11) NOT NULL  , `modultyp_id` int(11) NOT NULL  , `createdate` int(11) NOT NULL  , `updatedate` int(11) NOT NULL  , `createuser` varchar(255) NOT NULL  , `updateuser` varchar(255) NOT NULL  , `next_article_slice_id` int(11) NULL  , `revision` int(11) NOT NULL  , PRIMARY KEY (`id`,`re_article_slice_id`,`article_id`,`modultyp_id`)) ENGINE=MyISAM;');
     rex_website_manager_utils::logQuery($log, $sql, 'ALTER TABLE ' . $tablePrefix . 'article ADD INDEX `id` (`id`), ADD INDEX `clang` (`clang`), ADD UNIQUE INDEX `find_articles` (`id`, `clang`), ADD INDEX `re_id` (`re_id`);');
     rex_website_manager_utils::logQuery($log, $sql, 'ALTER TABLE ' . $tablePrefix . 'article_slice ADD INDEX `id` (`id`), ADD INDEX `clang` (`clang`), ADD INDEX `re_article_slice_id` (`re_article_slice_id`), ADD INDEX `article_id` (`article_id`), ADD INDEX `find_slices` (`clang`, `article_id`);');
     // clangs
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_clangs']) {
         // identical
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . 'clang AS SELECT * FROM rex_clang');
     } else {
         // different
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE TABLE `' . $tablePrefix . 'clang` ( `id` int(11) NOT NULL  , `name` varchar(255) NOT NULL  , `revision` int(11) NOT NULL  , PRIMARY KEY (`id`)) ENGINE=MyISAM;');
         rex_website_manager_utils::logQuery($log, $sql, 'INSERT INTO `' . $tablePrefix . 'clang` VALUES ("0", "deutsch", 0);');
     }
     // media
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_media']) {
         // identical
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . 'file AS SELECT * FROM rex_file');
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . 'file_category AS SELECT * FROM rex_file_category');
     } else {
         // different
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE TABLE `' . $tablePrefix . 'file` ( `file_id` int(11) NOT NULL  auto_increment, `re_file_id` int(11) NOT NULL  , `category_id` int(11) NOT NULL  , `attributes` text NULL  , `filetype` varchar(255) NULL  , `filename` varchar(255) NULL  , `originalname` varchar(255) NULL  , `filesize` varchar(255) NULL  , `width` int(11) NULL  , `height` int(11) NULL  , `title` varchar(255) NULL  , `createdate` int(11) NOT NULL  , `updatedate` int(11) NOT NULL  , `createuser` varchar(255) NOT NULL  , `updateuser` varchar(255) NOT NULL  , `revision` int(11) NOT NULL  , PRIMARY KEY (`file_id`)) ENGINE=MyISAM;');
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE TABLE `' . $tablePrefix . 'file_category` ( `id` int(11) NOT NULL  auto_increment, `name` varchar(255) NOT NULL  , `re_id` int(11) NOT NULL  , `path` varchar(255) NOT NULL  , `createdate` int(11) NOT NULL  , `updatedate` int(11) NOT NULL  , `createuser` varchar(255) NOT NULL  , `updateuser` varchar(255) NOT NULL  , `attributes` text NULL  , `revision` int(11) NOT NULL  , PRIMARY KEY (`id`,`name`)) ENGINE=MyISAM;');
         rex_website_manager_utils::logQuery($log, $sql, 'ALTER TABLE ' . $tablePrefix . 'file ADD INDEX `re_file_id` (`re_file_id`), ADD INDEX `category_id` (`category_id`);');
         rex_website_manager_utils::logQuery($log, $sql, 'ALTER TABLE ' . $tablePrefix . 'file_category DROP PRIMARY KEY, ADD PRIMARY KEY (`id`), ADD INDEX `re_id` (`re_id`);');
     }
     // modules
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_modules']) {
         // identical
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . 'module AS SELECT * FROM rex_module');
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . 'module_action AS SELECT * FROM rex_module_action');
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . 'action AS SELECT * FROM rex_action');
     } else {
         // different
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE TABLE `' . $tablePrefix . 'module` ( `id` int(11) NOT NULL  auto_increment, `name` varchar(255) NOT NULL  , `category_id` int(11) NOT NULL  , `ausgabe` text NOT NULL  , `eingabe` text NOT NULL  , `createuser` varchar(255) NOT NULL  , `updateuser` varchar(255) NOT NULL  , `createdate` int(11) NOT NULL  , `updatedate` int(11) NOT NULL  , `attributes` text NULL  , `revision` int(11) NOT NULL  , PRIMARY KEY (`id`,`category_id`)) ENGINE=MyISAM;');
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE TABLE `' . $tablePrefix . 'module_action` ( `id` int(11) NOT NULL  auto_increment, `module_id` int(11) NOT NULL  , `action_id` int(11) NOT NULL  , `revision` int(11) NOT NULL  , PRIMARY KEY (`id`)) ENGINE=MyISAM;');
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE TABLE `' . $tablePrefix . 'action` ( `id` int(11) NOT NULL  auto_increment, `name` varchar(255) NOT NULL  , `preview` text NULL  , `presave` text NULL  , `postsave` text NULL  , `previewmode` tinyint(4) NULL  , `presavemode` tinyint(4) NULL  , `postsavemode` tinyint(4) NULL  , `createuser` varchar(255) NOT NULL  , `createdate` int(11) NOT NULL  , `updateuser` varchar(255) NOT NULL  , `updatedate` int(11) NOT NULL  , `revision` int(11) NOT NULL  , PRIMARY KEY (`id`)) ENGINE=MyISAM;');
         rex_website_manager_utils::logQuery($log, $sql, 'ALTER TABLE ' . $tablePrefix . 'module DROP PRIMARY KEY, ADD PRIMARY KEY (`id`), ADD INDEX `category_id` (`category_id`);');
     }
     // templates
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_templates']) {
         // identical
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . 'template AS SELECT * FROM rex_template');
     } else {
         // different
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE TABLE `' . $tablePrefix . 'template` ( `id` int(11) NOT NULL  auto_increment, `label` varchar(255) NULL  , `name` varchar(255) NULL  , `content` text NULL  , `active` tinyint(1) NULL  , `createuser` varchar(255) NOT NULL  , `updateuser` varchar(255) NOT NULL  , `createdate` int(11) NOT NULL  , `updatedate` int(11) NOT NULL  , `attributes` text NULL  , `revision` int(11) NOT NULL  , PRIMARY KEY (`id`)) ENGINE=MyISAM;');
     }
     // meta infos
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_meta_infos']) {
         // identical
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . '62_type AS SELECT * FROM rex_62_type');
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . '62_params AS SELECT * FROM rex_62_params');
     } else {
         // different (addon will be reinstalled)
         if (!in_array('metainfo', $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons'])) {
             $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons'][] = 'metainfo';
         }
     }
     // image types
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_image_types']) {
         // identical
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . '679_types AS SELECT * FROM rex_679_types');
         rex_website_manager_utils::logQuery($log, $sql, 'CREATE VIEW ' . $tablePrefix . '679_type_effects AS SELECT * FROM rex_679_type_effects');
     } else {
         // different (addon will be reinstalled)
         if (!in_array('image_manager', $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons'])) {
             $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons'][] = 'image_manager';
         }
     }
     // ***************************************************************************************************
     // directories
     // ***************************************************************************************************
     $includePath = realpath($REX['HTDOCS_PATH'] . 'redaxo/include/') . DIRECTORY_SEPARATOR;
     $htdocsPath = realpath($REX['HTDOCS_PATH']) . DIRECTORY_SEPARATOR;
     rex_website_manager_utils::logMkDir($log, $includePath . $generatedDir);
     rex_website_manager_utils::logMkDir($log, $includePath . $generatedDir . '/articles');
     rex_website_manager_utils::logMkDir($log, $includePath . $generatedDir . '/files');
     rex_website_manager_utils::logMkDir($log, $includePath . $generatedDir . '/templates');
     if (!$REX['WEBSITE_MANAGER_SETTINGS']['identical_media']) {
         rex_website_manager_utils::logMkDir($log, $htdocsPath . $mediaDir);
     }
     // ***************************************************************************************************
     // addons/plugins
     // ***************************************************************************************************
     $reinstallAddons = $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons'];
     $reinstallPlugins = $REX['WEBSITE_MANAGER_SETTINGS']['reinstall_plugins'];
     // set stuff for new website
     $REX['TABLE_PREFIX'] = $tablePrefix;
     $REX['GENERATED_PATH'] = realpath($REX['HTDOCS_PATH'] . 'redaxo/include/' . $generatedDir);
     // reinstall addons
     for ($curAddonCount = 0; $curAddonCount < count($reinstallAddons); $curAddonCount++) {
         if (OOAddon::isInstalled($reinstallAddons[$curAddonCount])) {
             require_once $REX['INCLUDE_PATH'] . '/addons/' . $reinstallAddons[$curAddonCount] . '/install.inc.php';
             $log->logInfo('[REINSTALL ADDON] ' . $reinstallAddons[$curAddonCount]);
             $sqlFile = $REX['INCLUDE_PATH'] . '/addons/' . $reinstallAddons[$curAddonCount] . '/install.sql';
             if (file_exists($sqlFile)) {
                 $returnValue = rex_install_dump($sqlFile);
                 if ($returnValue) {
                     $log->logInfo('[REINSTALL ADDON SQL DUMP] ' . $sqlFile);
                 } else {
                     $log->logError('[REINSTALL ADDON SQL DUMP] ' . $sqlFile);
                 }
             }
         } else {
             $log->logError('[REINSTALL ADDON] ' . $reinstallAddons[$curAddonCount]);
         }
     }
     // reinstall plugins
     for ($curPluginCount = 0; $curPluginCount < count($reinstallPlugins); $curPluginCount++) {
         $curAddon = '';
         $curPlugin = '';
         $reinstallPluginsArray = explode(WEBSITE_MANAGER_PLUGIN_DELIMITER, $reinstallPlugins[$curPluginCount]);
         if (isset($reinstallPluginsArray[0])) {
             $curAddon = $reinstallPluginsArray[0];
         }
         if (isset($reinstallPluginsArray[1])) {
             $curPlugin = $reinstallPluginsArray[1];
         }
         if ($curAddon != '' && $curPlugin != '' && OOPlugin::isInstalled($curAddon, $curPlugin)) {
             require_once $REX['INCLUDE_PATH'] . '/addons/' . $curAddon . '/plugins/' . $curPlugin . '/install.inc.php';
             $log->logInfo('[REINSTALL PLUGIN] ' . $curPlugin);
             $sqlFile = $REX['INCLUDE_PATH'] . '/addons/' . $curAddon . '/plugins/' . $curPlugin . '/install.sql';
             if (file_exists($sqlFile)) {
                 $returnValue = rex_install_dump($sqlFile);
                 if ($returnValue) {
                     $log->logInfo('[REINSTALL PLUGIN SQL DUMP] ' . $sqlFile);
                 } else {
                     $log->logError('[REINSTALL PLUGIN SQL DUMP] ' . $sqlFile);
                 }
             }
         } else {
             $log->logError('[REINSTALL PLUGIN] ' . $reinstallPlugins[$curPluginCount]);
         }
     }
     // include custom php file with additional userdefined stuff
     require_once WEBSITE_MANAGER_CUSTOM_DIR . 'create_website.after.inc.php';
     // extension point
     rex_register_extension_point('WEBSITE_AFTER_CREATED', array('website_id' => $websiteId, 'sql_object' => $sql, 'table_prefix' => $tablePrefix, 'generated_dir' => $generatedDir, 'media_dir' => $mediaDir, 'log_object' => $log));
     // put back stuff for master website
     $REX['TABLE_PREFIX'] = rex_website::tablePrefix;
     $REX['GENERATED_PATH'] = realpath($REX['HTDOCS_PATH'] . 'redaxo/include/' . rex_website::generatedDir);
 }
Пример #14
0
 $content .= '
     <div class="rex-form-row">
         <p class="rex-form-col-a rex-form-checkbox rex-form-label-right">
             <input class="rex-form-checkbox" id="install-packages-upload-status" type="checkbox" name="upload[status]" value="1" ' . (!$new && $file['status'] ? 'checked="checked" ' : '') . '/>
             <label for="install-packages-upload-status">' . $I18N->msg('install_online') . '</label>
         </p>
     </div>';
 $content .= '
     <div class="rex-form-row">
         <p class="rex-form-col-a rex-form-checkbox rex-form-label-right">
             ' . $hiddenField . '
             <input class="rex-form-checkbox" id="install-packages-upload-upload-file" type="checkbox" name="upload[upload_file]" value="1" ' . ($new ? 'checked="checked" ' : '') . $uploadCheckboxDisabled . '/>
             <label for="install-packages-upload-upload-file">' . $I18N->msg('install_upload_file') . '</label>
         </p>
     </div>';
 if (OOAddon::isInstalled($addonkey) && is_dir(rex_path::addonAssets($addonkey))) {
     $content .= '
     <div class="rex-form-row">
         <p class="rex-form-col-a rex-form-checkbox rex-form-label-right">
             <input class="rex-form-checkbox" id="install-packages-upload-replace-assets" type="checkbox" name="upload[replace_assets]" value="1" ' . ($new ? '' : 'disabled="disabled" ') . '/>
             <label for="install-packages-upload-replace-assets">' . $I18N->msg('install_replace_assets') . '</label>
         </p>
     </div>';
 }
 if (is_dir(rex_path::addon($addonkey, 'tests'))) {
     $content .= '
     <div class="rex-form-row">
         <p class="rex-form-col-a rex-form-checkbox rex-form-label-right">
             <input class="rex-form-checkbox" id="install-packages-upload-ignore-tests" type="checkbox" name="upload[ignore_tests]" value="1" checked="checked"' . ($new ? '' : 'disabled="disabled" ') . '/>
             <label for="install-packages-upload-ignore-tests">' . $I18N->msg('install_ignore_tests') . '</label>
         </p>