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