function opf_unregister_filter($name) { if (!function_exists('opf_unregister_call_uninstall')) { function opf_unregister_call_uninstall($file) { include $file; } } static $old_name = FALSE; $now = time(); $name = opf_check_name($name); if (!$name) { return FALSE; } if ($old_name == $name) { return FALSE; } // prevent usage of opf_unregister_filter() in plugin_uninstall.php $old_name = $name; // check whether $name is in DB if (opf_is_registered($name)) { $pos = opf_get_position($name); $type = opf_get_type($name); // delete plugin-dir if present if ($plugin_dir = opf_db_query_vars("SELECT `plugin` FROM `" . TABLE_PREFIX . "mod_outputfilter_dashboard` WHERE `name`='%s'", $name)) { if ($plugin_dir && file_exists(WB_PATH . '/modules/outputfilter_dashboard/plugins/' . $plugin_dir)) { // uninstall.php present? include it if (file_exists(WB_PATH . '/modules/outputfilter_dashboard/plugins/' . $plugin_dir . '/plugin_uninstall.php')) { opf_unregister_call_uninstall(WB_PATH . '/modules/outputfilter_dashboard/plugins/' . $plugin_dir . '/plugin_uninstall.php'); } opf_io_rmdir(WB_PATH . '/modules/outputfilter_dashboard/plugins/' . $plugin_dir); } } $res = opf_db_run_query("DELETE FROM `" . TABLE_PREFIX . "mod_outputfilter_dashboard` WHERE `name`='%s'", $name); if ($res) { if (opf_db_run_query("UPDATE `" . TABLE_PREFIX . "mod_outputfilter_dashboard` SET `position`=`position`-1\n WHERE `type`='%s' AND `position`>%d", $type, $pos)) { return TRUE; } } } return FALSE; }
function opf_move_down_one($name) { $name = opf_check_name($name); if (!$name) { return FALSE; } $pos = opf_get_position($name); $type = opf_get_type($name); if ($pos !== FALSE && $type !== FALSE) { $max = opf_get_position_max($type); if ($max && $pos < $max) { $pos_new = $pos + 1; return opf_switch_position($type, $pos, $pos_new); } } return FALSE; }