本文整理汇总了PHP中dbescdate函数的典型用法代码示例。如果您正苦于以下问题:PHP dbescdate函数的具体用法?PHP dbescdate怎么用?PHP dbescdate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbescdate函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_channel_sync_delivery
//.........这里部分代码省略.........
continue;
}
}
}
foreach ($abook as $k => $v) {
if (in_array($k, $disallowed) || strpos($k, 'abook') !== 0) {
continue;
}
$clean[$k] = $v;
}
if (!array_key_exists('abook_xchan', $clean)) {
continue;
}
$r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", dbesc($clean['abook_xchan']), intval($channel['channel_id']));
// make sure we have an abook entry for this xchan on this system
if (!$r) {
if ($max_friends !== false && $total_friends > $max_friends) {
logger('process_channel_sync_delivery: total_channels service class limit exceeded');
continue;
}
if ($max_feeds !== false && intval($clean['abook_feed']) && $total_feeds > $max_feeds) {
logger('process_channel_sync_delivery: total_feeds service class limit exceeded');
continue;
}
q("insert into abook ( abook_xchan, abook_channel ) values ('%s', %d ) ", dbesc($clean['abook_xchan']), intval($channel['channel_id']));
$total_friends++;
if (intval($clean['abook_feed'])) {
$total_feeds++;
}
}
if (count($clean)) {
foreach ($clean as $k => $v) {
if ($k == 'abook_dob') {
$v = dbescdate($v);
}
$r = dbq("UPDATE abook set " . dbesc($k) . " = '" . dbesc($v) . "' where abook_xchan = '" . dbesc($clean['abook_xchan']) . "' and abook_channel = " . intval($channel['channel_id']));
}
}
}
}
// sync collections (privacy groups) oh joy...
if (array_key_exists('collections', $arr) && is_array($arr['collections']) && count($arr['collections'])) {
$x = q("select * from groups where uid = %d", intval($channel['channel_id']));
foreach ($arr['collections'] as $cl) {
$found = false;
if ($x) {
foreach ($x as $y) {
if ($cl['collection'] == $y['hash']) {
$found = true;
break;
}
}
if ($found) {
if ($y['name'] != $cl['name'] || $y['visible'] != $cl['visible'] || $y['deleted'] != $cl['deleted']) {
q("update groups set name = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d", dbesc($cl['name']), intval($cl['visible']), intval($cl['deleted']), dbesc($cl['hash']), intval($channel['channel_id']));
}
if (intval($cl['deleted']) && !intval($y['deleted'])) {
q("delete from group_member where gid = %d", intval($y['id']));
}
}
}
if (!$found) {
$r = q("INSERT INTO `groups` ( hash, uid, visible, deleted, name )\n\t\t\t\t\t\tVALUES( '%s', %d, %d, %d, '%s' ) ", dbesc($cl['collection']), intval($channel['channel_id']), intval($cl['visible']), intval($cl['deleted']), dbesc($cl['name']));
}
// now look for any collections locally which weren't in the list we just received.
// They need to be removed by marking deleted and removing the members.
示例2: diaspora_discover
function diaspora_discover(&$a, &$b)
{
require_once 'include/network.php';
$result = array();
$network = null;
$diaspora = false;
$diaspora_base = '';
$diaspora_guid = '';
$diaspora_key = '';
$dfrn = false;
$x = old_webfinger($webbie);
if ($x) {
logger('old_webfinger: ' . print_r($x, true));
foreach ($x as $link) {
if ($link['@attributes']['rel'] === NAMESPACE_DFRN) {
$dfrn = unamp($link['@attributes']['href']);
}
if ($link['@attributes']['rel'] === 'salmon') {
$notify = unamp($link['@attributes']['href']);
}
if ($link['@attributes']['rel'] === NAMESPACE_FEED) {
$poll = unamp($link['@attributes']['href']);
}
if ($link['@attributes']['rel'] === 'http://microformats.org/profile/hcard') {
$hcard = unamp($link['@attributes']['href']);
}
if ($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
$profile = unamp($link['@attributes']['href']);
}
if ($link['@attributes']['rel'] === 'http://portablecontacts.net/spec/1.0') {
$poco = unamp($link['@attributes']['href']);
}
if ($link['@attributes']['rel'] === 'http://joindiaspora.com/seed_location') {
$diaspora_base = unamp($link['@attributes']['href']);
$diaspora = true;
}
if ($link['@attributes']['rel'] === 'http://joindiaspora.com/guid') {
$diaspora_guid = unamp($link['@attributes']['href']);
$diaspora = true;
}
if ($link['@attributes']['rel'] === 'diaspora-public-key') {
$diaspora_key = base64_decode(unamp($link['@attributes']['href']));
if (strstr($diaspora_key, 'RSA ')) {
$pubkey = rsatopem($diaspora_key);
} else {
$pubkey = $diaspora_key;
}
$diaspora = true;
}
}
if ($diaspora && $diaspora_base && $diaspora_guid) {
$guid = $diaspora_guid;
$diaspora_base = trim($diaspora_base, '/');
$notify = $diaspora_base . '/receive';
if (strpos($webbie, '@')) {
$addr = str_replace('acct:', '', $webbie);
$hostname = substr($webbie, strpos($webbie, '@') + 1);
}
$network = 'diaspora';
// until we get a dfrn layer, we'll use diaspora protocols for Friendica,
// but give it a different network so we can go back and fix these when we get proper support.
// It really should be just 'friendica' but we also want to distinguish
// between Friendica sites that we can use D* protocols with and those we can't.
// Some Friendica sites will have Diaspora disabled.
if ($dfrn) {
$network = 'friendica-over-diaspora';
}
if ($hcard) {
$vcard = scrape_vcard($hcard);
$vcard['nick'] = substr($webbie, 0, strpos($webbie, '@'));
if (!$vcard['fn']) {
$vcard['fn'] = $webbie;
}
}
$r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($addr));
/**
*
* Diaspora communications are notoriously unreliable and receiving profile update messages (indeed any messages)
* are pretty much random luck. We'll check the timestamp of the xchan_name_date at a higher level and refresh
* this record once a month; because if you miss a profile update message and they update their profile photo or name
* you're otherwise stuck with stale info until they change their profile again - which could be years from now.
*
*/
if ($r) {
$r = q("update xchan set xchan_name = '%s', xchan_network = '%s', xchan_name_date = '%s' where xchan_hash = '%s' limit 1", dbesc($vcard['fn']), dbesc($network), dbesc(datetime_convert()), dbesc($addr));
} else {
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_pubkey, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ", dbesc($addr), dbesc($guid), dbesc($pubkey), dbesc($addr), dbesc($profile), dbesc($vcard['fn']), dbesc($network), dbescdate(datetime_convert()));
}
$r = q("select * from hubloc where hubloc_hash = '%s' limit 1", dbesc($webbie));
if (!$r) {
$r = q("insert into hubloc ( hubloc_guid, hubloc_hash, hubloc_addr, hubloc_network, hubloc_url, hubloc_host, hubloc_callback, hubloc_updated, hubloc_primary ) values ('%s','%s','%s','%s','%s','%s','%s','%s', 1)", dbesc($guid), dbesc($addr), dbesc($addr), dbesc($network), dbesc(trim($diaspora_base, '/')), dbesc($hostname), dbesc($notify), dbescdate(datetime_convert()));
}
$photos = import_xchan_photo($vcard['photo'], $addr);
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'", dbescdate(datetime_convert('UTC', 'UTC', $arr['photo_updated'])), dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]), dbesc($photos[3]), dbesc($addr));
return true;
}
return false;
/*
$vcard['fn'] = notags($vcard['fn']);
$vcard['nick'] = str_replace(' ','',notags($vcard['nick']));
//.........这里部分代码省略.........
示例3: discover_by_webbie
//.........这里部分代码省略.........
$gnusoc = true;
$probe_atom = true;
}
if (!$pubkey) {
$pubkey = $salmon_key;
}
if (($dfrn || $diaspora) && $hcard) {
$probe_hcard = true;
}
if (!$fullname) {
$fullname = $nickname;
}
if ($probe_atom) {
$k = z_fetch_url($atom_feed);
if ($k['success']) {
$feed_meta = feed_meta($k['body']);
}
if ($feed_meta) {
// stash any discovered pubsubhubbub hubs in case we need to follow them
// this will save an expensive lookup later
if ($feed_meta['hubs'] && $address) {
set_xconfig($address, 'system', 'push_hubs', $feed_meta['hubs']);
set_xconfig($address, 'system', 'feed_url', $atom_feed);
}
if ($feed_meta['author']['author_name']) {
$fullname = $feed_meta['author']['author_name'];
}
if (!$avatar) {
if ($feed_meta['author']['author_photo']) {
$avatar = $feed_meta['author']['author_photo'];
}
}
// for GNU-social over-ride any url aliases we may have picked up in webfinger
// The author.uri element in the feed is likely to be more accurate
if ($gnusoc && $feed_meta['author']['author_uri']) {
$location = $feed_meta['author']['author_uri'];
}
}
} else {
if ($probe_hcard) {
$vcard = scrape_vcard($hcard);
if ($vcard) {
logger('vcard: ' . print_r($vcard, true), LOGGER_DATA);
if ($vcard['fn']) {
$fullname = $vcard['fn'];
}
if ($vcard['photo'] && strpos($vcard['photo'], 'http') !== 0) {
$vcard['photo'] = $diaspora_base . '/' . $vcard['photo'];
}
if (!$avatar) {
$avatar = $vcard['photo'];
}
}
}
}
if ($profile && !$location) {
$location = $profile;
}
if ($location) {
$m = parse_url($location);
$base = $m['scheme'] . '://' . $m['host'];
$host = $m['host'];
}
if ($diaspora && $diaspora_base && $diaspora_guid) {
if ($dfrn) {
$network = 'friendica-over-diaspora';
} else {
$network = 'diaspora';
}
$base = trim($diaspora_base, '/');
$notify = $base . '/receive';
} else {
if ($gnusoc) {
$network = 'gnusoc';
$notify = $salmon;
}
}
logger('network: ' . $network);
logger('address: ' . $address);
logger('fullname: ' . $fullname);
logger('pubkey: ' . $pubkey);
logger('location: ' . $location);
// if we have everything we need, let's create the records
if ($network && $address && $fullname && $pubkey && $location) {
$r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($address));
if ($r) {
$r = q("update xchan set xchan_name = '%s', xchan_network = '%s', xchan_name_date = '%s' where xchan_hash = '%s' limit 1", dbesc($fullname), dbesc($network), dbesc(datetime_convert()), dbesc($address));
} else {
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_pubkey, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ", dbesc($address), dbesc($diaspora_guid ? $diaspora_guid : $location), dbesc($pubkey), dbesc($address), dbesc($location), dbesc($fullname), dbesc($network), dbescdate(datetime_convert()));
}
$r = q("select * from hubloc where hubloc_hash = '%s' limit 1", dbesc($address));
if (!$r) {
$r = q("insert into hubloc ( hubloc_guid, hubloc_hash, hubloc_addr, hubloc_network, hubloc_url, hubloc_host, hubloc_callback, hubloc_updated, hubloc_primary ) values ('%s','%s','%s','%s','%s','%s','%s','%s', 1)", dbesc($diaspora_guid ? $diaspora_guid : $location), dbesc($address), dbesc($address), dbesc($network), dbesc($base), dbesc($host), dbesc($notify), dbescdate(datetime_convert()));
}
$photos = import_xchan_photo($avatar, $address);
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'", dbescdate(datetime_convert()), dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]), dbesc($photos[3]), dbesc($address));
return true;
}
return false;
}
示例4: send_message
//.........这里部分代码省略.........
if (!$retconv) {
$r = q("select * from conv where guid = '%s' and uid = %d limit 1", dbesc($conv_guid), intval(local_channel()));
if ($r) {
$retconv = $r[0];
$retconv['subject'] = base64url_decode(str_rot47($retconv['subject']));
}
}
if (!$retconv) {
$ret['message'] = 'conversation not found';
return $ret;
}
// generate a unique message_id
do {
$dups = false;
$hash = random_string();
$mid = $hash . '@' . get_app()->get_hostname();
$r = q("SELECT id FROM mail WHERE mid = '%s' LIMIT 1", dbesc($mid));
if (count($r)) {
$dups = true;
}
} while ($dups == true);
if (!strlen($replyto)) {
$replyto = $mid;
}
/**
*
* When a photo was uploaded into the message using the (profile wall) ajax
* uploader, The permissions are initially set to disallow anybody but the
* owner from seeing it. This is because the permissions may not yet have been
* set for the post. If it's private, the photo permissions should be set
* appropriately. But we didn't know the final permissions on the post until
* now. So now we'll look for links of uploaded messages that are in the
* post and set them to the same permissions as the post itself.
*
*/
$match = null;
$images = null;
if (preg_match_all("/\\[zmg\\](.*?)\\[\\/zmg\\]/", strpos($body, '[/crypt]') ? $_POST['media_str'] : $body, $match)) {
$images = $match[1];
}
$match = false;
if (preg_match_all("/\\[attachment\\](.*?)\\[\\/attachment\\]/", strpos($body, '[/crypt]') ? $_POST['media_str'] : $body, $match)) {
$attaches = $match[1];
}
$attachments = '';
if (preg_match_all('/(\\[attachment\\](.*?)\\[\\/attachment\\])/', $body, $match)) {
$attachments = array();
foreach ($match[2] as $mtch) {
$hash = substr($mtch, 0, strpos($mtch, ','));
$rev = intval(substr($mtch, strpos($mtch, ',')));
$r = attach_by_hash_nodata($hash, $rev);
if ($r['success']) {
$attachments[] = array('href' => $a->get_baseurl() . '/attach/' . $r['data']['hash'], 'length' => $r['data']['filesize'], 'type' => $r['data']['filetype'], 'title' => urlencode($r['data']['filename']), 'revision' => $r['data']['revision']);
}
$body = str_replace($match[1], '', $body);
}
}
$jattach = $attachments ? json_encode($attachments) : '';
if ($subject) {
$subject = str_rot47(base64url_encode($subject));
}
if ($body) {
$body = str_rot47(base64url_encode($body));
}
$r = q("INSERT INTO mail ( account_id, conv_guid, mail_obscured, channel_id, from_xchan, to_xchan, title, body, attach, mid, parent_mid, created, expires )\n\t\tVALUES ( %d, '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )", intval($channel['channel_account_id']), dbesc($conv_guid), intval(1), intval($channel['channel_id']), dbesc($channel['channel_hash']), dbesc($recipient), dbesc($subject), dbesc($body), dbesc($jattach), dbesc($mid), dbesc($replyto), dbesc(datetime_convert()), dbescdate($expires));
// verify the save
$r = q("SELECT * FROM mail WHERE mid = '%s' and channel_id = %d LIMIT 1", dbesc($mid), intval($channel['channel_id']));
if ($r) {
$post_id = $r[0]['id'];
$retmail = $r[0];
xchan_mail_query($retmail);
} else {
$ret['message'] = t('Stored post could not be verified.');
return $ret;
}
if (count($images)) {
foreach ($images as $image) {
if (!stristr($image, $a->get_baseurl() . '/photo/')) {
continue;
}
$image_uri = substr($image, strrpos($image, '/') + 1);
$image_uri = substr($image_uri, 0, strpos($image_uri, '-'));
$r = q("UPDATE photo SET allow_cid = '%s' WHERE resource_id = '%s' AND uid = %d and allow_cid = '%s'", dbesc('<' . $recipient . '>'), dbesc($image_uri), intval($channel['channel_id']), dbesc('<' . $channel['channel_hash'] . '>'));
$r = q("UPDATE attach SET allow_cid = '%s' WHERE hash = '%s' AND is_photo = 1 and uid = %d and allow_cid = '%s'", dbesc('<' . $recipient . '>'), dbesc($image_uri), intval($channel['channel_id']), dbesc('<' . $channel['channel_hash'] . '>'));
}
}
if ($attaches) {
foreach ($attaches as $attach) {
$hash = substr($attach, 0, strpos($attach, ','));
$rev = intval(substr($attach, strpos($attach, ',')));
attach_store($channel, $observer_hash, $options = 'update', array('hash' => $hash, 'revision' => $rev, 'allow_cid' => '<' . $recipient . '>'));
}
}
proc_run('php', 'include/notifier.php', 'mail', $post_id);
$ret['success'] = true;
$ret['message_item'] = intval($post_id);
$ret['conv'] = $retconv;
$ret['mail'] = $retmail;
return $ret;
}
示例5: process_channel_sync_delivery
//.........这里部分代码省略.........
continue;
}
}
}
foreach ($abook as $k => $v) {
if (in_array($k, $disallowed) || strpos($k, 'abook') !== 0) {
continue;
}
$clean[$k] = $v;
}
if (!array_key_exists('abook_xchan', $clean)) {
continue;
}
$r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", dbesc($clean['abook_xchan']), intval($channel['channel_id']));
// make sure we have an abook entry for this xchan on this system
if (!$r) {
if ($max_friends !== false && $total_friends > $max_friends) {
logger('process_channel_sync_delivery: total_channels service class limit exceeded');
continue;
}
if ($max_feeds !== false && $clean['abook_flags'] & ABOOK_FLAG_FEED && $total_feeds > $max_feeds) {
logger('process_channel_sync_delivery: total_feeds service class limit exceeded');
continue;
}
q("insert into abook ( abook_xchan, abook_channel ) values ('%s', %d ) ", dbesc($clean['abook_xchan']), intval($channel['channel_id']));
$total_friends++;
if ($clean['abook_flags'] & ABOOK_FLAG_FEED) {
$total_feeds++;
}
}
if (count($clean)) {
foreach ($clean as $k => $v) {
if ($k == 'abook_dob') {
$v = dbescdate($v);
}
$r = dbq("UPDATE abook set " . dbesc($k) . " = '" . dbesc($v) . "' where abook_xchan = '" . dbesc($clean['abook_xchan']) . "' and abook_channel = " . intval($channel['channel_id']));
}
}
}
}
// sync collections (privacy groups) oh joy...
if (array_key_exists('collections', $arr) && is_array($arr['collections']) && count($arr['collections'])) {
$x = q("select * from groups where uid = %d", intval($channel['channel_id']));
foreach ($arr['collections'] as $cl) {
$found = false;
if ($x) {
foreach ($x as $y) {
if ($cl['collection'] == $y['hash']) {
$found = true;
break;
}
}
if ($found) {
if ($y['name'] != $cl['name'] || $y['visible'] != $cl['visible'] || $y['deleted'] != $cl['deleted']) {
q("update groups set name = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d", dbesc($cl['name']), intval($cl['visible']), intval($cl['deleted']), dbesc($cl['hash']), intval($channel['channel_id']));
}
if (intval($cl['deleted']) && !intval($y['deleted'])) {
q("delete from group_member where gid = %d", intval($y['id']));
}
}
}
if (!$found) {
$r = q("INSERT INTO `groups` ( hash, uid, visible, deleted, name )\n\t\t\t\t\t\tVALUES( '%s', %d, %d, %d, '%s' ) ", dbesc($cl['collection']), intval($channel['channel_id']), intval($cl['visible']), intval($cl['deleted']), dbesc($cl['name']));
}
// now look for any collections locally which weren't in the list we just received.
// They need to be removed by marking deleted and removing the members.