if (!($admin->is_authenticated() && $admin->get_permission('outputfilter_dashboard', 'module'))) {
     $aJsonRespond['message'] = 'insuficcient rights';
     exit(json_encode($aJsonRespond));
 }
 // Sanitize variables
 $action = $admin->add_slashes($_POST['action']);
 if ($action == "updatePosition") {
     $i = array();
     $i_keys = array();
     foreach (opf_get_types() as $type => $typename) {
         $i[$type] = 1;
         $i_keys[] = $type;
     }
     foreach ($aRows as $recID) {
         $id = $admin->checkIDKEY($recID, 0, 'key', true);
         $filter = opf_get_data($id);
         $type = $filter['type'];
         // now we sanitize array
         $qstring = "UPDATE `" . TABLE_PREFIX . "mod_outputfilter_dashboard`" . " SET `position` = '" . $i[$type] . "'" . " WHERE `id` = " . intval($id) . " ";
         if (!opf_db_run_query($qstring)) {
             $aJsonRespond['success'] = false;
             $aJsonRespond['message'] = 'db query failed: ' . opf_db_get_error();
             $aJsonRespond['icon'] = 'cancel.gif';
             exit(json_encode($aJsonRespond));
         }
         $i[$type]++;
     }
 } else {
     $aJsonRespond['message'] = 'wrong arguments "$action"';
     exit(json_encode($aJsonRespond));
 }
    require_once WB_PATH . '/include/pclzip/pclzip.lib.php';
}
global $LANG;
$export_ok = FALSE;
$temp_dir = WB_PATH . MEDIA_DIRECTORY . '/opf_plugins/';
$temp_link = WB_URL . MEDIA_DIRECTORY . '/opf_plugins/';
$plugin_dir = dirname(__FILE__) . '/plugins/';
$temp_name = uniqid(mt_rand(1000, 9999));
$text_failed = $LANG['MOD_OPF']['TXT_EXPORT_FAILED_PLUGIN'];
// check write permissions
if (!is_writable($temp_dir)) {
    $export_message = sprintf($text_failed, $LANG['MOD_OPF']['TXT_WRITE_DENIED'], $temp_dir);
    return FALSE;
}
// get filter-data
if (!($filter = opf_get_data($id))) {
    $export_message = sprintf($text_failed, $LANG['MOD_OPF']['TXT_NO_FILTER']);
    return FALSE;
}
$filter['desc'] = unserialize($filter['desc']);
$filter['modules'] = unserialize($filter['modules']);
$filter['additional_values'] = unserialize($filter['additional_values']);
$filter['additional_fields'] = unserialize($filter['additional_fields']);
$filter['additional_fields_languages'] = unserialize($filter['additional_fields_languages']);
// update additional_fields: copy data from additional_values to additional_fields
if (is_array($filter['additional_fields'])) {
    foreach ($filter['additional_fields'] as $i => $f) {
        $filter['additional_fields'][$i]['value'] = $filter['additional_values'][$filter['additional_fields'][$i]['variable']];
    }
}
unset($filter['additional_values'], $filter['id'], $filter['position'], $filter['pages'], $filter['pages_parent']);