function opf_save()
{
    global $database;
    $types = opf_get_types();
    // get values
    $id = opf_fetch_post('id', 0, 'int');
    // id is set from opf_edit_filter() only
    $type = opf_fetch_post('type', '', 'unchanged');
    $name = opf_fetch_post('name', '', 'unchanged');
    $func = opf_fetch_post('func', '', 'unchanged');
    $funcname = opf_fetch_post('funcname', '', 'unchanged');
    $desc = opf_fetch_post('desc', '', 'unchanged');
    $active = opf_fetch_post('active', 0, 'int');
    $modules = opf_fetch_post('modules', array(), 'unchanged');
    //$pages  = opf_fetch_post( 'pages', array(), 'unchanged');
    $pages_parent = opf_fetch_post('pages_parent', array(), 'unchanged');
    $searchres = opf_fetch_post('searchresult', FALSE, 'exists');
    $backend = opf_fetch_post('backend', FALSE, 'exists');
    if ($searchres !== FALSE) {
        $pages_parent[] = '0';
    }
    if ($backend !== FALSE) {
        $pages_parent[] = 'backend';
    }
    // cleanup
    $desc = trim($desc);
    $func = trim($func);
    $name = trim($name);
    $funcname = trim($funcname);
    $type = array_key_exists($type, $types) ? $type : key($types);
    $file = '';
    $additional_values = serialize('');
    // move single-page values from $pages_parent to $pages
    $tmp_pages_parent = $tmp_pages = array();
    foreach ($pages_parent as $pid) {
        if (strpos($pid, 's') === 0) {
            $tmp_pages[] = substr($pid, 1);
        } else {
            $tmp_pages_parent[] = $pid;
        }
    }
    $pages_parent = $tmp_pages_parent;
    $pages = $tmp_pages;
    // add additional data
    $filter_old = array();
    if ($id > 0 && opf_db_query_vars("SELECT TRUE FROM " . TABLE_PREFIX . "mod_outputfilter_dashboard" . " WHERE `id`=%d", $id)) {
        // comes from edit, so fetch old data from DB
        $filter_old = opf_db_query("SELECT *" . " FROM " . TABLE_PREFIX . "mod_outputfilter_dashboard" . " WHERE `id`=%d", $id);
        if (!empty($filter_old)) {
            $filter_old = $filter_old[0];
            $userfunc = $filter_old['userfunc'];
            $plugin = $filter_old['plugin'];
            $allowedit = $filter_old['allowedit'];
            $allowedittarget = $filter_old['allowedittarget'];
            $configurl = $filter_old['configurl'];
            $helppath = unserialize($filter_old['helppath']);
            $csspath = $filter_old['csspath'];
            $file = $filter_old['file'];
        }
    } else {
        // comes from add, add default values for inline-filters
        $userfunc = 1;
        $plugin = '';
        $allowedit = 1;
        $allowedittarget = 1;
        $configurl = '';
        $csspath = '';
        $helppath = array();
    }
    // do we have to handle additional data?
    if ($id > 0 && !empty($filter_old)) {
        // comes from edit, so check additional_fields
        $additional_fields = unserialize($filter_old['additional_fields']);
        if (!empty($additional_fields)) {
            $additional_values = array();
            foreach ($additional_fields as $field) {
                if (isset($_POST[$field['name']])) {
                    if (($field['type'] == 'textarea' || $field['type'] == 'editarea') && is_array($field['value'])) {
                        $a = array();
                        preg_match_all("~^\\s*'(.*?)'\\s*=>\\s*'(.*?)'\\s*,?\\s*\$~ms", opf_fetch_post($field['name'], '', 'unchanged'), $matches, PREG_SET_ORDER);
                        if (isset($matches) && $matches) {
                            foreach ($matches as $match) {
                                $a[$match[1]] = $match[2];
                            }
                        }
                        $additional_values[$field['variable']] = $a;
                    } elseif ($field['type'] == 'array') {
                        $a = array();
                        $i = 0;
                        while (isset($_POST[$field['name']]['k'][$i])) {
                            // we can't use opf_fetch_post() because we need to read from $_POST[$field['name']]['k'][$i]
                            $a[opf_fetch_clean($_POST[$field['name']]['k'][$i], '', 'unchanged', FALSE, TRUE)] = opf_fetch_clean($_POST[$field['name']]['v'][$i], '', 'unchanged', FALSE, TRUE);
                            $i++;
                        }
                        $additional_values[$field['variable']] = $a;
                    } else {
                        $additional_values[$field['variable']] = opf_fetch_post($field['name'], '', 'unchanged');
                    }
                } else {
                    $additional_values[$field['variable']] = FALSE;
                }
            }
        }
    }
    // use old values if we come from edit and allowedit is 0
    if ($id > 0 && !empty($filter_old)) {
        if ($allowedit == 0) {
            $name = $filter_old['name'];
            $funcname = $filter_old['funcname'];
            $func = $filter_old['func'];
            $type = $filter_old['type'];
            $desc = unserialize($filter_old['desc']);
            if ($allowedittarget == 0) {
                $modules = unserialize($filter_old['modules']);
                $pages = unserialize($filter_old['pages']);
                $pages_parent = unserialize($filter_old['pages_parent']);
            }
        }
    }
    // prevent inline-filters from overwriting a different filter with same name
    if ($id == 0) {
        // we come from add-filter
        while (opf_is_registered($name)) {
            $name .= mt_rand(0, 9);
        }
    } else {
        // we come from edit-filter: allow to overwrite old one (same $id)
        if (opf_check_name($id) != $name) {
            while (opf_is_registered($name)) {
                $name .= mt_rand(0, 9);
            }
        }
    }
    // register or update filter
    $res = opf_register_filter(array('id' => $id, 'type' => $type, 'name' => $name, 'func' => $func, 'file' => $file, 'funcname' => $funcname, 'modules' => $modules, 'pages' => $pages, 'pages_parent' => $pages_parent, 'desc' => $desc, 'userfunc' => $userfunc, 'plugin' => $plugin, 'active' => $active, 'allowedit' => $allowedit, 'allowedittarget' => $allowedittarget, 'configurl' => $configurl, 'csspath' => $csspath, 'helppath' => $helppath, 'force' => TRUE, 'filter_installed' => FALSE, 'additional_values' => $additional_values));
    if ($res) {
        if ($id == 0) {
            return $database->getLastInsertId();
        } else {
            return $id;
        }
    }
    return $res;
}
    $file_index = <<<EOD
