示例#1
0
$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();
    return true;
});
// delete website (after form submit)