function get_cats_of_cat($parent_id) { // Returns an array of categorie Objects of all categories which are under the categorie with ihe id $parent_id global $db, $config_vars, $userdata; // get the sql where to limit the query to categories which the user is allowed to view $auth_where = get_allowed_catgroups_where($userdata['user_id'], 'view'); if (!isset($auth_where)) { return; } $sql = "SELECT * FROM " . $config_vars['table_prefix'] . "cats WHERE (parent_id = {$parent_id}) and ({$auth_where})"; if (!($result = $db->sql_query($sql))) { error_report(SQL_ERROR, 'get_cats_of_cat', __LINE__, __FILE__, $sql); } // generate categorie objects for each categorie that is returned by the query while ($row = $db->sql_fetchrow($result)) { $catobj = new categorie(); if ($catobj->generate_from_row($row) != OP_SUCCESSFUL) { return OP_FAILED; } $cat_objects[] = $catobj; } return $cat_objects; }