<?php
@header('HTTP/1.1 301 Moved Permanently',TRUE,301);
exit(header('Location: ../index.php'));
EOD;
    $file_install = <<<EOD
<?php
if(!defined('WB_PATH')) die(header('Location: index.php'));
opf_register_filter({$filter_dump})
// if this fails to import, try the serialized version:
else opf_register_filter('{$filter_ser}', TRUE);

EOD;
    $file_contents = array('plugin_info.php' => $file_info, 'index.php' => $file_index, 'plugin_install.php' => $file_install, 'filter.php' => $filter_func);
    foreach ($file_contents as $file => $contents) {
        if ($fh = fopen($plugin_dir . $plugin_name . '/' . $file, 'wb')) {
            fputs($fh, $contents);
            fclose($fh);
        } else {
            $convert_message = sprintf($text_failed, $LANG['MOD_OPF']['TXT_WRITE_FAILED'], $plugin_dir . $plugin_name . '/' . $file);
            rm_full_dir($plugin_dir . $plugin_name);
            return FALSE;
        }
    }
}
if (opf_register_filter($filter)) {
    $convert_ok = TRUE;
    return TRUE;
} else {
    return FALSE;
}
<?php

/*
plugin_install.php
Copyright (C) 2009 Thomas "thorn" Hornik <*****@*****.**>
This file is part of opf Correct Date Format, a module for Website Baker CMS.
opf Correct Date Format is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
opf Correct Date Format is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with opf Correct Date Format. If not, see <http://www.gnu.org/licenses/>.
*/
// prevent this file from being accessed directly
if (!defined('WB_PATH')) {
    die(header('Location: index.php'));
}
opf_register_filter(array('name' => 'Correct Date Format', 'type' => OPF_TYPE_SECTION, 'funcname' => 'opff_correct_date_format', 'desc' => array('EN' => "Dates like \"Monday, 1st January, 2008\" will be always in English, even if the language is set to e.g. German. This filter will correct those dates to display as expected \"Montag, 1. Januar, 2008\".\nOn a windows host this filter may fail.\nRequires PHP 4.3.3 or higher.\nConfig:\nLocale: Enter a 'locale'-string if the filter doesn't work automatically.\nDate format: Allows to format the Date-strings.", 'DE' => "Datumsangaben, wie \"Monday, 1st January, 2008\" erscheinen immer in englisch, auch wenn als Sprache Deutsch eingestellt ist. Dieser Filter behebt das Problem, und zeigt sie in der Form \"Montag, 1. Januar, 2008\" an.\nM&ouml;glicherweise funktioniert der Filter auf einem Windows-System nicht richtig.\nDer Filter Ben&ouml;tigt PHP 4.3.3 oder h&ouml;her.\nKonfiguration:\nSpracheinstellung: Wenn der Filter nicht automatisch funktioniert, kann hier eine andere 'locale'-Einstellung eingetragen werden.\nDatumsformat: Das gew&uuml;nschte Datumsformat kann beliebig Formatiert werden."), 'modules' => 'download_gallery,news', 'file' => '{OPF:PLUGIN_PATH}/filter.php', 'plugin' => 'correct_date_format', 'active' => 1, 'allowedit' => 0, 'allowedittarget' => 1, 'configurl' => '', 'additional_fields' => array(array('label' => array('EN' => 'Locale', 'DE' => 'Spracheinstellung'), 'variable' => 'locale', 'type' => 'text', 'name' => 'af_locale', 'value' => '', 'style' => 'width: 98%;'), array('label' => array('EN' => 'Date format', 'DE' => 'Datumsformat'), 'variable' => 'date_formats', 'type' => 'array', 'name' => 'af_date_formats', 'value' => array('D M d, Y' => '%a %b %d %Y', 'M d Y' => '%b %d. %Y', 'd M Y' => '%d. %b %Y', 'jS F, Y' => '%e. %B %Y', 'l, jS F, Y' => '%A, %e. %B %Y')))));
<?php

/*
plugin_install.php
Copyright (C) 2010 Thomas "thorn" Hornik <*****@*****.**>, http://nettest.thekk.de
This file is part of opf cache control, a plugin-filter for OutputFilter Dashboard.
opf cache control is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
opf cache control is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.        See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with opf cache control. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('WB_PATH')) {
    die(header('Location: ../../index.php'));
}
opf_register_filter(array('name' => 'Cache Control', 'type' => OPF_TYPE_PAGE_LAST, 'file' => '{OPF:PLUGIN_PATH}/filter.php', 'funcname' => 'opff_cachecontrol', 'desc' => array('EN' => "Prevent Browsers from delivering outdated files (css, js) from it's cache.\nKeep care that this filter is called last!", 'DE' => "Verhindert, dass Browser veralterte CSS- oder JS-Dateien aus ihrem Cache ausliefern.\nAchten Sie darauf, dass dieser Filter als letzter aufgerufen wird!"), 'modules' => 'all', 'plugin' => 'cachecontrol', 'active' => 1, 'allowedit' => 0, 'allowedittarget' => 1, 'configurl' => ''));