Commit 91bd3891 authored by Donal McMullan's avatar Donal McMullan

Replace 'if(' with 'if (' in introduced code

parent 525bcf22
......@@ -72,7 +72,7 @@ if (empty($networkenabled)) {
// Content type for output is never html:
header('Content-type: text/xml; charset=utf-8');
ini_set('display_errors',0);
if(!empty($errors)) throw new XmlrpcServerException('Initialization failed. Non-recoverable error.', 6000);
if (!empty($errors)) throw new XmlrpcServerException('Initialization failed. Non-recoverable error.', 6000);
// PHP 5.2.2: $HTTP_RAW_POST_DATA not populated bug:
// http://bugs.php.net/bug.php?id=41293
......@@ -93,7 +93,7 @@ try {
}
// Cascading switch. Kinda.
if($xml->getName() == 'encryptedMessage') {
if ($xml->getName() == 'encryptedMessage') {
// The IP address for the hostname supplied by the client.
// This hostname can't be trusted.
......@@ -116,7 +116,7 @@ if($xml->getName() == 'encryptedMessage') {
$payload = xmlenc_envelope_strip($xml);
}
if($xml->getName() == 'signedMessage') {
if ($xml->getName() == 'signedMessage') {
// The IP address for the hostname supplied by the client.
// This hostname can't be trusted.
......@@ -139,9 +139,9 @@ if($xml->getName() == 'signedMessage') {
$payload = xmldsig_envelope_strip($xml);
}
if($xml->getName() == 'methodCall') {
if ($xml->getName() == 'methodCall') {
// $payload ?
if(empty($xml->methodName)) {
if (empty($xml->methodName)) {
throw new XmlrpcServerException('Payload is not an XML-RPC document', 6008);
}
......
......@@ -42,7 +42,7 @@ class AuthImap extends Auth {
$this->config['protocol'] = '/imap';
$this->config['changepasswordurl'] = '';
if(!empty($id)) {
if (!empty($id)) {
return $this->init($id);
}
return true;
......@@ -122,18 +122,18 @@ class PluginAuthImap extends PluginAuth {
if ($instance > 0) {
$current = get_records_array('auth_instance', 'id', $instance, 'priority ASC');
if($current == false) {
if ($current == false) {
throw new Exception('Could not find data for auth instance '.$instance);
}
$default = $current[0];
$current_config = get_records_menu('auth_instance_config', 'instance', $instance, '', 'field, value');
if($current_config == false) {
if ($current_config == false) {
$current_config = array();
}
foreach (self::$default_config as $key => $value) {
if(array_key_exists($key, $current_config)) {
if (array_key_exists($key, $current_config)) {
self::$default_config[$key] = $current_config[$key];
}
}
......
......@@ -36,7 +36,7 @@ class AuthInternal extends Auth {
public function __construct($id = null) {
$this->has_config = false;
$this->type = 'internal';
if(!empty($id)) {
if (!empty($id)) {
return $this->init($id);
}
return true;
......
......@@ -390,7 +390,7 @@ function auth_setup () {
function auth_get_auth_instances_for_institution($institution=null) {
static $cache = array();
if(null == $institution) {
if (null == $institution) {
return array();
}
......@@ -422,7 +422,7 @@ function auth_get_auth_instances_for_institution($institution=null) {
$cache[$institution] = get_records_sql_array($sql, array());
if(empty($cache[$institution])) {
if (empty($cache[$institution])) {
return false;
}
}
......@@ -500,7 +500,7 @@ function auth_get_auth_instances_for_username($institution, $username) {
$cache[$institution][$username] = get_records_sql_array($sql, array(array('institution' => $institution), array('username' => $username)));
if(empty($cache[$institution])) {
if (empty($cache[$institution])) {
return false;
}
}
......@@ -949,7 +949,7 @@ function login_submit(Pieform $form, $values) {
$USER->authinstance = $authinstance->id;
if($auth->authenticate_user_account($username, $password, $institution)) {
if ($auth->authenticate_user_account($username, $password, $institution)) {
$userdata = $auth->get_user_info();
if (
empty($userdata) ||
......
......@@ -98,7 +98,7 @@ class Session {
static $instance;
//if we don't have the single instance, create one
if(!isset($instance)) {
if (!isset($instance)) {
$instance = new Session();
}
return($instance);
......
......@@ -64,7 +64,7 @@ class AuthXmlrpc extends Auth {
$this->config['theyssoin'] = 0;
$this->config['parent'] = null;
$this->file = fopen('/tmp/out.txt', 'w');
if(!empty($id)) {
if (!empty($id)) {
return $this->init($id);
}
return true;
......@@ -104,7 +104,7 @@ class AuthXmlrpc extends Auth {
$this->must_be_ready();
$peer = get_peer($remotewwwroot);
if($peer->deleted != 0 || $this->config['theyssoin'] != 1) {
if ($peer->deleted != 0 || $this->config['theyssoin'] != 1) {
throw new MaharaException('We don\'t accept SSO connections from '.$peer->name );
}
......@@ -405,17 +405,17 @@ class PluginAuthXmlrpc extends PluginAuth {
// Get the current data (if any exists) for this auth instance
if ($instance > 0) {
$default = get_record('auth_instance', 'id', $instance);
if($default == false) {
if ($default == false) {
throw new Exception(get_string('nodataforinstance', 'auth').$instance);
}
$current_config = get_records_menu('auth_instance_config', 'instance', $instance, '', 'field, value');
if($current_config == false) {
if ($current_config == false) {
throw new Exception('No config data for instance: '.$instance);
}
foreach (self::$default_config as $key => $value) {
if(array_key_exists($key, $current_config)) {
if (array_key_exists($key, $current_config)) {
self::$default_config[$key] = $current_config[$key];
// We can use the wwwroot to create a Peer object
......
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