/[drupal]/contributions/modules/storm/stormproject/stormproject.module
ViewVC logotype

Diff of /contributions/modules/storm/stormproject/stormproject.module

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

revision 1.8.4.11, Fri Jul 25 08:51:13 2008 UTC revision 1.8.4.12, Fri Aug 1 08:15:10 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: stormproject.module,v 1.8.4.10 2008/07/23 19:37:50 robertogerola Exp $  // $Id: stormproject.module,v 1.8.4.11 2008/07/25 08:51:13 robertogerola Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 123  function stormproject_access_sql($sql, $ Line 123  function stormproject_access_sql($sql, $
123    return storm_rewrite_sql($sql, $where);    return storm_rewrite_sql($sql, $where);
124  }  }
125    
126  function stormproject_storm_rewrite_where_sql($query, $primary_table ='n', $account = NULL) {  function stormproject_storm_rewrite_where_sql($query, $primary_table) {
127    static $conds = array();    static $conds = array();
128    
   if (!$account) {  
     global $user;  
     $account = $user;  
   }  
   
129    if ($conds[$account->uid]) {    if ($conds[$account->uid]) {
130      return $conds[$account->uid];      return $conds[$account->uid];
131    }    }
# Line 145  function stormproject_storm_rewrite_wher Line 140  function stormproject_storm_rewrite_wher
140    
141      $cond = '';      $cond = '';
142      if (user_access('Storm project: view own', $account)) {      if (user_access('Storm project: view own', $account)) {
143        $cond .= "${primary_table}.uid=". $account->uid;        $cond .= " ${primary_table}.uid=". $account->uid;
144      }      }
145      if (user_access('Storm project: view of user organization', $account)) {      if (user_access('Storm project: view of user organization', $account)) {
146        if ($cond) $cond .= ' OR ';        if ($cond) $cond .= ' OR ';
147        $cond .= 'spr1.organization_nid='. $account->stormorganization_nid;        $cond .= ' spr1.organization_nid='. $account->stormorganization_nid;
148      }      }
149      if ($cond) {      if ($cond) {
150        $cond = "WHEN 'stormproject' THEN (SELECT IF($cond,1,0) FROM {stormproject} spr1 WHERE spr1.vid=${primary_table}.vid) ";        $cond = " WHEN 'stormproject' THEN (SELECT IF($cond,1,0) FROM {stormproject} spr1 WHERE spr1.vid=${primary_table}.vid) ";
151      }      }
152      else {      else {
153        $cond = "WHEN 'stormproject' THEN 0 ";        $cond = " WHEN 'stormproject' THEN 0 ";
154      }      }
155    }    }
156    

Legend:
Removed from v.1.8.4.11  
changed lines
  Added in v.1.8.4.12

  ViewVC Help
Powered by ViewVC 1.1.2