mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-22 13:23:40 +00:00
Merge pull request #501 from MrPetovan/task/3878-move-datetime-to-src
Refactor datetime_convert() into DateTimeFormat::convert()
This commit is contained in:
commit
215a18093a
15 changed files with 90 additions and 66 deletions
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
define("DAV_ACL_READ", "{DAV:}read");
|
define("DAV_ACL_READ", "{DAV:}read");
|
||||||
define("DAV_ACL_WRITE", "{DAV:}write");
|
define("DAV_ACL_WRITE", "{DAV:}write");
|
||||||
|
@ -150,7 +151,7 @@ function vcard_source_compile($vcardsource)
|
||||||
*/
|
*/
|
||||||
function wdcal_php2MySqlTime($phpDate)
|
function wdcal_php2MySqlTime($phpDate)
|
||||||
{
|
{
|
||||||
return date("Y-m-d H:i:s", $phpDate);
|
return date(DateTimeFormat::MYSQL, $phpDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +160,7 @@ function wdcal_php2MySqlTime($phpDate)
|
||||||
*/
|
*/
|
||||||
function wdcal_mySql2PhpTime($sqlDate)
|
function wdcal_mySql2PhpTime($sqlDate)
|
||||||
{
|
{
|
||||||
$ts = DateTime::createFromFormat("Y-m-d H:i:s", $sqlDate);
|
$ts = DateTime::createFromFormat(DateTimeFormat::MYSQL, $sqlDate);
|
||||||
return $ts->format("U");
|
return $ts->format("U");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,15 +110,15 @@ function renderCalDavEntry_data(&$calendar, &$calendarobject)
|
||||||
|
|
||||||
q("INSERT INTO %s%sjqcalendar (`calendar_id`, `calendarobject_id`, `Summary`, `StartTime`, `EndTime`, `IsEditable`, `IsAllDayEvent`, `IsRecurring`, `Color`) VALUES
|
q("INSERT INTO %s%sjqcalendar (`calendar_id`, `calendarobject_id`, `Summary`, `StartTime`, `EndTime`, `IsEditable`, `IsAllDayEvent`, `IsRecurring`, `Color`) VALUES
|
||||||
(%d, %d, '%s', CONVERT_TZ('%s', '$timezoneOffset', @@session.time_zone), CONVERT_TZ('%s', '$timezoneOffset', @@session.time_zone), %d, %d, %d, '%s')",
|
(%d, %d, '%s', CONVERT_TZ('%s', '$timezoneOffset', @@session.time_zone), CONVERT_TZ('%s', '$timezoneOffset', @@session.time_zone), %d, %d, %d, '%s')",
|
||||||
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), dbesc($event["summary"]), date("Y-m-d H:i:s", $start),
|
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), dbesc($event["summary"]), date(DateTimeFormat::MYSQL, $start),
|
||||||
date("Y-m-d H:i:s", $last_end), 1, $allday, $recurring, dbesc(substr($event["color"], 1))
|
date(DateTimeFormat::MYSQL, $last_end), 1, $allday, $recurring, dbesc(substr($event["color"], 1))
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($alarms as $alarm) {
|
foreach ($alarms as $alarm) {
|
||||||
$alarm = renderCalDavEntry_calcalarm($alarm, $component);
|
$alarm = renderCalDavEntry_calcalarm($alarm, $component);
|
||||||
$notified = ($alarm->getTimestamp() < time() ? 1 : 0);
|
$notified = ($alarm->getTimestamp() < time() ? 1 : 0);
|
||||||
q("INSERT INTO %s%snotifications (`calendar_id`, `calendarobject_id`, `alert_date`, `notified`) VALUES (%d, %d, CONVERT_TZ('%s', '$timezoneOffset', @@session.time_zone), %d)",
|
q("INSERT INTO %s%snotifications (`calendar_id`, `calendarobject_id`, `alert_date`, `notified`) VALUES (%d, %d, CONVERT_TZ('%s', '$timezoneOffset', @@session.time_zone), %d)",
|
||||||
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), $alarm->format("Y-m-d H:i:s"), $notified
|
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($calendar["id"]), IntVal($calendarobject["id"]), $alarm->format(DateTimeFormat::MYSQL), $notified
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $obj
|
* @param mixed $obj
|
||||||
|
@ -100,9 +101,9 @@ function wdcal_print_feed($base_path = "")
|
||||||
else $type = Sabre\VObject\Property\DateTime::LOCALTZ;
|
else $type = Sabre\VObject\Property\DateTime::LOCALTZ;
|
||||||
|
|
||||||
$datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
|
$datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
|
||||||
$datetime_start->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarStartTime"]))), $type);
|
$datetime_start->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, IntVal($_REQUEST["CalendarStartTime"]))), $type);
|
||||||
$datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
|
$datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
|
||||||
$datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarEndTime"]))), $type);
|
$datetime_end->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, IntVal($_REQUEST["CalendarEndTime"]))), $type);
|
||||||
|
|
||||||
$component->add($datetime_start);
|
$component->add($datetime_start);
|
||||||
$component->add($datetime_end);
|
$component->add($datetime_end);
|
||||||
|
@ -182,9 +183,9 @@ function wdcal_print_feed($base_path = "")
|
||||||
else $type = Sabre\VObject\Property\DateTime::LOCALTZ;
|
else $type = Sabre\VObject\Property\DateTime::LOCALTZ;
|
||||||
|
|
||||||
$datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
|
$datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
|
||||||
$datetime_start->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarStartTime"]))), $type);
|
$datetime_start->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, IntVal($_REQUEST["CalendarStartTime"]))), $type);
|
||||||
$datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
|
$datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
|
||||||
$datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarEndTime"]))), $type);
|
$datetime_end->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, IntVal($_REQUEST["CalendarEndTime"]))), $type);
|
||||||
|
|
||||||
$component->__unset("DTSTART");
|
$component->__unset("DTSTART");
|
||||||
$component->__unset("DTEND");
|
$component->__unset("DTEND");
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wdcal_local $localization
|
* @param wdcal_local $localization
|
||||||
|
@ -520,9 +521,9 @@ function wdcal_set_component_date(&$component, &$localization)
|
||||||
$type = Sabre\VObject\Property\DateTime::LOCALTZ;
|
$type = Sabre\VObject\Property\DateTime::LOCALTZ;
|
||||||
}
|
}
|
||||||
$datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
|
$datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
|
||||||
$datetime_start->setDateTime(new DateTime(date("Y-m-d H:i:s", $ts_start)), $type);
|
$datetime_start->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $ts_start)), $type);
|
||||||
$datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
|
$datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
|
||||||
$datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", $ts_end)), $type);
|
$datetime_end->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $ts_end)), $type);
|
||||||
|
|
||||||
$component->__unset("DTSTART");
|
$component->__unset("DTSTART");
|
||||||
$component->__unset("DTEND");
|
$component->__unset("DTEND");
|
||||||
|
@ -598,7 +599,7 @@ function wdcal_set_component_recurrence(&$component, &$localization)
|
||||||
$date = $localization->date_local2timestamp($_REQUEST["rec_until_date"]);
|
$date = $localization->date_local2timestamp($_REQUEST["rec_until_date"]);
|
||||||
$part_until = ";UNTIL=" . date("Ymd", $date);
|
$part_until = ";UNTIL=" . date("Ymd", $date);
|
||||||
$datetime_until = new Sabre\VObject\Property\DateTime("UNTIL");
|
$datetime_until = new Sabre\VObject\Property\DateTime("UNTIL");
|
||||||
$datetime_until->setDateTime(new DateTime(date("Y-m-d H:i:s", $date)), Sabre\VObject\Property\DateTime::DATE);
|
$datetime_until->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $date)), Sabre\VObject\Property\DateTime::DATE);
|
||||||
break;
|
break;
|
||||||
case "count":
|
case "count":
|
||||||
$part_until = ";COUNT=" . IntVal($_REQUEST["rec_until_count"]);
|
$part_until = ";COUNT=" . IntVal($_REQUEST["rec_until_count"]);
|
||||||
|
@ -645,7 +646,7 @@ function wdcal_set_component_recurrence(&$component, &$localization)
|
||||||
if (isset($_REQUEST["rec_exceptions"])) {
|
if (isset($_REQUEST["rec_exceptions"])) {
|
||||||
$arr = array();
|
$arr = array();
|
||||||
foreach ($_REQUEST["rec_exceptions"] as $except) {
|
foreach ($_REQUEST["rec_exceptions"] as $except) {
|
||||||
$arr[] = new DateTime(date("Y-m-d H:i:s", $except));
|
$arr[] = new DateTime(date(DateTimeFormat::MYSQL, $except));
|
||||||
}
|
}
|
||||||
/** @var Sabre\VObject\Property\MultiDateTime $prop */
|
/** @var Sabre\VObject\Property\MultiDateTime $prop */
|
||||||
$prop = Sabre\VObject\Property::create("EXDATE");
|
$prop = Sabre\VObject\Property::create("EXDATE");
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
||||||
{
|
{
|
||||||
|
@ -67,8 +68,8 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
||||||
$component = dav_get_eventComponent($vevent);
|
$component = dav_get_eventComponent($vevent);
|
||||||
|
|
||||||
if ($row["adjust"]) {
|
if ($row["adjust"]) {
|
||||||
$start = datetime_convert('UTC', date_default_timezone_get(), $row["start"]);
|
$start = DateTimeFormat::local($row["start"]);
|
||||||
$finish = datetime_convert('UTC', date_default_timezone_get(), $row["finish"]);
|
$finish = DateTimeFormat::local($row["finish"]);
|
||||||
} else {
|
} else {
|
||||||
$start = $row["start"];
|
$start = $row["start"];
|
||||||
$finish = $row["finish"];
|
$finish = $row["finish"];
|
||||||
|
@ -87,9 +88,9 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
||||||
$type = ($allday ? Sabre\VObject\Property\DateTime::DATE : Sabre\VObject\Property\DateTime::LOCALTZ);
|
$type = ($allday ? Sabre\VObject\Property\DateTime::DATE : Sabre\VObject\Property\DateTime::LOCALTZ);
|
||||||
|
|
||||||
$datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
|
$datetime_start = new Sabre\VObject\Property\DateTime("DTSTART");
|
||||||
$datetime_start->setDateTime(new DateTime(date("Y-m-d H:i:s", $ts_start)), $type);
|
$datetime_start->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $ts_start)), $type);
|
||||||
$datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
|
$datetime_end = new Sabre\VObject\Property\DateTime("DTEND");
|
||||||
$datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", $ts_end)), $type);
|
$datetime_end->setDateTime(new DateTime(date(DateTimeFormat::MYSQL, $ts_end)), $type);
|
||||||
|
|
||||||
$component->add($datetime_start);
|
$component->add($datetime_start);
|
||||||
$component->add($datetime_end);
|
$component->add($datetime_end);
|
||||||
|
@ -115,8 +116,8 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
||||||
private function jqcal2wdcal($row, $calendar, $base_path)
|
private function jqcal2wdcal($row, $calendar, $base_path)
|
||||||
{
|
{
|
||||||
if ($row["adjust"]) {
|
if ($row["adjust"]) {
|
||||||
$start = datetime_convert('UTC', date_default_timezone_get(), $row["start"]);
|
$start = DateTimeFormat::local($row["start"]);
|
||||||
$finish = datetime_convert('UTC', date_default_timezone_get(), $row["finish"]);
|
$finish = DateTimeFormat::local($row["finish"]);
|
||||||
} else {
|
} else {
|
||||||
$start = $row["start"];
|
$start = $row["start"];
|
||||||
$finish = $row["finish"];
|
$finish = $row["finish"];
|
||||||
|
@ -174,11 +175,11 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($date_from != "") {
|
if ($date_from != "") {
|
||||||
if (is_numeric($date_from)) $sql_where .= " AND `finish` >= '" . date("Y-m-d H:i:s", $date_from) . "'";
|
if (is_numeric($date_from)) $sql_where .= " AND `finish` >= '" . date(DateTimeFormat::MYSQL, $date_from) . "'";
|
||||||
else $sql_where .= " AND `finish` >= '" . dbesc($date_from) . "'";
|
else $sql_where .= " AND `finish` >= '" . dbesc($date_from) . "'";
|
||||||
}
|
}
|
||||||
if ($date_to != "") {
|
if ($date_to != "") {
|
||||||
if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date("Y-m-d H:i:s", $date_to) . "'";
|
if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date(DateTimeFormat::MYSQL, $date_to) . "'";
|
||||||
else $sql_where .= " AND `start` <= '" . dbesc($date_to) . "'";
|
else $sql_where .= " AND `start` <= '" . dbesc($date_to) . "'";
|
||||||
}
|
}
|
||||||
$ret = [];
|
$ret = [];
|
||||||
|
|
|
@ -7,10 +7,12 @@
|
||||||
* Author: Michael Johnston
|
* Author: Michael Johnston
|
||||||
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Temporal;
|
||||||
|
|
||||||
function dwpost_install() {
|
function dwpost_install() {
|
||||||
Addon::registerHook('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local');
|
Addon::registerHook('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local');
|
||||||
|
@ -185,7 +187,7 @@ function dwpost_send(&$a,&$b) {
|
||||||
$post = xmlify($post);
|
$post = xmlify($post);
|
||||||
$tags = dwpost_get_tags($b['tag']);
|
$tags = dwpost_get_tags($b['tag']);
|
||||||
|
|
||||||
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
|
$date = DateTimeFormat::convert($b['created'], $tz);
|
||||||
$year = intval(substr($date,0,4));
|
$year = intval(substr($date,0,4));
|
||||||
$mon = intval(substr($date,5,2));
|
$mon = intval(substr($date,5,2));
|
||||||
$day = intval(substr($date,8,2));
|
$day = intval(substr($date,8,2));
|
||||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
require_once 'mod/share.php';
|
require_once 'mod/share.php';
|
||||||
|
@ -519,12 +520,12 @@ function fromgplus_fetch($a, $uid) {
|
||||||
if (function_exists("share_header"))
|
if (function_exists("share_header"))
|
||||||
$post .= share_header($item->object->actor->displayName, $item->object->actor->url,
|
$post .= share_header($item->object->actor->displayName, $item->object->actor->url,
|
||||||
$item->object->actor->image->url, "",
|
$item->object->actor->image->url, "",
|
||||||
datetime_convert('UTC','UTC',$item->object->published),$item->object->url);
|
DateTimeFormat::utc($item->object->published),$item->object->url);
|
||||||
else
|
else
|
||||||
$post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName).
|
$post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName).
|
||||||
"' profile='".$item->object->actor->url.
|
"' profile='".$item->object->actor->url.
|
||||||
"' avatar='".$item->object->actor->image->url.
|
"' avatar='".$item->object->actor->image->url.
|
||||||
"' posted='".datetime_convert('UTC','UTC',$item->object->published).
|
"' posted='".DateTimeFormat::utc($item->object->published).
|
||||||
"' link='".$item->object->url."']";
|
"' link='".$item->object->url."']";
|
||||||
|
|
||||||
$post .= fromgplus_html2bbcode($item->object->content);
|
$post .= fromgplus_html2bbcode($item->object->content);
|
||||||
|
|
|
@ -7,10 +7,12 @@
|
||||||
* Author: Michael Johnston
|
* Author: Michael Johnston
|
||||||
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Temporal;
|
||||||
|
|
||||||
function ijpost_install() {
|
function ijpost_install() {
|
||||||
Addon::registerHook('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local');
|
Addon::registerHook('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local');
|
||||||
|
@ -184,7 +186,7 @@ function ijpost_send(&$a,&$b) {
|
||||||
$post = xmlify($post);
|
$post = xmlify($post);
|
||||||
$tags = ijpost_get_tags($b['tag']);
|
$tags = ijpost_get_tags($b['tag']);
|
||||||
|
|
||||||
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
|
$date = DateTimeFormat::convert($b['created'], $tz);
|
||||||
$year = intval(substr($date,0,4));
|
$year = intval(substr($date,0,4));
|
||||||
$mon = intval(substr($date,5,2));
|
$mon = intval(substr($date,5,2));
|
||||||
$day = intval(substr($date,8,2));
|
$day = intval(substr($date,8,2));
|
||||||
|
|
|
@ -7,10 +7,12 @@
|
||||||
* Author: Michael Johnston
|
* Author: Michael Johnston
|
||||||
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Temporal;
|
||||||
|
|
||||||
function ljpost_install() {
|
function ljpost_install() {
|
||||||
Addon::registerHook('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local');
|
Addon::registerHook('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local');
|
||||||
|
@ -185,7 +187,7 @@ function ljpost_send(&$a,&$b) {
|
||||||
$post = xmlify($post);
|
$post = xmlify($post);
|
||||||
$tags = ljpost_get_tags($b['tag']);
|
$tags = ljpost_get_tags($b['tag']);
|
||||||
|
|
||||||
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
|
$date = DateTimeFormat::convert($b['created'], $tz);
|
||||||
$year = intval(substr($date,0,4));
|
$year = intval(substr($date,0,4));
|
||||||
$mon = intval(substr($date,5,2));
|
$mon = intval(substr($date,5,2));
|
||||||
$day = intval(substr($date,8,2));
|
$day = intval(substr($date,8,2));
|
||||||
|
|
|
@ -6,8 +6,10 @@
|
||||||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
require_once 'include/datetime.php';
|
require_once 'include/datetime.php';
|
||||||
|
|
||||||
|
@ -24,8 +26,8 @@ function membersince_uninstall()
|
||||||
function membersince_display(&$a, &$b)
|
function membersince_display(&$a, &$b)
|
||||||
{
|
{
|
||||||
// Works in Vier
|
// Works in Vier
|
||||||
$b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . L10n::t('Member since:') . "</dt>\n<dd>" . datetime_convert('UTC', date_default_timezone_get(), $a->profile['register_date']) . "</dd>\n</dl>", $b, 1);
|
$b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . L10n::t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local($a->profile['register_date']) . "</dd>\n</dl>", $b, 1);
|
||||||
|
|
||||||
// Trying for Frio
|
// Trying for Frio
|
||||||
//$b = preg_replace('/<\/div>/', "<div id=\"aprofile-membersince\" class=\"aprofile\"><hr class=\"profile-separator\"><div class=\"profile-label-name\">" . L10n::t('Member since:') . "</div><div class=\"profile-entry\">" . datetime_convert('UTC', date_default_timezone_get(), $a->profile['register_date']) . "</div></div>", $b, 1);
|
//$b = preg_replace('/<\/div>/', "<div id=\"aprofile-membersince\" class=\"aprofile\"><hr class=\"profile-separator\"><div class=\"profile-label-name\">" . L10n::t('Member since:') . "</div><div class=\"profile-entry\">" . DateTimeFormat::local($a->profile['register_date']) . "</div></div>", $b, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
* Version: 1.1
|
* Version: 1.1
|
||||||
* Author: Keith Fernie <http://friendika.me4.it/profile/keith>
|
* Author: Keith Fernie <http://friendika.me4.it/profile/keith>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
function public_server_install() {
|
function public_server_install() {
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@ function public_server_register_account($a,$b) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$r = q("UPDATE user set account_expires_on = '%s', expire = %d where uid = %d",
|
$r = q("UPDATE user set account_expires_on = '%s', expire = %d where uid = %d",
|
||||||
dbesc(datetime_convert('UTC','UTC','now +' . $days . ' days')),
|
dbesc(DateTimeFormat::utc('now +' . $days . ' days')),
|
||||||
intval($days_posts),
|
intval($days_posts),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
@ -67,7 +69,7 @@ function public_server_cron($a,$b) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
q("update user set expire_notification_sent = '%s' where uid = %d",
|
q("update user set expire_notification_sent = '%s' where uid = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
intval($rr['uid'])
|
intval($rr['uid'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +87,7 @@ function public_server_cron($a,$b) {
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
foreach($r as $rr)
|
foreach($r as $rr)
|
||||||
q("update user set account_expires_on = '%s' where uid = %d",
|
q("update user set account_expires_on = '%s' where uid = %d",
|
||||||
dbesc(datetime_convert('UTC','UTC','now +' . '6 days')),
|
dbesc(DateTimeFormat::utc('now +' . '6 days')),
|
||||||
intval($rr['uid'])
|
intval($rr['uid'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +100,7 @@ function public_server_cron($a,$b) {
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
foreach($r as $rr)
|
foreach($r as $rr)
|
||||||
q("update user set account_expires_on = '%s' where uid = %d",
|
q("update user set account_expires_on = '%s' where uid = %d",
|
||||||
dbesc(datetime_convert('UTC','UTC','now +' . '6 days')),
|
dbesc(DateTimeFormat::utc('now +' . '6 days')),
|
||||||
intval($rr['uid'])
|
intval($rr['uid'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -136,7 +138,7 @@ function public_server_login($a,$b) {
|
||||||
if(! $days)
|
if(! $days)
|
||||||
return;
|
return;
|
||||||
$r = q("UPDATE user set account_expires_on = '%s' where uid = %d and account_expires_on > '0000-00-00 00:00:00'",
|
$r = q("UPDATE user set account_expires_on = '%s' where uid = %d and account_expires_on > '0000-00-00 00:00:00'",
|
||||||
dbesc(datetime_convert('UTC','UTC','now +' . $days . ' days')),
|
dbesc(DateTimeFormat::utc('now +' . $days . ' days')),
|
||||||
local_user()
|
local_user()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* Version: 0.2
|
* Version: 0.2
|
||||||
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
|
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
@ -13,10 +14,11 @@ use Friendica\Core\Worker;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Model\Group;
|
use Friendica\Model\Group;
|
||||||
use Friendica\Model\User;
|
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\Queue;
|
use Friendica\Model\Queue;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Model\User;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
require 'addon/pumpio/oauth/http.php';
|
require 'addon/pumpio/oauth/http.php';
|
||||||
require 'addon/pumpio/oauth/oauth_client.php';
|
require 'addon/pumpio/oauth/oauth_client.php';
|
||||||
|
@ -670,7 +672,7 @@ function pumpio_sync(&$a) {
|
||||||
if ($abandon_days < 1)
|
if ($abandon_days < 1)
|
||||||
$abandon_days = 0;
|
$abandon_days = 0;
|
||||||
|
|
||||||
$abandon_limit = date("Y-m-d H:i:s", time() - $abandon_days * 86400);
|
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
|
||||||
|
|
||||||
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'pumpio' AND `k` = 'import' AND `v` = '1' ORDER BY RAND() ");
|
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'pumpio' AND `k` = 'import' AND `v` = '1' ORDER BY RAND() ");
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
|
@ -869,7 +871,7 @@ function pumpio_dounlike(&$a, $uid, $self, $post, $own_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("UPDATE `item` SET `deleted` = 1, `unseen` = 1, `changed` = '%s' WHERE `verb` = '%s' AND `uid` = %d AND `contact-id` = %d AND `thr-parent` = '%s'",
|
$r = q("UPDATE `item` SET `deleted` = 1, `unseen` = 1, `changed` = '%s' WHERE `verb` = '%s' AND `uid` = %d AND `contact-id` = %d AND `thr-parent` = '%s'",
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc(ACTIVITY_LIKE),
|
dbesc(ACTIVITY_LIKE),
|
||||||
intval($uid),
|
intval($uid),
|
||||||
intval($contactid),
|
intval($contactid),
|
||||||
|
@ -1000,7 +1002,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
|
||||||
`location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
|
`location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
|
||||||
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
|
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc($contact->url),
|
dbesc($contact->url),
|
||||||
dbesc(normalise_link($contact->url)),
|
dbesc(normalise_link($contact->url)),
|
||||||
dbesc(str_replace("acct:", "", $contact->id)),
|
dbesc(str_replace("acct:", "", $contact->id)),
|
||||||
|
@ -1209,11 +1211,11 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
|
||||||
if ($post->object->displayName != "")
|
if ($post->object->displayName != "")
|
||||||
$postarray['title'] = $post->object->displayName;
|
$postarray['title'] = $post->object->displayName;
|
||||||
|
|
||||||
$postarray['created'] = datetime_convert('UTC','UTC',$post->published);
|
$postarray['created'] = DateTimeFormat::utc($post->published);
|
||||||
if (isset($post->updated))
|
if (isset($post->updated))
|
||||||
$postarray['edited'] = datetime_convert('UTC','UTC',$post->updated);
|
$postarray['edited'] = DateTimeFormat::utc($post->updated);
|
||||||
elseif (isset($post->received))
|
elseif (isset($post->received))
|
||||||
$postarray['edited'] = datetime_convert('UTC','UTC',$post->received);
|
$postarray['edited'] = DateTimeFormat::utc($post->received);
|
||||||
else
|
else
|
||||||
$postarray['edited'] = $postarray['created'];
|
$postarray['edited'] = $postarray['created'];
|
||||||
|
|
||||||
|
@ -1228,7 +1230,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
|
||||||
|
|
||||||
$postarray['body'] = share_header($share_author, $post->object->author->url,
|
$postarray['body'] = share_header($share_author, $post->object->author->url,
|
||||||
$post->object->author->image->url, "",
|
$post->object->author->image->url, "",
|
||||||
datetime_convert('UTC','UTC',$post->object->created),
|
DateTimeFormat::utc($post->object->created),
|
||||||
$post->links->self->href).
|
$post->links->self->href).
|
||||||
$postarray['body']."[/share]";
|
$postarray['body']."[/share]";
|
||||||
|
|
||||||
|
@ -1236,7 +1238,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
|
||||||
$postarray['body'] = "[share author='".$share_author.
|
$postarray['body'] = "[share author='".$share_author.
|
||||||
"' profile='".$post->object->author->url.
|
"' profile='".$post->object->author->url.
|
||||||
"' avatar='".$post->object->author->image->url.
|
"' avatar='".$post->object->author->image->url.
|
||||||
"' posted='".datetime_convert('UTC','UTC',$post->object->created).
|
"' posted='".DateTimeFormat::convert($post->object->created, 'UTC', 'UTC', ).
|
||||||
"' link='".$post->links->self->href."']".$postarray['body']."[/share]";
|
"' link='".$post->links->self->href."']".$postarray['body']."[/share]";
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -38,6 +38,8 @@ define('STATUSNET_DEFAULT_POLL_INTERVAL', 5); // given in minutes
|
||||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'statusnetoauth.php';
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'statusnetoauth.php';
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
|
|
||||||
|
use Codebird\Codebird;
|
||||||
|
use CodebirdSN\CodebirdSN;
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Content\OEmbed;
|
use Friendica\Content\OEmbed;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
|
@ -51,6 +53,7 @@ use Friendica\Model\Group;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
function statusnet_install()
|
function statusnet_install()
|
||||||
|
@ -757,7 +760,7 @@ function statusnet_cron(App $a, $b)
|
||||||
$abandon_days = 0;
|
$abandon_days = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$abandon_limit = date("Y-m-d H:i:s", time() - $abandon_days * 86400);
|
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
|
||||||
|
|
||||||
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'import' AND `v` ORDER BY RAND()");
|
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'import' AND `v` ORDER BY RAND()");
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
|
@ -933,7 +936,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
|
||||||
`location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
|
`location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
|
||||||
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0 ) ",
|
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0 ) ",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc($contact->statusnet_profile_url),
|
dbesc($contact->statusnet_profile_url),
|
||||||
dbesc(normalise_link($contact->statusnet_profile_url)),
|
dbesc(normalise_link($contact->statusnet_profile_url)),
|
||||||
dbesc(statusnet_address($contact)),
|
dbesc(statusnet_address($contact)),
|
||||||
|
@ -974,13 +977,13 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
|
||||||
dbesc($photos[0]),
|
dbesc($photos[0]),
|
||||||
dbesc($photos[1]),
|
dbesc($photos[1]),
|
||||||
dbesc($photos[2]),
|
dbesc($photos[2]),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
intval($contact_id)
|
intval($contact_id)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// update profile photos once every two weeks as we have no notification of when they change.
|
// update profile photos once every two weeks as we have no notification of when they change.
|
||||||
//$update_photo = (($r[0]['avatar-date'] < datetime_convert('','','now -2 days')) ? true : false);
|
//$update_photo = (($r[0]['avatar-date'] < DateTimeFormat::convert('now -2 days', '', '', )) ? true : false);
|
||||||
$update_photo = ($r[0]['avatar-date'] < datetime_convert('', '', 'now -12 hours'));
|
$update_photo = ($r[0]['avatar-date'] < DateTimeFormat::utc('now -12 hours'));
|
||||||
|
|
||||||
// check that we have all the photos, this has been known to fail on occasion
|
// check that we have all the photos, this has been known to fail on occasion
|
||||||
if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
|
if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
|
||||||
|
@ -1005,9 +1008,9 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
|
||||||
dbesc($photos[0]),
|
dbesc($photos[0]),
|
||||||
dbesc($photos[1]),
|
dbesc($photos[1]),
|
||||||
dbesc($photos[2]),
|
dbesc($photos[2]),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc($contact->statusnet_profile_url),
|
dbesc($contact->statusnet_profile_url),
|
||||||
dbesc(normalise_link($contact->statusnet_profile_url)),
|
dbesc(normalise_link($contact->statusnet_profile_url)),
|
||||||
dbesc(statusnet_address($contact)),
|
dbesc(statusnet_address($contact)),
|
||||||
|
@ -1194,8 +1197,8 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
||||||
$postarray['body'] = $converted["body"];
|
$postarray['body'] = $converted["body"];
|
||||||
$postarray['tag'] = $converted["tags"];
|
$postarray['tag'] = $converted["tags"];
|
||||||
|
|
||||||
$postarray['created'] = datetime_convert('UTC', 'UTC', $content->created_at);
|
$postarray['created'] = DateTimeFormat::utc($content->created_at);
|
||||||
$postarray['edited'] = datetime_convert('UTC', 'UTC', $content->created_at);
|
$postarray['edited'] = DateTimeFormat::utc($content->created_at);
|
||||||
|
|
||||||
if (is_string($content->place->name)) {
|
if (is_string($content->place->name)) {
|
||||||
$postarray["location"] = $content->place->name;
|
$postarray["location"] = $content->place->name;
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
* Version: 1.0
|
* Version: 1.0
|
||||||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
function testdrive_install() {
|
function testdrive_install() {
|
||||||
|
|
||||||
|
@ -42,7 +44,7 @@ function testdrive_register_account($a,$b) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$r = q("UPDATE user set account_expires_on = '%s' where uid = %d",
|
$r = q("UPDATE user set account_expires_on = '%s' where uid = %d",
|
||||||
dbesc(datetime_convert('UTC','UTC','now +' . $days . ' days')),
|
dbesc(DateTimeFormat::convert('now +' . $days . ' days')),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ function testdrive_cron($a,$b) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
q("update user set expire_notification_sent = '%s' where uid = %d",
|
q("update user set expire_notification_sent = '%s' where uid = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
intval($rr['uid'])
|
intval($rr['uid'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ use Friendica\Model\Photo;
|
||||||
use Friendica\Model\Queue;
|
use Friendica\Model\Queue;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
|
@ -681,7 +682,7 @@ function twitter_cron(App $a, $b)
|
||||||
$abandon_days = 0;
|
$abandon_days = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$abandon_limit = date("Y-m-d H:i:s", time() - $abandon_days * 86400);
|
$abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
|
||||||
|
|
||||||
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1'");
|
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1'");
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
|
@ -1016,7 +1017,7 @@ function twitter_fetch_contact($uid, $contact, $create_user)
|
||||||
`location`, `about`, `writable`, `blocked`, `readonly`, `pending`)
|
`location`, `about`, `writable`, `blocked`, `readonly`, `pending`)
|
||||||
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
|
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc("https://twitter.com/" . $contact->screen_name),
|
dbesc("https://twitter.com/" . $contact->screen_name),
|
||||||
dbesc(normalise_link("https://twitter.com/" . $contact->screen_name)),
|
dbesc(normalise_link("https://twitter.com/" . $contact->screen_name)),
|
||||||
dbesc($contact->screen_name."@twitter.com"),
|
dbesc($contact->screen_name."@twitter.com"),
|
||||||
|
@ -1060,16 +1061,16 @@ function twitter_fetch_contact($uid, $contact, $create_user)
|
||||||
dbesc($photos[0]),
|
dbesc($photos[0]),
|
||||||
dbesc($photos[1]),
|
dbesc($photos[1]),
|
||||||
dbesc($photos[2]),
|
dbesc($photos[2]),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
intval($contact_id)
|
intval($contact_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// update profile photos once every two weeks as we have no notification of when they change.
|
// update profile photos once every two weeks as we have no notification of when they change.
|
||||||
//$update_photo = (($r[0]['avatar-date'] < datetime_convert('','','now -2 days')) ? true : false);
|
//$update_photo = (($r[0]['avatar-date'] < DateTimeFormat::convert('now -2 days', '', '', )) ? true : false);
|
||||||
$update_photo = ($r[0]['avatar-date'] < datetime_convert('', '', 'now -12 hours'));
|
$update_photo = ($r[0]['avatar-date'] < DateTimeFormat::utc('now -12 hours'));
|
||||||
|
|
||||||
// check that we have all the photos, this has been known to fail on occasion
|
// check that we have all the photos, this has been known to fail on occasion
|
||||||
if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
|
if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
|
||||||
|
@ -1095,9 +1096,9 @@ function twitter_fetch_contact($uid, $contact, $create_user)
|
||||||
dbesc($photos[0]),
|
dbesc($photos[0]),
|
||||||
dbesc($photos[1]),
|
dbesc($photos[1]),
|
||||||
dbesc($photos[2]),
|
dbesc($photos[2]),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
dbesc("https://twitter.com/".$contact->screen_name),
|
dbesc("https://twitter.com/".$contact->screen_name),
|
||||||
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)),
|
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)),
|
||||||
dbesc($contact->screen_name."@twitter.com"),
|
dbesc($contact->screen_name."@twitter.com"),
|
||||||
|
@ -1489,8 +1490,8 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
|
||||||
$converted = twitter_expand_entities($a, $postarray['body'], $post, false, $picture);
|
$converted = twitter_expand_entities($a, $postarray['body'], $post, false, $picture);
|
||||||
$postarray['body'] = $converted["body"];
|
$postarray['body'] = $converted["body"];
|
||||||
$postarray['tag'] = $converted["tags"];
|
$postarray['tag'] = $converted["tags"];
|
||||||
$postarray['created'] = datetime_convert('UTC', 'UTC', $post->created_at);
|
$postarray['created'] = DateTimeFormat::utc($post->created_at);
|
||||||
$postarray['edited'] = datetime_convert('UTC', 'UTC', $post->created_at);
|
$postarray['edited'] = DateTimeFormat::utc($post->created_at);
|
||||||
|
|
||||||
$statustext = $converted["plain"];
|
$statustext = $converted["plain"];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue