<?php

/*define('SAVED_NEW', 1);

define('SAVED_UPDATED', 2);

define('SAVED_DELETED', 3);

if (!defined('E_DEPRECATED')) {
  define('E_DEPRECATED', 8192);
}*/

if(file_exists("sites/all/modules/common/database/ConnectionUtil.php")) {
    include_once("sites/all/modules/common/database/ConnectionUtil.php");
    include_once("sites/all/modules/common/database/DBAlias.php");
}

function purify_n_prepare() {
	foreach($_REQUEST as $key=>$value){

        if(is_array($value)) {
            $val1 = array();
            foreach($value as $val) {
                if(!is_null($val) && is_string($val))
	                $val1[] = check_plain($val);
	            else
		            $val1[] = $val;
            }
        } else {
		    if(!is_null($value) && is_string($value) )
			    $val1 = check_plain($value);
	        else
		        $val1 = $value;
        }

		$PREQUEST[check_plain($key)] = $val1;
	}

	if(isset($PREQUEST))
		return $PREQUEST;
	else
		return array();
}


function getUserAgency(){
	global $user;
	return db_result(db_query("SELECT agency FROM user_agency WHERE name = '%s'", $user->name));
}
