示例#1
0
$REX['WEBSITE_MANAGER_REXVARS']['TABLE_PREFIX'] = $REX['TABLE_PREFIX'];
?>

<h2>REX Vars for current Website</h2>
<pre class="rex-code"><?php 
echo rex_website_manager_utils::print_r_pretty($REX['WEBSITE_MANAGER_REXVARS']);
?>
</pre>

<?php 
unset($REX['WEBSITE_MANAGER_REXVARS']);
?>

<h2>Settings</h2>
<pre class="rex-code"><?php 
echo rex_website_manager_utils::print_r_pretty($REX['WEBSITE_MANAGER_SETTINGS']);
?>
</pre>

<h2>create_website.before.inc.php</h2>
<?php 
echo rex_highlight_string(file_get_contents($REX['INCLUDE_PATH'] . '/data/addons/website_manager/custom/create_website.before.inc.php'));
?>

<h2>create_website.after.inc.php</h2>
<?php 
echo rex_highlight_string(file_get_contents($REX['INCLUDE_PATH'] . '/data/addons/website_manager/custom/create_website.after.inc.php'));
?>


<h2>destroy_website.before.inc.php</h2>
示例#2
0
<?php

echo rex_website_manager_utils::getHtmlFromMDFile('UPDATE.md');
示例#3
0
<?php

