本文整理汇总了PHP中photos_albums_list函数的典型用法代码示例。如果您正苦于以下问题:PHP photos_albums_list函数的具体用法?PHP photos_albums_list怎么用?PHP photos_albums_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了photos_albums_list函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: photos_content
function photos_content(&$a)
{
// URLs:
// photos/name
// photos/name/album/xxxxx (xxxxx is album name)
// photos/name/image/xxxxx
if (get_config('system', 'block_public') && !local_channel() && !remote_channel()) {
notice(t('Public access denied.') . EOL);
return;
}
$unsafe = array_key_exists('unsafe', $_REQUEST) && $_REQUEST['unsafe'] ? 1 : 0;
require_once 'include/bbcode.php';
require_once 'include/security.php';
require_once 'include/conversation.php';
if (!x($a->data, 'channel')) {
notice(t('No photos selected') . EOL);
return;
}
$ph = photo_factory('');
$phototypes = $ph->supportedTypes();
$_SESSION['photo_return'] = $a->cmd;
//
// Parse arguments
//
$can_comment = perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'post_comments');
if (argc() > 3) {
$datatype = argv(2);
$datum = argv(3);
} else {
if (argc() > 2) {
$datatype = argv(2);
$datum = '';
} else {
$datatype = 'summary';
}
}
if (argc() > 4) {
$cmd = argv(4);
} else {
$cmd = 'view';
}
//
// Setup permissions structures
//
$can_post = false;
$visitor = 0;
$owner_uid = $a->data['channel']['channel_id'];
$owner_aid = $a->data['channel']['channel_account_id'];
$observer = $a->get_observer();
$can_post = perm_is_allowed($owner_uid, $observer['xchan_hash'], 'write_storage');
$can_view = perm_is_allowed($owner_uid, $observer['xchan_hash'], 'view_storage');
if (!$can_view) {
notice(t('Access to this item is restricted.') . EOL);
return;
}
$sql_extra = permissions_sql($owner_uid);
$o = "";
$o .= "<script> var profile_uid = " . $a->profile['profile_uid'] . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
// tabs
$_is_owner = local_channel() && local_channel() == $owner_uid;
$o .= profile_tabs($a, $_is_owner, $a->data['channel']['channel_address']);
/**
* Display upload form
*/
if ($can_post) {
$uploader = '';
$ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'], 'addon_text' => $uploader, 'default_upload' => true);
call_hooks('photo_upload_form', $ret);
/* Show space usage */
$r = q("select sum(size) as total from photo where aid = %d and scale = 0 ", intval($a->data['channel']['channel_account_id']));
$limit = service_class_fetch($a->data['channel']['channel_id'], 'photo_upload_limit');
if ($limit !== false) {
$usage_message = sprintf(t("%1\$.2f MB of %2\$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000);
} else {
$usage_message = sprintf(t('%1$.2f MB photo storage used.'), $r[0]['total'] / 1024000);
}
if ($_is_owner) {
$channel = $a->get_channel();
$acl = new AccessList($channel);
$channel_acl = $acl->get();
$lockstate = $acl->is_private() ? 'lock' : 'unlock';
}
$aclselect = $_is_owner ? populate_acl($channel_acl, false) : '';
$selname = $datum ? hex2bin($datum) : '';
$albums = array_key_exists('albums', $a->data) ? $a->data['albums'] : photos_albums_list($a->data['channel'], $a->data['observer']);
if (!$selname) {
$def_album = get_pconfig($a->data['channel']['channel_id'], 'system', 'photo_path');
if ($def_album) {
$selname = filepath_macro($def_album);
$albums['album'][] = array('text' => $selname);
}
}
$tpl = get_markup_template('photos_upload.tpl');
$upload_form = replace_macros($tpl, array('$pagename' => t('Upload Photos'), '$sessid' => session_id(), '$usage' => $usage_message, '$nickname' => $a->data['channel']['channel_address'], '$newalbum_label' => t('Enter an album name'), '$newalbum_placeholder' => t('or select an existing album (doubleclick)'), '$visible' => array('visible', t('Create a status post for this upload'), 0, '', array(t('No'), t('Yes'))), '$albums' => $albums['albums'], '$selname' => $selname, '$permissions' => t('Permissions'), '$aclselect' => $aclselect, '$lockstate' => $lockstate, '$uploader' => $ret['addon_text'], '$default' => $ret['default_upload'] ? true : false, '$uploadurl' => $ret['post_url'], '$submit' => t('Submit')));
}
//
// dispatch request
//
/*
* Display a single photo album
//.........这里部分代码省略.........
示例2: api_albums
function api_albums(&$a, $type)
{
json_return_and_die(photos_albums_list($a->get_channel(), $a->get_observer()));
}
示例3: embedphotos_album_list
function embedphotos_album_list($a)
{
$o = '';
require_once 'include/photos.php';
$p = photos_albums_list(\App::get_channel(), \App::get_observer());
if ($p['success']) {
return $p['albums'];
} else {
return null;
}
}
示例4: photos_album_widget
function photos_album_widget($channelx, $observer, $sortkey = 'album', $direction = 'asc')
{
$o = '';
if (array_key_exists('albums', App::$data)) {
$albums = App::$data['albums'];
} else {
$albums = photos_albums_list($channelx, $observer, $sortkey, $direction);
}
if ($albums['success']) {
$o = replace_macros(get_markup_template('photo_albums.tpl'), array('$nick' => $channelx['channel_address'], '$title' => t('Photo Albums'), '$albums' => $albums['albums'], '$baseurl' => z_root(), '$upload' => perm_is_allowed($channelx['channel_id'], $observer ? $observer['xchan_hash'] : '', 'write_storage') ? t('Upload New Photos') : ''));
}
return $o;
}
示例5: photos_content
function photos_content(&$a)
{
// URLs:
// photos/name
// photos/name/upload
// photos/name/upload/xxxxx (xxxxx is album name)
// photos/name/album/xxxxx
// photos/name/album/xxxxx/edit
// photos/name/image/xxxxx
// photos/name/image/xxxxx/edit
if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
notice(t('Public access denied.') . EOL);
return;
}
require_once 'include/bbcode.php';
require_once 'include/security.php';
require_once 'include/conversation.php';
if (!x($a->data, 'channel')) {
notice(t('No photos selected') . EOL);
return;
}
$ph = photo_factory('');
$phototypes = $ph->supportedTypes();
$_SESSION['photo_return'] = $a->cmd;
//
// Parse arguments
//
$can_comment = perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'post_comments');
if (argc() > 3) {
$datatype = argv(2);
$datum = argv(3);
} elseif (argc() > 2 && argv(2) === 'upload') {
$datatype = 'upload';
} else {
$datatype = 'summary';
}
if (argc() > 4) {
$cmd = argv(4);
} else {
$cmd = 'view';
}
//
// Setup permissions structures
//
$can_post = false;
$visitor = 0;
$owner_uid = $a->data['channel']['channel_id'];
$owner_aid = $a->data['channel']['channel_account_id'];
$observer = $a->get_observer();
$can_post = perm_is_allowed($owner_uid, $observer['xchan_hash'], 'post_photos');
$can_view = perm_is_allowed($owner_uid, $observer['xchan_hash'], 'view_photos');
if (!$can_view) {
notice(t('Access to this item is restricted.') . EOL);
return;
}
$sql_extra = permissions_sql($owner_uid);
$o = "";
$o .= "<script> var profile_uid = " . $a->profile['profile_uid'] . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
// tabs
$_is_owner = local_user() && local_user() == $owner_uid;
$o .= profile_tabs($a, $_is_owner, $a->data['channel']['channel_address']);
//
// dispatch request
//
/**
* Display upload form
*/
if ($datatype === 'upload') {
if (!$can_post) {
notice(t('Permission denied.'));
return;
}
if (array_key_exists('albums', $a->data)) {
$albums = get_app()->data['albums'];
} else {
$albums = photos_albums_list($a->data['channel'], $a->data['observer']);
}
$selname = $datum ? hex2bin($datum) : '';
$albumselect = '<select id="photos-upload-album-select" name="album" size="4">';
$albumselect .= '<option value="" ' . (!$selname ? ' selected="selected" ' : '') . '> </option>';
if (count($albums['albums'])) {
foreach ($albums['albums'] as $album) {
if (!$album['text']) {
continue;
}
$selected = $selname === $album['text'] ? ' selected="selected" ' : '';
$albumselect .= '<option value="' . $album['text'] . '"' . $selected . '>' . $album['text'] . '</option>';
}
}
$albumselect .= '</select>';
$uploader = '';
$ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'], 'addon_text' => $uploader, 'default_upload' => true);
call_hooks('photo_upload_form', $ret);
$default_upload = '<input id="photos-upload-choose" type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" >
<input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>';
/* Show space usage */
$r = q("select sum(size) as total from photo where aid = %d and scale = 0 ", intval($a->data['channel']['channel_account_id']));
$limit = service_class_fetch($a->data['channel']['channel_id'], 'photo_upload_limit');
if ($limit !== false) {
$usage_message = sprintf(t("You have used %1\$.2f Mbytes of %2\$.2f Mbytes photo storage."), $r[0]['total'] / 1024000, $limit / 1024000);
//.........这里部分代码省略.........
示例6: photos_album_widget
function photos_album_widget($channelx, $observer, $albums = null)
{
$o = '';
// If we weren't passed an album list, see if the photos module
// dropped one for us to find in $a->data['albums'].
// If all else fails, load it.
if (!$albums) {
if (array_key_exists('albums', get_app()->data)) {
$albums = get_app()->data['albums'];
} else {
$albums = photos_albums_list($channelx, $observer);
}
}
if ($albums['success']) {
$o = replace_macros(get_markup_template('photo_albums.tpl'), array('$nick' => $channelx['channel_address'], '$title' => t('Photo Albums'), '$albums' => $albums['albums'], '$baseurl' => z_root(), '$upload' => perm_is_allowed($channelx['channel_id'], $observer ? $observer['xchan_hash'] : '', 'write_storage') ? t('Upload New Photos') : ''));
}
return $o;
}
示例7: api_albums
function api_albums($type)
{
json_return_and_die(photos_albums_list(App::get_channel(), App::get_observer()));
}