| 1 |
<?php |
<?php |
| 2 |
// $Id: stormorganization.module,v 1.9 2008/06/18 15:25:01 robertogerola Exp $ |
// $Id: stormorganization.module,v 1.10 2008/06/23 16:46:35 robertogerola Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 33 |
); |
); |
| 34 |
} |
} |
| 35 |
|
|
|
function stormorganization_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { |
|
|
switch ($op) { |
|
|
case 'view': |
|
|
global $user; |
|
|
if (!stormorganization_access('view', $node, $user)) { |
|
|
$node = NULL; |
|
|
} |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
| 36 |
function stormorganization_access($op, $node, $account) { |
function stormorganization_access($op, $node, $account) { |
| 37 |
if (is_numeric($node)) $node = node_load($node); |
if (is_numeric($node)) $node = node_load($node); |
| 38 |
|
|
| 383 |
|
|
| 384 |
function stormorganization_form_alter(&$form, $form_state, $form_id) { |
function stormorganization_form_alter(&$form, $form_state, $form_id) { |
| 385 |
if ($form_id == 'storm_admin_settings') { |
if ($form_id == 'storm_admin_settings') { |
| 386 |
$s = "SELECT n.nid, n.title FROM {stormorganization} so INNER JOIN {node} n ON so.nid=n.nid WHERE n.status=1 AND n.type='stormorganization' ORDER BY n.title"; |
$s = "SELECT n.nid, n.title FROM {node} AS n INNER JOIN {stormorganization} AS sor ON sor.nid=n.nid WHERE n.status=1 AND n.type='stormorganization' ORDER BY n.title"; |
| 387 |
|
$s = db_rewrite_sql($s); |
| 388 |
$r = db_query(stormorganization_access_sql($s)); |
$r = db_query(stormorganization_access_sql($s)); |
| 389 |
$organizations = array(); |
$organizations = array(); |
| 390 |
while ($organization = db_fetch_object($r)) { |
while ($organization = db_fetch_object($r)) { |