Commit 431a6613 authored by Robert Lyon's avatar Robert Lyon

Tidying up the initial code to mahara standards (Bug #1393530)

Change-Id: I398479c34771df1978a98ac42b1b866afe4e7917
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent e099440c
This diff is collapsed.
This diff is collapsed.
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage auth-webservice
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2011 Catalyst IT Ltd http://catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage auth-webservice
* @subpackage core
* @author Catalyst IT Ltd
* @author Piers Harding
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2011 Catalyst IT Ltd http://catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
......@@ -110,7 +93,6 @@ class AuthWebservice extends AuthInternal {
}
// The main type - a salted sha1
// $sha1sent = $this->encrypt_password($theysent, $salt);
$sha1sent = $this->encrypt_password($theysent, $salt, '$2a$' . get_config('bcrypt_cost') . '$', get_config('passwordsaltmain'));
return $sha1sent == $wehave;
}
......@@ -146,7 +128,7 @@ class PluginAuthWebservice extends PluginAuth {
'url' => 'webservice/admin/index.php',
'title' => get_string('webservices', 'auth.webservice'),
'weight' => 10,
'selected' => false,
'selected' => false,
'submenu' => array(),
),
'webservice/oauthconfig' => array(
......@@ -154,7 +136,7 @@ class PluginAuthWebservice extends PluginAuth {
'url' => 'webservice/admin/oauthv1sregister.php',
'title' => get_string('oauth', 'auth.webservice'),
'weight' => 10,
'selected' => false,
'selected' => false,
'submenu' => array(),
),
'webservice/logs' => array(
......@@ -162,7 +144,7 @@ class PluginAuthWebservice extends PluginAuth {
'url' => 'webservice/admin/webservicelogs.php',
'title' => get_string('webservicelogs', 'auth.webservice'),
'weight' => 20,
'selected' => false,
'selected' => false,
'submenu' => array(),
),
'webservice/testclient' => array(
......@@ -176,7 +158,6 @@ class PluginAuthWebservice extends PluginAuth {
);
if ($USER->is_logged_in() && $smarty) {
// $main = main_nav();
$SELECTEDSUBNAV = ($SELECTEDSUBNAV ? $SELECTEDSUBNAV : array());
$items = array_merge($SELECTEDSUBNAV, $items);
$apps = false;
......@@ -246,7 +227,7 @@ class PluginAuthWebservice extends PluginAuth {
// activate webservices
foreach (array('soap', 'xmlrpc', 'rest', 'oauth') as $proto) {
set_config('webservice_'.$proto.'_enabled', 1);
set_config('webservice_' . $proto.'_enabled', 1);
}
}
}
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage auth-webservice
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2011 Catalyst IT Ltd http://catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2012031600;
$config->release = '1.0.0';
$config->version = 2014112800;
$config->release = '1.0.1';
$config->requires_config = 0;
$config->requires_parent = 0;
/**
* CSS rules for the webservice auth plugin
* Stylesheet for the webservice auth plugin.
*
* Copyright (C) 2011 Catalyst IT
* This file is distributed under the same terms as Mahara itself
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
* This file is licensed under the same terms as Mahara itself
*/
.webservicelogs-info {
max-width: 150px;
color: red;
max-width: 150px;
color: red;
}
tr#authorise_instructions_container th {
......@@ -19,7 +22,7 @@ th {
}
#pluginconfig table {
width: 100%;
width: 100%;
}
td.actions {
......@@ -40,13 +43,13 @@ div#verifier {
}
.arguments {
color: #EA33A6;
color: #EA33A6;
}
div.detaildescription {
margin: 0px;
margin: 0px;
border:solid 1px #DEDEDE;
background:#FFF1BC;
background:#FFF1BC;
color:#222222;
padding:4px;
}
......@@ -56,22 +59,21 @@ pre.detaildescription {
}
div.xmlrpcdescription {
margin: 0px;
margin: 0px;
border:solid 1px #DEDEDE;
background:#DFEEE7;
background:#DFEEE7;
color:#222222;
padding:4px;
}
div.restdescription {
margin: 0px;
margin: 0px;
border:solid 1px #DEDEDE;
background:#FEEBE5;
background:#FEEBE5;
color:#222222;
padding:4px;
}
span.response {
color: #EA33A6;
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
<a href="{$WWWROOT}webservice/admin/search.php?f={$a}{if $search->l}&amp;l={$search->l}{/if}">{$a}</a>
</span>
{/foreach}
<br />
<br />
<label>{str tag="lastname"}:</label>
<span class="{if !$search->l} selected{/if} all">
<a href="{$WWWROOT}webservice/admin/search.php{if $search->f}?f={$search->f}{/if}">{str tag="All"}</a>
......
......@@ -4,8 +4,6 @@
<br/>
<br/>
{$form|safe}
{include file='footer.tpl'}
\ No newline at end of file
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage admin
* @subpackage auth-webservice
* @author Catalyst IT Ltd
* @author Piers Harding
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2011 Catalyst IT Ltd http://catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('ADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
// define('MENUITEM', 'webservice/config');
define('MENUITEM', 'configextensions/pluginadminwebservices');
// define('SECTION_PLUGINTYPE', 'core');
// define('SECTION_PLUGINNAME', 'admin');
// define('SECTION_PAGE', 'webservice');
$path = get_config('docroot') . 'lib/zend';
set_include_path($path . PATH_SEPARATOR . get_include_path());
......
/**
* 'Speeds up' the user search if the user has javascript enabled in their
* browser
* @source: http://gitorious.org/mahara/mahara
*
* @licstart
* Copyright (C) 2006-2011 Catalyst IT Ltd
* @package mahara
* @subpackage auth-webservice
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
* The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
* @licend
*/
function UserSearch() {
......@@ -50,16 +38,19 @@ function UserSearch() {
if (initialtype == 'f') {
if (self.params.l) {
self.params = {'l' : self.params.l};
} else {
}
else {
self.params = {};
}
forEach(getElementsByTagAndClassName('span', 'selected', 'firstnamelist'), function (i) {
removeElementClass(i, 'selected');
});
} else if (initialtype == 'l') {
}
else if (initialtype == 'l') {
if (self.params.f) {
self.params = {'f' : self.params.f};
} else {
}
else {
self.params = {};
}
forEach(getElementsByTagAndClassName('span', 'selected', 'lastnamelist'), function (i) {
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage core
* @subpackage auth-webservice
* @author Catalyst IT Ltd
* @author Piers Harding
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2011 Catalyst IT Ltd http://catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
......@@ -55,7 +38,8 @@ if ($action == 'search') {
json_headers();
if (param_boolean('raw', false)) {
$data = get_log_search_results($params, $offset, $limit, $sortby, $sortdir);
} else {
}
else {
$data['data'] = build_webservice_log_search_results($params, $offset, $limit, $sortby, $sortdir);
}
$data['error'] = false;
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage admin
* @subpackage auth-webservice
* @author Catalyst IT Ltd
* @author Piers Harding
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2011 Catalyst IT Ltd http://catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'adminhome/pluginadminwebservices');
// define('MENUITEM', 'webservice/oauthconfig');
// define('SECTION_PLUGINTYPE', 'core');
// define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'oauth');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('oauthv1sregister', 'auth.webservice'));
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2009 Moodle Pty Ltd (http://moodle.com)
* Copyright (C) 2011 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* Reload web services config
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* @package mahara
* @subpackage auth-webservice
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
*/
/**
* Reload web services config
*
* @author Piers Harding
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package web service
* @copyright Copyright (C) 2011 Catalyst IT Ltd (http://www.catalyst.net.nz)
*/
define('INTERNAL', 1);
// disable the WSDL cache
......@@ -36,7 +18,7 @@ ini_set("soap.wsdl_cache_enabled", "0");
define('PUBLIC', 1);
// must be run from the command line
if (isset($_SERVER['REMOTE_ADDR']) || isset($_SERVER['GATEWAY_INTERFACE'])){
if (isset($_SERVER['REMOTE_ADDR']) || isset($_SERVER['GATEWAY_INTERFACE'])) {
die('Direct access to this script is forbidden.');
}
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage core
* @subpackage auth-webservice
* @author Catalyst IT Ltd
* @author Piers Harding
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2011 Catalyst IT Ltd http://catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
......@@ -58,7 +41,8 @@ if ($action == 'search') {
json_headers();
if (param_boolean('raw', false)) {
$data = get_admin_user_search_results($params, $offset, $limit, $sortby, $sortdir);
} else {
}
else {
$data['data'] = build_webservice_user_search_results($params, $offset, $limit, $sortby, $sortdir);
}
$data['error'] = false;
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage admin
* @subpackage auth-webservice
* @author Catalyst IT Ltd
* @author Piers Harding
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2011 Catalyst IT Ltd http://catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
......@@ -78,7 +61,8 @@ $search = (object) array(
if ($USER->get('admin')) {
$institutions = get_records_array('institution', '', '', 'displayname');
$search->institution = param_alphanum('institution', 'all');
} else {
}
else {
$institutions = get_records_select_array('institution', "name IN ('" . join("','", array_keys($USER->get('admininstitutions'))) . "')", null, 'displayname');
$search->institution_requested = param_alphanum('institution_requested', 'all');
}
......@@ -107,5 +91,4 @@ else {
$heading = get_string('headingusersearchuser', 'auth.webservice');
}
$smarty->assign('PAGEHEADING', $heading);
// $smarty->display('webservice/search.tpl');
$smarty->display('../../../auth/webservice/theme/raw/search.tpl');
$smarty->display('auth:webservice:search.tpl');
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage admin
* @subpackage auth-webservice
* @author Catalyst IT Ltd
* @author Piers Harding
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2011 Catalyst IT Ltd http://catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configextensions/pluginadminwebservices');
// define('MENUITEM', 'webservice/config');
// define('SECTION_PLUGINTYPE', 'core');
// define('SECTION_PLUGINNAME', 'admin');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('pluginadmin', 'admin'));
require_once('pieforms/pieform.php');
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2011 Catalyst IT Ltd and others; see: