mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-17 05:48:49 +00:00
Continued:
- SQL keywords must be all-uppercase (MrPetovan) - used empty(), not isset() (annando) - used more DBM::is_result() Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
parent
ed59c29484
commit
249a8ac6fc
5 changed files with 29 additions and 19 deletions
|
@ -13,6 +13,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
|
@ -170,17 +171,19 @@ function dwpost_send(App $a, array &$b) {
|
|||
|
||||
$tz = 'UTC';
|
||||
|
||||
$x = q("select timezone from user where uid = %d limit 1",
|
||||
$x = q("SELECT `timezone` FROM `user` WHERE `uid`=%d LIMIT 1",
|
||||
intval($b['uid'])
|
||||
);
|
||||
if($x && strlen($x[0]['timezone']))
|
||||
|
||||
if (DBM::is_result($x) && strlen($x[0]['timezone'])) {
|
||||
$tz = $x[0]['timezone'];
|
||||
}
|
||||
|
||||
$dw_username = PConfig::get($b['uid'],'dwpost','dw_username');
|
||||
$dw_password = PConfig::get($b['uid'],'dwpost','dw_password');
|
||||
$dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc';
|
||||
|
||||
if($dw_username && $dw_password && $dw_blog) {
|
||||
if ($dw_username && $dw_password && $dw_blog) {
|
||||
$title = $b['title'];
|
||||
$post = BBCode::convert($b['body']);
|
||||
$post = xmlify($post);
|
||||
|
|
|
@ -28,7 +28,7 @@ function geocoordinates_uninstall()
|
|||
|
||||
function geocoordinates_resolve_item(array &$item)
|
||||
{
|
||||
if (!isset($item['coord']) || isset($item['location'])) {
|
||||
if (empty($item['coord']) || !empty($item['location'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ function geocoordinates_resolve_item(array &$item)
|
|||
return;
|
||||
}
|
||||
|
||||
$language = Config::get("geocoordinates", "language");
|
||||
$language = Config::get("geocoordinates", "language", "de");
|
||||
|
||||
if ($language == "") {
|
||||
$language = "de";
|
||||
|
@ -62,7 +62,7 @@ function geocoordinates_resolve_item(array &$item)
|
|||
|
||||
$s = Network::fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=".$coords[0].",".$coords[1]."&key=".$key."&language=".$language);
|
||||
|
||||
if ($s === FALSE) {
|
||||
if ($s === FALSE || empty($s)) {
|
||||
logger("API could not be queried", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
@ -83,8 +83,9 @@ function geocoordinates_resolve_item(array &$item)
|
|||
|
||||
logger("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], LOGGER_DEBUG);
|
||||
|
||||
if ($item["location"] != "")
|
||||
if ($item["location"] != "") {
|
||||
Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]);
|
||||
}
|
||||
}
|
||||
|
||||
function geocoordinates_post_hook(App $a, array &$item)
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
|
@ -168,17 +169,19 @@ function ijpost_send(App $a, array &$b) {
|
|||
|
||||
$tz = 'UTC';
|
||||
|
||||
$x = q("select timezone from user where uid = %d limit 1",
|
||||
$x = q("SELECT `timezone` FROM `user` WHERE `uid`=%d LIMIT 1",
|
||||
intval($b['uid'])
|
||||
);
|
||||
if($x && strlen($x[0]['timezone']))
|
||||
|
||||
if (DBM::is_result($x) && strlen($x[0]['timezone'])) {
|
||||
$tz = $x[0]['timezone'];
|
||||
}
|
||||
|
||||
$ij_username = PConfig::get($b['uid'],'ijpost','ij_username');
|
||||
$ij_password = PConfig::get($b['uid'],'ijpost','ij_password');
|
||||
$ij_blog = 'http://www.insanejournal.com/interface/xmlrpc';
|
||||
|
||||
if($ij_username && $ij_password && $ij_blog) {
|
||||
if ($ij_username && $ij_password && $ij_blog) {
|
||||
$title = $b['title'];
|
||||
$post = BBCode::convert($b['body']);
|
||||
$post = xmlify($post);
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
|
@ -163,11 +164,13 @@ function ljpost_send(App $a, array &$b) {
|
|||
|
||||
$tz = 'UTC';
|
||||
|
||||
$x = q("select timezone from user where uid = %d limit 1",
|
||||
$x = q("SELECT `timezone` FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||
intval($b['uid'])
|
||||
);
|
||||
if($x && strlen($x[0]['timezone']))
|
||||
|
||||
if (DBM::is_result($x) && strlen($x[0]['timezone'])) {
|
||||
$tz = $x[0]['timezone'];
|
||||
}
|
||||
|
||||
$lj_username = xmlify(PConfig::get($b['uid'],'ljpost','lj_username'));
|
||||
$lj_password = xmlify(PConfig::get($b['uid'],'ljpost','lj_password'));
|
||||
|
@ -176,10 +179,11 @@ function ljpost_send(App $a, array &$b) {
|
|||
// $lj_journal = $lj_username;
|
||||
|
||||
$lj_blog = xmlify(PConfig::get($b['uid'],'ljpost','lj_blog'));
|
||||
if(! strlen($lj_blog))
|
||||
if (! strlen($lj_blog)) {
|
||||
$lj_blog = xmlify('http://www.livejournal.com/interface/xmlrpc');
|
||||
}
|
||||
|
||||
if($lj_username && $lj_password && $lj_blog) {
|
||||
if ($lj_username && $lj_password && $lj_blog) {
|
||||
$title = xmlify($b['title']);
|
||||
$post = BBCode::convert($b['body']);
|
||||
$post = xmlify($post);
|
||||
|
|
|
@ -63,8 +63,8 @@ function testdrive_register_account($a,$b) {
|
|||
function testdrive_cron($a,$b) {
|
||||
require_once('include/enotify.php');
|
||||
|
||||
$r = q("select * from user where account_expires_on < UTC_TIMESTAMP() + INTERVAL 5 DAY and
|
||||
expire_notification_sent = '0000-00-00 00:00:00' ");
|
||||
$r = q("SELECT * FROM `user` WHERE `account_expires_on` < UTC_TIMESTAMP() + INTERVAL 5 DAY AND
|
||||
`expire_notification_sent` = '0000-00-00 00:00:00'");
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
|
@ -80,15 +80,14 @@ function testdrive_cron($a,$b) {
|
|||
'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
|
||||
]);
|
||||
|
||||
q("update user set expire_notification_sent = '%s' where uid = %d",
|
||||
q("UPDATE `user` SET `expire_notification_sent`='%s' WHERE `uid`=%d",
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
intval($rr['uid'])
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$r = q("select * from user where account_expired = 1 and account_expires_on < UTC_TIMESTAMP() - INTERVAL 5 DAY ");
|
||||
$r = q("SELECT * FROM `user` WHERE `account_expired`=1 AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 5 DAY");
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue