function flickr_sets_menu in Flickr 5
Same name and namespace in other branches
- 6 sets/flickr_sets.module \flickr_sets_menu()
- 7 sets/flickr_sets.module \flickr_sets_menu()
Implementation of hook_menu().
File
- sets/
flickr_sets.module, line 8
Code
function flickr_sets_menu($may_cache) {
global $user;
$items = array();
if ($may_cache) {
}
else {
if (arg(0) == 'flickr' && is_numeric(arg(1)) && arg(1) > 0) {
$account = user_load(array(
'uid' => arg(1),
));
if ($account !== FALSE && isset($account->flickr['nsid'])) {
$nsid = $account->flickr['nsid'];
$admin_access = user_access('administer flickr');
// let a user view their own account or all if they have permission
$view_access |= user_access('view own flickr photos') && $user->uid == arg(1) || user_access('view all flickr photos');
// Only admins can view blocked accounts
$view_access &= $account->status || $admin_access;
//flickr user set page
$items[] = array(
'path' => 'flickr/' . arg(1) . '/sets',
'title' => t("Sets"),
'type' => MENU_LOCAL_TASK,
'callback' => 'flickr_sets_photosets',
'callback arguments' => array(
arg(1),
$nsid,
),
'access' => $view_access,
);
$items[] = array(
'path' => 'flickr/' . arg(1) . '/sets/list',
'title' => t("List"),
'type' => MENU_DEFAULT_LOCAL_TASK,
'access' => $view_access,
);
if (arg(3) != NULL && arg(2) == 'sets') {
$set_info = flickr_photoset_get_info(arg(3));
if ($set_info !== FALSE) {
$items[] = array(
'path' => 'flickr/' . arg(1) . '/sets/' . arg(3),
// Don't check_plain because flickr does it for us.
'title' => t("Set: !setname", array(
'!setname' => $set_info['title']['_content'],
)),
'type' => MENU_LOCAL_TASK,
'callback' => 'flickr_sets_photoset',
'callback arguments' => array(
arg(1),
$nsid,
arg(3),
$set_info,
),
'access' => $view_access,
);
}
}
}
}
}
return $items;
}