<?php
	class systemEXECUTION {
		public function runQuery($mQuery, $mParams = null) {
			global $systemHandler;
			$systemMySQLi = $systemHandler->loadHandler("MYSQLI");
			$systemSecurity = $systemHandler->loadHandler("SECURITY");
			
			if(is_array($mParams)) {
				foreach($mParams as $mKey => $mValue)
					$mParams[$mKey] = str_replace("{user.id}", $systemHandler->loadHandler("SESSION")->loadSession("USER"), $mValue);
			}
			else if ($mParams == "{user.id}")
				$mParams = $systemHandler->loadHandler("SESSION")->loadSession("USER");
			
			$mParams = $systemSecurity->validateParams($mParams);
			$mQuery = $systemMySQLi->mConnection->query(vsprintf($mQuery, $mParams));
			if(!$mQuery)
				die($systemMySQLi->mConnection->error);
			
			return $mQuery;
		}
	}
?>