本文整理汇总了PHP中json_return_and_die函数的典型用法代码示例。如果您正苦于以下问题:PHP json_return_and_die函数的具体用法?PHP json_return_and_die怎么用?PHP json_return_and_die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了json_return_and_die函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: zfinger_init
function zfinger_init(&$a)
{
require_once 'include/zot.php';
require_once 'include/crypto.php';
$x = zotinfo($_REQUEST);
json_return_and_die($x);
}
开发者ID:kenrestivo,项目名称:hubzilla,代码行数:7,代码来源:zfinger.php
示例2: notes_init
/** @file */
function notes_init(&$a)
{
if (!local_channel()) {
return;
}
$ret = array('success' => true);
if (array_key_exists('note_text', $_REQUEST)) {
$body = escape_tags($_REQUEST['note_text']);
// I've had my notes vanish into thin air twice in four years.
// Provide a backup copy if there were contents previously
// and there are none being saved now.
if (!$body) {
$old_text = get_pconfig(local_channel(), 'notes', 'text');
if ($old_text) {
set_pconfig(local_channel(), 'notes', 'text.bak', $old_text);
}
}
set_pconfig(local_channel(), 'notes', 'text', $body);
}
// push updates to channel clones
if (argc() > 1 && argv(1) === 'sync') {
require_once 'include/zot.php';
build_sync_packet();
}
logger('notes saved.', LOGGER_DEBUG);
json_return_and_die($ret);
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:28,代码来源:notes.php
示例3: export_identity
function export_identity(&$a, $channel_hash)
{
if ($channel_hash == '') {
json_error_die(422, 'Unprocessable Entity', 'Must supply channel_hash parameter.');
}
json_return_and_die(identity_basic_export(get_channel_id($channel_hash), $_REQUEST['posts'] ? intval($_REQUEST['posts']) : 0));
}
开发者ID:kenrestivo,项目名称:migrator-plugin,代码行数:7,代码来源:migrator_export.php
示例4: init
function init()
{
$result = null;
$cmd = argc() > 1 ? argv(1) : '';
// Provide a stored request for somebody desiring a connection
// when they first need to register someplace. Once they've
// created a channel, we'll try to revive the connection request
// and process it.
if ($_REQUEST['connect']) {
$_SESSION['connect'] = $_REQUEST['connect'];
}
switch ($cmd) {
case 'invite_check.json':
$result = check_account_invite($_REQUEST['invite_code']);
break;
case 'email_check.json':
$result = check_account_email($_REQUEST['email']);
break;
case 'password_check.json':
$result = check_account_password($_REQUEST['password']);
break;
default:
break;
}
if ($result) {
json_return_and_die($result);
}
}
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:28,代码来源:Register.php
示例5: init
function init()
{
if (argv(1) === 'json') {
$data = get_site_info();
json_return_and_die($data);
}
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:7,代码来源:Siteinfo.php
示例6: dirstats_content
function dirstats_content(&$a)
{
$hubcount = get_config('dirstats', 'hubcount');
$zotcount = get_config('dirstats', 'zotcount');
$friendicacount = get_config('dirstats', 'friendicacount');
$diasporacount = get_config('dirstats', 'diasporacount');
$channelcount = get_config('dirstats', 'channelcount');
$friendicachannelcount = get_config('dirstats', 'friendicachannelcount');
$diasporachannelcount = get_config('dirstats', 'diasporachannelcount');
$over35s = get_config('dirstats', 'over35s');
$under35s = get_config('dirstats', 'under35s');
$average = get_config('dirstats', 'averageage');
$chatrooms = get_config('dirstats', 'chatrooms');
$tags = get_config('dirstats', 'tags');
$ob = $a->get_observer();
$observer = $ob['xchan_hash'];
// Requested by Martin
$fountainofyouth = get_xconfig($observer, 'dirstats', 'averageage');
if (intval($fountainofyouth)) {
$average = $fountainofyouth;
}
if (argv(1) == 'json') {
$dirstats = array('hubcount' => $hubcount, 'zotcount' => $zotcount, 'friendicacount' => $friendicacount, 'diasporacount' => $diasporacount, 'channelcount' => $channelcount, 'friendicachannelcount' => $friendicachannelcount, 'diasporachannelcount' => $diasporachannelcount, 'over35s' => $over35s, 'under35s' => $under35s, 'average' => $average, 'chatrooms' => $chatrooms, 'tags' => $tags);
echo json_return_and_die($dirstats);
} elseif (argv(1) == 'genpost' && get_config('dirstats', 'allowfiledump')) {
$result = '[b]Hub count[/b] : ' . $hubcount . "\n" . '[b]Hubzilla Hubs[/b] : ' . $zotcount . "\n" . '[b]Friendica Hubs[/b] : ' . $friendicacount . "\n" . '[b]Diaspora Pods[/b] : ' . $diasporacount . "\n" . '[b]Hubzilla Channels[/b] : ' . $channelcount . "\n" . '[b]Friendica Profiles[/b] : ' . $friendicachannelcount . "\n" . '[b]Diaspora Profiles[/b] : ' . $diasporachannelcount . "\n" . '[b]People aged 35 and above[/b] : ' . $over35s . "\n" . '[b]People aged 34 and below[/b] : ' . $under35s . "\n" . '[b]Average Age[/b] : ' . $average . "\n" . '[b]Known Chatrooms[/b] : ' . $chatrooms . "\n" . '[b]Unique Profile Tags[/b] : ' . $tags . "\n";
file_put_contents('genpost', $result);
} else {
$tpl = get_markup_template("dirstats.tpl", "addon/dirstats/");
return replace_macros($tpl, array('$title' => t('Hubzilla Directory Stats'), '$hubtitle' => t('Total Hubs'), '$hubcount' => $hubcount, '$zotlabel' => t('Hubzilla Hubs'), '$zotcount' => $zotcount, '$friendicalabel' => t('Friendica Hubs'), '$friendicacount' => $friendicacount, '$diasporalabel' => t('Diaspora Pods'), '$diasporacount' => $diasporacount, '$zotchanlabel' => t('Hubzilla Channels'), '$channelcount' => $channelcount, '$friendicachanlabel' => t('Friendica Channels'), '$friendicachannelcount' => $friendicachannelcount, '$diasporachanlabel' => t('Diaspora Channels'), '$diasporachannelcount' => $diasporachannelcount, '$over35label' => t('Aged 35 and above'), '$over35s' => $over35s, '$under35label' => t('Aged 34 and under'), '$under35s' => $under35s, '$averageagelabel' => t('Average Age'), '$average' => $average, '$chatlabel' => t('Known Chatrooms'), '$chatrooms' => $chatrooms, '$tagslabel' => t('Known Tags'), '$tags' => $tags, '$disclaimer' => t('Please note Diaspora and Friendica statistics are merely those **this directory** is aware of, and not all those known in the network. This also applies to chatrooms,')));
}
}
开发者ID:git-marijus,项目名称:hubzilla-addons,代码行数:32,代码来源:dirstats.php
示例7: zotfeed_init
function zotfeed_init(&$a)
{
$result = array('success' => false);
$mindate = $_REQUEST['mindate'] ? datetime_convert('UTC', 'UTC', $_REQUEST['mindate']) : '';
if (!$mindate) {
$mindate = datetime_convert('UTC', 'UTC', 'now - 1 month');
}
if (get_config('system', 'block_public') && !get_account_id() && !remote_user()) {
$result['message'] = 'Public access denied';
json_return_and_die($result);
}
$observer = $a->get_observer();
$channel_address = argc() > 1 ? argv(1) : '';
if ($channel_address) {
$r = q("select channel_id, channel_name from channel where channel_address = '%s' and not (channel_pageflags & %d) limit 1", dbesc(argv(1)), intval(PAGE_REMOVED));
} else {
$x = get_sys_channel();
if ($x) {
$r = array($x);
}
}
if (!$r) {
$result['message'] = 'Channel not found.';
json_return_and_die($result);
}
logger('zotfeed request: ' . $r[0]['channel_name'], LOGGER_DEBUG);
$result['messages'] = zot_feed($r[0]['channel_id'], $observer['xchan_hash'], $mindate);
$result['success'] = true;
json_return_and_die($result);
}
开发者ID:Mauru,项目名称:red,代码行数:30,代码来源:zotfeed.php
示例8: init
function init()
{
$result = array('success' => false);
$mindate = $_REQUEST['mindate'] ? datetime_convert('UTC', 'UTC', $_REQUEST['mindate']) : '';
if (!$mindate) {
$mindate = datetime_convert('UTC', 'UTC', 'now - 14 days');
}
if (observer_prohibited()) {
$result['message'] = 'Public access denied';
json_return_and_die($result);
}
$observer = \App::get_observer();
$channel_address = argc() > 1 ? argv(1) : '';
if ($channel_address) {
$r = q("select channel_id, channel_name from channel where channel_address = '%s' and channel_removed = 0 limit 1", dbesc(argv(1)));
} else {
$x = get_sys_channel();
if ($x) {
$r = array($x);
}
$mindate = datetime_convert('UTC', 'UTC', 'now - 14 days');
}
if (!$r) {
$result['message'] = 'Channel not found.';
json_return_and_die($result);
}
logger('zotfeed request: ' . $r[0]['channel_name'], LOGGER_DEBUG);
$result['messages'] = zot_feed($r[0]['channel_id'], $observer['xchan_hash'], array('mindate' => $mindate));
$result['success'] = true;
json_return_and_die($result);
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:31,代码来源:Zotfeed.php
示例9: migrator_init
function migrator_init(&$a)
{
$x = argc();
if ($x > 1) {
api_login($a);
switch (argv(1)) {
case "version":
json_return_and_die(array("status" => "OK", 'platform' => PLATFORM_NAME, 'platform_version' => RED_VERSION, 'zot_version' => ZOT_REVISION, 'db_version' => DB_UPDATE_VERSION, 'migrator_version' => MIGRATOR_VERSION));
break;
case "import":
if (PLATFORM_NAME == "redmatrix") {
json_error_die(400, 'Bad Request', 'Cannot import to Redmatrix, only to Hubzilla.');
}
switch (argv(2)) {
case 'account':
migrator_import_account($a);
break;
case 'identity':
migrator_import_identity($a, argv(3));
break;
case 'items':
migrator_import_items($a, argv(3));
break;
case 'directory':
migrator_update_directory($a, argv(3));
break;
default:
json_error_die(404, 'Not Found', 'No such endpoint');
break;
}
case "export":
switch (argv(2)) {
case "users":
export_users($a);
break;
case "channel_hashes":
export_channel_hashes($a, argv(3));
break;
case "identity":
export_identity($a, argv(3));
break;
case "first_post":
first_post($a, argv(3));
break;
case "items":
export_items($a, argv(3), argv(4), argv(5));
break;
default:
json_error_die(404, 'Not Found', 'No such endpoint');
break;
}
break;
default:
json_error_die(404, 'Not Found', 'No such endpoint');
break;
}
}
}
开发者ID:kenrestivo,项目名称:migrator-plugin,代码行数:58,代码来源:migrator.php
示例10: init
function init()
{
$ret = array('result' => false);
if (argc() != 2) {
json_return_and_die($ret);
}
$ret = get_online_status(argv(1));
json_return_and_die($ret);
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:9,代码来源:Online.php
示例11: tasks_post
function tasks_post(&$a)
{
// logger('post: ' . print_r($_POST,true));
if (!local_channel()) {
return;
}
$channel = App::get_channel();
if (argc() > 2 && argv(1) === 'complete' && intval(argv(2))) {
$ret = array('success' => false);
$r = q("select * from event where `type` = 'task' and uid = %d and id = %d limit 1", intval(local_channel()), intval(argv(2)));
if ($r) {
$event = $r[0];
if ($event['event_status'] === 'COMPLETED') {
$event['event_status'] = 'IN-PROCESS';
$event['event_status_date'] = NULL_DATE;
$event['event_percent'] = 0;
$event['event_sequence'] = $event['event_sequence'] + 1;
$event['edited'] = datetime_convert();
} else {
$event['event_status'] = 'COMPLETED';
$event['event_status_date'] = datetime_convert();
$event['event_percent'] = 100;
$event['event_sequence'] = $event['event_sequence'] + 1;
$event['edited'] = datetime_convert();
}
$x = event_store_event($event);
if ($x) {
$ret['success'] = true;
}
}
json_return_and_die($ret);
}
if (argc() == 2 && argv(1) === 'new') {
$text = escape_tags(trim($_REQUEST['summary']));
if (!$text) {
return array('success' => false);
}
$event = array();
$event['account'] = $channel['channel_account_id'];
$event['uid'] = $channel['channel_id'];
$event['event_xchan'] = $channel['channel_hash'];
$event['type'] = 'task';
$event['nofinish'] = true;
$event['created'] = $event['edited'] = $event['start'] = datetime_convert();
$event['adjust'] = 1;
$event['allow_cid'] = '<' . $channel['channel_hash'] . '>';
$event['summary'] = escape_tags($_REQUEST['summary']);
$x = event_store_event($event);
if ($x) {
$x['success'] = true;
} else {
$x = array('success' => false);
}
json_return_and_die($x);
}
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:56,代码来源:tasks.php
示例12: migrator_update_directory
function migrator_update_directory(&$a, $channel_hash)
{
$channel_id = get_channel_id($channel_hash);
if (!$channel_id) {
json_error_die(404, 'Not Found', 'No such channel ' . $channel_hash);
}
proc_run('php', 'include/notifier.php', 'location', $channel_id);
proc_run('php', 'include/directory.php', $channel_id);
json_return_and_die(array("status" => 'OK', 'channel_hash' => $channel_hash, 'channel_id' => $channel_id));
}
开发者ID:kenrestivo,项目名称:migrator-plugin,代码行数:10,代码来源:migrator_import.php
示例13: get
function get()
{
if (\App::$argv[1] === "json") {
$tmp = list_smilies();
$results = array();
for ($i = 0; $i < count($tmp['texts']); $i++) {
$results[] = array('text' => $tmp['texts'][$i], 'icon' => $tmp['icons'][$i]);
}
json_return_and_die($results);
} else {
return smilies('', true);
}
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:13,代码来源:Smilies.php
示例14: chatsvc_content
function chatsvc_content(&$a)
{
$status = strip_tags($_REQUEST['status']);
$room_id = intval($a->data['chat']['room_id']);
$stopped = x($_REQUEST, 'stopped') && intval($_REQUEST['stopped']) ? true : false;
if ($status && $room_id) {
$x = q("select channel_address from channel where channel_id = %d limit 1", intval($a->data['chat']['uid']));
$r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s' limit 1", dbesc($status), dbesc(datetime_convert()), intval($room_id), dbesc(get_observer_hash()), dbesc($_SERVER['REMOTE_ADDR']));
goaway(z_root() . '/chat/' . $x[0]['channel_address'] . '/' . $room_id);
}
if (!$stopped) {
$lastseen = intval($_REQUEST['last']);
$ret = array('success' => false);
$sql_extra = permissions_sql($a->data['chat']['uid']);
$r = q("select * from chatroom where cr_uid = %d and cr_id = %d {$sql_extra}", intval($a->data['chat']['uid']), intval($a->data['chat']['room_id']));
if (!$r) {
json_return_and_die($ret);
}
$inroom = array();
$r = q("select * from chatpresence left join xchan on xchan_hash = cp_xchan where cp_room = %d order by xchan_name", intval($a->data['chat']['room_id']));
if ($r) {
foreach ($r as $rr) {
switch ($rr['cp_status']) {
case 'away':
$status = t('Away');
break;
case 'online':
default:
$status = t('Online');
break;
}
$inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'], 'name' => $rr['xchan_name'], status => $status);
}
}
$chats = array();
$r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d order by created", intval($a->data['chat']['room_id']), intval($lastseen));
if ($r) {
foreach ($r as $rr) {
$chats[] = array('id' => $rr['chat_id'], 'img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'], 'name' => $rr['xchan_name'], 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'r'), 'text' => smilies(bbcode($rr['chat_text'])));
}
}
}
$r = q("update chatpresence set cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s' limit 1", dbesc(datetime_convert()), intval($a->data['chat']['room_id']), dbesc(get_observer_hash()), dbesc($_SERVER['REMOTE_ADDR']));
$ret['success'] = true;
if (!$stopped) {
$ret['inroom'] = $inroom;
$ret['chats'] = $chats;
}
json_return_and_die($ret);
}
开发者ID:Mauru,项目名称:red,代码行数:50,代码来源:chatsvc.php
示例15: ratingsearch_init
function ratingsearch_init(&$a)
{
$ret = array('success' => false);
$dirmode = intval(get_config('system', 'directory_mode'));
if ($dirmode == DIRECTORY_MODE_NORMAL) {
$ret['message'] = 'This site is not a directory server.';
json_return_and_die($ret);
}
if (argc() > 1) {
$hash = argv(1);
}
if (!$hash) {
$ret['message'] = 'No channel identifier';
json_return_and_die($ret);
}
if (strpos($hash, '@')) {
$r = q("select * from hubloc where hubloc_addr = '%s' limit 1", dbesc($hash));
if ($r) {
$hash = $r[0]['hubloc_hash'];
}
}
$p = q("select * from xchan where xchan_hash like '%s'", dbesc($hash . '%'));
if ($p) {
$target = $p[0]['xchan_hash'];
} else {
$p = q("select * from site where site_url like '%s' and site_type = %d ", dbesc('%' . $hash), intval(SITE_TYPE_ZOT));
if ($p) {
$target = strtolower($hash);
} else {
$ret['message'] = 'Rating target not found';
json_return_and_die($ret);
}
}
if ($p) {
$ret['target'] = $p[0];
}
$ret['success'] = true;
$r = q("select * from xlink left join xchan on xlink_xchan = xchan_hash \n\t\twhere xlink_link = '%s' and xlink_rating != 0 and xlink_static = 1 order by xchan_name asc", dbesc($target));
if ($r) {
$ret['ratings'] = $r;
} else {
$ret['ratings'] = array();
}
json_return_and_die($ret);
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:45,代码来源:ratingsearch.php
示例16: notes_init
/** @file */
function notes_init(&$a)
{
if (!local_user()) {
return;
}
$ret = array('success' => true);
if ($_REQUEST['note_text'] || $_REQUEST['note_text'] == '') {
$body = escape_tags($_REQUEST['note_text']);
set_pconfig(local_user(), 'notes', 'text', $body);
}
// push updates to channel clones
if (argc() > 1 && argv(1) === 'sync') {
require_once 'include/zot.php';
build_sync_packet();
}
logger('notes saved.', LOGGER_DEBUG);
json_return_and_die($ret);
}
开发者ID:Mauru,项目名称:red,代码行数:19,代码来源:notes.php
示例17: oexchange_content
function oexchange_content(&$a)
{
if (!local_channel()) {
if (remote_channel()) {
$observer = $a->get_observer();
if ($observer && $observer['xchan_url']) {
$parsed = @parse_url($observer['xchan_url']);
if (!$parsed) {
notice(t('Unable to find your hub.') . EOL);
return;
}
$url = $parsed['scheme'] . '://' . $parsed['host'] . ($parsed['port'] ? ':' . $parsed['port'] : '');
$url .= '/oexchange';
$result = z_post_url($url, $_REQUEST);
json_return_and_die($result);
}
}
return login(false);
}
if (argc() > 1 && argv(1) === 'done') {
info(t('Post successful.') . EOL);
return;
}
$url = x($_REQUEST, 'url') && strlen($_REQUEST['url']) ? urlencode(notags(trim($_REQUEST['url']))) : '';
$title = x($_REQUEST, 'title') && strlen($_REQUEST['title']) ? '&title=' . urlencode(notags(trim($_REQUEST['title']))) : '';
$description = x($_REQUEST, 'description') && strlen($_REQUEST['description']) ? '&description=' . urlencode(notags(trim($_REQUEST['description']))) : '';
$tags = x($_REQUEST, 'tags') && strlen($_REQUEST['tags']) ? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '';
$ret = z_fetch_url($a->get_baseurl() . '/urlinfo?f=&url=' . $url . $title . $description . $tags);
if ($ret['success']) {
$s = $ret['body'];
}
if (!strlen($s)) {
return;
}
$post = array();
$post['profile_uid'] = local_channel();
$post['return'] = '/oexchange/done';
$post['body'] = $s;
$post['type'] = 'wall';
$_REQUEST = $post;
require_once 'mod/item.php';
item_post($a);
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:43,代码来源:oexchange.php
示例18: new_channel_init
function new_channel_init(&$a)
{
$cmd = argc() > 1 ? argv(1) : '';
if ($cmd === 'autofill.json') {
require_once 'library/urlify/URLify.php';
$result = array('error' => false, 'message' => '');
$n = trim($_REQUEST['name']);
$x = strtolower(URLify::transliterate($n));
$test = array();
// first name
if (strpos($x, ' ')) {
$test[] = legal_webbie(substr($x, 0, strpos($x, ' ')));
}
if ($test[0]) {
// first name plus first initial of last
$test[] = strpos($x, ' ') ? $test[0] . legal_webbie(trim(substr($x, strpos($x, ' '), 2))) : '';
// first name plus random number
$test[] = $test[0] . mt_rand(1000, 9999);
}
// fullname
$test[] = legal_webbie($x);
// fullname plus random number
$test[] = legal_webbie($x) . mt_rand(1000, 9999);
json_return_and_die(check_webbie($test));
}
if ($cmd === 'checkaddr.json') {
require_once 'library/urlify/URLify.php';
$result = array('error' => false, 'message' => '');
$n = trim($_REQUEST['nick']);
$x = strtolower(URLify::transliterate($n));
$test = array();
$n = legal_webbie($x);
if (strlen($n)) {
$test[] = $n;
$test[] = $n . mt_rand(1000, 9999);
}
for ($y = 0; $y < 100; $y++) {
$test[] = 'id' . mt_rand(1000, 9999);
}
json_return_and_die(check_webbie($test));
}
}
开发者ID:Gillesq,项目名称:hubzilla,代码行数:42,代码来源:new_channel.php
示例19: post
function post()
{
if (argc() > 1 && argv(1) === 'album') {
// API: /embedphotos/album
$name = x($_POST, 'name') ? $_POST['name'] : null;
if (!$name) {
json_return_and_die(array('errormsg' => 'Error retrieving album', 'status' => false));
}
$album = $this->embedphotos_widget_album(array('channel' => \App::get_channel(), 'album' => $name));
json_return_and_die(array('status' => true, 'content' => $album));
}
if (argc() > 1 && argv(1) === 'albumlist') {
// API: /embedphotos/albumlist
$album_list = $this->embedphotos_album_list($a);
json_return_and_die(array('status' => true, 'albumlist' => $album_list));
}
if (argc() > 1 && argv(1) === 'photolink') {
// API: /embedphotos/photolink
$href = x($_POST, 'href') ? $_POST['href'] : null;
if (!$href) {
json_return_and_die(array('errormsg' => 'Error retrieving link ' . $href, 'status' => false));
}
$resource_id = array_pop(explode("/", $href));
$r = q("SELECT obj,body from item where resource_type = 'photo' and resource_id = '%s' limit 1", dbesc($resource_id));
if (!$r) {
json_return_and_die(array('errormsg' => 'Error retrieving resource ' . $resource_id, 'status' => false));
}
$obj = json_decode($r[0]['obj'], true);
if (x($obj, 'body')) {
$photolink = $obj['body'];
} elseif (x($obj, 'bbcode')) {
$photolink = $obj['bbcode'];
} elseif ($r[0]['body'] !== '') {
$photolink = $r[0]['body'];
} else {
json_return_and_die(array('errormsg' => 'Error retrieving resource ' . $resource_id, 'status' => false));
}
json_return_and_die(array('status' => true, 'photolink' => $photolink));
}
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:40,代码来源:Embedphotos.php
示例20: prate_post
function prate_post(&$a)
{
if (!local_channel()) {
return;
}
$channel = App::get_channel();
$target = trim($_REQUEST['target']);
if (!$target) {
return;
}
if ($target === $channel['channel_hash']) {
return;
}
$rating = intval($_POST['rating']);
if ($rating < -10) {
$rating = -10;
}
if ($rating > 10) {
$rating = 10;
}
$rating_text = trim(escape_tags($_REQUEST['rating_text']));
$signed = $target . '.' . $rating . '.' . $rating_text;
$sig = base64url_encode(rsa_sign($signed, $channel['channel_prvkey']));
$z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), dbesc($target));
if ($z) {
$record = $z[0]['xlink_id'];
$w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s'\n\t\t\twhere xlink_id = %d", intval($rating), dbesc($rating_text), dbesc($sig), dbesc(datetime_convert()), intval($record));
} else {
$w = q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_sig, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', '%s', 1 ) ", dbesc($channel['channel_hash']), dbesc($target), intval($rating), dbesc($rating_text), dbesc($sig), dbesc(datetime_convert()));
$z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), dbesc($orig_record[0]['abook_xchan']));
if ($z) {
$record = $z[0]['xlink_id'];
}
}
if ($record) {
proc_run('php', 'include/ratenotif.php', 'rating', $record);
}
json_return_and_die(array('result' => true));
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:39,代码来源:prate.php
注:本文中的json_return_and_die函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论