| 94 | | if ($path = Kohana::find_file('controllers', $controller_path, FALSE)) |
| 95 | | { |
| 96 | | // Set controller name |
| 97 | | self::$controller = $segment; |
| 98 | | |
| 99 | | // Change controller path |
| 100 | | self::$controller_path = $path; |
| 101 | | } |
| 102 | | else |
| 103 | | { |
| 104 | | // Stop searching |
| | 94 | $found = FALSE; |
| | 95 | foreach (Config::include_paths() as $dir) |
| | 96 | { |
| | 97 | // Search within controllers only |
| | 98 | $dir .= 'controllers/'; |
| | 99 | |
| | 100 | if (file_exists($dir.$controller_path) OR file_exists($dir.$controller_path.EXT)) |
| | 101 | { |
| | 102 | // Valid path |
| | 103 | $found = TRUE; |
| | 104 | |
| | 105 | if (is_file($dir.$controller_path.EXT)) |
| | 106 | { |
| | 107 | // Set controller name |
| | 108 | self::$controller = $segment; |
| | 109 | |
| | 110 | // Change controller path |
| | 111 | self::$controller_path = $dir.$controller_path.EXT; |
| | 112 | } |
| | 113 | |
| | 114 | // Skip remaining controller paths |
| | 115 | continue; |
| | 116 | } |
| | 117 | } |
| | 118 | |
| | 119 | if ($found === FALSE) |
| | 120 | { |
| | 121 | // Stop searching, nothing was found |