Update lib/functions.php

Add findTemplate function which search for a template file starting from the current sub-forum and going up higher in the theme folder hierarchy until it find the template.