<?php
/**
 * Boot code for TeamBuddy
 */

// General error handling
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");

// Include Francis FW
$dependencies = dirname( __FILE__ ) . '/../../dependencies';
require_once $dependencies . '/Francis/config/boot_francis.php';
Francis_Utils_Config::set( 'path.dependencies', $dependencies );

// Setting application version
Francis_Utils_Config::set( 'version', '212' );
Francis_Utils_Config::set( 'environment', 'DEV' );

// Google Push Notifications
Francis_Utils_Config::set( 'push.gcm.apikey', 'AIzaSyCx2rDPdJPjWEOZqanaBsUZddj3n0j27Sw' );

Francis_Utils_Config::set( 'slack.logWebhook', NULL );



date_default_timezone_set('UTC');

// Global shortcut function
// @todo Replace later
function _lc( $txt, array $params = NULL ) {
    return vsprintf( $txt, $params );
}

/**
 * Strip tags, optionally strip or encode special characters.
 * Useful to avoid XSS attacks
 *
 * @param string $txt
 * @return mixed
 *
 */
function _xss( $txt ) {
    return ( is_string( $txt ) ) ? filter_var( $txt, FILTER_SANITIZE_STRING ) : $txt;
}