<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

  function RunPreFilter($file = "none") {
    global $base_path, $active_filters;
    $filters = $active_filters;
    while (list($k, $v) = @each($filters)) {
      include_once "$base_path/filters/filter.$v.php";
      call_user_func("filter_$v", 'pre', $file);
    }
  }

  function RunPostFilter($file = "none") {
    global $base_path, $active_filters;
    $filters = array_reverse($active_filters);
    while (list($k, $v) = @each($filters)) {
      include_once "$base_path/filters/filter.$v.php";
      call_user_func("filter_$v", 'post', $file);
    }
    exit;
  }

  function ExecuteFilter($filter) {
    global $base_path;
    include_once "$base_path/filters/filter.$filter.php";
    call_user_func("filter_$filter");
  }


  function AddFilter($filter_name) {
    global $active_filters;
    $active_filters[] = $filter_name;
  }

  function RemoveFilter($filter_name) {
    global $active_filters;
    while (list($k, $v) = @each($active_filters)) {
      if ($v == $filter_name) {
        unset($active_filters[$k]);
      }
    }
    @reset($active_filters);
  }

?>