/[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.3, Thu Oct 15 05:52:59 2009 UTC revision 1.1.2.4, Thu Oct 15 06:42:35 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2    
3  function api_file_redirect() {  function api_file_redirect() {
4      $branches = api_get_branches();
5      $branch = $branches[variable_get('api_default_branch', NULL)];
6    
7    $args = func_get_args();    $args = func_get_args();
8    $suffix = '';    $suffix = '';
9    $file = new StdClass();    $file = new StdClass();
10    $file->object_type = 'file';    $file->object_type = 'file';
11    $file->branch_name = db_result(db_query("SELECT branch_name FROM {api_branch} WHERE branch_id = %d", variable_get('api_default_branch', NULL)));    $file->branch_name = $branch->branch_name;
12    
13    $end = count($args) - 1;    $end = count($args) - 1;
14    if (in_array($args[$end], array('source', 'documentation'))) {    if (in_array($args[$end], array('source', 'documentation'))) {
15      $suffix = '/' . $args[$end];      $suffix = '/' . $args[$end];
16      $end -= 1;      $end -= 1;
17    }    }
18    if (db_result(db_query("SELECT 1 FROM {api_branch} WHERE branch_name = '%s'", $args[$end]))) {    foreach ($branches as $b) {
19      $file->branch_name = $args[$end];      if ($b->branch_name === $args[$end]) {
20      $end -= 1;        $branch = $b;
21          $file->branch_name = $args[$end];
22          $end -= 1;
23          break
24        }
25    }    }
26    $file->object_name = implode('/', array_slice($args, 0, $end + 1));    $file->object_name = implode('/', array_slice($args, 0, $end + 1));
27    
28    drupal_goto(api_url($file) . $suffix);    drupal_goto(api_url($branch, $file) . $suffix);
29  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.2