Commit fa77003c authored by Nigel McNie's avatar Nigel McNie
Browse files
parents f15e84c8 0deae716
......@@ -7,3 +7,4 @@ mahara-*.tar.bz2
mahara-*.tar.gz
mahara-*.zip
*.swp
.patches
......@@ -59,7 +59,6 @@ $limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$userid = $USER->get('id');
$prefix = get_config('dbprefix');
if ($type == 'all') {
$count = count_records('notification_internal_activity', 'usr', $userid);
......@@ -67,10 +66,10 @@ if ($type == 'all') {
'ctime DESC', '*', $offset, $limit);
} else if ($type == 'adminmessages' && $USER->get('admin')) {
$count = count_records_select('notification_internal_activity', 'usr = ? AND type IN (
SELECT name FROM ' . $prefix . 'activity_type WHERE admin = ?)',
SELECT name FROM {activity_type} WHERE admin = ?)',
array($userid, 1));
$records = get_records_select_array('notification_internal_activity', 'usr = ? AND type IN (
SELECT name FROM ' . $prefix . 'activity_type WHERE admin = ?)',
SELECT name FROM {activity_type} WHERE admin = ?)',
array($userid, 1),
'ctime DESC', '*', $offset, $limit);
}
......
......@@ -25,8 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'account');
define('SUBMENUITEM', 'activity');
define('MENUITEM', 'settings/recentactivity');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'activity');
......
......@@ -25,8 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'account');
define('SUBMENUITEM', 'activityprefs');
define('MENUITEM', 'settings/activitypreferences');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'activitypreferences');
......
......@@ -25,8 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'account');
define('SUBMENUITEM', 'accountprefs');
define('MENUITEM', 'settings/preferences');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'preferences');
......
......@@ -35,7 +35,6 @@ $stopmonitoring = param_integer('stopmonitoring', 0);
$userlist = param_alpha('userlist', null);
$getartefacts = param_integer('getartefacts', 0);
$prefix = get_config('dbprefix');
$userid = $USER->get('id');
if ($stopmonitoring) {
......@@ -51,8 +50,8 @@ if ($stopmonitoring) {
delete_records('usr_watchlist_artefact', 'usr', $userid, 'artefact', $m[1]);
$count++;
}
else if (preg_match('/^stopcommunities\-(\d+)$/',$k,$m)) {
delete_records('usr_watchlist_community', 'usr', $userid, 'community', $m[1]);
else if (preg_match('/^stopgroups\-(\d+)$/',$k,$m)) {
delete_records('usr_watchlist_group', 'usr', $userid, 'group', $m[1]);
$count++;
}
}
......@@ -68,9 +67,9 @@ if ($stopmonitoring) {
if (!empty($userlist)) {
if ($userlist == 'views') {
$sql = 'SELECT DISTINCT u.*
FROM ' . $prefix . 'usr u
JOIN ' . $prefix . 'view v ON v.owner = u.id
JOIN ' . $prefix . 'usr_watchlist_view w ON w.view = v.id
FROM {usr} u
JOIN {view} v ON v.owner = u.id
JOIN {usr_watchlist_view} w ON w.view = v.id
WHERE w.usr = ?';
if (!$users = get_records_sql_array($sql, array($userid))) {
......@@ -79,9 +78,9 @@ if (!empty($userlist)) {
}
else if ($userlist == 'artefacts') {
$sql = 'SELECT DISTINCT u.*
FROM ' . $prefix . 'usr u
JOIN ' . $prefix . 'artefact a ON a.owner = u.id
JOIN ' . $prefix . 'usr_watchlist_artefact w ON w.artefact = a.id
FROM {usr} u
JOIN {artefact} a ON a.owner = u.id
JOIN {usr_watchlist_artefact} w ON w.artefact = a.id
WHERE w.usr = ?';
if (!$users = get_records_sql_array($sql, array($userid))) {
......@@ -107,7 +106,6 @@ $limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$userid = $USER->get('id');
$prefix = get_config('dbprefix');
$count = 0;
$records = array();
......@@ -115,8 +113,8 @@ $records = array();
if ($type == 'views') {
$count = count_records('usr_watchlist_view', 'usr', $userid);
$sql = 'SELECT v.*, v.title AS name, w.recurse
FROM ' . $prefix . 'view v
JOIN ' . $prefix . 'usr_watchlist_view w ON w.view = v.id
FROM {view} v
JOIN {usr_watchlist_view} w ON w.view = v.id
WHERE w.usr = ?';
$values = array($userid);
if (isset($owner)) {
......@@ -127,20 +125,20 @@ if ($type == 'views') {
ORDER BY v.mtime DESC';
$records = get_records_sql_array($sql, $values, $offset, $limit);
}
else if ($type == 'communities') {
$count = count_records('usr_watchlist_community', 'usr', $userid);
$sql = 'SELECT c.*
FROM ' . $prefix . 'community c
JOIN ' . $prefix . 'usr_watchlist_community w ON w.community = c.id
else if ($type == 'groups') {
$count = count_records('usr_watchlist_group', 'usr', $userid);
$sql = 'SELECT g.*
FROM {group} g
JOIN {usr_watchlist_group} w ON w.group = g.id
WHERE w.usr = ?
ORDER BY c.mtime DESC';
ORDER BY g.mtime DESC';
$records = get_records_sql_array($sql, array($userid), $offset, $limit);
}
else if ($type == 'artefacts') {
$count = count_records('usr_watchlist_artefact', 'usr', $userid);
$sql = 'SELECT a.* , a.title AS name, w.view, w.recurse
FROM ' . $prefix . 'artefact a
JOIN ' . $prefix . 'usr_watchlist_artefact w ON w.artefact = a.id
FROM {artefact} a
JOIN {usr_watchlist_artefact} w ON w.artefact = a.id
WHERE w.usr = ?';
$values = array($userid);
if (isset($owner)) {
......
......@@ -25,8 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'account');
define('SUBMENUITEM', 'watchlist');
define('MENUITEM', 'settings/mywatchlist');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'watchlist');
......@@ -34,7 +33,7 @@ define('SECTION_PAGE', 'watchlist');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
$viewstring = get_string('views', 'activity');
$communitystring = get_string('communities', 'activity');
$groupstring = get_string('groups', 'activity');
$artefactstring = get_string('artefacts', 'activity');
$monitoredstring = get_string('monitored', 'activity');
$allusersstring = get_string('allusers');
......@@ -50,8 +49,8 @@ var watchlist = new TableRenderer(
[
function(r, d) {
var url = '';
if (d.type == 'communities') {
url = '{$wwwroot}/contacts/communities/view.php?id=' + r.id;
if (d.type == 'groups') {
url = '{$wwwroot}/contacts/groups/view.php?id=' + r.id;
}
else if (d.type == 'views') {
url = '{$wwwroot}/view/view.php?view=' + r.id;
......@@ -79,9 +78,9 @@ watchlist.updateOnLoad();
watchlist.rowfunction = function(r, n) { return TR({'id': r.id, 'class': 'view r' + (n % 2)}); }
function changeTitle(title) {
var titles = { 'views': '{$viewstring}', 'communities': '{$communitystring}', 'artefacts': '{$artefactstring}' };
var titles = { 'views': '{$viewstring}', 'groups': '{$groupstring}', 'artefacts': '{$artefactstring}' };
$('typeheader').innerHTML = '{$monitoredstring} ' + titles[title];
if (title != 'communities') {
if (title != 'groups') {
$('typeandchildren').innerHTML = '{$andchildren}';
}
else {
......@@ -130,7 +129,7 @@ function statusChange() {
}
changeTitle(typevalue);
$('messagediv').innerHTML = '';
if (typevalue == 'communities') {
if (typevalue == 'groups') {
$('user').options.length = 0;
$('user').disabled = true;
}
......@@ -159,11 +158,10 @@ function statusChange() {
JAVASCRIPT;
$prefix = get_config('dbprefix');
$sql = 'SELECT DISTINCT u.*
FROM ' . $prefix . 'usr u
JOIN ' . $prefix . 'view v ON v.owner = u.id
JOIN ' . $prefix . 'usr_watchlist_view w ON w.view = v.id
FROM {usr} u
JOIN {view} v ON v.owner = u.id
JOIN {usr_watchlist_view} w ON w.view = v.id
WHERE w.usr = ?';
if (!$viewusers = get_records_sql_array($sql, array($USER->get('id')))) {
......
......@@ -26,8 +26,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configextensions');
define('SUBMENUITEM', 'pluginadmin');
define('MENUITEM', 'configextensions/pluginadmin');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('pluginadmin', 'admin'));
require_once('pieforms/pieform.php');
......
......@@ -26,8 +26,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configextensions');
define('SUBMENUITEM', 'pluginadmin');
define('MENUITEM', 'configextensions/pluginadmin');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('pluginadmin', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
......
......@@ -27,8 +27,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configextensions');
define('SUBMENUITEM', 'templatesadmin');
define('MENUITEM', 'configextensions/templatesadmin');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('templatesadmin', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
......
......@@ -26,8 +26,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configsite');
define('SUBMENUITEM', 'adminfiles');
define('MENUITEM', 'configsite/adminfiles');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'adminfiles');
......
......@@ -35,12 +35,11 @@ $public = (int) param_boolean('public');
$result = array();
//$menuitems = get_records_array('site_menu','public',$public,'displayorder');
$prefix = get_config('dbprefix');
$menuitems = get_records_sql_array('
SELECT
s.*, a.title AS filename
FROM ' . $prefix . 'site_menu s
LEFT OUTER JOIN ' . $prefix . 'artefact a ON s.file = a.id
FROM {site_menu} s
LEFT OUTER JOIN {artefact} a ON s.file = a.id
WHERE
s.public = ' . $public . '
ORDER BY s.displayorder', null);
......
......@@ -26,9 +26,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configsite');
define('SUBMENUITEM', 'sitemenu');
define('SUBMENUITEM', 'sitepages');
define('MENUITEM', 'configsite/sitemenu');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'sitemenu');
......
......@@ -26,8 +26,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configsite');
define('SUBMENUITEM', 'networking');
define('MENUITEM', 'configsite/networking');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('docroot') . 'api/xmlrpc/lib.php');
......
......@@ -26,8 +26,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configsite');
define('SUBMENUITEM', 'siteoptions');
define('MENUITEM', 'configsite/siteoptions');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
......
......@@ -26,8 +26,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configsite');
define('SUBMENUITEM', 'sitepages');
define('MENUITEM', 'configsite/sitepages');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'sitepages');
......
......@@ -28,8 +28,7 @@
// here might need to be fixed there too.
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configusers');
define('SUBMENUITEM', 'adminusers');
define('MENUITEM', 'configusers/adminusers');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('adminusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
......@@ -65,18 +64,17 @@ $form = array(
function adminusers_submit(Pieform $form, $values) {
global $SESSION;
$table = get_config('dbprefix') . 'usr';
db_begin();
execute_sql('UPDATE ' . $table . '
execute_sql('UPDATE {usr}
SET admin = 0
WHERE admin = 1');
execute_sql('UPDATE ' . $table . '
execute_sql('UPDATE {usr}
SET admin = 1
WHERE id IN (' . join(',', $values['users']) . ')');
execute_sql('DELETE FROM ' . get_config('dbprefix') . 'usr_activity_preference
WHERE activity IN (SELECT name FROM ' . get_config('dbprefix') . 'activity_type
WHERE admin = 1 )
execute_sql('DELETE FROM {usr_activity_preference}
WHERE activity IN (SELECT name FROM {activity_type}
WHERE admin = 1)
AND usr NOT IN (' . join(',', $values['users']) . ')');
db_commit();
$SESSION->add_ok_msg(get_string('adminusersupdated', 'admin'));
......
......@@ -25,8 +25,7 @@
*/
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configusers');
define('SUBMENUITEM', 'institutions');
define('MENUITEM', 'configusers/institutions');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('institutions', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
......@@ -225,10 +224,9 @@ if ($institution || $add) {
}
else {
// Get a list of institutions
$prefix = get_config('dbprefix');
$institutions = get_records_sql_array('SELECT i.name, i.displayname, i.registerallowed, COUNT(u.id) AS hasmembers
FROM ' . $prefix . 'institution i
LEFT OUTER JOIN ' . $prefix . 'usr u ON (u.institution = i.name)
FROM {institution} i
LEFT OUTER JOIN {usr} u ON (u.institution = i.name)
GROUP BY 1, 2, 3
ORDER BY i.name', array());
$smarty->assign('institutions', $institutions);
......
......@@ -26,8 +26,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configusers');
define('SUBMENUITEM', 'adminnotifications');
define('MENUITEM', 'configusers/adminnotifications');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('adminnotifications', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
......@@ -36,11 +35,9 @@ define('SECTION_PAGE', 'notifications');
require_once('pieforms/pieform.php');
$prefix = get_config('dbprefix');
$sql = 'SELECT u.*, a.activity, a.method
FROM ' . $prefix . 'usr u
LEFT JOIN ' . $prefix . 'usr_activity_preference a ON a.usr = u.id
FROM {usr} u
LEFT JOIN {usr_activity_preference} a ON a.usr = u.id
WHERE u.admin = ?';
$admins = get_records_sql_array($sql, array(1));
......
......@@ -30,7 +30,6 @@ define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
$action = param_variable('action');
$dbprefix = get_config('dbprefix');
if ($action == 'suspend') {
$id = param_integer('id');
......
Supports Markdown
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