Fixing typos, code formatting, docs, fixing PHP warnings.
Cleaning whitespaces.
Fixing query.
Fixing category list filtered by session_id see #6837
Minor - format code, white spaces
Adding api_get_path(WEB_CODE_PATH), format code.
Fixing exercise edition.