Example #1
0
    $sql->setWhere('id=' . $redirect_id . ' LIMIT 1');
    if ($sql->delete()) {
        echo rex_info($I18N->msg('seo42_redirect_deleted'));
    } else {
        echo rex_warning($sql->getErrro());
    }
    seo42_utils::updateRedirectsFile(false);
    $func = '';
}
// add or edit redirect (after form submit)
rex_register_extension('REX_FORM_SAVED', function ($params) {
    global $REX;
    $redirectId = seo42_utils::getLastInsertedId($params['sql']);
    $maxAge = intval($REX['ADDON']['seo42']['settings']['redirects_max_age']);
    $createDate = seo42_utils::getDate();
    $expireDate = seo42_utils::getDate($maxAge);
    if (!seo42_utils::redirectsDoExpire()) {
        $expireDate = 0;
    }
    $sql = rex_sql::factory();
    $sql->setDebug(true);
    $sql->setQuery('UPDATE `' . $REX['TABLE_PREFIX'] . 'redirects` SET create_date = "' . $createDate . '", expire_date = "' . $expireDate . '" WHERE id = ' . $redirectId);
    seo42_utils::updateRedirectsFile(false);
    // use exit statement, if you want to debug
    return true;
});
// delete redirect (after form submit)
rex_register_extension('REX_FORM_DELETED', function ($params) {
    global $REX;
    seo42_utils::updateRedirectsFile(false);
    // use exit statement, if you want to debug