# HG changeset patch # User Nathan Phillip Brink # Date 2010-10-16 13:44:00 # Node ID 1d32948ffcdb87a082942cf5b69114a2eeb44e48 # Parent 2563473a88be0ef313e7b871c80d024ec946f1ae Fix department auto-complete. diff --git a/auto.php b/auto.php --- a/auto.php +++ b/auto.php @@ -74,14 +74,12 @@ if (!$getsections && count($term_parts) if (!file_exists($dept_file)) clean_empty_exit(); $departments = unserialize(file_get_contents($dept_file)); + $json_depts = array(); foreach ($departments as $key => $department) - { - if (!strncmp($department, $dept, $dept_strlen)) - $departments[$key] = $department; - else - unset($departments[$key]); - } - echo json_encode($departments); + if (!strncmp($department, $dept, $dept_strlen)) + $json_depts[] = $department; + + echo json_encode($json_depts); exit(0); }