aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/access.php22
-rw-r--r--engine/lib/annotations.php2
-rw-r--r--engine/lib/configuration.php4
-rw-r--r--engine/lib/elgglib.php2
-rw-r--r--engine/lib/entities.php2
-rw-r--r--engine/lib/group.php4
-rw-r--r--engine/lib/objects.php2
-rw-r--r--engine/lib/query.php8
-rw-r--r--engine/lib/relationships.php6
-rw-r--r--engine/lib/sites.php2
-rw-r--r--engine/lib/users.php2
11 files changed, 28 insertions, 28 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index b920f9fbe..ae0ae891b 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -66,9 +66,9 @@
if (empty($access_array[$user_id]) || $flush == true) {
- $query = "select am.access_collection_id from {$CONFIG->dbprefix}access_collection_membership am ";
- $query .= " left join {$CONFIG->dbprefix}access_collections ag on ag.id = am.access_collection_id ";
- $query .= " where am.user_guid = {$user_id} and (ag.site_guid = {$site_id} or ag.site_guid = 0)";
+ $query = "SELECT am.access_collection_id FROM {$CONFIG->dbprefix}access_collection_membership am ";
+ $query .= " LEFT JOIN {$CONFIG->dbprefix}access_collections ag ON ag.id = am.access_collection_id ";
+ $query .= " WHERE am.user_guid = {$user_id} AND (ag.site_guid = {$site_id} OR ag.site_guid = 0)";
$tmp_access_array = array(2);
if (isloggedin())
@@ -80,8 +80,8 @@
}
- $query = "select ag.id from {$CONFIG->dbprefix}access_collections ag ";
- $query .= " where ag.owner_guid = {$user_id} and (ag.site_guid = {$site_id} or ag.site_guid = 0)";
+ $query = "SELECT ag.id FROM {$CONFIG->dbprefix}access_collections ag ";
+ $query .= " WHERE ag.owner_guid = {$user_id} AND (ag.site_guid = {$site_id} OR ag.site_guid = 0)";
if ($collections = get_data($query)) {
foreach($collections as $collection)
@@ -192,10 +192,10 @@
if (empty($access_array[$user_id]) || $flush == true) {
- $query = "select ag.* from {$CONFIG->dbprefix}access_collections ag ";
- $query .= " where (ag.site_guid = {$site_id} or ag.site_guid = 0)";
- $query .= " and (ag.owner_guid = {$user_id})";
- $query .= " and ag.id >= 3";
+ $query = "SELECT ag.* FROM {$CONFIG->dbprefix}access_collections ag ";
+ $query .= " WHERE (ag.site_guid = {$site_id} OR ag.site_guid = 0)";
+ $query .= " AND (ag.owner_guid = {$user_id})";
+ $query .= " AND ag.id >= 3";
$tmp_access_array = array(0 => elgg_echo("PRIVATE"), 1 => elgg_echo("LOGGED_IN"), 2 => elgg_echo("PUBLIC"));
if ($collections = get_data($query)) {
@@ -396,10 +396,10 @@
global $CONFIG;
if (!$idonly) {
- $query = "select e.* from {$CONFIG->dbprefix}access_collection_membership m join {$CONFIG->dbprefix}entities e on e.guid = m.user_guid WHERE m.access_collection_id = {$collection}";
+ $query = "SELECT e.* FROM {$CONFIG->dbprefix}access_collection_membership m JOIN {$CONFIG->dbprefix}entities e ON e.guid = m.user_guid WHERE m.access_collection_id = {$collection}";
$collection_members = get_data($query, "entity_row_to_elggstar");
} else {
- $query = "select e.guid from {$CONFIG->dbprefix}access_collection_membership m join {$CONFIG->dbprefix}entities e on e.guid = m.user_guid WHERE m.access_collection_id = {$collection}";
+ $query = "SELECT e.guid FROM {$CONFIG->dbprefix}access_collection_membership m JOIN {$CONFIG->dbprefix}entities e ON e.guid = m.user_guid WHERE m.access_collection_id = {$collection}";
$collection_members = get_data($query);
foreach($collection_members as $key => $val)
$collection_members[$key] = $val->guid;
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 94fbf7f4e..699430431 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -143,7 +143,7 @@
$annotation_id = (int) $annotation_id;
$access = get_access_sql_suffix("a");
- return row_to_elggannotation(get_data_row("select a.*, n.string as name, v.string as value from {$CONFIG->dbprefix}annotations a JOIN {$CONFIG->dbprefix}metastrings n on a.name_id = n.id JOIN {$CONFIG->dbprefix}metastrings v on a.value_id = v.id where a.id=$annotation_id and $access"));
+ return row_to_elggannotation(get_data_row("SELECT a.*, n.string as name, v.string as value from {$CONFIG->dbprefix}annotations a JOIN {$CONFIG->dbprefix}metastrings n on a.name_id = n.id JOIN {$CONFIG->dbprefix}metastrings v on a.value_id = v.id where a.id=$annotation_id and $access"));
}
/**
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index 12915cef4..fd242b01a 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -75,7 +75,7 @@
$site_guid = (int) $site_guid;
if ($site_guid == 0)
$site_guid = (int) $CONFIG->site_id;
- if ($result = get_data_row("select value from {$CONFIG->dbprefix}config where name = '{$name}' and site_guid = {$site_guid}")) {
+ if ($result = get_data_row("SELECT value from {$CONFIG->dbprefix}config where name = '{$name}' and site_guid = {$site_guid}")) {
$result = $result->value;
$result = unserialize($result->value);
$CONFIG->$name = $result;
@@ -99,7 +99,7 @@
if ($site_guid == 0)
$site_guid = (int) $CONFIG->site_id;
- if ($result = get_data("select * from {$CONFIG->dbprefix}config where site_guid = {$site_guid}")) {
+ if ($result = get_data("SELECT * from {$CONFIG->dbprefix}config where site_guid = {$site_guid}")) {
foreach ($result as $r)
{
$name = $r->name;
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index bec58d241..a05227aa6 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1505,7 +1505,7 @@
if (isset($DATALIST_CACHE[$name]))
return $DATALIST_CACHE[$name];
- if ($row = get_data_row("select value from {$CONFIG->dbprefix}datalists where name = '{$name}'")) {
+ if ($row = get_data_row("SELECT value from {$CONFIG->dbprefix}datalists where name = '{$name}'")) {
$DATALIST_CACHE[$name] = $row->value;
return $row->value;
}
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index ba376917b..de1093835 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1409,7 +1409,7 @@
if (!$count) {
$query = "SELECT * from {$CONFIG->dbprefix}entities where ";
} else {
- $query = "select count(guid) as total from {$CONFIG->dbprefix}entities where ";
+ $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where ";
}
foreach ($where as $w)
$query .= " $w and ";
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 02aefbe1b..51afd8e41 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -364,7 +364,7 @@
if ($row)
{
// Exists and you have access to it
- if ($exists = get_data_row("select guid from {$CONFIG->dbprefix}groups_entity where guid = {$guid}")) {
+ if ($exists = get_data_row("SELECT guid from {$CONFIG->dbprefix}groups_entity WHERE guid = {$guid}")) {
$result = update_data("UPDATE {$CONFIG->dbprefix}groups_entity set name='$name', description='$description' where guid=$guid");
if ($result!=false)
{
@@ -532,7 +532,7 @@
if (!$count) {
$query = "SELECT * from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}objects_entity o on e.guid=o.guid where ";
} else {
- $query = "select count(e.guid) as total from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}objects_entity o on e.guid=o.guid where ";
+ $query = "SELECT count(e.guid) as total from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}objects_entity o on e.guid=o.guid where ";
}
foreach ($where as $w)
$query .= " $w and ";
diff --git a/engine/lib/objects.php b/engine/lib/objects.php
index aaf873b19..0bbcf1bb9 100644
--- a/engine/lib/objects.php
+++ b/engine/lib/objects.php
@@ -256,7 +256,7 @@
if ($row)
{
// Core entities row exists and we have access to it
- if ($exists = get_data_row("select guid from {$CONFIG->dbprefix}objects_entity where guid = {$guid}")) {
+ if ($exists = get_data_row("SELECT guid from {$CONFIG->dbprefix}objects_entity where guid = {$guid}")) {
$result = update_data("UPDATE {$CONFIG->dbprefix}objects_entity set title='$title', description='$description' where guid=$guid");
if ($result!=false)
{
diff --git a/engine/lib/query.php b/engine/lib/query.php
index c74628b91..d18f152cf 100644
--- a/engine/lib/query.php
+++ b/engine/lib/query.php
@@ -401,7 +401,7 @@
{
function __construct()
{
- $this->query_type = "select";
+ $this->query_type = "SELECT";
}
}
@@ -415,7 +415,7 @@
{
function __construct()
{
- $this->query_type = "insert into";
+ $this->query_type = "INSERT INTO";
}
}
@@ -429,7 +429,7 @@
{
function __construct()
{
- $this->query_type = "delete from";
+ $this->query_type = "DELETE FROM";
}
}
@@ -443,7 +443,7 @@
{
function __construct()
{
- $this->query_type = "update";
+ $this->query_type = "UPDATE";
}
}
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index 8f2d52bbc..f43a46c54 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -380,7 +380,7 @@
$relationship = sanitise_string($relationship);
$guid_two = (int)$guid_two;
- if ($row = get_data_row("select guid_one from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid_one and relationship='$relationship' and guid_two=$guid_two limit 1")) {
+ if ($row = get_data_row("SELECT guid_one FROM {$CONFIG->dbprefix}entity_relationships WHERE guid_one=$guid_one AND relationship='$relationship' AND guid_two=$guid_two limit 1")) {
return true;
}
return false;
@@ -506,9 +506,9 @@
$joinon = "e.guid = r.guid_two";
if ($count) {
- $query = "select count(distinct e.guid) as total ";
+ $query = "SELECT count(distinct e.guid) as total ";
} else {
- $query = "select distinct e.* ";
+ $query = "SELECT distinct e.* ";
}
$query .= " from {$CONFIG->dbprefix}entity_relationships r JOIN {$CONFIG->dbprefix}entities e on $joinon where ";
foreach ($where as $w)
diff --git a/engine/lib/sites.php b/engine/lib/sites.php
index 7b02424d5..f7d3407ae 100644
--- a/engine/lib/sites.php
+++ b/engine/lib/sites.php
@@ -270,7 +270,7 @@
if ($row)
{
// Exists and you have access to it
- if ($exists = get_data_row("select guid from {$CONFIG->dbprefix}sites_entity where guid = {$guid}")) {
+ if ($exists = get_data_row("SELECT guid from {$CONFIG->dbprefix}sites_entity where guid = {$guid}")) {
$result = update_data("UPDATE {$CONFIG->dbprefix}sites_entity set name='$name', description='$description', url='$url' where guid=$guid");
if ($result!=false)
{
diff --git a/engine/lib/users.php b/engine/lib/users.php
index bd212570c..82b7cef12 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -356,7 +356,7 @@
{
// Exists and you have access to it
- if ($exists = get_data_row("select guid from {$CONFIG->dbprefix}users_entity where guid = {$guid}")) {
+ if ($exists = get_data_row("SELECT guid from {$CONFIG->dbprefix}users_entity where guid = {$guid}")) {
$result = update_data("UPDATE {$CONFIG->dbprefix}users_entity set name='$name', username='$username', password='$password', email='$email', language='$language', code='$code', last_action = ". time() ." where guid = {$guid}");
if ($result != false)
{