/[drupal]/contributions/modules/api/legacy.inc
ViewVC logotype

Diff of /contributions/modules/api/legacy.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.2, Fri Aug 21 07:00:54 2009 UTC revision 1.1.2.3, Thu Oct 15 05:52:59 2009 UTC
# Line 2  Line 2 
2    
3  function api_file_redirect() {  function api_file_redirect() {
4    $args = func_get_args();    $args = func_get_args();
   $branches = api_get_branches();  
5    $suffix = '';    $suffix = '';
6    $file = new StdClass();    $file = new StdClass();
7    $file->object_type = 'file';    $file->object_type = 'file';
8    $file->branch_name = variable_get('api_default_branch', NULL);    $file->branch_name = db_result(db_query("SELECT branch_name FROM {api_branch} WHERE branch_id = %d", variable_get('api_default_branch', NULL)));
9    
10    $end = count($args) - 1;    $end = count($args) - 1;
11    if (in_array($args[$end], array('source', 'documentation'))) {    if (in_array($args[$end], array('source', 'documentation'))) {
12      $suffix = '/' . $args[$end];      $suffix = '/' . $args[$end];
13      $end -= 1;      $end -= 1;
14    }    }
15    if (isset($branches[$args[$end]])) {    if (db_result(db_query("SELECT 1 FROM {api_branch} WHERE branch_name = '%s'", $args[$end]))) {
16      $file->branch_name = $branches[$args[$end]]->branch_name;      $file->branch_name = $args[$end];
17      $end -= 1;      $end -= 1;
18    }    }
19    $file->object_name = implode('/', array_slice($args, 0, $end - 0 + 1));    $file->object_name = implode('/', array_slice($args, 0, $end + 1));
20    
21    drupal_goto(api_url($file) . $suffix);    drupal_goto(api_url($file) . $suffix);
22  }  }

Legend:
Removed from v.1.1.2.2  
changed lines
  Added in v.1.1.2.3

  ViewVC Help
Powered by ViewVC 1.1.2