Commit 5295e94a authored by Francois Marier's avatar Francois Marier
Browse files
parent 14ad7c34
......@@ -417,8 +417,8 @@ function institution_submit(Pieform $form, $values) {
$hostwwwroot = null;
foreach ($authinstances as $ai) {
if ($ai->id == $instanceid && $ai->authname == 'xmlrpc') {
$hostwwwroot = get_field_sql("SELECT value FROM {auth_instance_config} WHERE instance = ? AND field = 'wwwroot'", array($instanceid));
if ($hostwwwroot && count_records_select('auth_instance_config', "field = 'wwwroot' AND value = ?", array($hostwwwroot)) == 1) {
$hostwwwroot = get_field_sql("SELECT \"value\" FROM {auth_instance_config} WHERE \"instance\" = ? AND field = 'wwwroot'", array($instanceid));
if ($hostwwwroot && count_records_select('auth_instance_config', "field = 'wwwroot' AND \"value\" = ?", array($hostwwwroot)) == 1) {
// Unfortunately, it's possible that this host record could belong to a different institution,
// so specify the institution here.
delete_records('host', 'wwwroot', $hostwwwroot, 'institution', $institution);
......
......@@ -55,7 +55,7 @@ class PluginBlocktypeRecentposts extends PluginBlocktype {
JOIN {artefact_blog_blogpost} ab ON (ab.blogpost = a.id AND ab.published = 1)
WHERE a.artefacttype = \'blogpost\'
AND a.parent IN ( ' . $artefactids . ' )
AND a.owner = (SELECT owner from {view} WHERE id = ?)
AND a.owner = (SELECT "owner" from {view} WHERE id = ?)
ORDER BY a.ctime DESC
LIMIT 10', array($instance->get('view')))) {
$mostrecent = array();
......
......@@ -289,7 +289,7 @@ class ArtefactTypeBlog extends ArtefactType {
public static function get_blog_list($limit, $offset) {
global $USER;
($result = get_records_sql_array("
SELECT * FROM {artefact} WHERE owner = ? AND artefacttype = 'blog'
SELECT * FROM {artefact} WHERE \"owner\" = ? AND artefacttype = 'blog'
ORDER BY title LIMIT ? OFFSET ?", array($USER->get('id'), $limit, $offset)))
|| ($result = array());
......
......@@ -39,7 +39,7 @@ $id = param_integer('id', null);
if (is_null($id)) {
if (!$records = get_records_select_array(
'artefact',
"artefacttype = 'blog' AND owner = ?",
"artefacttype = 'blog' AND \"owner\" = ?",
array($USER->get('id')),
'id ASC'
)) {
......
......@@ -92,7 +92,7 @@ class PluginBlocktypeContactinfo extends PluginBlocktype {
FROM {artefact} a
WHERE artefacttype = \'email\'
AND a.owner = (
SELECT owner
SELECT "owner"
FROM {view}
WHERE id = ?
)
......@@ -151,7 +151,7 @@ class PluginBlocktypeContactinfo extends PluginBlocktype {
$artefacttypes = array_diff(PluginArtefactInternal::get_contactinfo_artefact_types(), array('email'));
$artefactids = get_column_sql('
SELECT id FROM {artefact}
WHERE owner = ? AND artefacttype IN (' . join(',', array_map('db_quote', $artefacttypes)) . ')', array($view->get('owner')));
WHERE \"owner\" = ? AND artefacttype IN (' . join(',', array_map('db_quote', $artefacttypes)) . ')', array($view->get('owner')));
$configdata['artefactids'] = $artefactids;
if (isset($configdata['email'])) {
if ($newemail = get_field('artefact_internal_profile_email', 'artefact', 'principal', 1, 'owner', $view->get('owner'))) {
......
......@@ -129,7 +129,7 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype {
FROM {artefact} a
WHERE (artefacttype = \'profileicon\' OR artefacttype = \'email\')
AND a.owner = (
SELECT owner
SELECT "owner"
FROM {view}
WHERE id = ?
)
......@@ -226,7 +226,7 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype {
$artefacttypes = array_diff(PluginArtefactInternal::get_artefact_types(), array('email'));
$artefactids = get_column_sql('
SELECT id FROM {artefact}
WHERE owner = ? AND artefacttype IN (' . join(',', array_map('db_quote', $artefacttypes)) . ')', array($view->get('owner')));
WHERE \"owner\" = ? AND artefacttype IN (' . join(',', array_map('db_quote', $artefacttypes)) . ')', array($view->get('owner')));
$configdata['artefactids'] = $artefactids;
if (isset($configdata['email'])) {
if ($newemail = get_field('artefact_internal_profile_email', 'artefact', 'principal', 1, 'owner', $view->get('owner'))) {
......
......@@ -73,7 +73,7 @@ class HtmlExportInternal extends HtmlExportArtefactPlugin {
);
$elementlist = call_static_method('ArtefactTypeProfile', 'get_all_fields');
$elementlistlookup = array_flip(array_keys($elementlist));
$profilefields = get_column_sql('SELECT id FROM {artefact} WHERE owner=? AND artefacttype IN ('
$profilefields = get_column_sql('SELECT id FROM {artefact} WHERE \"owner\" = ? AND artefacttype IN ('
. join(",",array_map(create_function('$a','return db_quote($a);'), array_keys($elementlist)))
. ")", array($this->exporter->get('user')->get('id')));
foreach ($profilefields as $id) {
......
......@@ -94,7 +94,7 @@ class LeapExportElementInternal extends LeapExportElement {
if ($icons = get_column_sql("SELECT id
FROM {artefact}
WHERE artefacttype = 'profileicon'
AND owner = ?
AND \"owner\" = ?
ORDER BY id = (
SELECT profileicon FROM {usr} WHERE id = ?
) DESC, id", array($userid, $userid))) {
......
......@@ -158,7 +158,7 @@ class PluginArtefactInternal extends PluginArtefact {
if (!isset($cache[$owner])) {
$cache[$owner] = get_records_sql_assoc("SELECT id, artefacttype, title
FROM {artefact}
WHERE owner = ?
WHERE \"owner\" = ?
AND artefacttype IN (
SELECT name
FROM {artefact_installed_type}
......@@ -226,7 +226,7 @@ class PluginArtefactInternal extends PluginArtefact {
if (!isset($cache[$owner])) {
$cache[$owner] = get_records_sql_assoc("SELECT artefacttype, id
FROM {artefact}
WHERE owner = ?
WHERE \"owner\" = ?
AND artefacttype IN (
SELECT name
FROM {artefact_installed_type}
......
......@@ -1311,7 +1311,7 @@ function artefact_instance_from_type($artefact_type, $user_id=null) {
function artefact_watchlist_notification($artefactids) {
// gets all the views containing this artefact or a parent of this artefact and creates a watchlist activity for each view
if ($views = get_column_sql('SELECT DISTINCT view FROM {view_artefact} WHERE artefact IN (' . implode(',', array_merge(array_keys(artefact_get_parents_for_cache($artefactids)), $artefactids)) . ')')) {
if ($views = get_column_sql('SELECT DISTINCT "view" FROM {view_artefact} WHERE artefact IN (' . implode(',', array_merge(array_keys(artefact_get_parents_for_cache($artefactids)), $artefactids)) . ')')) {
require_once('activity.php');
foreach ($views as $view) {
activity_occurred('watchlist', (object)array('view' => $view));
......
......@@ -109,8 +109,8 @@ class PluginBlocktypeEntireresume extends PluginBlocktype {
SELECT id
FROM {artefact}
WHERE artefacttype IN(' . $artefacttypes . ')
AND owner = (
SELECT owner
AND "owner" = (
SELECT "owner"
FROM {view}
WHERE id = ?
)', array($blockinstance->get('view')));
......
......@@ -196,7 +196,7 @@ class PluginBlocktypeResumefield extends PluginBlocktype {
if (!empty($impcfg['artefacttype'])) {
if ($artefactid = get_field_sql("SELECT id
FROM {artefact}
WHERE owner = ?
WHERE \"owner\" = ?
AND artefacttype = ?
AND artefacttype IN (
SELECT name
......
......@@ -46,7 +46,7 @@ class HtmlExportResume extends HtmlExportArtefactPlugin {
if ($artefacts = get_column_sql("SELECT id
FROM {artefact}
WHERE owner = ?
WHERE \"owner\" = ?
AND artefacttype IN
(SELECT name FROM {artefact_installed_type} WHERE plugin = 'resume')",
array($this->exporter->get('user')->get('id')))) {
......
......@@ -169,7 +169,7 @@ class ArtefactTypeResume extends ArtefactType {
parent::commit();
if ($blockinstances = get_records_sql_array('
SELECT id, view, configdata
SELECT id, "view", configdata
FROM {block_instance}
WHERE blocktype = \'entireresume\'
AND "view" IN (
......
......@@ -530,7 +530,7 @@ class User {
$types = array('profile', 'dashboard');
$views = get_records_select_assoc(
'view',
'owner = ? AND type IN (' . join(',', array_map('db_quote', $types)) . ')',
'"owner" = ? AND type IN (' . join(',', array_map('db_quote', $types)) . ')',
array($this->id),
'',
'type,id'
......
......@@ -59,7 +59,7 @@ class PluginBlocktypeMyviews extends SystemBlocktype {
// Get viewable views
$views = array();
if ($allviews = get_records_select_array('view', "owner = ? AND type NOT IN ('profile', 'dashboard')", array($userid))) {
if ($allviews = get_records_select_array('view', "\"owner\" = ? AND type NOT IN ('profile', 'dashboard')", array($userid))) {
foreach ($allviews as $view) {
if (can_view_view($view->id)) {
$views[$view->id] = $view;
......
......@@ -198,7 +198,7 @@ class PluginBlocktypeWall extends SystemBlocktype {
);
insert_record('blocktype_wall_post', $record);
$userid = get_field_sql('SELECT owner FROM {view} WHERE id = (SELECT "view" FROM {block_instance} WHERE id = ?)', array($values['instance']));
$userid = get_field_sql('SELECT "owner" FROM {view} WHERE id = (SELECT "view" FROM {block_instance} WHERE id = ?)', array($values['instance']));
redirect('/user/view.php?id=' . $userid);
}
......
......@@ -85,11 +85,11 @@ function edit_tag_submit(Pieform $form, $values) {
}
db_begin();
execute_sql(
"UPDATE {view_tag} SET tag = ? WHERE tag = ? AND view IN (SELECT id FROM {view} WHERE owner = ?)",
"UPDATE {view_tag} SET tag = ? WHERE tag = ? AND \"view\" IN (SELECT id FROM {view} WHERE \"owner\" = ?)",
array($values['tagname'], $tag, $userid)
);
execute_sql(
"UPDATE {artefact_tag} SET tag = ? WHERE tag = ? AND artefact IN (SELECT id FROM {artefact} WHERE owner = ?)",
"UPDATE {artefact_tag} SET tag = ? WHERE tag = ? AND artefact IN (SELECT id FROM {artefact} WHERE \"owner\" = ?)",
array($values['tagname'], $tag, $userid)
);
db_commit();
......@@ -104,11 +104,11 @@ function delete_tag_submit(Pieform $form, $values) {
}
db_begin();
execute_sql(
"DELETE FROM {view_tag} WHERE tag = ? AND view IN (SELECT id FROM {view} WHERE owner = ?)",
"DELETE FROM {view_tag} WHERE tag = ? AND view IN (SELECT id FROM {view} WHERE \"owner\" = ?)",
array($tag, $userid)
);
execute_sql(
"DELETE FROM {artefact_tag} WHERE tag = ? AND artefact IN (SELECT id FROM {artefact} WHERE owner = ?)",
"DELETE FROM {artefact_tag} WHERE tag = ? AND artefact IN (SELECT id FROM {artefact} WHERE \"owner\" = ?)",
array($tag, $userid)
);
db_commit();
......
......@@ -202,11 +202,11 @@ abstract class PluginExport extends Plugin {
if ($artefacts == self::EXPORT_ALL_ARTEFACTS) {
$tmpartefacts = get_column_sql('SELECT id
FROM {artefact}
WHERE owner = ?
WHERE "owner" = ?
UNION
SELECT artefact
FROM {view_artefact}
WHERE "view" IN (SELECT id FROM {view} WHERE owner = ?)
WHERE "view" IN (SELECT id FROM {view} WHERE "owner" = ?)
ORDER BY id', array($userid, $userid));
$this->artefactexportmode = $artefacts;
}
......
......@@ -37,7 +37,7 @@ $group = get_record('group', 'id', $id);
$group->admins = get_column_sql("SELECT member
FROM {group_member}
WHERE \"group\" = ?
AND role = 'admin'", array($group->id));
AND \"role\" = 'admin'", array($group->id));
$filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment