The %MACROSCOPIC (DIRICHLET) boundary conditions part of the code for the inlet boundary sets the macroscopic velocity of the flow to the desired inlet profile. The density can be obtained as a function of the known distribution functions (fIn[1,3,5], fIn[4.7.8]) by combining the expressions for the density and the two components of the momentum. It follows a similar procedure for the outlet but setting the density and calculating the macroscopic velocity from the known distribution functions.
Nicolas Delbosc's PhD thesis, section 3.2.5 explains Zou-He boundary conditions. You can find the thesis here: http://etheses.whiterose.ac.uk/13546/1/Thesis_for_web_new.pdf
As far as I am concerned. In LBM boundary condition are imposed over the distribution functions fi() and not over the velocity field Ux,Uy.
Depending on the Lattice array D2Q9, D2Q5, etc, you will need to impose boundary conditions over every involved fi(), that means you will prescribe the values of fi() at every desired border.