Ok, well it's early, but I was focussing on function s_print_title_desc(), and noticed on line 120...
if (isset($title)&&strlen($title)>0)
... is lacking a space after the '&&' so it should be
if (isset($title) && strlen($title)>0)
in order to meet both criteria?
Just a guess, but I know this function is the issue, or at least I think it is.