| 1 |
<?php |
<?php |
| 2 |
// $Id: photos.module,v 1.2.2.34 2009/03/08 05:40:01 eastcn Exp $ |
// $Id: photos.module,v 1.2.2.35 2009/03/10 02:18:59 eastcn Exp $ |
| 3 |
|
|
| 4 |
//hook_menu |
//hook_menu |
| 5 |
function photos_menu() { |
function photos_menu() { |
| 93 |
'title' => 'Images Management', |
'title' => 'Images Management', |
| 94 |
'page callback' => 'photos_edit_page', |
'page callback' => 'photos_edit_page', |
| 95 |
'page arguments' => array(1), |
'page arguments' => array(1), |
| 96 |
'access callback' => 'node_access', |
'access callback' => '_photos_access', |
| 97 |
'access arguments' => array('update', 1), |
'access arguments' => array('editAlbum', 1), |
| 98 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 99 |
'file' => 'inc/photos.edit.inc', |
'file' => 'inc/photos.edit.inc', |
| 100 |
); |
); |
| 308 |
case 'album': |
case 'album': |
| 309 |
return ($value->type == 'photos') && node_access('view', $value); |
return ($value->type == 'photos') && node_access('view', $value); |
| 310 |
case 'subAlbum': |
case 'subAlbum': |
| 311 |
return _photos_select_sub_album() && variable_get('photos_node_'.$value->type, 0) && node_access('view', $value); |
return variable_get('photos_node_'.$value->type, 0) && node_access('view', $value); |
| 312 |
|
case 'editAlbum': |
| 313 |
|
if($value->type == 'photos'){ |
| 314 |
|
return node_access('delete', $value); |
| 315 |
|
}else{ |
| 316 |
|
return variable_get('photos_node_'.$value->type, 0) && node_access('delete', $value); |
| 317 |
|
} |
| 318 |
case 'imageEdit': |
case 'imageEdit': |
| 319 |
if(!is_object($value)){ |
if(!is_object($value)){ |
| 320 |
$value = db_fetch_object(db_query('SELECT r.format, n.* FROM {node} n INNER JOIN {node_revisions} r ON n.nid = r.nid INNER JOIN {x_image} x ON n.nid = x.pid WHERE x.fid = %d', $value)); |
$value = db_fetch_object(db_query('SELECT r.format, n.* FROM {node} n INNER JOIN {node_revisions} r ON n.nid = r.nid INNER JOIN {x_image} x ON n.nid = x.pid WHERE x.fid = %d', $value)); |
| 401 |
}else{ |
}else{ |
| 402 |
$album = _photos_node_view($node, $node->album['page_display'], 'page'); |
$album = _photos_node_view($node, $node->album['page_display'], 'page'); |
| 403 |
} |
} |
| 404 |
$node->content['album']['#value'] = $album ? $album: ''; |
if($album){ |
| 405 |
|
$node->content['album']['#value'] = '<div class="clear-block">'.$album . '</div>'; |
| 406 |
|
} |
| 407 |
} |
} |
| 408 |
break; |
break; |
| 409 |
case 'validate': |
case 'validate': |
| 465 |
$limit = $node->album[$type.'_viewnum'] ? $node->album[$type.'_viewnum'] :variable_get('photos_display_'.$type.'_viewnum', 10); |
$limit = $node->album[$type.'_viewnum'] ? $node->album[$type.'_viewnum'] :variable_get('photos_display_'.$type.'_viewnum', 10); |
| 466 |
$result = db_query_range('SELECT f.filepath, f.filemime, f.timestamp, f.filename, f.filesize, u.uid, u.name, p.* FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid INNER JOIN {users} u ON f.uid = u.uid WHERE p.pid = %d'. $order, $node->nid, 0, $limit); |
$result = db_query_range('SELECT f.filepath, f.filemime, f.timestamp, f.filename, f.filesize, u.uid, u.name, p.* FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid INNER JOIN {users} u ON f.uid = u.uid WHERE p.pid = %d'. $order, $node->nid, 0, $limit); |
| 467 |
$i = 0; |
$i = 0; |
| 468 |
|
$label = $node->album[$type.'_imagesize'] ? $node->album[$type.'_imagesize'] : variable_get('photos_display_'.$type.'_imagesize', 0); |
| 469 |
while($data = db_fetch_array($result)){ |
while($data = db_fetch_array($result)){ |
| 470 |
$album .= photos_get_info(0, $data, array('href' => 'photos/image/'.$data['fid'], 'label' => $node->album[$type.'_imagesize'] ? $node->album[$type.'_imagesize'] : variable_get('photos_display_'.$type.'_imagesize', 0))); |
$album .= photos_get_info(0, $data, array('href' => 'photos/image/'.$data['fid'], 'label' => $label, 'thickbox' => true, 'pid' => $node->nid)); |
| 471 |
++$i; |
++$i; |
| 472 |
} |
} |
| 473 |
if($i >= $limit) $album .= theme('more_link', url('photos/album/'.$node->nid), t('Album view')); |
if($i >= $limit) $album .= theme('more_link', url('photos/album/'.$node->nid), t('Album view')); |
| 1097 |
if($view['link']){ |
if($view['link']){ |
| 1098 |
$view['href'] = 'photos/image/'.$image['fid']; |
$view['href'] = 'photos/image/'.$image['fid']; |
| 1099 |
} |
} |
| 1100 |
|
if($view['thickbox']){ |
| 1101 |
|
$view['thickbox'] = $image['thumb'][variable_get('photos_display_view_imagesize', false)]; |
| 1102 |
|
} |
| 1103 |
return theme('photos_imagehtml', $image['thumb'][$label], $view); |
return theme('photos_imagehtml', $image['thumb'][$label], $view); |
| 1104 |
} |
} |
| 1105 |
if($image['des']) $image['des'] = check_markup($image['des'], 0, FALSE); |
if($image['des']) $image['des'] = check_markup($image['des'], 0, FALSE); |