And some more changed lines
This commit is contained in:
parent
05393a6faa
commit
556cc0cc4c
|
@ -41,18 +41,18 @@ class ForumManager {
|
||||||
$select = '(`forum` OR `prv`)';
|
$select = '(`forum` OR `prv`)';
|
||||||
}
|
}
|
||||||
|
|
||||||
$contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro`, `contact`.`thumb` FROM `contact`
|
$contacts = dba::p("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro`, `contact`.`thumb` FROM `contact`
|
||||||
WHERE `network`= 'dfrn' AND $select AND `uid` = %d
|
WHERE `network`= 'dfrn' AND $select AND `uid` = ?
|
||||||
AND NOT `blocked` AND NOT `hidden` AND NOT `pending` AND NOT `archive`
|
AND NOT `blocked` AND NOT `hidden` AND NOT `pending` AND NOT `archive`
|
||||||
AND `success_update` > `failure_update`
|
AND `success_update` > `failure_update`
|
||||||
$order ",
|
$order ",
|
||||||
intval($uid)
|
$uid
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$contacts)
|
if (!$contacts)
|
||||||
return($forumlist);
|
return($forumlist);
|
||||||
|
|
||||||
foreach($contacts as $contact) {
|
while ($contact = dba::fetch($contacts)) {
|
||||||
$forumlist[] = array(
|
$forumlist[] = array(
|
||||||
'url' => $contact['url'],
|
'url' => $contact['url'],
|
||||||
'name' => $contact['name'],
|
'name' => $contact['name'],
|
||||||
|
@ -61,6 +61,8 @@ class ForumManager {
|
||||||
'thumb' => $contact['thumb'],
|
'thumb' => $contact['thumb'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
dba::close($contacts);
|
||||||
|
|
||||||
return($forumlist);
|
return($forumlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,19 +108,20 @@ function networks_widget($baseurl, $selected = '') {
|
||||||
|
|
||||||
$extra_sql = unavailable_networks();
|
$extra_sql = unavailable_networks();
|
||||||
|
|
||||||
$r = q("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = %d AND `network` != '' $extra_sql ORDER BY `network`",
|
$r = dba::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND `network` != '' $extra_sql ORDER BY `network`",
|
||||||
intval(local_user())
|
local_user()
|
||||||
);
|
);
|
||||||
|
|
||||||
$nets = array();
|
$nets = array();
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
require_once 'include/contact_selectors.php';
|
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
|
/// @TODO If 'network' is not there, this triggers an E_NOTICE
|
||||||
if ($rr['network']) {
|
if ($rr['network']) {
|
||||||
$nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
|
$nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dba::close($r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($nets) < 2) {
|
if (count($nets) < 2) {
|
||||||
|
@ -229,18 +230,14 @@ function common_friends_visitor_widget($profile_uid) {
|
||||||
|
|
||||||
if (! $cid) {
|
if (! $cid) {
|
||||||
if (get_my_url()) {
|
if (get_my_url()) {
|
||||||
$r = q("select id from contact where nurl = '%s' and uid = %d limit 1",
|
$r = dba::select('contact', array('id'),
|
||||||
dbesc(normalise_link(get_my_url())),
|
array('nurl' => normalise_link(get_my_url()), 'uid' => $profile_uid), array('limit' => 1));
|
||||||
intval($profile_uid)
|
|
||||||
);
|
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$cid = $r[0]['id'];
|
$cid = $r['id'];
|
||||||
} else {
|
} else {
|
||||||
$r = q("select id from gcontact where nurl = '%s' limit 1",
|
$r = dba::select('gcontact', array('id'), array('nurl' => normalise_link(get_my_url())), array('limit' => 1));
|
||||||
dbesc(normalise_link(get_my_url()))
|
|
||||||
);
|
|
||||||
if (dbm::is_result($r))
|
if (dbm::is_result($r))
|
||||||
$zcid = $r[0]['id'];
|
$zcid = $r['id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,15 +468,16 @@ function get_birthdays() {
|
||||||
$cachekey = "get_birthdays:".local_user();
|
$cachekey = "get_birthdays:".local_user();
|
||||||
$r = Cache::get($cachekey);
|
$r = Cache::get($cachekey);
|
||||||
if (is_null($r)) {
|
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`
|
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 ",
|
ORDER BY `start` ASC ",
|
||||||
intval(local_user()),
|
local_user(),
|
||||||
dbesc(datetime_convert('UTC','UTC','now + 6 days')),
|
datetime_convert('UTC','UTC','now + 6 days'),
|
||||||
dbesc(datetime_convert('UTC','UTC','now'))
|
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);
|
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_format = t('g A l F d') ; // 8 AM Friday January 18
|
||||||
$bd_short = t('F d');
|
$bd_short = t('F d');
|
||||||
|
|
||||||
$r = q("SELECT `event`.* FROM `event`
|
$r = dba::p("SELECT `event`.* FROM `event`
|
||||||
WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `start` >= '%s'
|
WHERE `event`.`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ?
|
||||||
ORDER BY `start` ASC ",
|
ORDER BY `start` ASC ",
|
||||||
intval(local_user()),
|
local_user(),
|
||||||
dbesc(datetime_convert('UTC','UTC','now + 7 days')),
|
datetime_convert('UTC','UTC','now + 7 days'),
|
||||||
dbesc(datetime_convert('UTC','UTC','now - 1 days'))
|
datetime_convert('UTC','UTC','now - 1 days')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$now = strtotime('now');
|
$now = strtotime('now');
|
||||||
$istoday = false;
|
$istoday = false;
|
||||||
foreach ($r as $rr) {
|
$skip = 0;
|
||||||
|
|
||||||
|
while ($rr = dba::fetch($r)) {
|
||||||
if (strlen($rr['name'])) {
|
if (strlen($rr['name'])) {
|
||||||
$total ++;
|
$total ++;
|
||||||
}
|
}
|
||||||
|
@ -575,12 +578,7 @@ function get_events() {
|
||||||
if ($strt === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) {
|
if ($strt === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) {
|
||||||
$istoday = true;
|
$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'));
|
$title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
|
||||||
|
|
||||||
if (strlen($title) > 35) {
|
if (strlen($title) > 35) {
|
||||||
|
@ -607,6 +605,8 @@ function get_events() {
|
||||||
$rr['startime'] = $strt;
|
$rr['startime'] = $strt;
|
||||||
$rr['today'] = $today;
|
$rr['today'] = $today;
|
||||||
}
|
}
|
||||||
|
dba::close($r);
|
||||||
|
$classtoday = (($istoday) ? 'event-today' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl = get_markup_template("events_reminder.tpl");
|
$tpl = get_markup_template("events_reminder.tpl");
|
||||||
|
|
Loading…
Reference in a new issue