And some more changed lines

This commit is contained in:
Michael 2017-08-11 19:26:08 +00:00
parent 05393a6faa
commit 556cc0cc4c
3 changed files with 32 additions and 33 deletions

View file

@ -41,18 +41,18 @@ class ForumManager {
$select = '(`forum` OR `prv`)';
}
$contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro`, `contact`.`thumb` FROM `contact`
WHERE `network`= 'dfrn' AND $select AND `uid` = %d
$contacts = dba::p("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro`, `contact`.`thumb` FROM `contact`
WHERE `network`= 'dfrn' AND $select AND `uid` = ?
AND NOT `blocked` AND NOT `hidden` AND NOT `pending` AND NOT `archive`
AND `success_update` > `failure_update`
$order ",
intval($uid)
$uid
);
if (!$contacts)
return($forumlist);
foreach($contacts as $contact) {
while ($contact = dba::fetch($contacts)) {
$forumlist[] = array(
'url' => $contact['url'],
'name' => $contact['name'],
@ -61,6 +61,8 @@ class ForumManager {
'thumb' => $contact['thumb'],
);
}
dba::close($contacts);
return($forumlist);
}

View file

@ -108,19 +108,20 @@ function networks_widget($baseurl, $selected = '') {
$extra_sql = unavailable_networks();
$r = q("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = %d AND `network` != '' $extra_sql ORDER BY `network`",
intval(local_user())
$r = dba::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND `network` != '' $extra_sql ORDER BY `network`",
local_user()
);
$nets = array();
if (dbm::is_result($r)) {
require_once 'include/contact_selectors.php';
foreach ($r as $rr) {
while ($rr = dba::fetch($r)) {
/// @TODO If 'network' is not there, this triggers an E_NOTICE
if ($rr['network']) {
$nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
}
}
dba::close($r);
}
if (count($nets) < 2) {
@ -229,18 +230,14 @@ function common_friends_visitor_widget($profile_uid) {
if (! $cid) {
if (get_my_url()) {
$r = q("select id from contact where nurl = '%s' and uid = %d limit 1",
dbesc(normalise_link(get_my_url())),
intval($profile_uid)
);
$r = dba::select('contact', array('id'),
array('nurl' => normalise_link(get_my_url()), 'uid' => $profile_uid), array('limit' => 1));
if (dbm::is_result($r)) {
$cid = $r[0]['id'];
$cid = $r['id'];
} else {
$r = q("select id from gcontact where nurl = '%s' limit 1",
dbesc(normalise_link(get_my_url()))
);
$r = dba::select('gcontact', array('id'), array('nurl' => normalise_link(get_my_url())), array('limit' => 1));
if (dbm::is_result($r))
$zcid = $r[0]['id'];
$zcid = $r['id'];
}
}
}

View file

@ -468,15 +468,16 @@ function get_birthdays() {
$cachekey = "get_birthdays:".local_user();
$r = Cache::get($cachekey);
if (is_null($r)) {
$r = q("SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event`
$s = dba::p("SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event`
INNER JOIN `contact` ON `contact`.`id` = `event`.`cid`
WHERE `event`.`uid` = %d AND `type` = 'birthday' AND `start` < '%s' AND `finish` > '%s'
WHERE `event`.`uid` = ? AND `type` = 'birthday' AND `start` < ? AND `finish` > ?
ORDER BY `start` ASC ",
intval(local_user()),
dbesc(datetime_convert('UTC','UTC','now + 6 days')),
dbesc(datetime_convert('UTC','UTC','now'))
local_user(),
datetime_convert('UTC','UTC','now + 6 days'),
datetime_convert('UTC','UTC','now')
);
if (dbm::is_result($r)) {
if (dbm::is_result($s)) {
$r = dba::inArray($s);
Cache::set($cachekey, $r, CACHE_HOUR);
}
}
@ -555,18 +556,20 @@ function get_events() {
$bd_format = t('g A l F d') ; // 8 AM Friday January 18
$bd_short = t('F d');
$r = q("SELECT `event`.* FROM `event`
WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `start` >= '%s'
$r = dba::p("SELECT `event`.* FROM `event`
WHERE `event`.`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ?
ORDER BY `start` ASC ",
intval(local_user()),
dbesc(datetime_convert('UTC','UTC','now + 7 days')),
dbesc(datetime_convert('UTC','UTC','now - 1 days'))
local_user(),
datetime_convert('UTC','UTC','now + 7 days'),
datetime_convert('UTC','UTC','now - 1 days')
);
if (dbm::is_result($r)) {
$now = strtotime('now');
$istoday = false;
foreach ($r as $rr) {
$skip = 0;
while ($rr = dba::fetch($r)) {
if (strlen($rr['name'])) {
$total ++;
}
@ -575,12 +578,7 @@ function get_events() {
if ($strt === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) {
$istoday = true;
}
}
$classtoday = (($istoday) ? 'event-today' : '');
$skip = 0;
foreach ($r as &$rr) {
$title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
if (strlen($title) > 35) {
@ -607,6 +605,8 @@ function get_events() {
$rr['startime'] = $strt;
$rr['today'] = $today;
}
dba::close($r);
$classtoday = (($istoday) ? 'event-today' : '');
}
$tpl = get_markup_template("events_reminder.tpl");