<?php

function FUNCTION_INIT() {
	global $thiss, $MENU_INIT;

	$FUNCTION_INIT = (isset($_REQUEST['FUNCTION_INIT']))? $_REQUEST['FUNCTION_INIT'] : null;
	$ARG1 = (isset($_REQUEST['ARG1']))? $_REQUEST['ARG1'] : null;
	$ARG1_VAL = (isset($_REQUEST['ARG1_VAL']))? $_REQUEST['ARG1_VAL'] : null;

	DETECT_TABLE_COLUMN();// TODO: $thiss tworzone na podstawie 'CURRENT_MENU' ustawianej w MENU_INIT, czyli FUNCTION_INIT dziala dla menu z poprzedniego requestu
	if ($_SESSION['DEBUG']) echo "<br>* executing f.FUNCTION_INIT to $FUNCTION_INIT *";
	if ($FUNCTION_INIT) {
		if (!($_SESSION['CURRENT_FUNCTION'] == $FUNCTION_INIT)) {
			$_SESSION['LAST_FUNCTION'] = $_SESSION['CURRENT_FUNCTION'];
			$_SESSION['LAST1_FUNCTION'] = $_SESSION['LAST_FUNCTION'];
		}
		$_SESSION['CURRENT_FUNCTION'] = $FUNCTION_INIT;
	}

	// czy jest róznica w dzialaniu FUNCTION_INIT z GET i POST?
	if (isset($_REQUEST['FUNCTION_INIT'])) {
	    if(!function_exists($_REQUEST['FUNCTION_INIT'])) SEF($_REQUEST['FUNCTION_INIT']);
		$_REQUEST['FUNCTION_INIT']($ARG1, $ARG1_VAL);
		if($_SESSION['DEBUG']) echo "<br>f.FUNCTION_INIT executing function due from _POST[FUNCTION_INIT] = $_REQUEST[FUNCTION_INIT]($ARG1,$ARG1_VAL) *";
	}
	else if ($FUNCTION_INIT) {
		$FUNCTION_INIT($ARG1, $ARG1_VAL);
		// echo "<hr>aaaaaaa $_POST[A_PROBLEM_DESC] $FUNCTION_INIT($ARG1,$ARG1_VAL)<hr>";
		if($_SESSION['DEBUG']) echo "<br>f.FUNCTION_INIT executing function due from not exist _POST[FUNCTION_INIT] - exec: $FUNCTION_INIT($ARG1,$ARG1_VAL) *";
	}
}
