$smarty->assign('msg', tra("File not found ") . $f);
            $smarty->display("error.tpl");
            die;
        }
        // Get file content to string
        $data = @file_get_contents($f);
        if (isset($php_errormsg)) {
            $data .= "ERROR: " . $php_errormsg;
        } else {
            // Should we apply all configured rules or only current one?
            if ($all == 'y') {
                $rules = $integrator->list_rules($repID);
                if (is_array($rules)) {
                    foreach ($rules as $r) {
                        if ($r["ruleID"] !== $ruleID && $r["enabled"]) {
                            $data = $integrator->apply_rule($rep, $r, $data);
                        }
                    }
                }
            }
            // Apply rule (make this rule 'enabled' :)
            $se = $rule["enabled"];
            $rule["enabled"] = 'y';
            $data = $integrator->apply_rule($rep, $rule, $data);
            $rule["enabled"] = $se;
        }
        $smarty->assign_by_ref('preview_data', $data);
    }
}
// Whether some action requested?
if (isset($_REQUEST["action"])) {
		$rep = $integrator->get_repository($repID);
		// Check if file given and present at configured location
		$f = $integrator->get_rep_file($rep, $file);
		if ((substr($rep["path"], 0, 7) != 'http://') && (substr($rep["path"], 0, 8) != 'https://') && !file_exists($f)) {
			$smarty->assign('msg', tra("File not found ") . $f);
			$smarty->display("error.tpl");
			die;
		}
		// Get file content to string
		$data = @file_get_contents($f);
		if (isset($php_errormsg)) $data.= "ERROR: " . $php_errormsg;
		else {
			// Should we apply all configured rules or only current one?
			if ($all == 'y') {
				$rules = $integrator->list_rules($repID);
				if (is_array($rules)) foreach ($rules as $r) if (($r["ruleID"] !== $ruleID) && $r["enabled"]) $data = $integrator->apply_rule($rep, $r, $data);
			}
			// Apply rule (make this rule 'enabled' :)
			$se = $rule["enabled"];
			$rule["enabled"] = 'y';
			$data = $integrator->apply_rule($rep, $rule, $data);
			$rule["enabled"] = $se;
		}
		$smarty->assign_by_ref('preview_data', $data);
	}
}
// Whether some action requested?
if (isset($_REQUEST["action"])) {
	switch ($_REQUEST["action"]) {
		case 'edit':
			if ($ruleID != 0) {