Merge develop into 1206-events-template
Conflicts: view/theme/frio/css/style.css
This commit is contained in:
commit
7dc5fc8b9f
59 changed files with 2369 additions and 602 deletions
|
@ -207,35 +207,34 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
|
|||
if ($uid == -1)
|
||||
$uid = local_user();
|
||||
|
||||
// Fetch contact data from the contact table for the user and given network
|
||||
$r = q("SELECT `id`, `id` AS `cid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
|
||||
// Fetch contact data from the contact table for the given user
|
||||
$r = q("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
|
||||
`keywords`, `gender`, `photo`, `thumb`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `bd` AS `birthday`, `self`
|
||||
FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` IN ('%s', '')",
|
||||
dbesc(normalise_link($url)), intval($uid), dbesc($profile["network"]));
|
||||
|
||||
// Is the contact present for the user in a different network? (Can happen with OStatus and the "Statusnet" addon)
|
||||
if (!$r)
|
||||
$r = q("SELECT `id`, `id` AS `cid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
|
||||
`keywords`, `gender`, `photo`, `thumb`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `bd` AS `birthday`, `self`
|
||||
FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
|
||||
dbesc(normalise_link($url)), intval($uid));
|
||||
FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
|
||||
dbesc(normalise_link($url)), intval($uid));
|
||||
|
||||
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
|
||||
if (!$r)
|
||||
$r = q("SELECT `id`, 0 AS `cid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
|
||||
$r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
|
||||
`keywords`, `gender`, `photo`, `thumb`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `bd` AS `birthday`, 0 AS `self`
|
||||
FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0",
|
||||
dbesc(normalise_link($url)));
|
||||
|
||||
// Fetch the data from the gcontact table
|
||||
if (!$r)
|
||||
$r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
|
||||
$r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
|
||||
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `community` AS `forum`, 0 AS `prv`, `community`, `birthday`, 0 AS `self`
|
||||
FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
FROM `gcontact` WHERE `nurl` = '%s'",
|
||||
dbesc(normalise_link($url)));
|
||||
|
||||
if ($r) {
|
||||
$profile = $r[0];
|
||||
// If there is more than one entry we filter out the connector networks
|
||||
if (count($r) > 1)
|
||||
foreach ($r AS $id => $result)
|
||||
if ($result["network"] == NETWORK_STATUSNET)
|
||||
unset($r[$id]);
|
||||
|
||||
$profile = array_shift($r);
|
||||
|
||||
// "bd" always contains the upcoming birthday of a contact.
|
||||
// "birthday" might contain the birthday including the year of birth.
|
||||
|
|
|
@ -172,7 +172,7 @@ class Config {
|
|||
// manage array value
|
||||
$dbvalue = (is_array($value)?serialize($value):$value);
|
||||
$dbvalue = (is_bool($dbvalue) ? intval($dbvalue) : $dbvalue);
|
||||
if(self::get($family,$key,true) === false) {
|
||||
if(is_null(self::get($family,$key,null,true))) {
|
||||
$a->config[$family][$key] = $value;
|
||||
$ret = q("INSERT INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' ) ",
|
||||
dbesc($family),
|
||||
|
|
|
@ -161,7 +161,7 @@ class PConfig {
|
|||
// manage array value
|
||||
$dbvalue = (is_array($value)?serialize($value):$value);
|
||||
|
||||
if(self::get($uid,$family,$key,true) === false) {
|
||||
if(is_null(self::get($uid,$family,$key,null, true))) {
|
||||
$a->config[$uid][$family][$key] = $value;
|
||||
$ret = q("INSERT INTO `pconfig` ( `uid`, `cat`, `k`, `v` ) VALUES ( %d, '%s', '%s', '%s' ) ",
|
||||
intval($uid),
|
||||
|
|
|
@ -1309,7 +1309,7 @@
|
|||
$r = q("SELECT STRAIGHT_JOIN `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
`contact`.`id` AS `cid`
|
||||
FROM `item`, `contact`
|
||||
WHERE `item`.`uid` = %d AND `verb` = '%s'
|
||||
AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
||||
|
@ -1388,7 +1388,7 @@
|
|||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
|
||||
`contact`.`id` AS `cid`,
|
||||
`user`.`nickname`, `user`.`hidewall`
|
||||
FROM `item` STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
STRAIGHT_JOIN `user` ON `user`.`uid` = `item`.`uid`
|
||||
|
@ -1457,7 +1457,7 @@
|
|||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
`contact`.`id` AS `cid`
|
||||
FROM `item`, `contact`
|
||||
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
||||
AND `contact`.`id` = `item`.`contact-id` AND `item`.`uid` = %d AND `item`.`verb` = '%s'
|
||||
|
@ -1534,7 +1534,7 @@
|
|||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
`contact`.`id` AS `cid`
|
||||
FROM `item`
|
||||
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`parent` = %d AND `item`.`visible`
|
||||
|
@ -1586,7 +1586,7 @@
|
|||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`nick` as `reply_author`,
|
||||
`contact`.`name`, `contact`.`photo` as `reply_photo`, `contact`.`url` as `reply_url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
`contact`.`id` AS `cid`
|
||||
FROM `item`, `contact`
|
||||
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
||||
AND `contact`.`id` = `item`.`contact-id`
|
||||
|
@ -1699,7 +1699,7 @@
|
|||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
`contact`.`id` AS `cid`
|
||||
FROM `item` FORCE INDEX (`uid_id`), `contact`
|
||||
WHERE `item`.`uid` = %d AND `verb` = '%s'
|
||||
AND NOT (`item`.`author-link` IN ('https://%s', 'http://%s'))
|
||||
|
@ -1776,7 +1776,7 @@
|
|||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
`contact`.`id` AS `cid`
|
||||
FROM `item`, `contact`
|
||||
WHERE `item`.`uid` = %d AND `verb` = '%s'
|
||||
AND `item`.`contact-id` = %d
|
||||
|
@ -1904,7 +1904,7 @@
|
|||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
`contact`.`id` AS `cid`
|
||||
FROM `item`, `contact`
|
||||
WHERE `item`.`uid` = %d
|
||||
AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
||||
|
|
|
@ -373,6 +373,86 @@ function visible_activity($item) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief List of all contact fields that are needed for the conversation function
|
||||
*/
|
||||
function contact_fieldlist() {
|
||||
|
||||
$fieldlist = "`contact`.`network`, `contact`.`url`, `contact`.`name`, `contact`.`writable`,
|
||||
`contact`.`self`, `contact`.`id` AS `cid`, `contact`.`alias`";
|
||||
|
||||
return $fieldlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SQL condition for contacts
|
||||
*/
|
||||
function contact_condition() {
|
||||
|
||||
$condition = "NOT `contact`.`blocked` AND NOT `contact`.`pending`";
|
||||
|
||||
return $condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief List of all item fields that are needed for the conversation function
|
||||
*/
|
||||
function item_fieldlist() {
|
||||
|
||||
/*
|
||||
These Fields are not added below (yet). They are here to for bug search.
|
||||
`item`.`type`,
|
||||
`item`.`extid`,
|
||||
`item`.`received`,
|
||||
`item`.`changed`,
|
||||
`item`.`author-avatar`,
|
||||
`item`.`object`,
|
||||
`item`.`target-type`,
|
||||
`item`.`target`,
|
||||
`item`.`resource-id`,
|
||||
`item`.`tag`,
|
||||
`item`.`attach`,
|
||||
`item`.`inform`,
|
||||
`item`.`pubmail`,
|
||||
`item`.`moderated`,
|
||||
`item`.`visible`,
|
||||
`item`.`spam`,
|
||||
`item`.`starred`,
|
||||
`item`.`bookmark`,
|
||||
`item`.`unseen`,
|
||||
`item`.`deleted`,
|
||||
`item`.`origin`,
|
||||
`item`.`forum_mode`,
|
||||
`item`.`last-child`,
|
||||
`item`.`mention`,
|
||||
`item`.`global`,
|
||||
`item`.`gcontact-id`,
|
||||
`item`.`shadow`,
|
||||
*/
|
||||
|
||||
$fieldlist = "`item`.`author-link`, `item`.`verb`, `item`.`id`, `item`.`parent`, `item`.`file`,
|
||||
`item`.`uid`, `item`.`author-name`, `item`.`location`, `item`.`coord`,
|
||||
`item`.`title`, `item`.`uri`, `item`.`created`, `item`.`app`, `item`.`guid`,
|
||||
`item`.`contact-id`, `item`.`thr-parent`, `item`.`parent-uri`, `item`.`rendered-hash`,
|
||||
`item`.`body`, `item`.`rendered-html`, `item`.`private`, `item`.`edited`,
|
||||
`item`.`allow_cid`, `item`.`allow_gid`, `item`.`deny_cid`, `item`.`deny_gid`,
|
||||
`item`.`event-id`, `item`.`object-type`, `item`.`starred`, `item`.`created`,
|
||||
`item`.`postopts`, `item`.`owner-link`, `item`.`owner-name`, `item`.`owner-avatar`,
|
||||
`item`.`plink`, `item`.`wall`, `item`.`commented`,
|
||||
`item`.`id` AS `item_id`, `item`.`network` AS `item_network`";
|
||||
|
||||
return $fieldlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SQL condition for items
|
||||
*/
|
||||
function item_condition() {
|
||||
|
||||
$condition = "`item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`";
|
||||
|
||||
return $condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Render" a conversation or list of items for HTML display.
|
||||
|
|
|
@ -162,7 +162,7 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
|
|||
* @brief Wrapper for date selector, tailored for use in birthday fields.
|
||||
*
|
||||
* @param string $dob Date of Birth
|
||||
* @return string
|
||||
* @return string Formatted html
|
||||
*/
|
||||
function dob($dob) {
|
||||
list($year,$month,$day) = sscanf($dob,'%4d-%2d-%2d');
|
||||
|
@ -175,7 +175,18 @@ function dob($dob) {
|
|||
else
|
||||
$value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
|
||||
|
||||
$o = '<input type="text" name="dob" value="' . $value . '" placeholder="' . t('YYYY-MM-DD or MM-DD') . '" />';
|
||||
$age = ((intval($value)) ? age($value, $a->user["timezone"], $a->user["timezone"]) : "");
|
||||
|
||||
$o = replace_macros(get_markup_template("field_input.tpl"), array(
|
||||
'$field' => array(
|
||||
'dob',
|
||||
t('Birthday:'),
|
||||
$value,
|
||||
(((intval($age)) > 0 ) ? t('Age: ') . $age : ""),
|
||||
'',
|
||||
'placeholder="' . t('YYYY-MM-DD or MM-DD') . '"'
|
||||
)
|
||||
));
|
||||
|
||||
// if ($dob && $dob != '0000-00-00')
|
||||
// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
|
||||
|
|
|
@ -197,7 +197,6 @@ class dfrn {
|
|||
`contact`.`name`, `contact`.`network`, `contact`.`photo`, `contact`.`url`,
|
||||
`contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`,
|
||||
`contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`,
|
||||
`sign`.`signed_text`, `sign`.`signature`, `sign`.`signer`
|
||||
FROM `item` $sql_post_table
|
||||
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
|
@ -369,6 +368,7 @@ class dfrn {
|
|||
|
||||
xml::add_element($doc, $relocate, "dfrn:url", $owner['url']);
|
||||
xml::add_element($doc, $relocate, "dfrn:name", $owner['name']);
|
||||
xml::add_element($doc, $relocate, "dfrn:addr", $owner['addr']);
|
||||
xml::add_element($doc, $relocate, "dfrn:photo", $photos[4]);
|
||||
xml::add_element($doc, $relocate, "dfrn:thumb", $photos[5]);
|
||||
xml::add_element($doc, $relocate, "dfrn:micro", $photos[6]);
|
||||
|
@ -1546,6 +1546,7 @@ class dfrn {
|
|||
$relocate["uid"] = $importer["importer_uid"];
|
||||
$relocate["cid"] = $importer["id"];
|
||||
$relocate["url"] = $xpath->query("dfrn:url/text()", $relocation)->item(0)->nodeValue;
|
||||
$relocate["addr"] = $xpath->query("dfrn:addr/text()", $relocation)->item(0)->nodeValue;
|
||||
$relocate["name"] = $xpath->query("dfrn:name/text()", $relocation)->item(0)->nodeValue;
|
||||
$relocate["photo"] = $xpath->query("dfrn:photo/text()", $relocation)->item(0)->nodeValue;
|
||||
$relocate["thumb"] = $xpath->query("dfrn:thumb/text()", $relocation)->item(0)->nodeValue;
|
||||
|
@ -1556,6 +1557,9 @@ class dfrn {
|
|||
$relocate["poll"] = $xpath->query("dfrn:poll/text()", $relocation)->item(0)->nodeValue;
|
||||
$relocate["sitepubkey"] = $xpath->query("dfrn:sitepubkey/text()", $relocation)->item(0)->nodeValue;
|
||||
|
||||
if ($relocate["addr"] == "")
|
||||
$relocate["addr"] = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$3@$2", $relocate["url"]);
|
||||
|
||||
// update contact
|
||||
$r = q("SELECT `photo`, `url` FROM `contact` WHERE `id` = %d AND `uid` = %d;",
|
||||
intval($importer["id"]),
|
||||
|
@ -1565,6 +1569,30 @@ class dfrn {
|
|||
|
||||
$old = $r[0];
|
||||
|
||||
// Update the gcontact entry
|
||||
$relocate["server_url"] = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$1$2", $relocate["url"]);
|
||||
|
||||
$x = q("UPDATE `gcontact` SET
|
||||
`name` = '%s',
|
||||
`photo` = '%s',
|
||||
`url` = '%s',
|
||||
`nurl` = '%s',
|
||||
`addr` = '%s',
|
||||
`connect` = '%s',
|
||||
`notify` = '%s',
|
||||
`server_url` = '%s'
|
||||
WHERE `nurl` = '%s';",
|
||||
dbesc($relocate["name"]),
|
||||
dbesc($relocate["photo"]),
|
||||
dbesc($relocate["url"]),
|
||||
dbesc(normalise_link($relocate["url"])),
|
||||
dbesc($relocate["addr"]),
|
||||
dbesc($relocate["addr"]),
|
||||
dbesc($relocate["notify"]),
|
||||
dbesc($relocate["server_url"]),
|
||||
dbesc(normalise_link($old["url"])));
|
||||
|
||||
// Update the contact table. We try to find every entry.
|
||||
$x = q("UPDATE `contact` SET
|
||||
`name` = '%s',
|
||||
`photo` = '%s',
|
||||
|
@ -1572,30 +1600,34 @@ class dfrn {
|
|||
`micro` = '%s',
|
||||
`url` = '%s',
|
||||
`nurl` = '%s',
|
||||
`addr` = '%s',
|
||||
`request` = '%s',
|
||||
`confirm` = '%s',
|
||||
`notify` = '%s',
|
||||
`poll` = '%s',
|
||||
`site-pubkey` = '%s'
|
||||
WHERE `id` = %d AND `uid` = %d;",
|
||||
WHERE (`id` = %d AND `uid` = %d) OR (`nurl` = '%s');",
|
||||
dbesc($relocate["name"]),
|
||||
dbesc($relocate["photo"]),
|
||||
dbesc($relocate["thumb"]),
|
||||
dbesc($relocate["micro"]),
|
||||
dbesc($relocate["url"]),
|
||||
dbesc(normalise_link($relocate["url"])),
|
||||
dbesc($relocate["addr"]),
|
||||
dbesc($relocate["request"]),
|
||||
dbesc($relocate["confirm"]),
|
||||
dbesc($relocate["notify"]),
|
||||
dbesc($relocate["poll"]),
|
||||
dbesc($relocate["sitepubkey"]),
|
||||
intval($importer["id"]),
|
||||
intval($importer["importer_uid"]));
|
||||
intval($importer["importer_uid"]),
|
||||
dbesc(normalise_link($old["url"])));
|
||||
|
||||
if ($x === false)
|
||||
return false;
|
||||
|
||||
// update items
|
||||
/// @todo This is an extreme performance killer
|
||||
$fields = array(
|
||||
'owner-link' => array($old["url"], $relocate["url"]),
|
||||
'author-link' => array($old["url"], $relocate["url"]),
|
||||
|
|
|
@ -507,6 +507,13 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
|||
$arr['inform'] = ((x($arr,'inform')) ? trim($arr['inform']) : '');
|
||||
$arr['file'] = ((x($arr,'file')) ? trim($arr['file']) : '');
|
||||
|
||||
// Items cannot be stored before they happen ...
|
||||
if ($arr['created'] > datetime_convert())
|
||||
$arr['created'] = datetime_convert();
|
||||
|
||||
// We haven't invented time travel by now.
|
||||
if ($arr['edited'] > datetime_convert())
|
||||
$arr['edited'] = datetime_convert();
|
||||
|
||||
if (($arr['author-link'] == "") AND ($arr['owner-link'] == ""))
|
||||
logger("Both author-link and owner-link are empty. Called by: ".App::callstack(), LOGGER_DEBUG);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue