aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/event.php44
-rw-r--r--include/group.php40
-rw-r--r--include/socgraph.php40
3 files changed, 62 insertions, 62 deletions
diff --git a/include/event.php b/include/event.php
index 153654120..cbee2b759 100644
--- a/include/event.php
+++ b/include/event.php
@@ -362,28 +362,28 @@ function event_store_event($arr) {
// The event changed. Update it.
- $r = q("UPDATE `event` SET
- `edited` = '%s',
- `dtstart` = '%s',
- `dtend` = '%s',
- `summary` = '%s',
- `description` = '%s',
- `location` = '%s',
- `etype` = '%s',
- `adjust` = %d,
- `nofinish` = %d,
- `event_status` = '%s',
- `event_status_date` = '%s',
- `event_percent` = %d,
- `event_repeat` = '%s',
- `event_sequence` = %d,
- `event_priority` = %d,
- `event_vdata` = '%s',
- `allow_cid` = '%s',
- `allow_gid` = '%s',
- `deny_cid` = '%s',
- `deny_gid` = '%s'
- WHERE `id` = %d AND `uid` = %d",
+ $r = q("UPDATE event SET
+ edited = '%s',
+ dtstart = '%s',
+ dtend = '%s',
+ summary = '%s',
+ description = '%s',
+ location = '%s',
+ etype = '%s',
+ adjust = %d,
+ nofinish = %d,
+ event_status = '%s',
+ event_status_date = '%s',
+ event_percent = %d,
+ event_repeat = '%s',
+ event_sequence = %d,
+ event_priority = %d,
+ event_vdata = '%s',
+ allow_cid = '%s',
+ allow_gid = '%s',
+ deny_cid = '%s',
+ deny_gid = '%s'
+ WHERE id = %d AND uid = %d",
dbesc($arr['edited']),
dbesc($arr['dtstart']),
diff --git a/include/group.php b/include/group.php
index 10853ff6b..39a907336 100644
--- a/include/group.php
+++ b/include/group.php
@@ -14,11 +14,11 @@ function group_add($uid,$name,$public = 0) {
// access lists. What we're doing here is reviving the dead group, but old content which
// was restricted to this group may now be seen by the new group members.
- $z = q("SELECT * FROM `groups` WHERE `id` = %d LIMIT 1",
+ $z = q("SELECT * FROM groups WHERE id = %d LIMIT 1",
intval($r)
);
if(($z) && $z[0]['deleted']) {
- /*$r = q("UPDATE `groups` SET `deleted` = 0 WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
+ /*$r = q("UPDATE groups SET deleted = 0 WHERE uid = %d AND gname = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);*/
@@ -32,13 +32,13 @@ function group_add($uid,$name,$public = 0) {
$dups = false;
$hash = random_string() . $name;
- $r = q("SELECT id FROM `groups` WHERE hash = '%s' LIMIT 1", dbesc($hash));
+ $r = q("SELECT id FROM groups WHERE hash = '%s' LIMIT 1", dbesc($hash));
if($r)
$dups = true;
} while($dups == true);
- $r = q("INSERT INTO `groups` ( hash, uid, visible, gname )
+ $r = q("INSERT INTO groups ( hash, uid, visible, gname )
VALUES( '%s', %d, %d, '%s' ) ",
dbesc($hash),
intval($uid),
@@ -57,7 +57,7 @@ function group_add($uid,$name,$public = 0) {
function group_rmv($uid,$name) {
$ret = false;
if(x($uid) && x($name)) {
- $r = q("SELECT id, hash FROM `groups` WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
+ $r = q("SELECT id, hash FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -102,13 +102,13 @@ function group_rmv($uid,$name) {
}
// remove all members
- $r = q("DELETE FROM `group_member` WHERE `uid` = %d AND `gid` = %d ",
+ $r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d ",
intval($uid),
intval($group_id)
);
// remove group
- $r = q("UPDATE `groups` SET `deleted` = 1 WHERE `uid` = %d AND `gname` = '%s'",
+ $r = q("UPDATE groups SET deleted = 1 WHERE uid = %d AND gname = '%s'",
intval($uid),
dbesc($name)
);
@@ -125,7 +125,7 @@ function group_rmv($uid,$name) {
function group_byname($uid,$name) {
if((! $uid) || (! strlen($name)))
return false;
- $r = q("SELECT * FROM `groups` WHERE `uid` = %d AND `gname` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM groups WHERE uid = %d AND gname = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -138,7 +138,7 @@ function group_byname($uid,$name) {
function group_rec_byhash($uid,$hash) {
if((! $uid) || (! strlen($hash)))
return false;
- $r = q("SELECT * FROM `groups` WHERE `uid` = %d AND `hash` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM groups WHERE uid = %d AND hash = '%s' LIMIT 1",
intval($uid),
dbesc($hash)
);
@@ -153,7 +153,7 @@ function group_rmv_member($uid,$name,$member) {
return false;
if(! ( $uid && $gid && $member))
return false;
- $r = q("DELETE FROM `group_member` WHERE `uid` = %d AND `gid` = %d AND xchan = '%s' ",
+ $r = q("DELETE FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' ",
intval($uid),
intval($gid),
dbesc($member)
@@ -173,7 +173,7 @@ function group_add_member($uid,$name,$member,$gid = 0) {
if((! $gid) || (! $uid) || (! $member))
return false;
- $r = q("SELECT * FROM `group_member` WHERE `uid` = %d AND `gid` = %d AND `xchan` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM group_member WHERE uid = %d AND gid = %d AND xchan = '%s' LIMIT 1",
intval($uid),
intval($gid),
dbesc($member)
@@ -183,7 +183,7 @@ function group_add_member($uid,$name,$member,$gid = 0) {
// we indicate success because the group member was in fact created
// -- It was just created at another time
if(! $r)
- $r = q("INSERT INTO `group_member` (`uid`, `gid`, `xchan`)
+ $r = q("INSERT INTO group_member (uid, gid, xchan)
VALUES( %d, %d, '%s' ) ",
intval($uid),
intval($gid),
@@ -198,9 +198,9 @@ function group_add_member($uid,$name,$member,$gid = 0) {
function group_get_members($gid) {
$ret = array();
if(intval($gid)) {
- $r = q("SELECT * FROM `group_member`
- LEFT JOIN abook ON abook_xchan = `group_member`.`xchan` left join xchan on xchan_hash = abook_xchan
- WHERE `gid` = %d AND abook_channel = %d and `group_member`.`uid` = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ",
+ $r = q("SELECT * FROM group_member
+ LEFT JOIN abook ON abook_xchan = group_member.xchan left join xchan on xchan_hash = abook_xchan
+ WHERE gid = %d AND abook_channel = %d and group_member.uid = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ",
intval($gid),
intval(local_channel()),
intval(local_channel())
@@ -232,7 +232,7 @@ function mini_group_select($uid,$group = '') {
$grps = array();
$o = '';
- $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `gname` ASC",
+ $r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval($uid)
);
$grps[] = array('name' => '', 'hash' => '0', 'selected' => '');
@@ -271,7 +271,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
);
- $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `gname` ASC",
+ $r = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
intval($_SESSION['uid'])
);
$member_of = array();
@@ -328,7 +328,7 @@ function expand_groups($a) {
$groups = implode(',', $x);
if($groups)
- $r = q("SELECT xchan FROM group_member WHERE gid IN ( select id from `groups` where hash in ( $groups ))");
+ $r = q("SELECT xchan FROM group_member WHERE gid IN ( select id from groups where hash in ( $groups ))");
$ret = array();
if($r)
@@ -340,7 +340,7 @@ function expand_groups($a) {
function member_of($c) {
- $r = q("SELECT `groups`.`gname`, `groups`.`id` FROM `groups` LEFT JOIN `group_member` ON `group_member`.`gid` = `groups`.`id` WHERE `group_member`.`xchan` = '%s' AND `groups`.`deleted` = 0 ORDER BY `groups`.`gname` ASC ",
+ $r = q("SELECT groups.gname, groups.id FROM groups LEFT JOIN group_member ON group_member.gid = groups.id WHERE group_member.xchan = '%s' AND groups.deleted = 0 ORDER BY groups.gname ASC ",
dbesc($c)
);
@@ -350,7 +350,7 @@ function member_of($c) {
function groups_containing($uid,$c) {
- $r = q("SELECT `gid` FROM `group_member` WHERE `uid` = %d AND `group_member`.`xchan` = '%s' ",
+ $r = q("SELECT gid FROM group_member WHERE uid = %d AND group_member.xchan = '%s' ",
intval($uid),
dbesc($c)
);
diff --git a/include/socgraph.php b/include/socgraph.php
index 4cb5600ec..69365f80f 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -245,10 +245,10 @@ function common_friends($uid,$xchan,$start = 0,$limit=100000000,$shuffle = false
function count_common_friends_zcid($uid,$zcid) {
- $r = q("SELECT count(*) as `total`
- FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
- where `glink`.`zcid` = %d
- and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) ",
+ $r = q("SELECT count(*) as total
+ FROM glink left join gcontact on glink.gcid = gcontact.id
+ where glink.zcid = %d
+ and gcontact.nurl in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) ",
intval($zcid),
intval($uid)
);
@@ -264,12 +264,12 @@ function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = fal
if($shuffle)
$sql_extra = " order by rand() ";
else
- $sql_extra = " order by `gcontact`.`name` asc ";
+ $sql_extra = " order by gcontact.name asc ";
- $r = q("SELECT `gcontact`.*
- FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
- where `glink`.`zcid` = %d
- and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 )
+ $r = q("SELECT gcontact.*
+ FROM glink left join gcontact on glink.gcid = gcontact.id
+ where glink.zcid = %d
+ and gcontact.nurl in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 )
$sql_extra limit %d offset %d",
intval($zcid),
intval($uid),
@@ -283,9 +283,9 @@ function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = fal
function count_all_friends($uid,$cid) {
- $r = q("SELECT count(*) as `total`
- FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
- where `glink`.`cid` = %d and `glink`.`uid` = %d ",
+ $r = q("SELECT count(*) as total
+ FROM glink left join gcontact on glink.gcid = gcontact.id
+ where glink.cid = %d and glink.uid = %d ",
intval($cid),
intval($uid)
);
@@ -299,10 +299,10 @@ function count_all_friends($uid,$cid) {
function all_friends($uid,$cid,$start = 0, $limit = 80) {
- $r = q("SELECT `gcontact`.*
- FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
- where `glink`.`cid` = %d and `glink`.`uid` = %d
- order by `gcontact`.`name` asc LIMIT %d OFFSET %d ",
+ $r = q("SELECT gcontact.*
+ FROM glink left join gcontact on glink.gcid = gcontact.id
+ where glink.cid = %d and glink.uid = %d
+ order by gcontact.name asc LIMIT %d OFFSET %d ",
intval($cid),
intval($uid),
intval($limit),
@@ -319,7 +319,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
if((! $uid) || (! $myxchan))
return array();
- $r = q("SELECT count(xlink_xchan) as `total`, xchan.* from xchan
+ $r = q("SELECT count(xlink_xchan) as total, xchan.* from xchan
left join xlink on xlink_link = xchan_hash
where xlink_xchan in ( select abook_xchan from abook where abook_channel = %d )
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
@@ -339,7 +339,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
if($r && count($r) >= ($limit -1))
return $r;
- $r2 = q("SELECT count(xlink_link) as `total`, xchan.* from xchan
+ $r2 = q("SELECT count(xlink_link) as total, xchan.* from xchan
left join xlink on xlink_link = xchan_hash
where xlink_xchan = ''
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
@@ -465,11 +465,11 @@ function poco($a,$extended = false) {
$sql_extra = sprintf(" and abook_id = %d and abook_hidden = 0 ",intval($cid));
if($system_mode) {
- $r = q("SELECT count(*) as `total` from abook where abook_self = 1
+ $r = q("SELECT count(*) as total from abook where abook_self = 1
and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') ");
}
else {
- $r = q("SELECT count(*) as `total` from abook where abook_channel = %d
+ $r = q("SELECT count(*) as total from abook where abook_channel = %d
$sql_extra ",
intval($channel_id)
);