initial fixes; make compatible with Debian/Ubuntu php5 settings (<? to <?php); fix library includes, missing relative paths; fix handling of mail_id; check for existence of object members before trying to use them; fixed pagenation query;