本文整理汇总了PHP中extra_query_args函数的典型用法代码示例。如果您正苦于以下问题:PHP extra_query_args函数的具体用法?PHP extra_query_args怎么用?PHP extra_query_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了extra_query_args函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get
function get()
{
if (observer_prohibited()) {
notice(t('Public access denied.') . EOL);
return;
}
if (!count(\App::$profile) || \App::$profile['hide_friends']) {
notice(t('Permission denied.') . EOL);
return;
}
if (!perm_is_allowed(\App::$profile['uid'], get_observer_hash(), 'view_contacts')) {
notice(t('Permission denied.') . EOL);
return;
}
if (!$_REQUEST['aj']) {
$_SESSION['return_url'] = \App::$query_string;
}
$is_owner = local_channel() && local_channel() == \App::$profile['uid'] ? true : false;
$abook_flags = " and abook_pending = 0 and abook_self = 0 ";
$sql_extra = '';
if (!$is_owner) {
$abook_flags = " and abook_hidden = 0 ";
$sql_extra = " and xchan_hidden = 0 ";
}
$r = q("SELECT count(*) as total FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d {$abook_flags} and xchan_orphan = 0 and xchan_deleted = 0 {$sql_extra} ", intval(\App::$profile['uid']));
if ($r) {
\App::set_pager_total($r[0]['total']);
}
$r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d {$abook_flags} and xchan_orphan = 0 and xchan_deleted = 0 {$sql_extra} order by xchan_name LIMIT %d OFFSET %d ", intval(\App::$profile['uid']), intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
if (!$r && !$_REQUEST['aj']) {
info(t('No connections.') . EOL);
return $o;
}
$contacts = array();
foreach ($r as $rr) {
$url = chanlink_url($rr['xchan_url']);
if ($url) {
$contacts[] = array('id' => $rr['abook_id'], 'archived' => intval($rr['abook_archived']) ? true : false, 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['xchan_name'], $rr['xchan_url']), 'thumb' => $rr['xchan_photo_m'], 'name' => substr($rr['xchan_name'], 0, 20), 'username' => $rr['xchan_addr'], 'link' => $url, 'sparkle' => '', 'itemurl' => $rr['url'], 'network' => '');
}
}
if ($_REQUEST['aj']) {
if ($contacts) {
$o = replace_macros(get_markup_template('viewcontactsajax.tpl'), array('$contacts' => $contacts));
} else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
} else {
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$tpl = get_markup_template("viewcontact_template.tpl");
$o .= replace_macros($tpl, array('$title' => t('View Connections'), '$contacts' => $contacts));
}
if (!$contacts) {
$o .= '<div id="content-complete"></div>';
}
return $o;
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:58,代码来源:Viewconnections.php
示例2: viewconnections_content
function viewconnections_content(&$a)
{
if (get_config('system', 'block_public') && !local_channel() && !remote_channel()) {
notice(t('Public access denied.') . EOL);
return;
}
if (!count($a->profile) || $a->profile['hide_friends']) {
notice(t('Permission denied.') . EOL);
return;
}
if (!perm_is_allowed($a->profile['uid'], get_observer_hash(), 'view_contacts')) {
notice(t('Permission denied.') . EOL);
return;
}
if (!$_REQUEST['aj']) {
$_SESSION['return_url'] = $a->query_string;
}
$is_owner = local_channel() && local_channel() == $a->profile['uid'] ? true : false;
$abook_flags = ABOOK_FLAG_PENDING | ABOOK_FLAG_SELF;
$xchan_flags = XCHAN_FLAGS_ORPHAN | XCHAN_FLAGS_DELETED;
if (!$is_owner) {
$abook_flags = $abook_flags | ABOOK_FLAG_HIDDEN;
$xchan_flags = $xchan_flags | XCHAN_FLAGS_HIDDEN;
}
$r = q("SELECT count(*) as total FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not (abook_flags & %d )>0 and not ( xchan_flags & %d )>0 ", intval($a->profile['uid']), intval($abook_flags), intval($xchan_flags));
if ($r) {
$a->set_pager_total($r[0]['total']);
}
$r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not ( abook_flags & %d )>0 and not ( xchan_flags & %d )>0 order by xchan_name LIMIT %d OFFSET %d ", intval($a->profile['uid']), intval($abook_flags), intval($xchan_flags), intval($a->pager['itemspage']), intval($a->pager['start']));
if (!$r && !$_REQUEST['aj']) {
info(t('No connections.') . EOL);
return $o;
}
$contacts = array();
foreach ($r as $rr) {
$url = chanlink_url($rr['xchan_url']);
if ($url) {
$contacts[] = array('id' => $rr['abook_id'], 'archived' => $rr['abook_flags'] & ABOOK_FLAG_ARCHIVED ? true : false, 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['xchan_name'], $rr['xchan_url']), 'thumb' => $rr['xchan_photo_m'], 'name' => substr($rr['xchan_name'], 0, 20), 'username' => $rr['xchan_addr'], 'link' => $url, 'sparkle' => '', 'itemurl' => $rr['url'], 'network' => '');
}
}
if ($_REQUEST['aj']) {
if ($contacts) {
$o = replace_macros(get_markup_template('viewcontactsajax.tpl'), array('$contacts' => $contacts));
} else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
} else {
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$tpl = get_markup_template("viewcontact_template.tpl");
$o .= replace_macros($tpl, array('$title' => t('View Connections'), '$contacts' => $contacts));
}
if (!$contacts) {
$o .= '<div id="content-complete"></div>';
}
return $o;
}
开发者ID:HaakonME,项目名称:redmatrix,代码行数:58,代码来源:viewconnections.php
示例3: connections_content
//.........这里部分代码省略.........
$hidden = true;
break;
case 'archived':
$search_flags = ABOOK_FLAG_ARCHIVED;
$head = t('Archived');
$archived = true;
break;
case 'pending':
$search_flags = ABOOK_FLAG_PENDING;
$head = t('New');
$pending = true;
nav_set_selected('intros');
break;
case 'ifpending':
$r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or (xchan_flags & %d)>0)", intval(local_channel()), intval(ABOOK_FLAG_PENDING), intval(ABOOK_FLAG_SELF | ABOOK_FLAG_IGNORED), intval(XCHAN_FLAGS_DELETED | XCHAN_FLAGS_ORPHAN));
if ($r && $r[0]['total']) {
$search_flags = ABOOK_FLAG_PENDING;
$head = t('New');
$pending = true;
nav_set_selected('intros');
$a->argv[1] = 'pending';
} else {
$head = t('All');
$search_flags = 0;
$all = true;
$a->argc = 1;
unset($a->argv[1]);
}
nav_set_selected('intros');
break;
// case 'unconnected':
// $search_flags = ABOOK_FLAG_UNCONNECTED;
// $head = t('Unconnected');
// $unconnected = true;
// break;
// case 'unconnected':
// $search_flags = ABOOK_FLAG_UNCONNECTED;
// $head = t('Unconnected');
// $unconnected = true;
// break;
case 'all':
$head = t('All');
default:
$search_flags = 0;
$all = true;
break;
}
$sql_extra = $search_flags ? " and ( abook_flags & " . $search_flags . " )>0 " : "";
if (argv(1) === 'pending') {
$sql_extra .= " and not ( abook_flags & " . ABOOK_FLAG_IGNORED . " )>0 ";
}
} else {
$sql_extra = " and not ( abook_flags & " . ABOOK_FLAG_BLOCKED . " )>0 ";
$unblocked = true;
}
$search = x($_REQUEST, 'search') ? notags(trim($_REQUEST['search'])) : '';
$tabs = array(array('label' => t('Suggestions'), 'url' => z_root() . '/suggest', 'sel' => '', 'title' => t('Suggest new connections')), array('label' => t('New Connections'), 'url' => z_root() . '/connections/pending', 'sel' => $pending ? 'active' : '', 'title' => t('Show pending (new) connections')), array('label' => t('All Connections'), 'url' => z_root() . '/connections/all', 'sel' => $all ? 'active' : '', 'title' => t('Show all connections')), array('label' => t('Unblocked'), 'url' => z_root() . '/connections', 'sel' => $unblocked && !$search && !$nets ? 'active' : '', 'title' => t('Only show unblocked connections')), array('label' => t('Blocked'), 'url' => z_root() . '/connections/blocked', 'sel' => $blocked ? 'active' : '', 'title' => t('Only show blocked connections')), array('label' => t('Ignored'), 'url' => z_root() . '/connections/ignored', 'sel' => $ignored ? 'active' : '', 'title' => t('Only show ignored connections')), array('label' => t('Archived'), 'url' => z_root() . '/connections/archived', 'sel' => $archived ? 'active' : '', 'title' => t('Only show archived connections')), array('label' => t('Hidden'), 'url' => z_root() . '/connections/hidden', 'sel' => $hidden ? 'active' : '', 'title' => t('Only show hidden connections')));
$tab_tpl = get_markup_template('common_tabs.tpl');
$t = replace_macros($tab_tpl, array('$tabs' => $tabs));
$searching = false;
if ($search) {
$search_hdr = $search;
$search_txt = dbesc(protect_sprintf(preg_quote($search)));
$searching = true;
}
$sql_extra .= $searching ? protect_sprintf(" AND xchan_name like '%{$search_txt}%' ") : "";
if ($_REQUEST['gid']) {
$sql_extra .= " and xchan_hash in ( select xchan from group_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) ";
}
$r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash \n\t\twhere abook_channel = %d and not (abook_flags & %d)>0 and not (xchan_flags & %d )>0 {$sql_extra} {$sql_extra2} ", intval(local_channel()), intval(ABOOK_FLAG_SELF), intval(XCHAN_FLAGS_DELETED | XCHAN_FLAGS_ORPHAN));
if ($r) {
$a->set_pager_total($r[0]['total']);
$total = $r[0]['total'];
}
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash\n\t\tWHERE abook_channel = %d and not (abook_flags & %d)>0 and not ( xchan_flags & %d)>0 {$sql_extra} {$sql_extra2} ORDER BY xchan_name LIMIT %d OFFSET %d ", intval(local_channel()), intval(ABOOK_FLAG_SELF), intval(XCHAN_FLAGS_DELETED | XCHAN_FLAGS_ORPHAN), intval($a->pager['itemspage']), intval($a->pager['start']));
$contacts = array();
if (count($r)) {
foreach ($r as $rr) {
if ($rr['xchan_url']) {
$contacts[] = array('img_hover' => sprintf(t('%1$s [%2$s]'), $rr['xchan_name'], $rr['xchan_url']), 'edit_hover' => t('Edit connection'), 'id' => $rr['abook_id'], 'alt_text' => $alt_text, 'dir_icon' => $dir_icon, 'thumb' => $rr['xchan_photo_m'], 'name' => $rr['xchan_name'], 'username' => $rr['xchan_name'], 'classes' => $rr['abook_flags'] & ABOOK_FLAG_ARCHIVED ? 'archived' : '', 'link' => z_root() . '/connedit/' . $rr['abook_id'], 'edit' => t('Edit'), 'url' => chanlink_url($rr['xchan_url']), 'network' => network_to_name($rr['network']));
}
}
}
if ($_REQUEST['aj']) {
if ($contacts) {
$o = replace_macros(get_markup_template('contactsajax.tpl'), array('$contacts' => $contacts, '$edit' => t('Edit')));
} else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
} else {
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= replace_macros(get_markup_template('connections.tpl'), array('$header' => t('Connections') . ($head ? ' - ' . $head : ''), '$tabs' => $t, '$total' => $total, '$search' => $search_hdr, '$desc' => t('Search your connections'), '$finding' => $searching ? t('Finding: ') . "'" . $search . "'" : "", '$submit' => t('Find'), '$edit' => t('Edit'), '$cmd' => $a->cmd, '$contacts' => $contacts, '$paginate' => paginate($a)));
}
if (!$contacts) {
$o .= '<div id="content-complete"></div>';
}
return $o;
}
开发者ID:redmatrix,项目名称:red,代码行数:101,代码来源:connections.php
示例4: photos_content
//.........这里部分代码省略.........
// ));
}
}
if ($_GET['order'] === 'posted') {
$order = array(t('Show Newest First'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album));
} else {
$order = array(t('Show Oldest First'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted');
}
$photos = array();
if (count($r)) {
$twist = 'rotright';
foreach ($r as $rr) {
if ($twist == 'rotright') {
$twist = 'rotleft';
} else {
$twist = 'rotright';
}
$ext = $phototypes[$rr['type']];
$imgalt_e = $rr['filename'];
$desc_e = $rr['description'];
$imagelink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'] . ($_GET['order'] === 'posted' ? '?f=&order=posted' : '');
$photos[] = array('id' => $rr['id'], 'twist' => ' ' . $twist . rand(2, 4), 'link' => $imagelink, 'title' => t('View Photo'), 'src' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' . $ext, 'alt' => $imgalt_e, 'desc' => $desc_e, 'ext' => $ext, 'hash' => $rr['resource_id'], 'unknown' => t('Unknown'));
}
}
if ($_REQUEST['aj']) {
if ($photos) {
$o = replace_macros(get_markup_template('photosajax.tpl'), array('$photos' => $photos));
} else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
} else {
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$tpl = get_markup_template('photo_album.tpl');
$o .= replace_macros($tpl, array('$photos' => $photos, '$album' => $album, '$album_edit' => array(t('Edit Album'), $album_edit), '$can_post' => $can_post, '$upload' => array(t('Upload'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album)), '$order' => $order, '$upload_form' => $upload_form, '$usage' => $usage_message));
}
if (!$photos && $_REQUEST['aj']) {
$o .= '<div id="content-complete"></div>';
echo $o;
killme();
}
// $o .= paginate($a);
return $o;
}
/**
* Display one photo
*/
if ($datatype === 'image') {
// fetch image, item containing image, then comments
$ph = q("SELECT id,aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,`type`,height,width,`size`,scale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' \n\t\t\t{$sql_extra} ORDER BY `scale` ASC ", intval($owner_uid), dbesc($datum));
if (!$ph) {
/* Check again - this time without specifying permissions */
$ph = q("SELECT id FROM photo WHERE uid = %d AND resource_id = '%s' LIMIT 1", intval($owner_uid), dbesc($datum));
if ($ph) {
notice(t('Permission denied. Access to this item may be restricted.') . EOL);
} else {
notice(t('Photo not available') . EOL);
}
return;
}
$prevlink = '';
$nextlink = '';
if ($_GET['order'] === 'posted') {
$order = 'ASC';
} else {
开发者ID:spthaolt,项目名称:hubzilla,代码行数:67,代码来源:photos.php
示例5: get
//.........这里部分代码省略.........
}
$age = '';
if (strlen($rr['birthday'])) {
if (($years = age($rr['birthday'], 'UTC', '')) != 0) {
$age = $years;
}
}
$page_type = '';
if ($rr['total_ratings']) {
$total_ratings = sprintf(tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']);
} else {
$total_ratings = '';
}
$profile = $rr;
if (x($profile, 'locale') == 1 || x($profile, 'region') == 1 || x($profile, 'postcode') == 1 || x($profile, 'country') == 1) {
$gender = x($profile, 'gender') == 1 ? t('Gender: ') . $profile['gender'] : False;
}
$marital = x($profile, 'marital') == 1 ? t('Status: ') . $profile['marital'] : False;
$homepage = x($profile, 'homepage') == 1 ? t('Homepage: ') : False;
$homepageurl = x($profile, 'homepage') == 1 ? $profile['homepage'] : '';
$hometown = x($profile, 'hometown') == 1 ? $profile['hometown'] : False;
$about = x($profile, 'about') == 1 ? bbcode($profile['about']) : False;
$keywords = x($profile, 'keywords') ? $profile['keywords'] : '';
$out = '';
if ($keywords) {
$keywords = str_replace(',', ' ', $keywords);
$keywords = str_replace(' ', ' ', $keywords);
$karr = explode(' ', $keywords);
if ($karr) {
if (local_channel()) {
$r = q("select keywords from profile where uid = %d and is_default = 1 limit 1", intval(local_channel()));
if ($r) {
$keywords = str_replace(',', ' ', $r[0]['keywords']);
$keywords = str_replace(' ', ' ', $keywords);
$marr = explode(' ', $keywords);
}
}
foreach ($karr as $k) {
if (strlen($out)) {
$out .= ', ';
}
if ($marr && in_arrayi($k, $marr)) {
$out .= '<strong>' . $k . '</strong>';
} else {
$out .= $k;
}
}
}
}
$entry = array('id' => ++$t, 'profile_link' => $profile_link, 'public_forum' => $rr['public_forum'], 'photo' => $rr['photo'], 'hash' => $rr['hash'], 'alttext' => $rr['name'] . (local_channel() || remote_channel() ? ' ' . $rr['address'] : ''), 'name' => $rr['name'], 'age' => $age, 'age_label' => t('Age:'), 'profile' => $profile, 'address' => $rr['address'], 'nickname' => substr($rr['address'], 0, strpos($rr['address'], '@')), 'location' => $location, 'location_label' => t('Location:'), 'gender' => $gender, 'total_ratings' => $total_ratings, 'viewrate' => true, 'canrate' => local_channel() ? true : false, 'pdesc' => $pdesc, 'pdesc_label' => t('Description:'), 'marital' => $marital, 'homepage' => $homepage, 'homepageurl' => linkify($homepageurl), 'hometown' => $hometown, 'hometown_label' => t('Hometown:'), 'about' => $about, 'about_label' => t('About:'), 'conn_label' => t('Connect'), 'forum_label' => t('Public Forum:'), 'connect' => $connect_link, 'online' => $online, 'kw' => $out ? t('Keywords: ') : '', 'keywords' => $out, 'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '', 'ignore_label' => t('Don\'t suggest'), 'common_friends' => $common[$rr['address']] ? intval($common[$rr['address']]) : '', 'common_label' => t('Common connections:'), 'common_count' => intval($common[$rr['address']]), 'safe' => $safe_mode);
$arr = array('contact' => $rr, 'entry' => $entry);
call_hooks('directory_item', $arr);
unset($profile);
unset($location);
if (!$arr['entry']) {
continue;
}
if ($sort_order == '' && $suggest) {
$entries[$addresses[$rr['address']]] = $arr['entry'];
// Use the same indexes as originally to get the best suggestion first
} else {
$entries[] = $arr['entry'];
}
}
ksort($entries);
// Sort array by key so that foreach-constructs work as expected
if ($j['keywords']) {
\App::$data['directory_keywords'] = $j['keywords'];
}
logger('mod_directory: entries: ' . print_r($entries, true), LOGGER_DATA);
if ($_REQUEST['aj']) {
if ($entries) {
$o = replace_macros(get_markup_template('directajax.tpl'), array('$entries' => $entries));
} else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
} else {
$maxheight = 94;
$dirtitle = $globaldir ? t('Global Directory') : t('Local Directory');
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; divmore_height = " . intval($maxheight) . "; </script>";
$o .= replace_macros($tpl, array('$search' => $search, '$desc' => t('Find'), '$finddsc' => t('Finding:'), '$safetxt' => htmlspecialchars($search, ENT_QUOTES, 'UTF-8'), '$entries' => $entries, '$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle, '$submit' => t('Find'), '$next' => alt_pager($a, $j['records'], t('next page'), t('previous page')), '$sort' => t('Sort options'), '$normal' => t('Alphabetic'), '$reverse' => t('Reverse Alphabetic'), '$date' => t('Newest to Oldest'), '$reversedate' => t('Oldest to Newest'), '$suggest' => $suggest ? '&suggest=1' : ''));
}
} else {
if ($_REQUEST['aj']) {
$o = '<div id="content-complete"></div>';
echo $o;
killme();
}
if (\App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search, '@')) {
goaway(z_root() . '/chanview/?f=&address=' . $search);
}
info(t("No entries (some entries may be hidden).") . EOL);
}
}
}
}
return $o;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:101,代码来源:Directory.php
示例6: openclipatar_profile_photo_content_end
function openclipatar_profile_photo_content_end(&$a, &$o)
{
$prefclipids = get_config('openclipatar', 'prefclipids');
$defsearch = get_config('openclipatar', 'defsearch');
$returnafter = get_config('openclipatar', 'returnafter');
$sortprefids = get_config('openclipatar', 'sortprefids');
if ($sortprefids == "0") {
$sortprefids = 'date';
}
// Backwards compatibility
if ($sortprefids == "1") {
$sortprefids = 'asentered';
}
$sortids = get_config('openclipatar', 'sortids');
$prefclipmsg = get_config('openclipatar', 'prefclipmsg');
head_add_css('addon/openclipatar/openclipatar.css');
$t = get_markup_template('avatars.tpl', 'addon/openclipatar/');
if (!$defsearch) {
$defsearch = 'avatar';
}
if (!$prefclipmsg) {
$prefclipmsg = t('System defaults:');
}
if (x($_POST, 'search')) {
$search = notags(trim($_POST['search']));
} else {
$search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
}
if (!$search) {
$search = $defsearch;
}
$entries = array();
$haveprefclips = false;
$eidlist = array();
if ($prefclipids && preg_match('/[\\d,]+/', $prefclipids)) {
logger('Openclipatar: initial load: ' . var_export($_REQUEST, true), LOGGER_DEBUG);
$sortpref = $sortprefids == 'asentered' ? 'date' : $sortprefids;
// Use user defined sort, unless it's asentered. That's handled later
$x = z_fetch_url('https://openclipart.org/search/json/?sort=' . $sortpref . '&amount=50&byids=' . dbesc($prefclipids));
if ($x['success']) {
$j = json_decode($x['body'], true);
if ($j && !empty($j['payload'])) {
$eidlist = explode(',', $prefclipids);
// save for later
if (!$_REQUEST['aj']) {
foreach ($j['payload'] as $rr) {
$e = openclipatar_decode_result($rr);
$e['extraclass'] = 'openclipatar-prefids';
$entries[] = $e;
}
if (count($entries)) {
openclipatar_sort_result($entries, $eidlist, $sortprefids);
$haveprefclips = true;
}
}
}
}
}
$x = z_fetch_url('https://openclipart.org/search/json/?sort=' . $sortids . '&amount=20&query=' . urlencode($search) . '&page=' . $a->pager['page']);
if ($x['success']) {
$j = json_decode($x['body'], true);
if ($j && !empty($j['payload'])) {
foreach ($j['payload'] as $rr) {
$e = openclipatar_decode_result($rr);
if (!in_array($e['id'], $eidlist)) {
//logger('openclipatar: id '.$e['id'].' not in '.var_export($eidlist,true), LOGGER_DEBUG);
$entries[] = $e;
}
}
$o .= "<script> var page_query = 'openclipatar'; var extra_args = '&search=" . urlencode($search) . '&' . extra_query_args() . "' ; </script>";
}
}
if ($_REQUEST['aj']) {
if ($entries) {
$o = replace_macros(get_markup_template('avatar-ajax.tpl', 'addon/openclipatar/'), array('$use' => t('Use'), '$entries' => $entries));
} else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
} else {
$o .= replace_macros($t, array('$selectmsg' => t('Or select from a free OpenClipart.org image:'), '$prefmsg' => $haveprefclips ? '<div class="openclipatar-prefclipmsg">' . $prefclipmsg . '</div>' : '', '$use' => t('Use'), '$defsearch' => array('search', t('Search Term'), $search), '$entries' => $entries));
}
}
开发者ID:einervonvielen,项目名称:redmatrix-addons,代码行数:84,代码来源:openclipatar.php
示例7: get
//.........这里部分代码省略.........
$pending = true;
nav_set_selected('intros');
break;
case 'ifpending':
$r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and abook_pending = 1 and abook_self = 0 and abook_ignored = 0 and xchan_deleted = 0 and xchan_orphan = 0 ", intval(local_channel()));
if ($r && $r[0]['total']) {
$search_flags = " and abook_pending = 1 ";
$head = t('New');
$pending = true;
nav_set_selected('intros');
\App::$argv[1] = 'pending';
} else {
$head = t('All');
$search_flags = '';
$all = true;
\App::$argc = 1;
unset(\App::$argv[1]);
}
nav_set_selected('intros');
break;
// case 'unconnected':
// $search_flags = " and abook_unconnected = 1 ";
// $head = t('Unconnected');
// $unconnected = true;
// break;
// case 'unconnected':
// $search_flags = " and abook_unconnected = 1 ";
// $head = t('Unconnected');
// $unconnected = true;
// break;
case 'all':
$head = t('All');
default:
$search_flags = '';
$all = true;
break;
}
$sql_extra = $search_flags;
if (argv(1) === 'pending') {
$sql_extra .= " and abook_ignored = 0 ";
}
} else {
$sql_extra = " and abook_blocked = 0 ";
$unblocked = true;
}
$search = x($_REQUEST, 'search') ? notags(trim($_REQUEST['search'])) : '';
$tabs = array('pending' => array('label' => t('New Connections'), 'url' => z_root() . '/connections/pending', 'sel' => $pending ? 'active' : '', 'title' => t('Show pending (new) connections')), 'all' => array('label' => t('All Connections'), 'url' => z_root() . '/connections/all', 'sel' => $all ? 'active' : '', 'title' => t('Show all connections')), 'blocked' => array('label' => t('Blocked'), 'url' => z_root() . '/connections/blocked', 'sel' => $blocked ? 'active' : '', 'title' => t('Only show blocked connections')), 'ignored' => array('label' => t('Ignored'), 'url' => z_root() . '/connections/ignored', 'sel' => $ignored ? 'active' : '', 'title' => t('Only show ignored connections')), 'archived' => array('label' => t('Archived'), 'url' => z_root() . '/connections/archived', 'sel' => $archived ? 'active' : '', 'title' => t('Only show archived connections')), 'hidden' => array('label' => t('Hidden'), 'url' => z_root() . '/connections/hidden', 'sel' => $hidden ? 'active' : '', 'title' => t('Only show hidden connections')));
//$tab_tpl = get_markup_template('common_tabs.tpl');
//$t = replace_macros($tab_tpl, array('$tabs'=>$tabs));
$searching = false;
if ($search) {
$search_hdr = $search;
$search_txt = dbesc(protect_sprintf(preg_quote($search)));
$searching = true;
}
$sql_extra .= $searching ? protect_sprintf(" AND xchan_name like '%{$search_txt}%' ") : "";
if ($_REQUEST['gid']) {
$sql_extra .= " and xchan_hash in ( select xchan from group_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) ";
}
$r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash \n\t\t\twhere abook_channel = %d and abook_self = 0 and xchan_deleted = 0 and xchan_orphan = 0 {$sql_extra} {$sql_extra2} ", intval(local_channel()));
if ($r) {
\App::set_pager_total($r[0]['total']);
$total = $r[0]['total'];
}
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash\n\t\t\tWHERE abook_channel = %d and abook_self = 0 and xchan_deleted = 0 and xchan_orphan = 0 {$sql_extra} {$sql_extra2} ORDER BY xchan_name LIMIT %d OFFSET %d ", intval(local_channel()), intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
$contacts = array();
if (count($r)) {
foreach ($r as $rr) {
if ($rr['xchan_url']) {
$status_str = '';
$status = array(intval($rr['abook_pending']) ? t('Pending approval') : '', intval($rr['abook_archived']) ? t('Archived') : '', intval($rr['abook_hidden']) ? t('Hidden') : '', intval($rr['abook_ignored']) ? t('Ignored') : '', intval($rr['abook_blocked']) ? t('Blocked') : '');
foreach ($status as $str) {
if (!$str) {
continue;
}
$status_str .= $str;
$status_str .= ', ';
}
$status_str = rtrim($status_str, ', ');
$contacts[] = array('img_hover' => sprintf(t('%1$s [%2$s]'), $rr['xchan_name'], $rr['xchan_url']), 'edit_hover' => t('Edit connection'), 'delete_hover' => t('Delete connection'), 'id' => $rr['abook_id'], 'thumb' => $rr['xchan_photo_m'], 'name' => $rr['xchan_name'], 'classes' => intval($rr['abook_archived']) ? 'archived' : '', 'link' => z_root() . '/connedit/' . $rr['abook_id'], 'deletelink' => z_root() . '/connedit/' . intval($rr['abook_id']) . '/drop', 'delete' => t('Delete'), 'url' => chanlink_url($rr['xchan_url']), 'webbie_label' => t('Channel address'), 'webbie' => $rr['xchan_addr'], 'network_label' => t('Network'), 'network' => network_to_name($rr['xchan_network']), 'public_forum' => intval($rr['xchan_pubforum']) ? true : false, 'status_label' => t('Status'), 'status' => $status_str, 'connected_label' => t('Connected'), 'connected' => datetime_convert('UTC', date_default_timezone_get(), $rr['abook_created'], 'c'), 'approve_hover' => t('Approve connection'), 'approve' => $rr['abook_pending'] ? t('Approve') : false, 'ignore_hover' => t('Ignore connection'), 'ignore' => !$rr['abook_ignored'] ? t('Ignore') : false, 'recent_label' => t('Recent activity'), 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']));
}
}
}
if ($_REQUEST['aj']) {
if ($contacts) {
$o = replace_macros(get_markup_template('contactsajax.tpl'), array('$contacts' => $contacts, '$edit' => t('Edit')));
} else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
} else {
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= replace_macros(get_markup_template('connections.tpl'), array('$header' => t('Connections') . ($head ? ': ' . $head : ''), '$tabs' => $tabs, '$total' => $total, '$search' => $search_hdr, '$label' => t('Search'), '$desc' => t('Search your connections'), '$finding' => $searching ? t('Connections search') . ": '" . $search . "'" : "", '$submit' => t('Find'), '$edit' => t('Edit'), '$cmd' => \App::$cmd, '$contacts' => $contacts, '$paginate' => paginate($a)));
}
if (!$contacts) {
$o .= '<div id="content-complete"></div>';
}
return $o;
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:101,代码来源:Connections.php
示例8: photos_content
//.........这里部分代码省略.........
$r = q("SELECT `resource_id`, `id`, `filename`, type, max(`scale`) AS `scale`, `description` FROM `photo` WHERE `uid` = %d AND `album` = '%s' \n\t\t\tAND `scale` <= 4 and (photo_flags = %d or photo_flags = %d ) {$sql_extra} GROUP BY `resource_id` ORDER BY `created` {$order} LIMIT %d , %d", intval($owner_uid), dbesc($album), intvaL(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($a->pager['start']), intval($a->pager['itemspage']));
$o .= '<h3>' . $album . '</h3>';
if ($cmd === 'edit') {
if ($album !== t('Profile Photos') && $album !== 'Contact Photos' && $album !== t('Contact Photos')) {
if ($can_post) {
if ($a->get_template_engine() === 'internal') {
$album_e = template_escape($album);
} else {
$album_e = $album;
}
$edit_tpl = get_markup_template('album_edit.tpl');
$o .= replace_macros($edit_tpl, array('$nametext' => t('New album name: '), '$nickname' => $a->data['channel']['channel_address'], '$album' => $album_e, '$hexalbum' => bin2hex($album), '$submit' => t('Submit'), '$dropsubmit' => t('Delete Album')));
}
}
} else {
if ($album !== t('Profile Photos') && $album !== 'Contact Photos' && $album !== t('Contact Photos')) {
if ($can_post) {
$o .= '<div id="album-edit-link"><a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '/edit' . '">' . t('Edit Album') . '</a></div>';
}
}
}
if ($_GET['order'] === 'posted') {
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '" >' . t('Show Newest First') . '</a></div>';
} else {
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted" >' . t('Show Oldest First') . '</a></div>';
}
if ($can_post) {
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</a></div>';
}
$ajaxout = '';
$tpl = get_markup_template('photo_album.tpl');
if (count($r)) {
$twist = 'rotright';
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= '<div id="photo-album-contents">';
foreach ($r as $rr) {
if ($twist == 'rotright') {
$twist = 'rotleft';
} else {
$twist = 'rotright';
}
$ext = $phototypes[$rr['type']];
$imgalt_e = $rr['filename'];
$desc_e = $rr['description'];
// prettyphoto has potential license issues, so we can no longer include it in core
// The following lines would need to be modified so that they are provided in theme specific files
// instead of core modules for themes that wish to make use of prettyphoto. I would suggest
// the feature as a per-theme display option and putting the rel line inside a template.
// if(feature_enabled($a->data['channel']['channel_id'],'prettyphoto')){
// $imagelink = ($a->get_baseurl() . '/photo/' . $rr['resource_id'] . '.' . $ext );
// $rel=("prettyPhoto[pp_gal]");
// }
// else {
$imagelink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'] . ($_GET['order'] === 'posted' ? '?f=&order=posted' : '');
$rel = "photo";
// }
$tmp = replace_macros($tpl, array('$id' => $rr['id'], '$twist' => ' ' . $twist . rand(2, 4), '$photolink' => $imagelink, '$rel' => $rel, '$phototitle' => t('View Photo'), '$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' . $ext, '$imgalt' => $imgalt_e, '$desc' => $desc_e, '$ext' => $ext, '$hash' => $rr['resource_id']));
if ($_REQUEST['aj']) {
$ajaxout .= $tmp;
} else {
$o .= $tmp;
}
}
}
if ($_REQUEST['aj']) {
if (!$r) {
开发者ID:Mauru,项目名称:red,代码行数:67,代码来源:photos.php
示例9: directory_content
//.........这里部分代码省略.........
}
if ($advanced) {
$query .= '&query=' . urlencode($advanced);
}
$sort_order = x($_REQUEST, 'order') ? $_REQUEST['order'] : '';
if ($sort_order) {
$query .= '&order=' . urlencode($sort_order);
}
if ($a->pager['page'] != 1) {
$query .= '&p=' . $a->pager['page'];
}
logger('mod_directory: query: ' . $query);
$x = z_fetch_url($query);
logger('directory: return from upstream: ' . print_r($x, true), LOGGER_DATA);
if ($x['success']) {
$t = 0;
$j = json_decode($x['body'], true);
if ($j) {
if ($j['results']) {
$entries = array();
$photo = 'thumb';
foreach ($j['results'] as $rr) {
$profile_link = chanlink_url($rr['url']);
$pdesc = $rr['description'] ? $rr['description'] . '<br />' : '';
$connect_link = local_user() ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '';
if (in_array($rr['hash'], $contacts)) {
$connect_link = '';
}
$details = '';
if (strlen($rr['locale'])) {
$details .= $rr['locale'];
}
if (strlen($rr['region'])) {
if (strlen($rr['locale'])) {
$details .= ', ';
}
$details .= $rr['region'];
}
if (strlen($rr['country'])) {
if (strlen($details)) {
$details .= ', ';
}
$details .= $rr['country'];
}
if (strlen($rr['birthday'])) {
if (($years = age($rr['birthday'], 'UTC', '')) != 0) {
$details .= '<br />' . t('Age: ') . $years;
}
}
if (strlen($rr['gender'])) {
$details .= '<br />' . t('Gender: ') . $rr['gender'];
}
$page_type = '';
$profile = $rr;
if (x($profile, 'locale') == 1 || x($profile, 'region') == 1 || x($profile, 'postcode') == 1 || x($profile, 'country') == 1) {
$location = t('Location:');
}
$gender = x($profile, 'gender') == 1 ? t('Gender:') : False;
$marital = x($profile, 'marital') == 1 ? t('Status:') : False;
$homepage = x($profile, 'homepage') == 1 ? t('Homepage:') : False;
$about = x($profile, 'about') == 1 ? t('About:') : False;
$entry = array('id' => ++$t, 'profile_link' => $profile_link, 'photo' => $rr['photo'], 'hash' => $rr['hash'], 'alttext' => $rr['name'] . ' ' . $rr['address'], 'name' => $rr['name'], 'details' => $pdesc . $details, 'profile' => $profile, 'address' => $rr['address'], 'location' => $location, 'gender' => $gender, 'pdesc' => $pdesc, 'marital' => $marital, 'homepage' => $homepage, 'about' => $about, 'conn_label' => t('Connect'), 'connect' => $connect_link);
$arr = array('contact' => $rr, 'entry' => $entry);
call_hooks('directory_item', $arr);
$entries[] = $arr['entry'];
unset($profile);
unset($location);
}
if ($j['keywords']) {
$a->data['directory_keywords'] = $j['keywords'];
}
logger('mod_directory: entries: ' . print_r($entries, true), LOGGER_DATA);
if ($_REQUEST['aj']) {
if ($entries) {
$o = replace_macros(get_markup_template('directajax.tpl'), array('$entries' => $entries));
} else {
$o = '<div id="content-complete"></div>';
}
echo $o;
killme();
} else {
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= replace_macros($tpl, array('$search' => $search, '$desc' => t('Find'), '$finddsc' => t('Finding:'), '$safetxt' => htmlspecialchars($search, ENT_QUOTES, 'UTF-8'), '$entries' => $entries, '$dirlbl' => t('Directory'), '$submit' => t('Find'), '$next' => alt_pager($a, $j['records'], t('next page'), t('previous page'))));
}
} else {
if ($_REQUEST['aj']) {
$o = '<div id="content-complete"></div>';
echo $o;
killme();
}
if ($a->pager['page'] == 1 && $j['records'] == 0 && strpos($search, '@')) {
goaway(z_root() . '/chanview/?f=&address=' . $search);
}
info(t("No entries (some entries may be hidden).") . EOL);
}
}
}
}
return $o;
}
开发者ID:Mauru,项目名称:red,代码行数:101,代码来源:directory.php
注:本文中的extra_query_args函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论