Hi Supun,
I was reading again your proposal. About sql.php, you mention "It needs refactoring and better integration with other scripts calling it." In your suggestions for implementing this, you mention moving code from sql.php to functions in sql.lib.php, functions that will be called from sql.php.
However, for "better integration with other scripts calling it", what do you have in mind? A number of scripts are doing include or include_once of sql.php, so I assume that instead of this, these other scripts will be calling a function located in sql.lib.php?