| 1 |
<?php |
<?php |
| 2 |
// $Id: stormorganization.module,v 1.11.4.7 2008/07/23 19:37:49 robertogerola Exp $ |
// $Id: stormorganization.module,v 1.11.4.8 2008/07/25 08:51:21 robertogerola Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 107 |
return storm_rewrite_sql($sql, $where); |
return storm_rewrite_sql($sql, $where); |
| 108 |
} |
} |
| 109 |
|
|
| 110 |
function stormorganization_storm_rewrite_where_sql($query, $primary_table ='n', $account = NULL) { |
function stormorganization_storm_rewrite_where_sql($query, $primary_table, $account = NULL) { |
| 111 |
static $conds = array(); |
static $conds = array(); |
| 112 |
|
|
| 113 |
if (!$account) { |
if (!$account) { |
| 133 |
} |
} |
| 134 |
if (user_access('Storm organization: view belonged', $account)) { |
if (user_access('Storm organization: view belonged', $account)) { |
| 135 |
if ($cond) $cond .= ' OR '; |
if ($cond) $cond .= ' OR '; |
| 136 |
$cond .= 'sor1.nid='. $account->stormorganization_nid; |
$cond .= ' sor1.nid='. $account->stormorganization_nid; |
| 137 |
} |
} |
| 138 |
if ($cond) { |
if ($cond) { |
| 139 |
$cond = "WHEN 'stormorganization' THEN (SELECT IF($cond,1,0) FROM {stormorganization} sor1 WHERE sor1.vid=${primary_table}.vid) "; |
$cond = " WHEN 'stormorganization' THEN (SELECT IF($cond,1,0) FROM {stormorganization} sor1 WHERE sor1.vid=${primary_table}.vid) "; |
| 140 |
} |
} |
| 141 |
else { |
else { |
| 142 |
$cond = "WHEN 'stormorganization' THEN 0 "; |
$cond = " WHEN 'stormorganization' THEN 0 "; |
| 143 |
} |
} |
| 144 |
} |
} |
| 145 |
|
|