<commit_before><?php 
/**
* Sahana front controller, through which all actions are dispatched
*
* PHP version 4 and 5
*
* LICENSE: This source file is subject to LGPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/copyleft/lesser.html
*
* @package    Sahana - http://sahana.sourceforge.net
* @author     http://www.linux.lk/~chamindra
* @copyright  Lanka Software Foundation - http://www.opensource.lk
*/

// === initialize global variables ===

// Find the base location of the Sahana installation
$global['approot']=realpath(dirname(__FILE__)).'/../';

// Initilize action and module global variables
$global['action'] = (NULL == $_REQUEST['act']) ? 
                            "default" : $_REQUEST['act'];
$global['module'] = (NULL == $_REQUEST['mod']) ? 
                            "home" : $_REQUEST['mod'];

// === initialize configuration variables ===
include_once ($global['approot']."conf/config.inc"); 
//TODO: when config is not there we have to setup

include_once ($global['approot']."inc/lib_modules.inc"); 
include ($global['approot']."inc/lib_session/handler_session.inc");
include ($global['approot']."inc/lib_security/authenticate.inc");

shn_front_controller();

// === front controller ===

function shn_front_controller() {
 
    global $global;
    global $conf;
    $approot = $global['approot'];
    $action = $global['action'];
    $module = $global['module'];

    // authenticate user
	$user_data = shn_authenticate_user();

 	if($user_data["user_id"]>0){
		shn_session_change($user_data);
    }
    
    // if (shn_authorized("shn_".$module."_".$action", $user)..
    //    change session
    // error<commit_msg>modified to include database functions<commit_after><?php 
/**
* Sahana front controller, through which all actions are dispatched
*
* PHP version 4 and 5
*
* LICENSE: This source file is subject to LGPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/copyleft/lesser.html
*
* @package    Sahana - http://sahana.sourceforge.net
* @author     http://www.linux.lk/~chamindra
* @copyright  Lanka Software Foundation - http://www.opensource.lk
*/

// === initialize global variables ===

// Find the base location of the Sahana installation
$global['approot']=realpath(dirname(__FILE__)).'/../';

// Initilize action and module global variables
$global['action'] = (NULL == $_REQUEST['act']) ? 
                            "default" : $_REQUEST['act'];
$global['module'] = (NULL == $_REQUEST['mod']) ? 
                            "home" : $_REQUEST['mod'];

// === initialize configuration variables ===
include_once ($global['approot']."conf/config.inc"); 
//TODO: when config is not there we have to setup

include_once ($global['approot']."inc/lib_modules.inc"); 
include ($global['approot']."inc/lib_session/handler_session.inc");
include ($global['approot']."inc/lib_security/authenticate.inc");
require_once($global['approot']."inc/handler_db.inc");

shn_front_controller();

// === front controller ===

function shn_front_controller() {
 
    global $global;
    global $conf;
    $approot = $global['approot'];
    $action = $global['action'];
    $module = $global['module'];

    // authenticate user
	$user_data = shn_authenticate_user();

 	if($user_data["user_id"]>0){
		shn_session_change($user_data);
    }
    
    // if (shn_authorized("shn_".$module."_".$action", $user)..
    //    change session
    // error
{'fraction_non_alphanumeric': 0.1690668202764977, 'fraction_numerical': 0.0017281105990783411, 'mean_word_length': 3.661744966442953, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2856007', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1041, 'n_words': 246}