$func = rex_request('func', 'string');
$website_id = rex_request('website_id', 'int');
// add or edit website (after form submit)
rex_register_extension('REX_FORM_SAVED', function ($params) {
    global $REX;
    // get values from submitted form
    $status = rex_request('status', 'string');
    $formValues = rex_website_manager_utils::getFormValues($params['form'], array('color'));
    $websiteId = rex_website_manager_utils::getLastInsertedId($params['sql']);
    if ($status == 'website_added') {
        // update table prefix in db
        rex_website_manager::updateTablePrefix($websiteId);
        // create website
        rex_website_manager::createWebsite($websiteId);
        // create clang file for clang fix
        if (!$REX['WEBSITE_MANAGER_SETTINGS']['identical_clangs']) {
            rex_website_manager::createClangFile($websiteId);
        }
        // important! without this, seo42 pathlist of master website eventually will become completely empty (404 errors guaranteed ;))
        $REX['WEBSITE_MANAGER']->getMasterWebsite()->generateAll();
    } else {
        // do nothing
    }
    // favicon create/update
    if ($REX['WEBSITE_MANAGER_SETTINGS']['colorize_favicon'] && $formValues['color'] != '') {
        rex_website_manager::createIcon($formValues['color']);
    }
    // update init file to reflect changes
    rex_website_manager::updateInitFile();
示例#4
0
<?php

echo rex_website_manager_utils::getHtmlFromMDFile('CHANGELOG.md');
示例#5
0
<?php

$search = array('(CHANGELOG.md)', '(LICENSE.md)');
$replace = array('(index.php?page=website_manager&subpage=help&chapter=changelog)', '(index.php?page=website_manager&subpage=help&chapter=license)');
echo rex_website_manager_utils::getHtmlFromMDFile('README.md', $search, $replace);
 public static function websiteCreated($params)
 {
     global $REX;
     $log = $params['subject']['log_object'];
     $sourceWebsiteId = $REX['ADDON']['siteclone']['settings']['source_webiste_id'];
     $sourceTablePrefix = $REX['WEBSITE_MANAGER']->getWebsite($sourceWebsiteId)->getTablePrefix();
     $newWebsiteId = $params['subject']['website_id'];
     $newTablePrefix = $params['subject']['table_prefix'];
     $sql = new rex_sql();
     //$sql->debugsql = true;
     // copy structure table data
     if ($REX['ADDON']['siteclone']['settings']['clone_structure']) {
         rex_website_manager_utils::logQuery($log, $sql, 'INSERT INTO `' . $newTablePrefix . 'article` SELECT * FROM ' . $sourceTablePrefix . 'article');
     }
     // copy slices table data
     if ($REX['ADDON']['siteclone']['settings']['clone_slices']) {
         rex_website_manager_utils::logQuery($log, $sql, 'INSERT INTO `' . $newTablePrefix . 'article_slice` SELECT * FROM ' . $sourceTablePrefix . 'article_slice');
     }
     // copy media table data
     if ($REX['ADDON']['siteclone']['settings']['clone_media']) {
         rex_website_manager_utils::logQuery($log, $sql, 'INSERT INTO `' . $newTablePrefix . 'file_category` SELECT * FROM ' . $sourceTablePrefix . 'file_category');
         rex_website_manager_utils::logQuery($log, $sql, 'INSERT INTO `' . $newTablePrefix . 'file` SELECT * FROM ' . $sourceTablePrefix . 'file');
         $src = $REX['FRONTEND_PATH'] . '/' . rex_website::constructMediaDir($sourceWebsiteId);
         $files = glob($src . '/*.*');
         foreach ($files as $file) {
             $targetFile = str_replace(rex_website::constructMediaDir($sourceWebsiteId), rex_website::constructMediaDir($newWebsiteId), $file);
             $logMsg = '[COPY FILE] Source: ' . $file . ' | Target: ' . $targetFile;
             if (copy($file, $targetFile)) {
                 $log->logInfo($logMsg);
             } else {
                 $log->logError($logMsg);
             }
         }
     }
     // copy string table data
     if ($REX['ADDON']['siteclone']['settings']['clone_strings']) {
         rex_website_manager_utils::logQuery($log, $sql, 'INSERT INTO `' . $newTablePrefix . 'string_table` SELECT * FROM ' . $sourceTablePrefix . 'string_table ORDER BY priority');
         // empty string table values
         if ($REX['ADDON']['siteclone']['settings']['empty_strings']) {
             $stringTableFields = $sql->getArray('SELECT * FROM `' . $newTablePrefix . 'string_table` LIMIT 1');
             $values = 'SET value_0 = ""';
             foreach ($stringTableFields[0] as $key => $value) {
                 if (preg_match('/value./', $key)) {
                     if ($key != 'value_0') {
                         $values .= ',' . $key . ' = ""';
                     }
                 }
             }
             rex_website_manager_utils::logQuery($log, $sql, 'UPDATE `' . $newTablePrefix . 'string_table` ' . $values);
         }
     }
     // copy file
     if ($REX['ADDON']['siteclone']['settings']['copy_file'] != '') {
         $sourceFile = str_replace('{id}', $sourceWebsiteId, $REX['ADDON']['siteclone']['settings']['copy_file']);
         $targetFile = str_replace('{id}', $newWebsiteId, $REX['ADDON']['siteclone']['settings']['copy_file']);
         $sourceFile = $REX['FRONTEND_PATH'] . DIRECTORY_SEPARATOR . trim($sourceFile, './');
         $targetFile = $REX['FRONTEND_PATH'] . DIRECTORY_SEPARATOR . trim($targetFile, './');
         $logMsg = '[COPY FILE] Source: ' . $sourceFile . ' | Target: ' . $targetFile;
         if (copy($sourceFile, $targetFile)) {
             $log->logInfo($logMsg);
         } else {
             $log->logError($logMsg);
         }
     }
 }
示例#7
0
$I18N->appendFile($REX['INCLUDE_PATH'] . '/addons/website_manager/lang/');
if (!OOAddon::isActivated('website_manager')) {
    // don't allow uninstall if website manager is not active. otherwise codeline hint msg won't be shown.
    $REX['ADDON']['installmsg']['website_manager'] = $I18N->msg('website_manager_uninstall_activate_first');
    $REX['ADDON']['install']['website_manager'] = 1;
} else {
    if (isset($REX['WEBSITE_MANAGER']) && $REX['WEBSITE_MANAGER']->getWebsiteCount() > 1) {
        // user has to manually delete websites first
        $REX['ADDON']['installmsg']['website_manager'] = $I18N->msg('website_manager_uninstall_delete_generated');
        $REX['ADDON']['install']['website_manager'] = 1;
    } else {
        if (!$REX['WEBSITE_MANAGER_SETTINGS']['allow_uninstall']) {
            // user has manually set this option so we can safly proceed with uninstallation
            $REX['ADDON']['installmsg']['website_manager'] = $I18N->msg('website_manager_uninstall_allow_uninstall');
            $REX['ADDON']['install']['website_manager'] = 1;
        } else {
            if (isset($REX['WEBSITE_MANAGER_DO_UNINSTALL']) && !$REX['WEBSITE_MANAGER_DO_UNINSTALL']) {
                // don't allow uninstall if user still has codeline in master.inc.php
                $REX['ADDON']['installmsg']['website_manager'] = $I18N->msg('website_manager_uninstall_codeline_hint');
                $REX['ADDON']['install']['website_manager'] = 1;
            } else {
                $sql = new rex_sql();
                //$sql->debugsql = true;
                $sql->setQuery('DROP TABLE IF EXISTS `rex_website`');
                rex_website_manager_utils::rrmdir(WEBSITE_MANAGER_DATA_DIR);
                rex_generateAll();
                $REX['ADDON']['install']['website_manager'] = 0;
            }
        }
    }
}
示例#8
0
</label>
							<input type="text" value="<?php 
echo rex_website_manager_utils::implodeArray($REX['WEBSITE_MANAGER_SETTINGS']['reinstall_addons']);
?>
" name="settings[reinstall_addons]" class="rex-form-text tags addon" id="reinstall_addons">
						</p>
					</div>

					<div class="rex-form-row rex-form-element-v1">
						<p class="rex-form-text">
							<label for="reinstall_plugins"><?php 
echo $I18N->msg('website_manager_settings_reinstall_plugins');
?>
</label>
							<input type="text" value="<?php 
echo rex_website_manager_utils::implodeArray($REX['WEBSITE_MANAGER_SETTINGS']['reinstall_plugins']);
?>
" name="settings[reinstall_plugins]" class="rex-form-text tags plugin" id="reinstall_plugins">
						</p>
					</div>

					<div class="rex-form-row rex-form-element-v1">
						<p class="rex-form-checkbox">
							<label for="identical_media"><?php 
echo $I18N->msg('website_manager_settings_identical_media');
?>
</label>
							<input type="hidden" name="settings[identical_media]" value="0" />
							<input <?php 
echo $disabled;
?>
示例#9
0
    }
    if (rex_request('page') != '') {
        // login
        // check permissions (has to be done here because $REX['USER'] is not availabe in master.inc.php)
        $REX['WEBSITE_MANAGER']->checkPermissions();
        // add css/js to page header
        rex_register_extension('PAGE_HEADER', 'rex_website_manager_utils::appendToPageHeader');
        // only website manager addons pages
        if (rex_request('page') == 'website_manager') {
            rex_register_extension('PAGE_HEADER', 'rex_website_manager_utils::appendToPageHeaderOnlyAddonPages');
        }
        if (rex_request('install') != '1') {
            // this shoudn't go off when addon gets installed
            // add website select and other stuff
            rex_register_extension('OUTPUT_FILTER', 'rex_website_manager_utils::addToOutputFilter');
        }
        // frontend link in meta menu
        if ($REX['WEBSITE_MANAGER_SETTINGS']['show_metamenu_frontend_link']) {
            rex_register_extension('META_NAVI', 'rex_website_manager_utils::addFrontendLinkToMetaMenu');
        }
        // fix article preview link
        if (!isset($REX['ADDON']['seo42']['settings']['one_page_mode']) || isset($REX['ADDON']['seo42']['settings']['one_page_mode']) && !$REX['ADDON']['seo42']['settings']['one_page_mode']) {
            rex_register_extension('PAGE_CONTENT_MENU', 'rex_website_manager_utils::fixArticlePreviewLink');
        }
        // fix clang
        rex_register_extension('CLANG_ADDED', 'rex_website_manager::fixClang');
        rex_register_extension('CLANG_DELETED', 'rex_website_manager::fixClang');
    }
    // init sortable rex list with prio switch
    rex_website_manager_utils::initPrioSwitch();
}
示例#10
0
 $msg = array();
 $msg[0] = rex_website_manager_utils::checkDir(WEBSITE_MANAGER_DATA_DIR);
 $msg[1] = rex_website_manager_utils::checkDir(WEBSITE_MANAGER_LOG_DIR);
 $msg[2] = rex_website_manager_utils::checkDir(WEBSITE_MANAGER_CUSTOM_DIR);
 $msg[3] = rex_website_manager_utils::checkDir(WEBSITE_MANAGER_GENERATED_DIR);
 if ($msg[0] != '') {
     rex_warning($msg[0]);
 } elseif ($msg[1] != '') {
     rex_warning($msg[1]);
 } elseif ($msg[2] != '') {
     rex_warning($msg[2]);
 } elseif ($msg[3] != '') {
     rex_warning($msg[3]);
 } else {
     require_once $REX['INCLUDE_PATH'] . '/addons/website_manager/settings.default.inc.php';
     rex_website_manager_utils::includeSettingsFile();
     // will be also creadted if does not exist
     rex_website_manager::updateInitFile();
     rex_website_manager::fixClang(null);
     // copy sutom files
     if (file_exists(WEBSITE_MANAGER_CUSTOM_DIR . 'create_website.before.inc.php')) {
         $copySuccess[0] = true;
     } else {
         $copySuccess[0] = copy($REX['INCLUDE_PATH'] . '/addons/website_manager/install/default.create_website.before.inc.php', WEBSITE_MANAGER_CUSTOM_DIR . 'create_website.before.inc.php');
     }
     if (file_exists(WEBSITE_MANAGER_CUSTOM_DIR . 'create_website.after.inc.php')) {
         $copySuccess[1] = true;
     } else {
         $copySuccess[1] = copy($REX['INCLUDE_PATH'] . '/addons/website_manager/install/default.create_website.after.inc.php', WEBSITE_MANAGER_CUSTOM_DIR . 'create_website.after.inc.php');
     }
     if (file_exists(WEBSITE_MANAGER_CUSTOM_DIR . 'destroy_website.before.inc.php')) {
示例#11
0
<?php

echo rex_website_manager_utils::getHtmlFromMDFile('LICENSE.md');
 public static function destroyWebsite($websiteId)
 {
     global $REX, $I18N;
     $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('======================================== DESTROY 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_destroy_website_security_msg'));
         exit;
     }
     // include custom php file with additional userdefined stuff
     require_once WEBSITE_MANAGER_CUSTOM_DIR . 'destroy_website.before.inc.php';
     // extension point
     rex_register_extension_point('WEBSITE_BEFORE_DESTROYED', array('website_id' => $websiteId, 'sql_object' => $sql, 'table_prefix' => $tablePrefix, 'generated_dir' => $generatedDir, 'media_dir' => $mediaDir, 'log_object' => $log));
     // ***************************************************************************************************
     // database views
     // ***************************************************************************************************
     // users
     rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . 'user');
     // clangs
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_clangs']) {
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . 'clang');
     }
     // media
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_media']) {
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . 'file');
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . 'file_category');
     }
     // modules
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_modules']) {
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . 'module');
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . 'module_action');
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . 'action');
     }
     // templates
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_templates']) {
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . 'template');
     }
     // meta infos
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_meta_infos']) {
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . '62_type');
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . '62_params');
     }
     // image types
     if ($REX['WEBSITE_MANAGER_SETTINGS']['identical_image_types']) {
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . '679_types');
         rex_website_manager_utils::logQuery($log, $sql, 'DROP VIEW ' . $tablePrefix . '679_type_effects');
     }
     // ***************************************************************************************************
     // database tables
     // ***************************************************************************************************
     $tables = $sql->showTables(1, $tablePrefix);
     for ($i = 0; $i < count($tables); $i++) {
         rex_website_manager_utils::logQuery($log, $sql, 'DROP TABLE ' . $tables[$i]);
     }
     // ***************************************************************************************************
     // directories
     // ***************************************************************************************************
     $generatedPath = realpath($REX['HTDOCS_PATH'] . 'redaxo/include/') . DIRECTORY_SEPARATOR . $generatedDir;
     $mediaPath = realpath($REX['HTDOCS_PATH']) . DIRECTORY_SEPARATOR . $mediaDir;
     rex_website_manager_utils::rrmdir($generatedPath);
     if (is_dir($generatedPath)) {
         $log->logError('[REMOVE DIR] ' . $generatedPath);
     } else {
         $log->logInfo('[REMOVE DIR] ' . $generatedPath);
     }
     if (!$REX['WEBSITE_MANAGER_SETTINGS']['identical_media']) {
         rex_website_manager_utils::rrmdir($mediaPath);
         if (is_dir($mediaPath)) {
             $log->logError('[REMOVE DIR] ' . $mediaPath);
         } else {
             $log->logInfo('[REMOVE DIR] ' . $mediaPath);
         }
     }
     // include custom php file with additional userdefined stuff
     require_once WEBSITE_MANAGER_CUSTOM_DIR . 'destroy_website.after.inc.php';
     // extension point
     rex_register_extension_point('WEBSITE_AFTER_DESTROYED', array('website_id' => $websiteId, 'sql_object' => $sql, 'table_prefix' => $tablePrefix, 'generated_dir' => $generatedDir, 'media_dir' => $mediaDir, 'log_object' => $log));
 }