From 21d5712f3612d18b3748102d5328a4c4361b37e3 Mon Sep 17 00:00:00 2001 From: Aaron Wells Date: Wed, 4 Jun 2014 18:42:49 +1200 Subject: [PATCH] Removing end-of-line whitespace As vetted in the May 2014 dev meeting http://meetbot.mahara.org/mahara-dev/2014/mahara-dev.2014-05-01-08.01.log.html Change-Id: I353ed74d69a5346fbe4e8e521e5c349dbe8dcbac --- htdocs/account/activity/index.php | 4 +- htdocs/account/index.php | 2 +- htdocs/account/institutions.php | 6 +- htdocs/admin/extensions/plugins.php | 12 +- htdocs/admin/site/getmenuitems.json.php | 4 +- htdocs/admin/site/menu.php | 4 +- htdocs/admin/upgrade.json.php | 6 +- htdocs/admin/upgrade.php | 6 +- htdocs/admin/users/admins.php | 2 +- htdocs/admin/users/bulkdownload.php | 6 +- htdocs/admin/users/institutions.php | 8 +- htdocs/admin/users/institutionstaff.php | 2 +- htdocs/admin/users/notifications.php | 6 +- htdocs/admin/users/staff.php | 2 +- htdocs/admin/users/suspended.json.php | 4 +- htdocs/admin/users/uploadcsv.php | 4 +- htdocs/api/xmlrpc/client.php | 10 +- htdocs/api/xmlrpc/dispatcher.php | 22 +-- htdocs/api/xmlrpc/lib.php | 44 +++--- htdocs/api/xmlrpc/server.php | 2 +- htdocs/artefact/blog/blocktype/blog/lib.php | 34 ++--- .../artefact/blog/blocktype/blogpost/lib.php | 34 ++--- .../blog/blocktype/recentposts/lib.php | 2 +- htdocs/artefact/blog/db/upgrade.php | 20 +-- htdocs/artefact/blog/lib.php | 44 +++--- htdocs/artefact/blog/post.php | 8 +- htdocs/artefact/blog/settings/index.php | 2 +- .../file/blocktype/filedownload/lib.php | 2 +- htdocs/artefact/file/blocktype/folder/lib.php | 6 +- htdocs/artefact/file/blocktype/image/lib.php | 2 +- htdocs/artefact/file/export/html/lib.php | 18 +-- htdocs/artefact/file/lib.php | 46 +++--- .../internal/blocktype/profileinfo/lib.php | 14 +- htdocs/artefact/internal/db/upgrade.php | 2 +- htdocs/artefact/internal/export/html/lib.php | 2 +- htdocs/artefact/internal/lib.php | 12 +- htdocs/artefact/lib.php | 110 +++++++------- .../resume/blocktype/entireresume/lib.php | 10 +- .../resume/blocktype/resumefield/lib.php | 6 +- htdocs/artefact/resume/composite.json.php | 2 +- htdocs/artefact/resume/export/leap/lib.php | 16 +- htdocs/artefact/resume/index.php | 8 +- htdocs/auth/browserid/db/upgrade.php | 2 +- .../browserid/lang/en.utf8/auth.browserid.php | 2 +- htdocs/auth/browserid/lib.php | 2 +- htdocs/auth/browserid/login.php | 2 +- htdocs/auth/imap/lib.php | 4 +- htdocs/auth/internal/lib.php | 6 +- htdocs/auth/lib.php | 100 ++++++------- htdocs/auth/none/lib.php | 2 +- htdocs/auth/saml/lib.php | 2 +- htdocs/auth/saml/validateurlsyntax.php | 44 +++--- htdocs/auth/user.php | 80 +++++----- htdocs/auth/xmlrpc/land.php | 4 +- htdocs/auth/xmlrpc/lib.php | 88 +++++------ htdocs/blocktype/externalfeed/db/upgrade.php | 4 +- htdocs/blocktype/externalfeed/lib.php | 22 +-- htdocs/blocktype/lib.php | 138 +++++++++--------- htdocs/blocktype/myfriends/lib.php | 2 +- htdocs/blocktype/myviews/lib.php | 2 +- htdocs/blocktype/wall/lib.php | 16 +- .../wall/theme/raw/pieforms/wallpost.php | 2 +- htdocs/blocktype/wall/wall.php | 2 +- htdocs/collection/views.php | 2 +- htdocs/export/download.php | 6 +- htdocs/export/html/lib.php | 42 +++--- htdocs/export/leap/lib.php | 16 +- htdocs/export/lib.php | 44 +++--- htdocs/group/interactions.php | 2 +- htdocs/group/requestjoin.php | 4 +- htdocs/grouptype/lib.php | 2 +- htdocs/init.php | 20 +-- htdocs/interaction/forum/lib.php | 14 +- htdocs/interaction/forum/topic.php | 2 +- htdocs/interaction/lib.php | 8 +- htdocs/json/taglist.php | 2 +- htdocs/lib/activity.php | 106 +++++++------- htdocs/lib/antispam/SimpleSpamTrap.php | 6 +- htdocs/lib/collection.php | 2 +- htdocs/lib/cron.php | 8 +- htdocs/lib/dml.php | 82 +++++------ htdocs/lib/file.php | 46 +++--- htdocs/lib/form/elements/artefactchooser.php | 36 ++--- htdocs/lib/form/elements/emaillist.php | 2 +- htdocs/lib/form/elements/tinywysiwyg.php | 6 +- htdocs/lib/form/elements/viewacl.php | 2 +- htdocs/lib/form/elements/weight.php | 6 +- htdocs/lib/group.php | 54 +++---- htdocs/lib/htmlpurifiercustom/Skype.php | 8 +- htdocs/lib/htmlpurifiercustom/Twitter.php | 8 +- htdocs/lib/institution.php | 6 +- htdocs/lib/layoutpreviewimage.php | 14 +- htdocs/lib/mahara.php | 86 +++++------ htdocs/lib/peer.php | 8 +- htdocs/lib/pieforms/pieform.php | 80 +++++----- .../lib/pieforms/pieform/elements/button.php | 4 +- .../lib/pieforms/pieform/elements/image.php | 2 +- htdocs/lib/pieforms/pieform/renderers/div.php | 2 +- .../lib/pieforms/pieform/renderers/table.php | 4 +- htdocs/lib/recaptcha/recaptchalib.php | 2 +- htdocs/lib/registration.php | 8 +- htdocs/lib/user.php | 84 +++++------ htdocs/local/upgrade.php | 2 +- htdocs/notification/emaildigest/lib.php | 22 +-- htdocs/notification/internal/lib.php | 4 +- htdocs/register.php | 2 +- htdocs/thumb.php | 6 +- htdocs/user/denyrequest.php | 2 +- htdocs/user/removefriend.php | 8 +- htdocs/user/view.php | 6 +- htdocs/view/blocks.php | 6 +- 111 files changed, 988 insertions(+), 988 deletions(-) diff --git a/htdocs/account/activity/index.php b/htdocs/account/activity/index.php index 1ee1646427..32631c0b61 100644 --- a/htdocs/account/activity/index.php +++ b/htdocs/account/activity/index.php @@ -69,7 +69,7 @@ function markread(form, action) { var e = getElementsByTagAndClassName(null,'tocheck'+action,form); var pd = {}; - + for (cb in e) { if (e[cb].checked == true) { pd[e[cb].name] = 1; @@ -92,7 +92,7 @@ function markread(form, action) { pd[p] = paginatorData.params[p]; } } - + sendjsonrequest('index.json.php', pd, 'GET', function (data) { paginator.updateResults(data); updateUnreadCount(data); diff --git a/htdocs/account/index.php b/htdocs/account/index.php index 3c242ecf90..48310c2d97 100644 --- a/htdocs/account/index.php +++ b/htdocs/account/index.php @@ -190,7 +190,7 @@ function accountprefs_submit(Pieform $form, $values) { } // use this as looping through values is not safe. - $expectedprefs = expected_account_preferences(); + $expectedprefs = expected_account_preferences(); if ($values['maildisabled'] == 0 && get_account_preference($USER->get('id'), 'maildisabled') == 1) { // Reset the sent and bounce counts otherwise mail will be disabled // on the next send attempt diff --git a/htdocs/account/institutions.php b/htdocs/account/institutions.php index 03d59751bd..d239d52a9c 100644 --- a/htdocs/account/institutions.php +++ b/htdocs/account/institutions.php @@ -73,7 +73,7 @@ function leaveinstitution_submit(Pieform $form, $values) { // List all institutions the user has requested membership, with a // cancel request button -$requested = get_column('usr_institution_request', 'institution', +$requested = get_column('usr_institution_request', 'institution', 'usr', $USER->id, 'confirmedusr', 1); if (!empty($requested)) { $elements = array(); @@ -81,7 +81,7 @@ if (!empty($requested)) { $elements[] = array( 'type' => 'submit', 'name' => '_cancelrequest_' . $i, - 'title' => get_string('youhaverequestedmembershipof', 'mahara', + 'title' => get_string('youhaverequestedmembershipof', 'mahara', $institutions[$i]->displayname), 'value' => get_string('cancelrequest') ); @@ -124,7 +124,7 @@ if (!empty($invited)) { $elements[] = array( 'type' => 'submit', 'name' => '_confirminvite_' . $i, - 'title' => get_string('youhavebeeninvitedtojoin', 'mahara', + 'title' => get_string('youhavebeeninvitedtojoin', 'mahara', $institutions[$i]->displayname), 'value' => get_string('joininstitution') ); diff --git a/htdocs/admin/extensions/plugins.php b/htdocs/admin/extensions/plugins.php index 6f54ef87b4..6168edd139 100644 --- a/htdocs/admin/extensions/plugins.php +++ b/htdocs/admin/extensions/plugins.php @@ -62,12 +62,12 @@ foreach (array_keys($plugins) as $plugin) { $plugins[$plugin]['installed'][$key]['types'][$collapseto] = true; } else { - $plugins[$plugin]['installed'][$key]['types'][$t] = + $plugins[$plugin]['installed'][$key]['types'][$t] = call_static_method($classname, 'has_config'); } } } - } + } else { $classname = generate_class_name($plugin, $i->name); safe_require($plugin, $key); @@ -77,7 +77,7 @@ foreach (array_keys($plugins) as $plugin) { } } } - + $dirhandle = opendir(get_config('docroot') . $plugin); while (false !== ($dir = readdir($dirhandle))) { $installed = false; // reinitialise @@ -125,7 +125,7 @@ foreach (array_keys($plugins) as $plugin) { if (!array_key_exists($dir, $plugins['artefact']['installed'])) { throw new InstallationException(get_string('blocktypeprovidedbyartefactnotinstallable', 'error', $dir)); } - validate_plugin('blocktype', $dir . '/' . $btdir, + validate_plugin('blocktype', $dir . '/' . $btdir, get_config('docroot') . 'artefact/' . $dir . '/blocktype/' . $btdir); $plugins['blocktype']['notinstalled'][$dir . '/' . $btdir] = array(); } @@ -158,7 +158,7 @@ function installplugin(name) { var message = {$successstring} + data.newversion; $(name + '.message').innerHTML = ':) ' + message; $(name + '.install').innerHTML = ''; - // move the whole thing into the list of installed plugins + // move the whole thing into the list of installed plugins // new parent node var bits = name.split('\.'); var newparent = $(bits[0] + '.installed'); @@ -173,7 +173,7 @@ function installplugin(name) { var message = ''; if (data.errormessage) { message = data.errormessage; - } + } else { message = {$failurestring}; } diff --git a/htdocs/admin/site/getmenuitems.json.php b/htdocs/admin/site/getmenuitems.json.php index dabd4a9628..25786eb6a4 100644 --- a/htdocs/admin/site/getmenuitems.json.php +++ b/htdocs/admin/site/getmenuitems.json.php @@ -37,8 +37,8 @@ if ($menuitems) { $safeurl = sanitize_url($i->url); if (empty($i->url) && !empty($i->file)) { $r['type'] = 'sitefile'; - $r['linkedto'] = get_config('wwwroot') . 'artefact/file/download.php?file=' . $i->file; - $r['linktext'] = $i->filename; + $r['linkedto'] = get_config('wwwroot') . 'artefact/file/download.php?file=' . $i->file; + $r['linktext'] = $i->filename; $r['file'] = $i->file; } else if ($safeurl == '') { diff --git a/htdocs/admin/site/menu.php b/htdocs/admin/site/menu.php index e7509a4a71..d61136c0e6 100644 --- a/htdocs/admin/site/menu.php +++ b/htdocs/admin/site/menu.php @@ -46,8 +46,8 @@ function getitems() { } // Get a list of the available admin files function getadminfiles() { - sendjsonrequest('getadminfiles.json.php', {'public':selectedmenu == 'loggedoutmenu'}, - 'GET', + sendjsonrequest('getadminfiles.json.php', {'public':selectedmenu == 'loggedoutmenu'}, + 'GET', function (data) { if (!data.error) { adminfiles = data.adminfiles; diff --git a/htdocs/admin/upgrade.json.php b/htdocs/admin/upgrade.json.php index b2ccc6c8fb..1af45a6389 100644 --- a/htdocs/admin/upgrade.json.php +++ b/htdocs/admin/upgrade.json.php @@ -30,7 +30,7 @@ raise_time_limit(120); raise_memory_limit('256M'); $data = array( 'key' => $name -); +); if ($install) { if (!get_config('installed')) { if ($name == 'localpreinst' || $name == 'localpostinst') { @@ -75,7 +75,7 @@ if (!empty($upgrade)) { $data['newversion'] = $upgrade->torelease . ' (' . $upgrade->to . ')' ; if ($name == 'core') { $funname = 'upgrade_core'; - } + } else if ($name == 'local') { $funname = 'upgrade_local'; } @@ -99,7 +99,7 @@ if (!empty($upgrade)) { } json_reply(false, $data); exit; - } + } catch (Exception $e) { list($texttrace, $htmltrace) = log_build_backtrace($e->getTrace()); $data['errormessage'] = $e->getMessage() . '
' . $htmltrace; diff --git a/htdocs/admin/upgrade.php b/htdocs/admin/upgrade.php index c38b9e3f32..f85ad68590 100644 --- a/htdocs/admin/upgrade.php +++ b/htdocs/admin/upgrade.php @@ -128,7 +128,7 @@ if (!empty($upgrades['core']->install)) { $upgrades['lastcoredata'] = true; $upgrades['localpostinst'] = true; $smarty->assign('install', true); -} +} $js = <<< EOJS function processNext() { @@ -183,13 +183,13 @@ $js = <<< EOJS var message = ''; if (data.errormessage) { message = data.errormessage; - } + } else { message = {$failurestring}; } $(data.key).innerHTML = ':( ' + message; } - }, + }, function () { $(element).innerHTML = ':( ' + {$failurestring}; }, diff --git a/htdocs/admin/users/admins.php b/htdocs/admin/users/admins.php index 70b10bdd97..bf3b170e2d 100644 --- a/htdocs/admin/users/admins.php +++ b/htdocs/admin/users/admins.php @@ -53,7 +53,7 @@ $form = pieform(array( function adminusers_submit(Pieform $form, $values) { global $SESSION; - + db_begin(); execute_sql('UPDATE {usr} SET admin = 0 diff --git a/htdocs/admin/users/bulkdownload.php b/htdocs/admin/users/bulkdownload.php index fd606a3bf1..faeb333003 100644 --- a/htdocs/admin/users/bulkdownload.php +++ b/htdocs/admin/users/bulkdownload.php @@ -53,7 +53,7 @@ function export_iframe_die($message) { } /** - * Registered as the progress report handler for the export. Streams updates + * Registered as the progress report handler for the export. Streams updates * back to the browser * * @param int $percent How far complete the export is @@ -204,8 +204,8 @@ if (!empty($exporterrors)) { $SESSION->add_error_msg(get_string('couldnotexportusers', 'admin', implode(', ', $exporterrors))); } -// Store the filename in the session, and redirect the iframe to it to trigger -// the download. Here it would be nice to trigger the download for everyone, +// Store the filename in the session, and redirect the iframe to it to trigger +// the download. Here it would be nice to trigger the download for everyone, // but alas this is not possible for people without javascript. $SESSION->set('exportfile', $zipfile); $continueurljs = get_config('wwwroot'); diff --git a/htdocs/admin/users/institutions.php b/htdocs/admin/users/institutions.php index dc4cb39f48..12b63976db 100644 --- a/htdocs/admin/users/institutions.php +++ b/htdocs/admin/users/institutions.php @@ -674,8 +674,8 @@ function institution_submit(Pieform $form, $values) { $newinstitution->showonlineusers = !isset($values['showonlineusers']) ? 2 : $values['showonlineusers']; if (get_config('usersuniquebyusername')) { - // Registering absolutely not allowed when this setting is on, it's a - // security risk. See the documentation for the usersuniquebyusername + // Registering absolutely not allowed when this setting is on, it's a + // security risk. See the documentation for the usersuniquebyusername // setting for more information $newinstitution->registerallowed = 0; } @@ -899,8 +899,8 @@ function institution_submit(Pieform $form, $values) { if ($add) { if (!$newinstitution->registerallowed) { - // If registration is not allowed, then an authinstance will not - // have been created, and thus cause the institution page to add + // If registration is not allowed, then an authinstance will not + // have been created, and thus cause the institution page to add // its own error message on the next page load $SESSION->add_ok_msg(get_string('institutionaddedsuccessfully2', 'admin')); } diff --git a/htdocs/admin/users/institutionstaff.php b/htdocs/admin/users/institutionstaff.php index 296941f351..a761c5521c 100644 --- a/htdocs/admin/users/institutionstaff.php +++ b/htdocs/admin/users/institutionstaff.php @@ -47,7 +47,7 @@ $form = array( 'defaultvalue' => $staffusers, 'lefttitle' => get_string('institutionmembers', 'admin'), 'righttitle' => get_string('institutionstaff', 'admin'), - 'searchparams' => array('limit' => 100, 'query' => '', 'member' => 1, + 'searchparams' => array('limit' => 100, 'query' => '', 'member' => 1, 'institution' => $institution), 'searchscript' => 'admin/users/userinstitutionsearch.json.php', ), diff --git a/htdocs/admin/users/notifications.php b/htdocs/admin/users/notifications.php index aa695286fd..442ca031b8 100644 --- a/htdocs/admin/users/notifications.php +++ b/htdocs/admin/users/notifications.php @@ -23,10 +23,10 @@ $sql = ' SELECT u.id, u.username, u.firstname, u.lastname, u.preferredname, u.admin, u.staff, u.profileicon, u.email, a.activity, a.method - FROM {usr} u + FROM {usr} u LEFT JOIN {usr_activity_preference} a ON a.usr = u.id - LEFT OUTER JOIN {usr_institution} ui - ON (ui.usr = u.id' . ($USER->get('admin') ? '' : ' AND ui.institution IN (' + LEFT OUTER JOIN {usr_institution} ui + ON (ui.usr = u.id' . ($USER->get('admin') ? '' : ' AND ui.institution IN (' . join(',',array_map('db_quote', array_keys($USER->get('institutions')))) . ')') . ') WHERE u.deleted = 0 GROUP BY diff --git a/htdocs/admin/users/staff.php b/htdocs/admin/users/staff.php index ce0ed710fe..88dab818cb 100644 --- a/htdocs/admin/users/staff.php +++ b/htdocs/admin/users/staff.php @@ -49,7 +49,7 @@ $form = pieform(array( function staffusers_submit(Pieform $form, $values) { global $SESSION; - + db_begin(); execute_sql('UPDATE {usr} SET staff = 0 diff --git a/htdocs/admin/users/suspended.json.php b/htdocs/admin/users/suspended.json.php index 6c1c0418f3..7339051ed4 100644 --- a/htdocs/admin/users/suspended.json.php +++ b/htdocs/admin/users/suspended.json.php @@ -21,7 +21,7 @@ $offset = param_integer('offset', 0); $type = param_alpha('type', 'suspended'); // Filter for institutional admins: -$instsql = $USER->get('admin') ? '' : ' +$instsql = $USER->get('admin') ? '' : ' AND ui.institution IN (' . join(',', array_map('db_quote', array_keys($USER->get('institutions')))) . ')'; $count = get_field_sql(' @@ -36,7 +36,7 @@ $count = get_field_sql(' ) AS a'); $data = get_records_sql_assoc(' - SELECT + SELECT u.id, u.firstname, u.lastname, u.studentid, u.suspendedctime, u.suspendedreason AS reason, ua.firstname AS cusrfirstname, ua.lastname AS cusrlastname, ' . db_format_tsfield('u.expiry', 'expiry') . ' FROM {usr} u diff --git a/htdocs/admin/users/uploadcsv.php b/htdocs/admin/users/uploadcsv.php index e74ae873fc..a1830a9981 100644 --- a/htdocs/admin/users/uploadcsv.php +++ b/htdocs/admin/users/uploadcsv.php @@ -468,7 +468,7 @@ function uploadcsv_submit(Pieform $form, $values) { $institution = new Institution($authobj->institution); - $maxusers = $institution->maxuseraccounts; + $maxusers = $institution->maxuseraccounts; if (!empty($maxusers)) { $members = count_records_sql(' SELECT COUNT(*) FROM {usr} u INNER JOIN {usr_institution} i ON u.id = i.usr @@ -555,7 +555,7 @@ function uploadcsv_submit(Pieform $form, $values) { // Reenable email set_config('sendemail', $cfgsendemail); - // Only send e-mail to users after we're sure they have been inserted + // Only send e-mail to users after we're sure they have been inserted // successfully $straccountcreatedtext = ($values['forcepasswordchange']) ? 'accountcreatedchangepasswordtext' : 'accountcreatedtext'; $straccountcreatedhtml = ($values['forcepasswordchange']) ? 'accountcreatedchangepasswordhtml' : 'accountcreatedhtml'; diff --git a/htdocs/api/xmlrpc/client.php b/htdocs/api/xmlrpc/client.php index 5b68b387f8..2f702e824f 100644 --- a/htdocs/api/xmlrpc/client.php +++ b/htdocs/api/xmlrpc/client.php @@ -59,7 +59,7 @@ class Client { $response_code = $result->info['http_code']; $response_code_prefix = substr($response_code, 0, 1); - + if ('2' != $response_code_prefix) { if ('4' == $response_code_prefix) { throw new XmlrpcClientException('Client error code: '. $response_code); @@ -90,7 +90,7 @@ class Client { if ($xml->getName() == 'encryptedMessage') { $payload_encrypted = true; $wwwroot = (string)$xml->wwwroot; - // Strip encryption, using an older code is OK, because we're the client. + // Strip encryption, using an older code is OK, because we're the client. // The server is able to respond with the correct key, be we're not $payload = xmlenc_envelope_strip($xml, true); } @@ -126,7 +126,7 @@ class Client { if (is_array($this->response) && array_key_exists('faultCode', $this->response)) { if ($this->response['faultCode'] == 7025) { log_info('Remote application has sent us a new public key'); - // The remote application sent back a new public key, the + // The remote application sent back a new public key, the // old one must have expired if (array_key_exists('faultString', $this->response)) { $details = openssl_x509_parse($this->response['faultString']); @@ -141,8 +141,8 @@ class Client { update_record('host', $updateobj, $whereobj); log_info('New key has been imported. Valid until ' . date('Y/m/d h:i:s', $details['validTo_time_t'])); - // Send request again. But don't use the cached - // peer, look it up again now we've changed the + // Send request again. But don't use the cached + // peer, look it up again now we've changed the // public key $this->send($wwwroot, false); } diff --git a/htdocs/api/xmlrpc/dispatcher.php b/htdocs/api/xmlrpc/dispatcher.php index 89bb6bee03..35869a86f7 100644 --- a/htdocs/api/xmlrpc/dispatcher.php +++ b/htdocs/api/xmlrpc/dispatcher.php @@ -19,13 +19,13 @@ class Dispatcher { private $system_methods = array('system.listMethods' => 'list_methods', 'system/listMethods' => 'list_methods', - 'system.methodSignature' => 'method_signature', - 'system/methodSignature' => 'method_signature', - 'system.methodHelp' => 'method_help', - 'system/methodHelp' => 'method_help', - 'system.listServices' => 'list_services', - 'system/listServices' => 'list_services', - 'system.keyswap' => 'keyswap', + 'system.methodSignature' => 'method_signature', + 'system/methodSignature' => 'method_signature', + 'system.methodHelp' => 'method_help', + 'system/methodHelp' => 'method_help', + 'system.listServices' => 'list_services', + 'system/listServices' => 'list_services', + 'system.keyswap' => 'keyswap', 'system/keyswap' => 'keyswap'); private $services = array( @@ -69,9 +69,9 @@ class Dispatcher { private $methodsig = array( 'user_authorise' => array( array( - array('type' => 'array', + array('type' => 'array', 'description' => '$userdata Array of user info for remote host' - ), + ), array('type' => 'string', 'description' => 'token - The unique ID provided by remotehost.' ), @@ -83,9 +83,9 @@ class Dispatcher { 'fetch_user_image' => array( array( - array('type' => 'string', + array('type' => 'string', 'description' => 'The encoded image.' - ), + ), array('type' => 'string', 'description' => 'username - The id of the user.' ) diff --git a/htdocs/api/xmlrpc/lib.php b/htdocs/api/xmlrpc/lib.php index 95e5ea2245..1cb5f093ba 100644 --- a/htdocs/api/xmlrpc/lib.php +++ b/htdocs/api/xmlrpc/lib.php @@ -65,7 +65,7 @@ function start_jump_session($peer, $instanceid, $wantsurl="") { } if (false == $approved) { - // This shouldn't happen: the user shouldn't have been presented with + // This shouldn't happen: the user shouldn't have been presented with // the link throw new AccessTotallyDeniedException('Host not approved for sso'); } @@ -486,10 +486,10 @@ function send_content_ready($token, $username, $format, $importdata, $fetchnow=f } /** - * If we're an IDP, kill_children will kill the session of the given user here, + * If we're an IDP, kill_children will kill the session of the given user here, * as well as at any other children * - * NOTE: well, currently it doesn't call kill_child on any other children, but + * NOTE: well, currently it doesn't call kill_child on any other children, but * it will kill the local sessions for the user * * @param string $username Username for session to kill @@ -500,7 +500,7 @@ function kill_children($username, $useragent) { global $REMOTEWWWROOT; // comes from server.php //require_once(get_config('docroot') .'api/xmlrpc/client.php'); - // We've received a logout request for user X. In Mahara, usernames are unique. So we check that user X + // We've received a logout request for user X. In Mahara, usernames are unique. So we check that user X // has an authinstance that would have been able to SSO to the remote site. $userid = get_field('usr', 'id', 'username', $username); $providers = get_service_providers(get_field('usr', 'authinstance', 'username', $username)); @@ -826,7 +826,7 @@ function get_public_key($uri, $application=null) { $xmlrpcserverurl = get_field('application', 'xmlrpcserverurl', 'name', $application); if (empty($xmlrpcserverurl)) { throw new XmlrpcClientException('Unknown application'); - } + } $wwwroot = dropslash(get_config('wwwroot')); $rq = xmlrpc_encode_request('system/keyswap', array($wwwroot, $openssl->certificate), array("encoding" => "utf-8")); @@ -1008,11 +1008,11 @@ function xmldsig_envelope_strip(&$xml) { * Encrypt a message and return it in an XML-Encrypted document * * This function can encrypt any content, but it was written to provide a system - * of encrypting XML-RPC request and response messages. The message does not + * of encrypting XML-RPC request and response messages. The message does not * need to be text - binary data should work. - * - * Asymmetric keys can encrypt only small chunks of data. Usually 1023 or 2047 - * characters, depending on the key size. So - we generate a symmetric key and + * + * Asymmetric keys can encrypt only small chunks of data. Usually 1023 or 2047 + * characters, depending on the key size. So - we generate a symmetric key and * use the asymmetric key to secure it for transport with the data. * * We generate a symmetric key @@ -1166,16 +1166,16 @@ class OpenSslRepo { } /** - * Decrypt some data using our private key and an auxiliary symmetric key. + * Decrypt some data using our private key and an auxiliary symmetric key. * The symmetric key encrypted the data, and then was itself encrypted with * our public key. - * This is because asymmetric keys can only safely be used to encrypt + * This is because asymmetric keys can only safely be used to encrypt * relatively short messages. * * @param string $data * @param string $key - * @param bool $oldkeyok If true, we will simply return the data rather - * than complaining about the key being old (if + * @param bool $oldkeyok If true, we will simply return the data rather + * than complaining about the key being old (if * we could decrypt it with an older key) * @return string * @access public @@ -1230,7 +1230,7 @@ class OpenSslRepo { * $openssl = new OpenSslRepo(); * Instead, use: * $openssl = OpenSslRepo::singleton(); - * + * */ private function __construct() { if (empty($this->keypair)) { @@ -1243,7 +1243,7 @@ class OpenSslRepo { } /** - * Utility function to get old SSL keys from the config table, or create a + * Utility function to get old SSL keys from the config table, or create a * blank record if none exists. * * @return array Array of keypair hashes @@ -1288,7 +1288,7 @@ class OpenSslRepo { * values * * @param string Name of the value you want - * @return mixed The value of the thing you asked for or null (if it + * @return mixed The value of the thing you asked for or null (if it * doesn't exist or is private) * @access public */ @@ -1301,17 +1301,17 @@ class OpenSslRepo { } /** - * Get the keypair. If it doesn't exist, create it. If it's out of date, + * Get the keypair. If it doesn't exist, create it. If it's out of date, * archive it and create a fresh pair. * * @param bool True if you want to force fresh keys to be generated - * @return bool + * @return bool * @access private */ public function get_keypair($regenerate = null) { $this->keypair = array(); $records = null; - + if ($records = get_records_select_menu('config', "field IN ('openssl_keypair', 'openssl_keypair_expires')", 'field', 'field, value')) { list($this->keypair['certificate'], $this->keypair['keypair_PEM']) = explode('@@@@@@@@', $records['openssl_keypair']); $this->keypair['expires'] = $records['openssl_keypair_expires']; @@ -1382,7 +1382,7 @@ class OpenSslRepo { $province = get_config('province'); $locality = get_config('locality'); - //TODO: Create additional fields on site setup and read those from + //TODO: Create additional fields on site setup and read those from // config. Then remove the next 3 linez if (empty($country)) $country = 'NZ'; if (empty($province)) $province = 'Wellington'; @@ -1414,8 +1414,8 @@ class OpenSslRepo { } if (!$csr_rsc = openssl_csr_new($dn, $new_key, $config)) { - // This behaviour has been observed once before, on an ubuntu hardy box. - // The php5-openssl package was installed but somehow openssl + // This behaviour has been observed once before, on an ubuntu hardy box. + // The php5-openssl package was installed but somehow openssl // wasn't. throw new ConfigException(get_string('errorcouldnotgeneratenewsslkey', 'auth')); } diff --git a/htdocs/api/xmlrpc/server.php b/htdocs/api/xmlrpc/server.php index 070813bacd..58dd90b657 100644 --- a/htdocs/api/xmlrpc/server.php +++ b/htdocs/api/xmlrpc/server.php @@ -107,7 +107,7 @@ catch (CryptException $e) { $response = ob_get_contents(); ob_end_clean(); - // Sign and encrypt our response, even though we don't know if the + // Sign and encrypt our response, even though we don't know if the // request was signed and encrypted $response = xmldsig_envelope($response); $peer = get_peer($REMOTEWWWROOT); diff --git a/htdocs/artefact/blog/blocktype/blog/lib.php b/htdocs/artefact/blog/blocktype/blog/lib.php index 83de016efa..221f7d8bcc 100644 --- a/htdocs/artefact/blog/blocktype/blog/lib.php +++ b/htdocs/artefact/blog/blocktype/blog/lib.php @@ -18,7 +18,7 @@ class PluginBlocktypeBlog extends PluginBlocktype { } /** - * Optional method. If exists, allows this class to decide the title for + * Optional method. If exists, allows this class to decide the title for * all blockinstances of this type */ public static function get_instance_title(BlockInstance $bi) { @@ -118,13 +118,13 @@ class PluginBlocktypeBlog extends PluginBlocktype { $elements = array(); - // If the blog in this block is owned by the owner of the View, then - // the block can be configured. Otherwise, the blog was copied in from - // another View. We won't confuse users by asking them to choose a blog - // to put in this block, when the one that is currently in it isn't + // If the blog in this block is owned by the owner of the View, then + // the block can be configured. Otherwise, the blog was copied in from + // another View. We won't confuse users by asking them to choose a blog + // to put in this block, when the one that is currently in it isn't // choosable. // - // Note: the owner check will have to change when we do group/site + // Note: the owner check will have to change when we do group/site // blogs if (empty($configdata['artefactid']) || $blog->get('owner') == $USER->get('id')) { $elements[] = self::artefactchooser_element((isset($configdata['artefactid'])) ? $configdata['artefactid'] : null); @@ -150,13 +150,13 @@ class PluginBlocktypeBlog extends PluginBlocktype { * Returns a list of artefact IDs that are in this blockinstance. * * {@internal{Because links to artefacts within blogposts don't count - * as making those artefacts 'children' of the blog post, we have to add + * as making those artefacts 'children' of the blog post, we have to add * them directly to the blog.}} * - * @return array List of artefact IDs that are 'in' this blog - all - * blogposts in it plus all links to other artefacts that are - * part of the blogpost text. Note that proper artefact - * children, such as blog post attachments, aren't included - + * @return array List of artefact IDs that are 'in' this blog - all + * blogposts in it plus all links to other artefacts that are + * part of the blogpost text. Note that proper artefact + * children, such as blog post attachments, aren't included - * the artefact parent cache is used for them * @see PluginBlocktypeBlogPost::get_artefacts() */ @@ -166,10 +166,10 @@ class PluginBlocktypeBlog extends PluginBlocktype { if (isset($configdata['artefactid'])) { $artefacts[] = $configdata['artefactid']; - // Artefacts that are linked to directly in blog post text aren't - // strictly children of blog posts, which means that - // artefact_in_view won't understand that they are "within the - // blog". We have to help it here directly by working out what + // Artefacts that are linked to directly in blog post text aren't + // strictly children of blog posts, which means that + // artefact_in_view won't understand that they are "within the + // blog". We have to help it here directly by working out what // artefacts are linked to in all of this blog's blog posts. $blog = $instance->get_artefact_instance($configdata['artefactid']); if ($blogposts = $blog->get_children_instances()) { @@ -197,7 +197,7 @@ class PluginBlocktypeBlog extends PluginBlocktype { } /** - * Optional method. If specified, allows the blocktype class to munge the + * Optional method. If specified, allows the blocktype class to munge the * artefactchooser element data before it's templated */ //public static function artefactchooser_get_element_data($artefact) { @@ -223,7 +223,7 @@ class PluginBlocktypeBlog extends PluginBlocktype { } /** - * Blog blocktype is only allowed in personal views, because currently + * Blog blocktype is only allowed in personal views, because currently * there's no such thing as group/site blogs */ public static function allowed_in_view(View $view) { diff --git a/htdocs/artefact/blog/blocktype/blogpost/lib.php b/htdocs/artefact/blog/blocktype/blogpost/lib.php index d80bfe8a0a..49895a45bb 100644 --- a/htdocs/artefact/blog/blocktype/blogpost/lib.php +++ b/htdocs/artefact/blog/blocktype/blogpost/lib.php @@ -18,7 +18,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype { } /** - * Optional method. If exists, allows this class to decide the title for + * Optional method. If exists, allows this class to decide the title for * all blockinstances of this type */ public static function get_instance_title(BlockInstance $bi) { @@ -58,17 +58,17 @@ class PluginBlocktypeBlogpost extends PluginBlocktype { /** * Returns a list of artefact IDs that are in this blockinstance. * - * Normally this would just include the blogpost ID itself (children such - * as attachments don't need to be included here, they're handled by the - * artefact parent cache). But people might just link to artefacts without - * using the attachment facility. There's nothing wrong with them doing - * that, so if they do we should scrape the post looking for such links and + * Normally this would just include the blogpost ID itself (children such + * as attachments don't need to be included here, they're handled by the + * artefact parent cache). But people might just link to artefacts without + * using the attachment facility. There's nothing wrong with them doing + * that, so if they do we should scrape the post looking for such links and * include those artefacts as being part of this blockinstance. * - * @return array List of artefact IDs that are 'in' this blogpost - all - * the blogpost ID plus links to other artefacts that are - * part of the blogpost text. Note that proper artefact - * children, such as blog post attachments, aren't included - + * @return array List of artefact IDs that are 'in' this blogpost - all + * the blogpost ID plus links to other artefacts that are + * part of the blogpost text. Note that proper artefact + * children, such as blog post attachments, aren't included - * the artefact parent cache is used for them * @see PluginBlocktypeBlog::get_artefacts() */ @@ -100,13 +100,13 @@ class PluginBlocktypeBlogpost extends PluginBlocktype { $elements = array(); - // If the blog post in this block is owned by the owner of the View, - // then the block can be configured. Otherwise, the blog post was - // copied in from another View. We won't confuse users by asking them to - // choose a blog post to put in this block, when the one that is + // If the blog post in this block is owned by the owner of the View, + // then the block can be configured. Otherwise, the blog post was + // copied in from another View. We won't confuse users by asking them to + // choose a blog post to put in this block, when the one that is // currently in it isn't choosable. // - // Note: the owner check will have to change when we do group/site + // Note: the owner check will have to change when we do group/site // blogs if (empty($configdata['artefactid']) || $blog->get('owner') == $USER->get('id')) { $elements[] = self::artefactchooser_element((isset($configdata['artefactid'])) ? $configdata['artefactid'] : null); @@ -138,7 +138,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype { } /** - * Optional method. If specified, allows the blocktype class to munge the + * Optional method. If specified, allows the blocktype class to munge the * artefactchooser element data before it's templated */ public static function artefactchooser_get_element_data($artefact) { @@ -168,7 +168,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype { } /** - * Blogpost blocktype is only allowed in personal views, because currently + * Blogpost blocktype is only allowed in personal views, because currently * there's no such thing as group/site blogs */ public static function allowed_in_view(View $view) { diff --git a/htdocs/artefact/blog/blocktype/recentposts/lib.php b/htdocs/artefact/blog/blocktype/recentposts/lib.php index 1b56b5ad3e..b73095f099 100644 --- a/htdocs/artefact/blog/blocktype/recentposts/lib.php +++ b/htdocs/artefact/blog/blocktype/recentposts/lib.php @@ -128,7 +128,7 @@ class PluginBlocktypeRecentposts extends PluginBlocktype { } /** - * Recentposts blocktype is only allowed in personal views, because + * Recentposts blocktype is only allowed in personal views, because * currently there's no such thing as group/site blogs */ public static function allowed_in_view(View $view) { diff --git a/htdocs/artefact/blog/db/upgrade.php b/htdocs/artefact/blog/db/upgrade.php index 6ea2af088c..7ce66fb7f5 100644 --- a/htdocs/artefact/blog/db/upgrade.php +++ b/htdocs/artefact/blog/db/upgrade.php @@ -12,7 +12,7 @@ defined('INTERNAL') || die(); function xmldb_artefact_blog_upgrade($oldversion=0) { - + // There was no database prior to this version. if ($oldversion < 2006120501) { install_from_xmldb_file( @@ -26,7 +26,7 @@ function xmldb_artefact_blog_upgrade($oldversion=0) { $table->addFieldInfo('file', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL); $table->addFieldInfo('when', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL); - + $table->addKeyInfo('blogpost_file_pending_pk', XMLDB_KEY_PRIMARY, array('file')); $table->addKeyInfo('filefk', XMLDB_KEY_FOREIGN, array('file'), 'artefact', array('id')); @@ -36,11 +36,11 @@ function xmldb_artefact_blog_upgrade($oldversion=0) { } if ($oldversion < 2008012200) { - // From 0.9, some files were not having their temporary download paths - // translated to proper artefact/file/download.php paths. This upgrade - // attempts to fix them. It should work in the vast majority of cases, - // the largest assumption made is that artefacts were inserted in - // ascending ID order when the post was created, which is a pretty safe + // From 0.9, some files were not having their temporary download paths + // translated to proper artefact/file/download.php paths. This upgrade + // attempts to fix them. It should work in the vast majority of cases, + // the largest assumption made is that artefacts were inserted in + // ascending ID order when the post was created, which is a pretty safe // bet. if ($blogfiles = get_records_array('artefact_blog_blogpost_file', '', '', 'blogpost ASC, file ASC')) { $blogpostids = join(', ', array_map(create_function('$a', 'return $a->blogpost;'), $blogfiles)); @@ -85,13 +85,13 @@ function xmldb_artefact_blog_upgrade($oldversion=0) { execute_sql('DROP INDEX {arteblogblog_blo2_ix} ON {artefact_blog_blogpost}'); execute_sql('CREATE INDEX {arteblogblog_blo_ix} ON {artefact_blog_blogpost} (blogpost)'); execute_sql('ALTER TABLE {artefact_blog_blogpost} DROP FOREIGN KEY {arteblogblog_blo2_fk}'); - // I can't quite get mysql to name this key correctly, so there - // will be a difference in the database if you upgrade from 0.9 + // I can't quite get mysql to name this key correctly, so there + // will be a difference in the database if you upgrade from 0.9 // compared with installing from 1.0 execute_sql('ALTER TABLE {artefact_blog_blogpost} ADD FOREIGN KEY (blogpost) REFERENCES {artefact} (id)'); } else { - // Rename indexes to keep things the same regardless of whether the + // Rename indexes to keep things the same regardless of whether the // user installed or upgraded to this release execute_sql('DROP INDEX {arteblogblog_blo2_ix}'); execute_sql('CREATE INDEX {arteblogblog_blo_ix} ON {artefact_blog_blogpost} USING btree (blogpost)'); diff --git a/htdocs/artefact/blog/lib.php b/htdocs/artefact/blog/lib.php index 50c95e58aa..9725d3e556 100644 --- a/htdocs/artefact/blog/lib.php +++ b/htdocs/artefact/blog/lib.php @@ -11,7 +11,7 @@ defined('INTERNAL') || die(); -/** +/** * Users can create blogs and blog posts using this plugin. */ class PluginArtefactBlog extends PluginArtefact { @@ -22,7 +22,7 @@ class PluginArtefactBlog extends PluginArtefact { 'blogpost', ); } - + public static function get_block_types() { return array(); } @@ -146,10 +146,10 @@ class ArtefactTypeBlog extends ArtefactType { if (empty($this->dirty)) { return; } - + // We need to keep track of newness before and after. $new = empty($this->id); - + // Commit to the artefact table. parent::commit(); @@ -170,9 +170,9 @@ class ArtefactTypeBlog extends ArtefactType { } /** - * Checks that the person viewing this blog is the owner. If not, throws an - * AccessDeniedException. Used in the blog section to ensure only the - * owners of the blogs can view or change them there. Other people see + * Checks that the person viewing this blog is the owner. If not, throws an + * AccessDeniedException. Used in the blog section to ensure only the + * owners of the blogs can view or change them there. Other people see * blogs when they are placed in views. */ public function check_permission() { @@ -255,7 +255,7 @@ class ArtefactTypeBlog extends ArtefactType { return array('html' => $smarty->fetch('artefact:blog:blog.tpl'), 'javascript' => ''); } - + public static function get_icon($options=null) { global $THEME; return $THEME->get_url('images/journal.png', false); @@ -383,7 +383,7 @@ class ArtefactTypeBlog extends ArtefactType { /** * Returns the number of posts in this blog that have been published. * - * The result of this function looked up from the database each time, so + * The result of this function looked up from the database each time, so * cache it if you know it's safe to do so. * * @return int @@ -518,9 +518,9 @@ class ArtefactTypeBlogPost extends ArtefactType { * This method extends ArtefactType::commit() by adding additional data * into the artefact_blog_blogpost table. * - * This method also works out what blockinstances this blogpost is in, and + * This method also works out what blockinstances this blogpost is in, and * informs them that they should re-check what artefacts they have in them. - * The post content may now link to different artefacts. See {@link + * The post content may now link to different artefacts. See {@link * PluginBlocktypeBlogPost::get_artefacts for more information} */ public function commit() { @@ -530,7 +530,7 @@ class ArtefactTypeBlogPost extends ArtefactType { db_begin(); $new = empty($this->id); - + parent::commit(); $this->dirty = true; @@ -551,8 +551,8 @@ class ArtefactTypeBlogPost extends ArtefactType { // 1) All blogpost blocktypes with this post in it // 2) All blog blocktypes with this posts's blog in it // - // With these, we tell them to rebuild what artefacts they have in them, - // since the post content could have changed and now have links to + // With these, we tell them to rebuild what artefacts they have in them, + // since the post content could have changed and now have links to // different artefacts in it $blockinstanceids = (array)get_column_sql('SELECT block FROM {view_artefact} @@ -582,7 +582,7 @@ class ArtefactTypeBlogPost extends ArtefactType { db_begin(); $this->detach(); // Detach all file attachments delete_records('artefact_blog_blogpost', 'blogpost', $this->id); - + parent::delete(); db_commit(); } @@ -602,9 +602,9 @@ class ArtefactTypeBlogPost extends ArtefactType { /** - * Checks that the person viewing this blog is the owner. If not, throws an - * AccessDeniedException. Used in the blog section to ensure only the - * owners of the blogs can view or change them there. Other people see + * Checks that the person viewing this blog is the owner. If not, throws an + * AccessDeniedException. Used in the blog section to ensure only the + * owners of the blogs can view or change them there. Other people see * blogs when they are placed in views. */ public function check_permission() { @@ -613,7 +613,7 @@ class ArtefactTypeBlogPost extends ArtefactType { throw new AccessDeniedException(get_string('youarenottheownerofthisblogpost', 'artefact.blog')); } } - + public function describe_size() { return $this->count_attachments() . ' ' . get_string('attachments', 'artefact.blog'); } @@ -872,7 +872,7 @@ class ArtefactTypeBlogPost extends ArtefactType { } } - /** + /** /** * This function creates a new blog post. * @@ -890,7 +890,7 @@ class ArtefactTypeBlogPost extends ArtefactType { return true; } - /** + /** * This function updates an existing blog post. * * @param User @@ -1076,7 +1076,7 @@ class ArtefactTypeBlogPost extends ArtefactType { } /** - * Looks through the blog post text for links to download artefacts, and + * Looks through the blog post text for links to download artefacts, and * returns the IDs of those artefacts. */ public function get_referenced_artefacts_from_postbody() { diff --git a/htdocs/artefact/blog/post.php b/htdocs/artefact/blog/post.php index 0bf7fcee87..26373963c1 100644 --- a/htdocs/artefact/blog/post.php +++ b/htdocs/artefact/blog/post.php @@ -24,7 +24,7 @@ safe_require('artefact', 'file'); if (!PluginArtefactBlog::is_active()) { throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('blog','artefact.blog'))); } -/* +/* * For a new post, the 'blog' parameter will be set to the blog's * artefact id. For an existing post, the 'blogpost' parameter will * be set to the blogpost's artefact id. @@ -37,8 +37,8 @@ if (!$blogpost) { $tagselect = param_variable('tagselect', ''); $blog = param_integer('blog'); if (!get_record('artefact', 'id', $blog, 'owner', $USER->get('id'))) { - // Blog security is also checked closer to when blogs are added, this - // check ensures that malicious users do not even see the screen for + // Blog security is also checked closer to when blogs are added, this + // check ensures that malicious users do not even see the screen for // adding a post to a blog that is not theirs throw new AccessDeniedException(get_string('youarenottheownerofthisblog', 'artefact.blog')); } @@ -201,7 +201,7 @@ $smarty->display('artefact:blog:editpost.tpl'); -/** +/** * This function get called to cancel the form submission. It returns to the * blog list. */ diff --git a/htdocs/artefact/blog/settings/index.php b/htdocs/artefact/blog/settings/index.php index d7ff217de0..107bc4580f 100644 --- a/htdocs/artefact/blog/settings/index.php +++ b/htdocs/artefact/blog/settings/index.php @@ -101,7 +101,7 @@ exit; */ function editblog_submit(Pieform $form, $values) { global $USER; - + ArtefactTypeBlog::edit_blog($USER, $values); redirect('/artefact/blog/view/index.php?id=' . $values['id']); diff --git a/htdocs/artefact/file/blocktype/filedownload/lib.php b/htdocs/artefact/file/blocktype/filedownload/lib.php index 8794d53b9c..7566107b18 100644 --- a/htdocs/artefact/file/blocktype/filedownload/lib.php +++ b/htdocs/artefact/file/blocktype/filedownload/lib.php @@ -101,7 +101,7 @@ class PluginBlocktypeFiledownload extends PluginBlocktype { } /** - * Optional method. If specified, allows the blocktype class to munge the + * Optional method. If specified, allows the blocktype class to munge the * artefactchooser element data before it's templated */ public static function artefactchooser_get_element_data($artefact) { diff --git a/htdocs/artefact/file/blocktype/folder/lib.php b/htdocs/artefact/file/blocktype/folder/lib.php index 0d67f74c66..6068affd2a 100644 --- a/htdocs/artefact/file/blocktype/folder/lib.php +++ b/htdocs/artefact/file/blocktype/folder/lib.php @@ -18,7 +18,7 @@ class PluginBlocktypeFolder extends PluginBlocktype { } /** - * Optional method. If exists, allows this class to decide the title for + * Optional method. If exists, allows this class to decide the title for * all blockinstances of this type */ public static function get_instance_title(BlockInstance $bi) { @@ -44,7 +44,7 @@ class PluginBlocktypeFolder extends PluginBlocktype { $configdata['viewid'] = $instance->get('view'); $configdata['simpledisplay'] = true; - // This can be either an image or profileicon. They both implement + // This can be either an image or profileicon. They both implement // render_self $result = ''; if (isset($configdata['artefactid'])) { @@ -148,7 +148,7 @@ class PluginBlocktypeFolder extends PluginBlocktype { } /** - * Optional method. If specified, allows the blocktype class to munge the + * Optional method. If specified, allows the blocktype class to munge the * artefactchooser element data before it's templated */ public static function artefactchooser_get_element_data($artefact) { diff --git a/htdocs/artefact/file/blocktype/image/lib.php b/htdocs/artefact/file/blocktype/image/lib.php index 7fcf520eb4..9eba373757 100644 --- a/htdocs/artefact/file/blocktype/image/lib.php +++ b/htdocs/artefact/file/blocktype/image/lib.php @@ -112,7 +112,7 @@ class PluginBlocktypeImage extends PluginBlocktype { } /** - * Optional method. If specified, allows the blocktype class to munge the + * Optional method. If specified, allows the blocktype class to munge the * artefactchooser element data before it's templated */ public static function artefactchooser_get_element_data($artefact) { diff --git a/htdocs/artefact/file/export/html/lib.php b/htdocs/artefact/file/export/html/lib.php index 605d559955..02fe91af7c 100644 --- a/htdocs/artefact/file/export/html/lib.php +++ b/htdocs/artefact/file/export/html/lib.php @@ -53,7 +53,7 @@ class HtmlExportFile extends HtmlExportArtefactPlugin { foreach ($folderids as $folderid) { if (!isset($this->artefactdata[$folderid])) { $artefact = artefact_instance_from_id($folderid); - // We grabbed all parents of the artefacts in the export, + // We grabbed all parents of the artefacts in the export, // but not all parents are folders if ($artefact->get('artefacttype') == 'folder') { $this->artefactdata[$folderid] = $artefact; @@ -126,11 +126,11 @@ class HtmlExportFile extends HtmlExportArtefactPlugin { } /** - * Given a filesystem directory and the id of an artefact, fill the - * filesystem directory with the files and folders that Mahara considers + * Given a filesystem directory and the id of an artefact, fill the + * filesystem directory with the files and folders that Mahara considers * are inside the artefact. * - * This method is recursive, creating the file/directory structure for all + * This method is recursive, creating the file/directory structure for all * directories under the one passed. * * This method also creates index.htmls in each directory created. @@ -160,13 +160,13 @@ class HtmlExportFile extends HtmlExportArtefactPlugin { } /** - * Given a filesystem directory and the artefact data corresponding to that + * Given a filesystem directory and the artefact data corresponding to that * directory, creates an index.html for it. * - * @param string $filesystemdirectory The file system directory to make the + * @param string $filesystemdirectory The file system directory to make the * index.html inside * @param int $level How deep this directory index is - * @param object $artefactdata Artefact data relating to the folder + * @param object $artefactdata Artefact data relating to the folder * represented by this directory */ private function create_index_for_directory($filesystemdirectory, $level, ArtefactTypeFolder $artefact=null) { @@ -194,9 +194,9 @@ class HtmlExportFile extends HtmlExportArtefactPlugin { /** * Helper to convert artefacts into smarty-friendly data * - * @param int $parent The ID of the parent folder for the artefact to + * @param int $parent The ID of the parent folder for the artefact to * convert - * @param bool $folders True to get folders, false to get everything but + * @param bool $folders True to get folders, false to get everything but * folders */ private function prepare_artefacts_for_smarty($parent, $folders) { diff --git a/htdocs/artefact/file/lib.php b/htdocs/artefact/file/lib.php index 576a114c13..95fc33cc13 100644 --- a/htdocs/artefact/file/lib.php +++ b/htdocs/artefact/file/lib.php @@ -24,7 +24,7 @@ class PluginArtefactFile extends PluginArtefact { 'audio', ); } - + public static function get_block_types() { return array('image'); } @@ -169,7 +169,7 @@ class PluginArtefactFile extends PluginArtefact { update_record('usr', array('quota' => get_config_plugin('artefact', 'file', 'defaultquota')), array('id' => $user['id'])); } } - + public static function sort_child_data($a, $b) { if ($a->container && !$b->container) { @@ -278,7 +278,7 @@ class PluginArtefactFile extends PluginArtefact { $count['removed']++; } } - + db_commit(); $changes = array(); foreach (array_filter($count) as $k => $v) { @@ -885,7 +885,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType { } /** - * Works out a full path to a folder, given an ID. Implemented this way so + * Works out a full path to a folder, given an ID. Implemented this way so * only one query is made. */ public static function get_full_path($id, &$folderdata) { @@ -943,7 +943,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType { * Try to add digits before the filename extension: If the desired * title contains a ".", add "." plus digits before the final ".", * otherwise append "." and digits. - * + * * @param string $desired * @param integer $parent * @param integer $owner @@ -1042,7 +1042,7 @@ class ArtefactTypeFile extends ArtefactTypeFileBase { public function __construct($id = 0, $data = null) { parent::__construct($id, $data); - + if ($this->id && ($filedata = get_record('artefact_file_files', 'artefact', $this->id))) { foreach($filedata as $name => $value) { if (property_exists($this, $name)) { @@ -1147,8 +1147,8 @@ class ArtefactTypeFile extends ArtefactTypeFileBase { * Takes the name of a file outside the myfiles area. * Returns a boolean indicating success or failure. * - * Note: this method is crappy because it returns false instead of throwing - * exceptions. It's not used in many places, and should probably die in a + * Note: this method is crappy because it returns false instead of throwing + * exceptions. It's not used in many places, and should probably die in a * future version. So think twice before using it :) */ public static function save_file($pathname, $data, User &$user=null, $outsidedataroot=false) { @@ -1363,7 +1363,7 @@ class ArtefactTypeFile extends ArtefactTypeFileBase { public function delete() { if (empty($this->id)) { - return; + return; } $file = $this->get_path(); if (is_file($file)) { @@ -1484,7 +1484,7 @@ class ArtefactTypeFile extends ArtefactTypeFileBase { 'value' => '' . get_string('defaultquotadescription', 'artefact.file') . '' ), 'defaultquota' => array( - 'title' => get_string('defaultquota', 'artefact.file'), + 'title' => get_string('defaultquota', 'artefact.file'), 'type' => 'bytes', 'defaultvalue' => $defaultquota, ), @@ -1577,23 +1577,23 @@ class ArtefactTypeFile extends ArtefactTypeFileBase { 'value' => '' . get_string('uploadagreementdescription', 'artefact.file') . '' ), 'uploadagreement' => array( - 'title' => get_string('requireagreement', 'artefact.file'), + 'title' => get_string('requireagreement', 'artefact.file'), 'type' => 'checkbox', 'defaultvalue' => $uploadagreement, ), 'defaultagreement' => array( 'type' => 'html', - 'title' => get_string('defaultagreement', 'artefact.file'), + 'title' => get_string('defaultagreement', 'artefact.file'), 'value' => get_string('uploadcopyrightdefaultcontent', 'install'), ), 'usecustomagreement' => array( - 'title' => get_string('usecustomagreement', 'artefact.file'), + 'title' => get_string('usecustomagreement', 'artefact.file'), 'type' => 'checkbox', 'defaultvalue' => $usecustomagreement, ), 'customagreement' => array( 'name' => 'customagreement', - 'title' => get_string('customagreement', 'artefact.file'), + 'title' => get_string('customagreement', 'artefact.file'), 'type' => 'wysiwyg', 'rows' => 10, 'cols' => 80, @@ -1983,7 +1983,7 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase { public static function collapse_config() { return 'file'; } - + public static function admin_public_folder_id() { // There is one public files directory and many admins, so the // name of the directory uses the site language rather than @@ -2031,8 +2031,8 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase { } /** - * Retrieves info from the artefact table about the folder with the given - * name, in the specified directory, owned by the specified + * Retrieves info from the artefact table about the folder with the given + * name, in the specified directory, owned by the specified * user/group/institution. * * @param string $name The name of the folder to search for @@ -2091,11 +2091,11 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase { $postcontent = preg_replace('#(]+href="[^>]+artefact/file/download\.php\?file=\d+)#', '\1&view=' . $view_id , $postcontent); $postcontent = preg_replace('#(]+src="[^>]+artefact/file/download\.php\?file=\d+)#', '\1&view=' . $view_id, $postcontent); - // Find images inside tags and temporarily draft them out of the - // content. This is so we can link up unlinked images to open to + // Find images inside tags and temporarily draft them out of the + // content. This is so we can link up unlinked images to open to // download.php. // - // This is a hack really - will probably need refinement/replacement + // This is a hack really - will probably need refinement/replacement // later (if only we could do this with HTMLPurifier!) $marker = ''; $matches = array(); @@ -2174,7 +2174,7 @@ class ArtefactTypeImage extends ArtefactTypeFile { if (empty($this->dirty)) { return; } - + // We need to keep track of newness before and after. $new = empty($this->id); @@ -2202,7 +2202,7 @@ class ArtefactTypeImage extends ArtefactTypeFile { public static function collapse_config() { return 'file'; - } + } public static function get_icon($options=null) { $url = get_config('wwwroot') . 'artefact/file/download.php?'; @@ -2229,7 +2229,7 @@ class ArtefactTypeImage extends ArtefactTypeFile { public function delete() { if (empty($this->id)) { - return; + return; } delete_records('artefact_file_image', 'artefact', $this->id); parent::delete(); diff --git a/htdocs/artefact/internal/blocktype/profileinfo/lib.php b/htdocs/artefact/internal/blocktype/profileinfo/lib.php index fd4c604870..7c1f237841 100644 --- a/htdocs/artefact/internal/blocktype/profileinfo/lib.php +++ b/htdocs/artefact/internal/blocktype/profileinfo/lib.php @@ -66,7 +66,7 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype { $smarty->assign('profileiconalt', get_string('profileimagetext', 'mahara', display_default_name(get_user($viewowner)))); } - // Override the introduction text if the user has any for this + // Override the introduction text if the user has any for this // particular blockinstance if (!empty($configdata['introtext'])) { $data['introduction'] = $configdata['introtext']; @@ -78,11 +78,11 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype { } /** - * Overrides the standard get_artefacts method to make sure the profileicon + * Overrides the standard get_artefacts method to make sure the profileicon * is added also. * * @param BlockInstance $instance The blockinstance to get artefacts for - * @return array A list of artefact IDs in the blockinstance, or false if + * @return array A list of artefact IDs in the blockinstance, or false if * there are none */ public static function get_artefacts(BlockInstance $instance) { @@ -132,7 +132,7 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype { foreach ($result as $profilefield) { if ($profilefield->artefacttype == 'profileicon') { $iconoptions[$profilefield->id] = ($profilefield->title) ? $profilefield->title : $profilefield->note; - } + } else { $emailoptions[$profilefield->id] = $profilefield->title; } @@ -200,8 +200,8 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype { } /** - * Deliberately enforce _no_ sort order. The database will return them in - * the order they were inserted, which means roughly the order that they + * Deliberately enforce _no_ sort order. The database will return them in + * the order they were inserted, which means roughly the order that they * are listed in the profile screen */ public static function artefactchooser_get_sort_order() { @@ -244,7 +244,7 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype { } /** - * Profileinfo blocktype is only allowed in personal views, because + * Profileinfo blocktype is only allowed in personal views, because * there's no such thing as group/site profiles */ public static function allowed_in_view(View $view) { diff --git a/htdocs/artefact/internal/db/upgrade.php b/htdocs/artefact/internal/db/upgrade.php index ad88f00078..fbb6b75bb4 100644 --- a/htdocs/artefact/internal/db/upgrade.php +++ b/htdocs/artefact/internal/db/upgrade.php @@ -12,7 +12,7 @@ defined('INTERNAL') || die(); function xmldb_artefact_internal_upgrade($oldversion=0) { - + $status = true; if ($oldversion < 2007042500) { diff --git a/htdocs/artefact/internal/export/html/lib.php b/htdocs/artefact/internal/export/html/lib.php index f8fdcd4476..a484d1888c 100644 --- a/htdocs/artefact/internal/export/html/lib.php +++ b/htdocs/artefact/internal/export/html/lib.php @@ -48,7 +48,7 @@ class HtmlExportInternal extends HtmlExportArtefactPlugin { $smarty->assign('page_heading', get_string('profileinformation', 'artefact.internal')); $smarty->assign('breadcrumbs', array(array('text' => 'Profile information', 'path' => 'index.html'))); - // Organise profile information by sections, ordered how it's ordered + // Organise profile information by sections, ordered how it's ordered // on the 'edit profile' page $sections = array( 'aboutme' => array(), diff --git a/htdocs/artefact/internal/lib.php b/htdocs/artefact/internal/lib.php index 39acc1f62b..e644562b41 100644 --- a/htdocs/artefact/internal/lib.php +++ b/htdocs/artefact/internal/lib.php @@ -96,7 +96,7 @@ class PluginArtefactInternal extends PluginArtefact { 'jabberusername', ); } - + public static function get_block_types() { return array(); } @@ -403,11 +403,11 @@ class ArtefactTypeProfile extends ArtefactType { if (!empty($data['owner'])) { if ($a = get_record('artefact', 'artefacttype', $type, 'owner', $data['owner'])) { return parent::__construct($a->id, $a); - } + } else { $this->owner = $data['owner']; } - } + } $this->ctime = time(); $this->atime = time(); $this->artefacttype = $type; @@ -439,7 +439,7 @@ class ArtefactTypeProfile extends ArtefactType { public static function is_singular() { return true; } - + public static function get_all_fields() { return array( 'firstname' => 'text', @@ -498,8 +498,8 @@ class ArtefactTypeProfile extends ArtefactType { public static function get_always_mandatory_fields() { return array( - 'firstname' => 'text', - 'lastname' => 'text', + 'firstname' => 'text', + 'lastname' => 'text', 'email' => 'emaillist', ); } diff --git a/htdocs/artefact/lib.php b/htdocs/artefact/lib.php index 683361f64d..01fde3ff5c 100644 --- a/htdocs/artefact/lib.php +++ b/htdocs/artefact/lib.php @@ -18,15 +18,15 @@ require_once(get_config('libroot') . 'group.php'); */ abstract class PluginArtefact extends Plugin { - /** - * This function returns a list of classnames + /** + * This function returns a list of classnames * of artefact types this plugin provides. * @abstract * @return array */ public static abstract function get_artefact_types(); - + /** * This function returns a list of classnames * of block types this plugin provides @@ -151,7 +151,7 @@ abstract class PluginArtefact extends Plugin { } } -/** +/** * Base artefact type class * @abstract */ @@ -221,7 +221,7 @@ abstract class ArtefactType { if (property_exists($this, $field)) { if (in_array($field, array('atime', 'ctime', 'mtime'))) { $value = strtotime($value); - } + } if ($field == 'tags' && !is_array($value)) { $value = preg_split("/\s*,\s*/", trim($value)); } @@ -334,12 +334,12 @@ abstract class ArtefactType { return get_field('artefact_installed_type', 'plugin', 'name', $this->get('artefacttype')); } - /** - * This function returns the instances + /** + * This function returns the instances * of all children of this artefact - * If you just want the basic info, + * If you just want the basic info, * use {@link get_children_metadata} instead. - * + * * @return array of instances. */ public function get_children_instances() { @@ -358,12 +358,12 @@ abstract class ArtefactType { } /** - * This function returns the db rows - * from the artefact table that have this + * This function returns the db rows + * from the artefact table that have this * artefact as the parent. * If you want instances, use {@link get_children_instances} * but bear in mind this will have a performance impact. - * + * * @return array */ public function get_children_metadata() { @@ -392,13 +392,13 @@ abstract class ArtefactType { return $this->parentinstance; } - /** - * This function returns the db row + /** + * This function returns the db row * (if there is one) of the parent * artefact for this instance. - * If you want the instance, use + * If you want the instance, use * {@link get_parent_instance} instead. - * + * * @return object - db row */ public function get_parent_metadata() { @@ -411,7 +411,7 @@ abstract class ArtefactType { /** * Returns how much quota this artefact has used. * - * It should try to not instantiate the artefact, because it is normally + * It should try to not instantiate the artefact, because it is normally * called as part of an expensive cron job * * @return int Size in bytes that the artefact is taking up in quota @@ -448,7 +448,7 @@ abstract class ArtefactType { } throw new InvalidArgumentException("Field $field wasn't found in class " . get_class($this)); } - + /** * Artefact destructor. Calls commit and marks the * artefact cache as dirty if necessary. @@ -460,13 +460,13 @@ abstract class ArtefactType { if ($this->deleted) { return; } - + if (!empty($this->dirty) && !defined('MAHARA_CRASHING')) { $this->commit(); } } - - /** + + /** * This method updates the contents of the artefact table only. If your * artefact has extra information in other tables, you need to override * this method, and call parent::commit() in your own function. @@ -535,7 +535,7 @@ abstract class ArtefactType { db_commit(); } - /** + /** * This function provides basic delete functionality. It gets rid of the * artefact's row in the artefact table, and the tables that reference the * artefact table. It also recursively deletes child artefacts. @@ -549,7 +549,7 @@ abstract class ArtefactType { $this->dirty = false; return; } - + db_begin(); // Call delete() on comments (if there are any) @@ -570,7 +570,7 @@ abstract class ArtefactType { if ($this->can_be_logged()) { $this->log('deleted'); } - + handle_event('deleteartefact', $this); // Set flags. @@ -750,18 +750,18 @@ abstract class ArtefactType { /** * Returns a URL for an icon for the appropriate artefact * - * @param array $options Options for the artefact. The array MUST have the - * 'id' key, representing the ID of the artefact for - * which the icon is being generated. Other keys - * include 'size' for a [width]x[height] version of - * the icon, as opposed to the default 20x20, and - * 'view' for the id of the view in which the icon is + * @param array $options Options for the artefact. The array MUST have the + * 'id' key, representing the ID of the artefact for + * which the icon is being generated. Other keys + * include 'size' for a [width]x[height] version of + * the icon, as opposed to the default 20x20, and + * 'view' for the id of the view in which the icon is * being displayed. - * @abstract + * @abstract * @return string URL for the icon */ public static abstract function get_icon($options=null); - + // ******************** STATIC FUNCTIONS ******************** // @@ -783,7 +783,7 @@ abstract class ArtefactType { * Returns a list of key => value pairs where the key is either '_default' * or a language string, and value is a URL linking to that behaviour for * this artefact type - * + * * @param integer This is the ID of the artefact being linked to */ public static abstract function get_links($id); @@ -809,7 +809,7 @@ abstract class ArtefactType { } /** - * Returns a short name for the artefact to be used in a list of artefacts in a view + * Returns a short name for the artefact to be used in a list of artefacts in a view */ public function display_title($maxlen=null) { if ($maxlen) { @@ -839,7 +839,7 @@ abstract class ArtefactType { protected function get_artefact_type() { $classname = get_class($this); - + $type = strtolower(substr($classname, strlen('ArtefactType'))); if (!artefact_type_installed($type)) { @@ -850,7 +850,7 @@ abstract class ArtefactType { } public function to_stdclass() { - return (object)get_object_vars($this); + return (object)get_object_vars($this); } public static function has_config() { @@ -976,21 +976,21 @@ abstract class ArtefactType { } /** - * Returns the ID of the artefact that should be the parent for copied + * Returns the ID of the artefact that should be the parent for copied * artefacts - e.g. the folder that files should be placed in. * * The $artefactstoignore is used to work around bug #3106 * * @param View $view The new view being created by the copy * @param View $template The view being copied from - * @param array $artefacttoignore A list of artefact IDs to ignore. In - * particular, it's a list of artefact IDs - * that have been created by a view being - * copied. This is so we don't accidentally - * try to use a new artefact as the parent - * for all of the artefacts, else we can get - * into a nasty infinite loop (e.g. when a - * folder called 'viewfiles' is being + * @param array $artefacttoignore A list of artefact IDs to ignore. In + * particular, it's a list of artefact IDs + * that have been created by a view being + * copied. This is so we don't accidentally + * try to use a new artefact as the parent + * for all of the artefacts, else we can get + * into a nasty infinite loop (e.g. when a + * folder called 'viewfiles' is being * copied). */ public function default_parent_for_copy(&$view, &$template, $artefactstoignore) { @@ -1020,7 +1020,7 @@ abstract class ArtefactType { if ($this->$key != $old->$key) { $entry->$key = $this->$key; $changed = true; - } + } } if (isset($changed)) { insert_record('artefact_log', $entry); @@ -1098,7 +1098,7 @@ abstract class ArtefactType { } public function get_attachments($assoc=false) { - $list = get_records_sql_assoc('SELECT a.id, a.artefacttype, a.title, a.description + $list = get_records_sql_assoc('SELECT a.id, a.artefacttype, a.title, a.description FROM {artefact_attachment} aa INNER JOIN {artefact} a ON a.id = aa.attachment WHERE aa.artefact = ? @@ -1393,7 +1393,7 @@ abstract class ArtefactType { } /** - * Given an artefact plugin name, this function will test if + * Given an artefact plugin name, this function will test if * it's installable or not. If not, InstallationException will be thrown. */ function artefact_check_plugin_sanity($pluginname) { @@ -1409,7 +1409,7 @@ function artefact_check_plugin_sanity($pluginname) { foreach ($types as $type) { $typeclassname = generate_artefact_class_name($type); if (get_config('installed')) { - if ($taken = get_record_select('artefact_installed_type', 'name = ? AND plugin != ?', + if ($taken = get_record_select('artefact_installed_type', 'name = ? AND plugin != ?', array($type, $pluginname))) { // Check the other plugin's code in case the duplicate type is being removed from it at the same time $otherclass = generate_class_name('artefact', $taken->plugin); @@ -1427,7 +1427,7 @@ function artefact_check_plugin_sanity($pluginname) { foreach ($types as $type) { $pluginclassname = generate_class_name('blocktype', $type); if (get_config('installed')) { - if (table_exists(new XMLDBTable('blocktype_installed')) && $taken = get_record_select('blocktype_installed', + if (table_exists(new XMLDBTable('blocktype_installed')) && $taken = get_record_select('blocktype_installed', 'name = ? AND artefactplugin != ? ', array($type, $pluginname))) { throw new InstallationException(get_string('blocktypenametaken', 'error', $type, @@ -1512,8 +1512,8 @@ function artefact_can_render_to($type, $format) { } function artefact_instance_from_id($id) { - $sql = 'SELECT a.*, i.plugin - FROM {artefact} a + $sql = 'SELECT a.*, i.plugin + FROM {artefact} a JOIN {artefact_installed_type} i ON a.artefacttype = i.name WHERE a.id = ?'; if (!$data = get_record_sql($sql, array($id))) { @@ -1588,8 +1588,8 @@ function artefact_instance_from_type($artefact_type, $user_id=null) { return new $classname($id); } else { - $sql = 'SELECT a.*, i.plugin - FROM {artefact} a + $sql = 'SELECT a.*, i.plugin + FROM {artefact} a JOIN {artefact_installed_type} i ON a.artefacttype = i.name WHERE a.artefacttype = ? AND a.owner = ?'; if (!$data = get_record_sql($sql, array($artefact_type, $user_id))) { @@ -1660,7 +1660,7 @@ function artefact_new_title($title, $artefacttype, $owner, $group, $institution) } /** - * Given a string of html, look for references to artefacts in it and return a + * Given a string of html, look for references to artefacts in it and return a * list of artefact IDs found * * @return array List of artefact IDs found diff --git a/htdocs/artefact/resume/blocktype/entireresume/lib.php b/htdocs/artefact/resume/blocktype/entireresume/lib.php index b131970e74..91879e5af6 100644 --- a/htdocs/artefact/resume/blocktype/entireresume/lib.php +++ b/htdocs/artefact/resume/blocktype/entireresume/lib.php @@ -50,8 +50,8 @@ class PluginBlocktypeEntireresume extends PluginBlocktype { return $smarty->fetch('blocktype:entireresume:content.tpl'); } - // Yes, we do have instance config. People are allowed to specify the title - // of the block, nothing else at this time. So in the next two methods we + // Yes, we do have instance config. People are allowed to specify the title + // of the block, nothing else at this time. So in the next two methods we // say yes and return no fields, so the title will be configurable. public static function has_instance_config() { return true; @@ -65,7 +65,7 @@ class PluginBlocktypeEntireresume extends PluginBlocktype { } /** - * Subscribe to the blockinstancecommit event to make sure all artefacts + * Subscribe to the blockinstancecommit event to make sure all artefacts * that should be in the blockinstance are */ public static function get_event_subscriptions() { @@ -78,7 +78,7 @@ class PluginBlocktypeEntireresume extends PluginBlocktype { } /** - * Hook for making sure that all resume artefacts are associated with a + * Hook for making sure that all resume artefacts are associated with a * blockinstance at blockinstance commit time */ public static function ensure_resume_artefacts_in_blockinstance($event, $blockinstance) { @@ -116,7 +116,7 @@ class PluginBlocktypeEntireresume extends PluginBlocktype { } /** - * Entireresume blocktype is only allowed in personal views, because + * Entireresume blocktype is only allowed in personal views, because * there's no such thing as group/site resumes */ public static function allowed_in_view(View $view) { diff --git a/htdocs/artefact/resume/blocktype/resumefield/lib.php b/htdocs/artefact/resume/blocktype/resumefield/lib.php index c237b6ea85..64167fd294 100644 --- a/htdocs/artefact/resume/blocktype/resumefield/lib.php +++ b/htdocs/artefact/resume/blocktype/resumefield/lib.php @@ -99,8 +99,8 @@ class PluginBlocktypeResumefield extends PluginBlocktype { } /** - * Deliberately enforce _no_ sort order. The database will return them in - * the order they were inserted, which means roughly the order that they + * Deliberately enforce _no_ sort order. The database will return them in + * the order they were inserted, which means roughly the order that they * are listed in the profile screen */ public static function artefactchooser_get_sort_order() { @@ -128,7 +128,7 @@ class PluginBlocktypeResumefield extends PluginBlocktype { } /** - * Resumefield blocktype is only allowed in personal views, because + * Resumefield blocktype is only allowed in personal views, because * there's no such thing as group/site resumes */ public static function allowed_in_view(View $view) { diff --git a/htdocs/artefact/resume/composite.json.php b/htdocs/artefact/resume/composite.json.php index b007715a97..7a064f7b7f 100644 --- a/htdocs/artefact/resume/composite.json.php +++ b/htdocs/artefact/resume/composite.json.php @@ -27,7 +27,7 @@ $othertable = 'artefact_resume_' . $type; $owner = $USER->get('id'); $sql = 'SELECT ar.*, a.owner - FROM {artefact} a + FROM {artefact} a JOIN {' . $othertable . '} ar ON ar.artefact = a.id WHERE a.owner = ? AND a.artefacttype = ? ORDER BY ar.displayorder'; diff --git a/htdocs/artefact/resume/export/leap/lib.php b/htdocs/artefact/resume/export/leap/lib.php index 241c03414c..80cae58034 100644 --- a/htdocs/artefact/resume/export/leap/lib.php +++ b/htdocs/artefact/resume/export/leap/lib.php @@ -15,7 +15,7 @@ */ /** - * The contact information artefact is deliberatly skipped from leap export, as + * The contact information artefact is deliberatly skipped from leap export, as * the information is duplicated from the profile anyway */ class LeapExportElementContactinformation extends LeapExportElement { @@ -25,7 +25,7 @@ class LeapExportElementContactinformation extends LeapExportElement { } /** - * The information in the personalinformation artefact is sent to the internal + * The information in the personalinformation artefact is sent to the internal * export plugin to be exported as persondata */ class LeapExportElementPersonalinformation extends LeapExportElement { @@ -76,7 +76,7 @@ class LeapExportElementPersonalinformation extends LeapExportElement { } /** - * The simple WYSIWYG resume fields are exported as simple entries with html + * The simple WYSIWYG resume fields are exported as simple entries with html * content */ class LeapExportElementResumeWysiwygField extends LeapExportElement { @@ -105,7 +105,7 @@ class LeapExportElementPersonalskill extends LeapExportElementResumeSkillField { /** * Base class for the composite artefacts. They consist of one or more - * entries per each artefact, and one entry to tie them all together in a + * entries per each artefact, and one entry to tie them all together in a * grouping (which is what this class represents) */ class LeapExportElementResumeComposite extends LeapExportElement { @@ -194,7 +194,7 @@ class LeapExportElementEmploymenthistory extends LeapExportElementResumeComposit /** - * Element to create pseudo-elements for composite children which aren't really + * Element to create pseudo-elements for composite children which aren't really * artefacts in Mahara but do need to map to LEAP elements */ abstract class LeapExportElementResumeCompositeChild extends LeapExportElement { @@ -207,8 +207,8 @@ abstract class LeapExportElementResumeCompositeChild extends LeapExportElement { $this->originalrecord = $child; $this->entrydata = $this->record_to_entrydata($child); $this->parentartefact = $parentartefact; - // We pass 'null' as the artefact ID, as this class represents - // composite children that aren't really artefacts. The field + // We pass 'null' as the artefact ID, as this class represents + // composite children that aren't really artefacts. The field // 'parentartefact' holds a reference to the parent. parent::__construct(null, $exporter); $this->assign_smarty_vars(); @@ -297,7 +297,7 @@ class LeapExportElementResumeCompositeChildMembership extends LeapExportElementR } /** - * Some of the resume composites need to be converted into more than one entry. + * Some of the resume composites need to be converted into more than one entry. * This class represents such a composite. */ abstract class LeapExportElementResumeCompositeChildWithSiblings extends LeapExportElementResumeCompositeChild { diff --git a/htdocs/artefact/resume/index.php b/htdocs/artefact/resume/index.php index 57ad290578..367961f861 100644 --- a/htdocs/artefact/resume/index.php +++ b/htdocs/artefact/resume/index.php @@ -69,11 +69,11 @@ $personalinformationform = pieform(array( ), 'placeofbirth' => array( 'type' => 'text', - 'defaultvalue' => ((!empty($personalinformation)) + 'defaultvalue' => ((!empty($personalinformation)) ? $personalinformation->get_composite('placeofbirth') : null), 'title' => get_string('placeofbirth', 'artefact.resume'), 'size' => 30, - ), + ), 'citizenship' => array( 'type' => 'text', 'defaultvalue' => ((!empty($personalinformation)) @@ -82,7 +82,7 @@ $personalinformationform = pieform(array( 'size' => 30, ), 'visastatus' => array( - 'type' => 'text', + 'type' => 'text', 'defaultvalue' => ((!empty($personalinformation)) ? $personalinformation->get_composite('visastatus') : null), 'title' => get_string('visastatus', 'artefact.resume'), @@ -90,7 +90,7 @@ $personalinformationform = pieform(array( 'size' => 30, ), 'gender' => array( - 'type' => 'radio', + 'type' => 'radio', 'defaultvalue' => ((!empty($personalinformation)) ? $personalinformation->get_composite('gender') : null), 'options' => array( diff --git a/htdocs/auth/browserid/db/upgrade.php b/htdocs/auth/browserid/db/upgrade.php index 27e2710422..faf54c80e8 100644 --- a/htdocs/auth/browserid/db/upgrade.php +++ b/htdocs/auth/browserid/db/upgrade.php @@ -6,7 +6,7 @@ * @author Francois Marier * @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. - * + * */ function xmldb_auth_browserid_upgrade($oldversion=0) { diff --git a/htdocs/auth/browserid/lang/en.utf8/auth.browserid.php b/htdocs/auth/browserid/lang/en.utf8/auth.browserid.php index c338e87e65..44b6b5dd42 100644 --- a/htdocs/auth/browserid/lang/en.utf8/auth.browserid.php +++ b/htdocs/auth/browserid/lang/en.utf8/auth.browserid.php @@ -6,7 +6,7 @@ * @author Francois Marier * @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(); diff --git a/htdocs/auth/browserid/lib.php b/htdocs/auth/browserid/lib.php index 0047cbdfc9..9810112291 100644 --- a/htdocs/auth/browserid/lib.php +++ b/htdocs/auth/browserid/lib.php @@ -6,7 +6,7 @@ * @author Francois Marier * @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(); diff --git a/htdocs/auth/browserid/login.php b/htdocs/auth/browserid/login.php index f2993c2108..63f8b2d6dd 100644 --- a/htdocs/auth/browserid/login.php +++ b/htdocs/auth/browserid/login.php @@ -6,7 +6,7 @@ * @author Francois Marier * @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); diff --git a/htdocs/auth/imap/lib.php b/htdocs/auth/imap/lib.php index 1f2307d638..da44fe13d3 100644 --- a/htdocs/auth/imap/lib.php +++ b/htdocs/auth/imap/lib.php @@ -66,11 +66,11 @@ class AuthImap extends Auth { $connectionstring = '{'. $this->config['host'] - .':'. + .':'. $this->config['port'] . $this->config['protocol'] - .'}'; + .'}'; try { $connection = imap_open($connectionstring, $user->username, $password, OP_HALFOPEN); diff --git a/htdocs/auth/internal/lib.php b/htdocs/auth/internal/lib.php index 4fca2ce0d3..c723434b6d 100644 --- a/htdocs/auth/internal/lib.php +++ b/htdocs/auth/internal/lib.php @@ -59,7 +59,7 @@ class AuthInternal extends Auth { } /** - * Internal authentication never auto-creates users - users instead + * Internal authentication never auto-creates users - users instead * register through register.php */ public function can_auto_create_users() { @@ -118,7 +118,7 @@ class AuthInternal extends Auth { /** * Internal authentication allows most standard us-keyboard-typable characters - * for username, as long as the username is between three and thirty + * for username, as long as the username is between three and thirty * characters in length. * * This method is NOT part of the authentication API. Other authentication @@ -135,7 +135,7 @@ class AuthInternal extends Auth { * Internal authentication allows most standard us-keyboard-typable characters - * for username, as long as the username is between three and 236 + * for username, as long as the username is between three and 236 * characters in length. * * This method is NOT part of the authentication API. Other authentication diff --git a/htdocs/auth/lib.php b/htdocs/auth/lib.php index a2a87cdebc..27abafc8b9 100644 --- a/htdocs/auth/lib.php +++ b/htdocs/auth/lib.php @@ -21,7 +21,7 @@ require_once(get_config('docroot') . '/lib/htmloutput.php'); class AuthUnknownUserException extends UserException {} /** - * An instance of an auth plugin failed during execution + * An instance of an auth plugin failed during execution * e.g. LDAP auth failed to connect to a directory * Developers can use this to fail an individual auth * instance, but not kill all from being tried. @@ -37,7 +37,7 @@ class AuthInstanceException extends UserException { } /** - * We tried to call a method on an auth plugin that hasn't been init'ed + * We tried to call a method on an auth plugin that hasn't been init'ed * successfully */ class UninitialisedAuthException extends SystemException {} @@ -112,7 +112,7 @@ abstract class Auth { $this->priority = $instance->priority; $this->authname = $instance->authname; - // Return now if the plugin type doesn't require any config + // Return now if the plugin type doesn't require any config // (e.g. internal) if ($this->has_instance_config == false) { return true; @@ -134,7 +134,7 @@ abstract class Auth { /** * The __get overloader is invoked when the requested member is private or * protected, or just doesn't exist. - * + * * @param string $name The name of the value to fetch * @return mixed The value */ @@ -153,7 +153,7 @@ abstract class Auth { /** * The __set overloader is invoked when the specified member is private or * protected, or just doesn't exist. - * + * * @param string $name The name of the value to set * @param mixed $value The value to assign * @return void @@ -170,9 +170,9 @@ abstract class Auth { /** * Check that the plugin has been initialised before we try to use it. - * + * * @throws UninitialisedAuthException - * @return bool + * @return bool */ protected function must_be_ready() { if ($this->ready == false) { @@ -184,7 +184,7 @@ abstract class Auth { /** * Fetch the URL that users can visit to change their passwords. This might * be a Moodle installation, for example. - * + * * @return mixed URL to change password or false if there is none */ public function changepasswordurl() { @@ -280,7 +280,7 @@ abstract class Auth { * The default behaviour is to assume that the password is in a valid form, * so make sure to implement this method if this is not the case! * - * This method is defined to be empty, so that authentication methods do + * This method is defined to be empty, so that authentication methods do * not have to specify a format if they do not need to. * * @param string $password The password to check @@ -303,21 +303,21 @@ abstract class Auth { } /** - * Called when a user is being logged out, either by clicking a logout - * link, their session timing out or some other method where their session - * is explicitly being ended with no more processing to take place on this + * Called when a user is being logged out, either by clicking a logout + * link, their session timing out or some other method where their session + * is explicitly being ended with no more processing to take place on this * page load. * - * You can use $USER->logout() to log a user out but continue page - * processing if necessary. register.php is an example of such a place + * You can use $USER->logout() to log a user out but continue page + * processing if necessary. register.php is an example of such a place * where this happens. * - * If you define this hook, you can call $USER->logout() in it if you need - * to before redirecting. Otherwise, it will be called for you once your + * If you define this hook, you can call $USER->logout() in it if you need + * to before redirecting. Otherwise, it will be called for you once your * hook has run. * - * If you do not explicitly redirect yourself, once this hook is finished - * the user will be redirected to the homepage with a message saying they + * If you do not explicitly redirect yourself, once this hook is finished + * the user will be redirected to the homepage with a message saying they * have been logged out successfully. * * This method has no parameters and needs no return value @@ -362,7 +362,7 @@ abstract class Auth { /******************************************************************************/ /** - * Handles authentication by setting up a session for a user if they are logged + * Handles authentication by setting up a session for a user if they are logged * in. * * This function combined with the Session class is smart - if the user is not @@ -470,7 +470,7 @@ function auth_setup () { $mnetuser = 0; if ($SESSION->get('mnetuser') && $authobj->parent) { - // We wish to remember that the user is an MNET user - even though + // We wish to remember that the user is an MNET user - even though // they're using the local login form $mnetuser = $USER->get('id'); } @@ -522,7 +522,7 @@ function auth_setup () { if ($USER->is_logged_in()) { return; } - + // Check if the page is public or the site is configured to be public. if (defined('PUBLIC') && !isset($_GET['login'])) { if ($lang = param_alphanumext('lang', null)) { @@ -535,14 +535,14 @@ function auth_setup () { if (defined('JSON')) { json_reply('global', get_string('nosessionreload'), 1); } - + auth_draw_login_page(null, $form); exit; } } /** - * + * * Returns all auth instances * * @return array Array of auth instance records @@ -561,10 +561,10 @@ function auth_get_auth_instances() { inst.displayname, i.instancename, i.authname - FROM + FROM {institution} inst, {auth_instance} i - WHERE + WHERE i.institution = inst.name ORDER BY inst.displayname, @@ -581,7 +581,7 @@ function auth_get_auth_instances() { /** - * + * * Given a list of institutions, returns all auth instances associated with them * * @return array Array of auth instance records @@ -597,10 +597,10 @@ function auth_get_auth_instances_for_institutions($institutions) { inst.displayname, i.instancename, i.authname - FROM + FROM {institution} inst, {auth_instance} i - WHERE + WHERE i.institution = inst.name AND inst.name IN (' . join(',', array_map('db_quote',$institutions)) . ') ORDER BY @@ -612,7 +612,7 @@ function auth_get_auth_instances_for_institutions($institutions) { /** - * Given an institution, returns the authentication methods used by it, sorted + * Given an institution, returns the authentication methods used by it, sorted * by priority. * * @param string $institution Name of the institution @@ -639,10 +639,10 @@ function auth_get_auth_instances_for_institution($institution=null) { i.authname, a.requires_config, a.requires_parent - FROM + FROM {auth_instance} i, {auth_installed} a - WHERE + WHERE a.name = i.authname AND i.institution = '. db_quote($institution).' ORDER BY @@ -661,7 +661,7 @@ function auth_get_auth_instances_for_institution($institution=null) { /** * Given a wwwroot, find any auth instances that can come from that host - * + * * @param string wwwroot of the host that is connecting to us * @return array array of record objects */ @@ -674,7 +674,7 @@ function auth_get_auth_instances_for_wwwroot($wwwroot) { aic.*, i.* FROM - {auth_instance} ai, + {auth_instance} ai, {auth_instance_config} aic, {institution} i WHERE @@ -687,7 +687,7 @@ function auth_get_auth_instances_for_wwwroot($wwwroot) { } /** - * Given an institution, get all the auth types EXCEPT those that are already + * Given an institution, get all the auth types EXCEPT those that are already * enabled AND do not require configuration. * * @param string $institution Name of the institution @@ -704,11 +704,11 @@ function auth_get_available_auth_types($institution=null) { SELECT DISTINCT a.name, a.requires_config - FROM + FROM {auth_installed} a - LEFT JOIN + LEFT JOIN {auth_instance} i - ON + ON a.name = i.authname AND i.institution = '. db_quote($institution).' WHERE @@ -716,7 +716,7 @@ function auth_get_available_auth_types($institution=null) { i.id IS NULL) AND a.active = 1 ORDER BY - a.name'; + a.name'; if (is_null($institution)) { $result = get_records_array('auth_installed', '','','name','name, requires_config'); @@ -830,8 +830,8 @@ function auth_check_required_fields() { $alwaysmandatoryfields = array_keys(ArtefactTypeProfile::get_always_mandatory_fields()); foreach(ArtefactTypeProfile::get_mandatory_fields() as $field => $type) { - // Always mandatory fields are stored in the usr table, so are part of - // the user session object. We can save a query by grabbing them from + // Always mandatory fields are stored in the usr table, so are part of + // the user session object. We can save a query by grabbing them from // the session. if (in_array($field, $alwaysmandatoryfields) && $USER->get($field) != null) { continue; @@ -1394,8 +1394,8 @@ class AuthFactory { static $authcache = array(); /** - * Take an instanceid and create an auth object for that instance. - * + * Take an instanceid and create an auth object for that instance. + * * @param int $id The id of the auth instance * @return Auth An intialised auth object or false, if the * instance doesn't exist (Should never happen) @@ -1450,7 +1450,7 @@ function login_submit(Pieform $form, $values) { // If the user doesn't exist, check for institutions that // want to create users automatically. try { - // Reset the LiveUser object, since we are attempting to create a + // Reset the LiveUser object, since we are attempting to create a // new user $SESSION->destroy_session(); $USER = new LiveUser(); @@ -1552,8 +1552,8 @@ function login_submit(Pieform $form, $values) { } catch (AuthUnknownUserException $e) { - // We weren't able to authenticate the user for some reason that - // probably isn't their fault (e.g. ldap extension not available + // We weren't able to authenticate the user for some reason that + // probably isn't their fault (e.g. ldap extension not available // when using ldap authentication) log_info($e->getMessage()); $SESSION->add_error_msg(get_string('loginfailed')); @@ -1716,7 +1716,7 @@ function auth_handle_account_expiries() { } } - + if ($expire) { // Inactivity (lastlogin is too old) @@ -1759,7 +1759,7 @@ function auth_handle_account_expiries() { } // Institution membership expiry - delete_records_sql('DELETE FROM {usr_institution} + delete_records_sql('DELETE FROM {usr_institution} WHERE ' . db_format_tsfield('expiry', false) . ' < ? AND expirymailsent = 1', array(time())); // Institution membership expiry warnings @@ -1860,7 +1860,7 @@ function auth_handle_institution_expiries() { /** * Clears out old session files * - * This should be run once every now and then (once a day is good), to clean + * This should be run once every now and then (once a day is good), to clean * out session files of users whose sessions have timed out. */ function auth_remove_old_session_files() { @@ -1901,7 +1901,7 @@ function auth_remove_old_session_files() { /** * Generates the login form for the sideblock. * - * {@internal{Not sure why this form definition doesn't use + * {@internal{Not sure why this form definition doesn't use * auth_get_login_form, but keep that in mind when making changes.}} */ function auth_generate_login_form() { @@ -2430,7 +2430,7 @@ class PluginAuth extends Plugin { } /** - * Can be overridden by plugins to assert when they are able to be used. + * Can be overridden by plugins to assert when they are able to be used. * For example, a plugin might check that a certain PHP extension is loaded */ public static function is_usable() { diff --git a/htdocs/auth/none/lib.php b/htdocs/auth/none/lib.php index df12a72876..6fd7956faf 100644 --- a/htdocs/auth/none/lib.php +++ b/htdocs/auth/none/lib.php @@ -13,7 +13,7 @@ defined('INTERNAL') || die(); require_once(get_config('docroot') . 'auth/lib.php'); /** - * This authentication method allows ANY user access to Mahara. It's useful for + * This authentication method allows ANY user access to Mahara. It's useful for * testing ONLY! */ class AuthNone extends Auth { diff --git a/htdocs/auth/saml/lib.php b/htdocs/auth/saml/lib.php index f6b742bf93..e8d4c9337b 100644 --- a/htdocs/auth/saml/lib.php +++ b/htdocs/auth/saml/lib.php @@ -245,7 +245,7 @@ class AuthSaml extends Auth { // tidy up the session for retries $SESSION->set('messages', array()); $SESSION->set('wantsurl', null); - + // redirect for logout of SAML 2.0 IdP redirect($CFG->wwwroot.'/auth/saml/index.php?logout=1'); } diff --git a/htdocs/auth/saml/validateurlsyntax.php b/htdocs/auth/saml/validateurlsyntax.php index dc6c98dab9..565eae9d9a 100644 --- a/htdocs/auth/saml/validateurlsyntax.php +++ b/htdocs/auth/saml/validateurlsyntax.php @@ -3,7 +3,7 @@ About validateUrlSyntax(): This function will verify if a http URL is formatted properly, returning either with true or false. - + I used rfc #2396 URI: Generic Syntax as my guide when creating the regular expression. For all the details see the comments below. @@ -12,7 +12,7 @@ Usage: validateUrlSyntax( url_to_check[, options]) url_to_check - string - The url to check - + options - string - A optional string of options to set which parts of the url are required, optional, or not allowed. Each option must be followed by a "+" for required, "?" for optional, or @@ -108,7 +108,7 @@ Changelog: August 29, 2003 -Allowed port numbers above 9999. Now allows up to 69999 - + Sometime, 2002 -Added new top level domains -aero, coop, museum, name, info, biz, pro @@ -130,7 +130,7 @@ Known Problems: Author(s): Rod Apeldoorn - rod(at)canowhoopass(dot)com - + Homepage: http://www.canowhoopass.com/ @@ -143,7 +143,7 @@ Thanks!: License: Copyright 2004, Rod Apeldoorn - + 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 2 of the License, or (at @@ -233,7 +233,7 @@ function validateUrlSyntax( $urladdr, $options="" ){ $aOptions[$key] = ''; } } - + // DEBUGGING - Unescape following line to display to screen current option values // echo '
'; print_r($aOptions); echo '
'; @@ -243,7 +243,7 @@ function validateUrlSyntax( $urladdr, $options="" ){ $unreserved = '[a-zA-Z0-9_.!~*' . '\'' . '()-]'; $escaped = '(%[0-9a-fA-F]{2})'; // Escape sequence - In Hex - %6d would be a 'm' $reserved = '[;/?:@&=+$,]'; // Special characters in the URI - + // Beginning Regular Expression // Scheme - Allows for 'http://', 'https://', 'mailto:', or 'ftp://' $scheme = '('; @@ -261,14 +261,14 @@ function validateUrlSyntax( $urladdr, $options="" ){ } $scheme .= ')' . $aOptions['s']; // End setting scheme - + // User Info - Allows for 'username@' or 'username:password@'. Note: contrary to rfc, I removed ':' from username section, allowing it only in password. // /---------------- Username -----------------------\ /-------------------------------- Password ------------------------------\ $userinfo = '((' . $unreserved . '|' . $escaped . '|[;&=+$,]' . ')+(:(' . $unreserved . '|' . $escaped . '|[;:&=+$,]' . ')+)' . $aOptions['P'] . '@)' . $aOptions['u']; - + // IP ADDRESS - Allows 0.0.0.0 to 255.255.255.255 $ipaddress = '((((2(([0-4][0-9])|(5[0-5])))|([01]?[0-9]?[0-9]))\.){3}((2(([0-4][0-9])|(5[0-5])))|([01]?[0-9]?[0-9])))'; - + // Tertiary Domain(s) - Optional - Multi - Although some sites may use other characters, the RFC says tertiary domains have the same naming restrictions as second level domains $domain_tertiary = '(' . $alphanum . '(([a-zA-Z0-9-]{0,62})' . $alphanum . ')?\.)*'; @@ -282,7 +282,7 @@ function validateUrlSyntax( $urladdr, $options="" ){ $domain_toplevel = '([a-zA-Z](([a-zA-Z0-9-]*)[a-zA-Z0-9])?)'; /* // Top Level Domain - Required - Domain List Current As Of December 2004. Use above escaped line to be forgiving of possible future TLD's $domain_toplevel = '(aero|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|post|pro|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ax|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)'; -*/ +*/ // Address can be IP address or Domain if ($aOptions['I'] === '{0}') { // IP Address Not Allowed @@ -293,24 +293,24 @@ function validateUrlSyntax( $urladdr, $options="" ){ $address = '((' . $ipaddress . ')|(' . $domain_tertiary . /* MDL-9295 $domain_secondary . */ $domain_toplevel . '))'; } $address = $address . $aOptions['a']; - + // Port Number - :80 or :8080 or :65534 Allows range of :0 to :65535 // (0-59999) |(60000-64999) |(65000-65499) |(65500-65529) |(65530-65535) $port_number = '(:(([0-5]?[0-9]{1,4})|(6[0-4][0-9]{3})|(65[0-4][0-9]{2})|(655[0-2][0-9])|(6553[0-5])))' . $aOptions['p']; - + // Path - Can be as simple as '/' or have multiple folders and filenames $path = '(/((;)?(' . $unreserved . '|' . $escaped . '|' . '[:@&=+$,]' . ')+(/)?)*)' . $aOptions['f']; - + // Query Section - Accepts ?var1=value1&var2=value2 or ?2393,1221 and much more $querystring = '(\?(' . $reserved . '|' . $unreserved . '|' . $escaped . ')*)' . $aOptions['q']; - + // Fragment Section - Accepts anchors such as #top $fragment = '(#(' . $reserved . '|' . $unreserved . '|' . $escaped . ')*)' . $aOptions['r']; - - + + // Building Regular Expression $regexp = '^' . $scheme . $userinfo . $address . $port_number . $path . $querystring . $fragment . '$'; - + // DEBUGGING - Uncomment Line Below To Display The Regular Expression Built // echo '
' . htmlentities(wordwrap($regexp,70,"\n",1)) . '
'; @@ -339,7 +339,7 @@ Usage: validateEmailSyntax( url_to_check[, options]) url_to_check - string - The url to check - + options - string - A optional string of options to set which parts of the url are required, optional, or not allowed. Each option must be followed by a "+" for required, "?" for optional, or @@ -355,13 +355,13 @@ Examples: validateEmailSyntax('mailto:george@fakemail.com', 's+') validateEmailSyntax('george@fakemail.com?subject=Hi%20George', 'q?') validateEmailSyntax('george@212.198.33.12', 'I?') - + Author(s): Rod Apeldoorn - rod(at)canowhoopass(dot)com - + Homepage: http://www.canowhoopass.com/ @@ -451,7 +451,7 @@ Usage: validateFtpSyntax( url_to_check[, options]) url_to_check - string - The url to check - + options - string - A optional string of options to set which parts of the url are required, optional, or not allowed. Each option must be followed by a "+" for required, "?" for optional, or diff --git a/htdocs/auth/user.php b/htdocs/auth/user.php index fb5755d544..d2d6ae67f8 100644 --- a/htdocs/auth/user.php +++ b/htdocs/auth/user.php @@ -88,7 +88,7 @@ class User { } /** - * + * */ public function find_by_id($id) { @@ -97,9 +97,9 @@ class User { } $sql = 'SELECT - *, - ' . db_format_tsfield('expiry') . ', - ' . db_format_tsfield('lastlogin') . ', + *, + ' . db_format_tsfield('expiry') . ', + ' . db_format_tsfield('lastlogin') . ', ' . db_format_tsfield('lastlastlogin') . ', ' . db_format_tsfield('lastaccess') . ', ' . db_format_tsfield('suspendedctime') . ', @@ -122,10 +122,10 @@ class User { } /** - * Populates this object with the user record identified by the given + * Populates this object with the user record identified by the given * username * - * @throws AuthUnknownUserException If the user cannot be found. Note that + * @throws AuthUnknownUserException If the user cannot be found. Note that * deleted users _can_ be found */ public function find_by_username($username) { @@ -159,10 +159,10 @@ class User { } /** - * Finds details for a user given a username and their authentication + * Finds details for a user given a username and their authentication * instance. * - * If the authentication instance is a child or a parent, its relation is + * If the authentication instance is a child or a parent, its relation is * checked too, because the user can enter the system by either method. */ public function find_by_instanceid_username($instanceid, $username, $remoteuser=false) { @@ -173,11 +173,11 @@ class User { $username = strtolower($username); if ($remoteuser) { - // See if the user has either the child or the parent authinstance. - // Most of the time, it's the parent auth instance that is - // stored with the user, but if they were created by (for - // example) SSO with no parent, then it will be the child that - // is stored. Nevertheless, a parent could be added later, and + // See if the user has either the child or the parent authinstance. + // Most of the time, it's the parent auth instance that is + // stored with the user, but if they were created by (for + // example) SSO with no parent, then it will be the child that + // is stored. Nevertheless, a parent could be added later, and // that should not matter in finding the user $parentwhere = ''; if ($parentid = get_field('auth_instance_config', 'value', 'field', 'parent', 'instance', $instanceid)) { @@ -202,7 +202,7 @@ class User { } $sql = 'SELECT - u.*, + u.*, ' . db_format_tsfield('u.expiry', 'expiry') . ', ' . db_format_tsfield('u.lastlogin', 'lastlogin') . ', ' . db_format_tsfield('u.lastlastlogin', 'lastlastlogin') . ', @@ -224,7 +224,7 @@ class User { } else { $sql = 'SELECT - *, + *, ' . db_format_tsfield('expiry') . ', ' . db_format_tsfield('lastlogin') . ', ' . db_format_tsfield('lastlastlogin') . ', @@ -250,7 +250,7 @@ class User { /** * Populates this object with the user record identified by a mobile 'token' * - * @throws AuthUnknownUserException If the user cannot be found. + * @throws AuthUnknownUserException If the user cannot be found. */ public function find_by_mobileuploadtoken($token, $username) { @@ -428,10 +428,10 @@ class User { $this->changed = false; } - /** + /** * This function returns a method for a particular * activity type, or null if it's not set. - * + * * @param int $key the activity type id */ public function get_activity_preference($key) { @@ -447,10 +447,10 @@ class User { $this->set('activityprefs', $activityprefs); } - /** + /** * This function returns a value for a particular * account preference, or null if it's not set. - * + * * @param string $key the field name */ public function get_account_preference($key) { @@ -734,7 +734,7 @@ class User { public function in_institution($institution, $role = null) { $institutions = $this->get('institutions'); - return isset($institutions[$institution]) + return isset($institutions[$institution]) && (is_null($role) || $institutions[$institution]->{$role}); } @@ -1334,7 +1334,7 @@ class LiveUser extends User { */ public function login($username, $password) { $sql = 'SELECT - *, + *, ' . db_format_tsfield('expiry') . ', ' . db_format_tsfield('lastlogin') . ', ' . db_format_tsfield('lastlastlogin') . ', @@ -1367,23 +1367,23 @@ class LiveUser extends User { return false; } - // Authentication instances that have parents do so because they cannot - // use Mahara's normal login mechanism - for example, XMLRPC. If the - // user is using one of these authentication instances, we look and try + // Authentication instances that have parents do so because they cannot + // use Mahara's normal login mechanism - for example, XMLRPC. If the + // user is using one of these authentication instances, we look and try // to use the parent. // - // There's no code here that prevents the authinstance being tried if - // it has no parent, mainly because that's an extra database lookup for - // the general case, and the authentication will probably just fail - // anyway. (XMLRPC, for example, leaves implementation of - // authenticate_user_account to the parent Auth class, which says 'not + // There's no code here that prevents the authinstance being tried if + // it has no parent, mainly because that's an extra database lookup for + // the general case, and the authentication will probably just fail + // anyway. (XMLRPC, for example, leaves implementation of + // authenticate_user_account to the parent Auth class, which says 'not // authorised' by default). $instanceid = $user->authinstance; if ($parentid = get_field('auth_instance_config', 'value', 'field', 'parent', 'instance', $instanceid)) { $instanceid = $parentid; } $auth = AuthFactory::create($instanceid); - + // catch the AuthInstanceException that allows authentication plugins to // fail but pass onto the next possible plugin try { @@ -1406,7 +1406,7 @@ class LiveUser extends User { catch (AuthInstanceException $e) { return false; } - + // Display a message to users who are only allowed to login via their // external application. if ($auth->authloginmsg != '') { @@ -1492,14 +1492,14 @@ class LiveUser extends User { } /** - * Updates information in a users' session once we know their session is + * Updates information in a users' session once we know their session is * continuing */ public function renew() { $time = time(); $this->set('logout_time', $time + get_config('session_timeout')); $oldlastaccess = $this->get('lastaccess'); - // If there is an access time update frequency, we use a cookie to + // If there is an access time update frequency, we use a cookie to // prevent updating before this time has expired. // If it is set to zero, we always update the accesstime. $accesstimeupdatefrequency = get_config('accesstimeupdatefrequency'); @@ -1514,11 +1514,11 @@ class LiveUser extends User { } /** - * When a user creates a security context by whatever method, we do some + * When a user creates a security context by whatever method, we do some * standard stuff * * @param object $user Record from the usr table - * @param integer $authinstance The ID of the authinstance that the user + * @param integer $authinstance The ID of the authinstance that the user * signed in with * @return void */ @@ -1529,9 +1529,9 @@ class LiveUser extends User { $this->authenticated = true; - // If the user has reauthenticated and they were an MNET user, we - // don't set these variables, because we wish to remember that they - // originally SSO-ed in from their other authinstance. See the + // If the user has reauthenticated and they were an MNET user, we + // don't set these variables, because we wish to remember that they + // originally SSO-ed in from their other authinstance. See the // session timeout code in auth_setup() for more info. if ($this->SESSION->get('mnetuser') != $user->id) { $this->SESSION->set('mnetuser', null); @@ -1579,7 +1579,7 @@ class LiveUser extends User { } /** - * When a user creates a security context by whatever method, we do some + * When a user creates a security context by whatever method, we do some * standard stuff * * @param int $user User ID diff --git a/htdocs/auth/xmlrpc/land.php b/htdocs/auth/xmlrpc/land.php index 303034d1e5..ba2088e0b6 100644 --- a/htdocs/auth/xmlrpc/land.php +++ b/htdocs/auth/xmlrpc/land.php @@ -58,8 +58,8 @@ if (empty($instances)) { throw new ParameterException(get_string('errnoauthinstances','auth', $remotewwwroot)); } -// If the user is already logged in as someone, log them out. That way, if -// XMLRPC authentication fails, the system isn't left looking stupid as it +// If the user is already logged in as someone, log them out. That way, if +// XMLRPC authentication fails, the system isn't left looking stupid as it // reports that the user couldn't log in while they actually are. if ($USER->is_logged_in()) { $USER->logout(); diff --git a/htdocs/auth/xmlrpc/lib.php b/htdocs/auth/xmlrpc/lib.php index 20252e504a..1f14b16e38 100644 --- a/htdocs/auth/xmlrpc/lib.php +++ b/htdocs/auth/xmlrpc/lib.php @@ -73,12 +73,12 @@ class AuthXmlrpc extends Auth { } /** - * The keepalive_client function is tricky to implement in Mahara. Moodle - * accomplishes this simply, because that application already updates the user + * The keepalive_client function is tricky to implement in Mahara. Moodle + * accomplishes this simply, because that application already updates the user * table once for every page view. * I think that we *really* don't want to do that with Mahara. There are heaps of * ways that we could implement this that are not very portable, but for now, it's - * best if we leave this on the todo pile. If it becomes crucially important for a + * best if we leave this on the todo pile. If it becomes crucially important for a * stakeholder, we can provide some implementation of it. */ public static function keepalive_client() {} @@ -119,20 +119,20 @@ class AuthXmlrpc extends Auth { try { $user = new User; if (get_config('usersuniquebyusername')) { - // When turned on, this setting means that it doesn't matter - // which other application the user SSOs from, they will be + // When turned on, this setting means that it doesn't matter + // which other application the user SSOs from, they will be // given the same account in Mahara. // - // This setting is one that has security implications unless - // only turned on by people who know what they're doing. In - // particular, every system linked to Mahara should be making - // sure that same username == same person. This happens for - // example if two Moodles are using the same LDAP server for + // This setting is one that has security implications unless + // only turned on by people who know what they're doing. In + // particular, every system linked to Mahara should be making + // sure that same username == same person. This happens for + // example if two Moodles are using the same LDAP server for // authentication. // - // If this setting is on, it must NOT be possible to self - // register on the site for ANY institution - otherwise users - // could simply pick usernames of people's accounts they wished + // If this setting is on, it must NOT be possible to self + // register on the site for ANY institution - otherwise users + // could simply pick usernames of people's accounts they wished // to steal. if ($institutions = get_column('institution', 'name', 'registerallowed', '1')) { log_warn("usersuniquebyusername is turned on but registration is allowed for an institution. " @@ -187,7 +187,7 @@ class AuthXmlrpc extends Auth { $user->expiry = null; $user->expirymailsent = 0; $user->lastlogin = time(); - + $user->firstname = $remoteuser->firstname; $user->lastname = $remoteuser->lastname; $user->email = $remoteuser->email; @@ -215,7 +215,7 @@ class AuthXmlrpc extends Auth { $userarray = (array)$userobj; db_commit(); - // Now we have fired the create event, we need to re-get the data + // Now we have fired the create event, we need to re-get the data // for this user $user = new User; $user->find_by_id($userobj->id); @@ -360,9 +360,9 @@ class AuthXmlrpc extends Auth { // We know who our user is now. Bring her back to life. $USER->reanimate($user->id, $this->instanceid); - // Set session variables to let the application know this session was - // initiated by MNET. Don't forget that users could initiate their - // sessions without MNET sometimes, which is why this data is stored in + // Set session variables to let the application know this session was + // initiated by MNET. Don't forget that users could initiate their + // sessions without MNET sometimes, which is why this data is stored in // the session object. $SESSION->set('mnetuser', $user->id); $SESSION->set('authinstance', $this->instanceid); @@ -405,9 +405,9 @@ class AuthXmlrpc extends Auth { } /** - * In practice, I don't think this method needs to return an accurate - * answer for this, because XMLRPC authentication doesn't use the standard - * authentication mechanisms, instead relying on land.php to handle + * In practice, I don't think this method needs to return an accurate + * answer for this, because XMLRPC authentication doesn't use the standard + * authentication mechanisms, instead relying on land.php to handle * everything. */ public function can_auto_create_users() { @@ -415,11 +415,11 @@ class AuthXmlrpc extends Auth { } /** - * Given a user and their remote user record, attempt to populate some of + * Given a user and their remote user record, attempt to populate some of * the user's profile fields and account settings from the remote data. * - * This does not change the first name, last name or e-mail fields, as these are - * dealt with differently depending on whether we are creating the user + * This does not change the first name, last name or e-mail fields, as these are + * dealt with differently depending on whether we are creating the user * record or updating it. * * This method attempts to set: @@ -487,8 +487,8 @@ class AuthXmlrpc extends Auth { public function kill_parent($username) { require_once(get_config('docroot') . 'api/xmlrpc/client.php'); - // For some people, the call to kill_children fails (when the remote - // site is a Moodle). We still haven't worked out why that is, but it's + // For some people, the call to kill_children fails (when the remote + // site is a Moodle). We still haven't worked out why that is, but it's // not a problem on the Mahara site try { $client = new Client(); @@ -517,16 +517,16 @@ class AuthXmlrpc extends Auth { $sessionlogouttime = $USER->get('logout_time'); if (get_config('usersuniquebyusername')) { - // The auth_remote_user will have a row for the institution in - // which the user SSOed into first. However, they could have - // been coming from somewhere else this time, which is why we - // can't use auth_remote_user for the lookup. Their username - // won't change for their Mahara account anyway, so just grab + // The auth_remote_user will have a row for the institution in + // which the user SSOed into first. However, they could have + // been coming from somewhere else this time, which is why we + // can't use auth_remote_user for the lookup. Their username + // won't change for their Mahara account anyway, so just grab // it out of the usr table. $remoteusername = get_field('usr', 'username', 'id', $USER->get('id')); } else { - // Check the auth_remote_user table for what the remote + // Check the auth_remote_user table for what the remote // application thinks the username is $remoteusername = get_field('auth_remote_user', 'remoteusername', 'localusr', $USER->get('id'), 'authinstance', $this->instanceid); if (!$remoteusername && $this->parent) { @@ -617,21 +617,21 @@ class PluginAuthXmlrpc extends PluginAuth { /** * A parent authority for XML-RPC is the data-source that a remote XML-RPC service - * communicates with to authenticate a user, for example, the XML-RPC server that - * we connect to might be authorising users against an LDAP store. If this is the - * case, and we know of the LDAP store, and our users are able to log on to our - * system and be authenticated directly against the LDAP store, then we honor that + * communicates with to authenticate a user, for example, the XML-RPC server that + * we connect to might be authorising users against an LDAP store. If this is the + * case, and we know of the LDAP store, and our users are able to log on to our + * system and be authenticated directly against the LDAP store, then we honor that * association. - * + * * In this way, the unique relationship is between the username and the authority, * not the username and the institution. This allows an institution to have a user * 'donal' on server 'LDAP-1' and a different user 'donal' on server 'LDAP-2'. - * - * Get a list of auth instances for this institution, and eliminate those that - * would not be valid parents (as they themselves require a parent). These are + * + * Get a list of auth instances for this institution, and eliminate those that + * would not be valid parents (as they themselves require a parent). These are * eliminated only to provide a saner interface to the admin user. In theory, it's * ok to chain authorities. - */ + */ $instances = auth_get_auth_instances_for_institution($institution); $options = array('None'); if (is_array($instances)) { @@ -764,7 +764,7 @@ class PluginAuthXmlrpc extends PluginAuth { * __get overloader. Unfortunately, the 'empty' function seems to just check for the * existence of the property - it doesn't call the overloader. Bug or feature? */ - + $tmpappname = $peer->appname; $elements['appname'] = array( @@ -906,7 +906,7 @@ class PluginAuthXmlrpc extends PluginAuth { $authinstance->priority = $lastinstance[0]->priority + 1; } } - + if (false == $peer->findByWwwroot($values['wwwroot'])) { try { $peer->bootstrap($values['wwwroot'], null, $values['appname'], $values['institution']); @@ -932,7 +932,7 @@ class PluginAuthXmlrpc extends PluginAuth { */ $peer->commit(); - + $authinstance->instancename = $values['instancename']; $authinstance->institution = $values['institution']; $authinstance->authname = $values['authname']; diff --git a/htdocs/blocktype/externalfeed/db/upgrade.php b/htdocs/blocktype/externalfeed/db/upgrade.php index 7b5af693a0..7c8329dd6a 100644 --- a/htdocs/blocktype/externalfeed/db/upgrade.php +++ b/htdocs/blocktype/externalfeed/db/upgrade.php @@ -14,14 +14,14 @@ defined('INTERNAL') || die(); function xmldb_blocktype_externalfeed_upgrade($oldversion=0) { if ($oldversion < 2008042100) { - // Add the 'image' column so that information about a feed's image can + // Add the 'image' column so that information about a feed's image can // be stored $table = new XMLDBTable('blocktype_externalfeed_data'); $field = new XMLDBField('image'); $field->setAttributes(XMLDB_TYPE_TEXT); add_field($table, $field); } - + if ($oldversion < 2008042101) { // We hit the 255 character limit for feed URLs if (is_postgres()) { diff --git a/htdocs/blocktype/externalfeed/lib.php b/htdocs/blocktype/externalfeed/lib.php index f36bed7a6e..e2edae59c1 100644 --- a/htdocs/blocktype/externalfeed/lib.php +++ b/htdocs/blocktype/externalfeed/lib.php @@ -92,7 +92,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { $smarty->assign('description', $data->description); $smarty->assign('url', $data->url); // 'full' won't be set for feeds created before 'full' support was added - $smarty->assign('full', isset($configdata['full']) ? $configdata['full'] : false); + $smarty->assign('full', isset($configdata['full']) ? $configdata['full'] : false); $smarty->assign('link', sanitize_url($data->link)); $smarty->assign('entries', $data->content); $smarty->assign('feedimage', self::make_feed_image_tag($data->image)); @@ -189,7 +189,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { } /** - * Optional method. If exists, allows this class to decide the title for + * Optional method. If exists, allows this class to decide the title for * all blockinstances of this type */ public static function get_instance_title(BlockInstance $bi) { @@ -279,7 +279,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { } public static function refresh_feeds() { - if (!$feeds = get_records_select_array('blocktype_externalfeed_data', + if (!$feeds = get_records_select_array('blocktype_externalfeed_data', 'lastupdate < ? OR lastupdate IS NULL', array(db_format_timestamp(strtotime('-30 minutes'))), '', 'id,url,authuser,authpassword,insecuresslmode,' . db_format_tsfield('lastupdate', 'tslastupdate'))) { return; @@ -338,7 +338,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { } } if (count($ids) == 0) { - delete_records('blocktype_externalfeed_data'); // just delete it all + delete_records('blocktype_externalfeed_data'); // just delete it all return; } $usedids = implode(', ', array_map('db_quote', array_keys($ids))); @@ -346,7 +346,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { } /** - * Parses the RSS feed given by $source. Throws an exception if the feed + * Parses the RSS feed given by $source. Throws an exception if the feed * isn't able to be parsed * * @param string $source The URI for the feed @@ -398,7 +398,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { catch (XML_Feed_Parser_Exception $e) { $cache[$source] = $e; throw $e; - // Don't catch other exceptions, they're an indication something + // Don't catch other exceptions, they're an indication something // really bad happened } @@ -455,7 +455,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { } /** - * Returns the HTML for the feed icon (not the little RSS one, but the + * Returns the HTML for the feed icon (not the little RSS one, but the * actual logo associated with the feed) */ private static function make_feed_image_tag($image) { @@ -486,8 +486,8 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { } $url = $image['url']; - // Try and fix URLs that aren't absolute. The standards all say URLs - // are supposed to be absolute in RSS feeds, yet still some people + // Try and fix URLs that aren't absolute. The standards all say URLs + // are supposed to be absolute in RSS feeds, yet still some people // can't even get the basics right... if (substr($url, 0, 1) == '/' && !empty($image['link'])) { $url = $image['link'] . $image['url']; @@ -559,8 +559,8 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { */ public static function import_create_blockinstance(array $config) { // Trigger retrieving the feed - // Note: may have to re-think this at some point - we'll end up retrieving all the - // RSS feeds for this user at import time, which could easily be quite + // Note: may have to re-think this at some point - we'll end up retrieving all the + // RSS feeds for this user at import time, which could easily be quite // slow. This plugin will need a bit of re-working for this to be possible if (!empty($config['config']['url'])) { try { diff --git a/htdocs/blocktype/lib.php b/htdocs/blocktype/lib.php index 8837c87940..fdc6a320e9 100644 --- a/htdocs/blocktype/lib.php +++ b/htdocs/blocktype/lib.php @@ -20,18 +20,18 @@ abstract class PluginBlocktype extends Plugin { public static function extra_xmldb_substitution($xml) { return str_replace( - '', + '', ' ', str_replace( - '', + '', '', $xml ) ); } - /** - * override this to return true if the blocktype + /** + * override this to return true if the blocktype * can only reasonably be placed once in a view */ public static function single_only() { @@ -83,17 +83,17 @@ abstract class PluginBlocktype extends Plugin { } /** - * If this blocktype contains artefacts, and uses the artefactchooser - * Pieform element to choose them, this method must return the definition + * If this blocktype contains artefacts, and uses the artefactchooser + * Pieform element to choose them, this method must return the definition * for the element. * - * This is used in view/artefactchooser.json.php to build pagination for + * This is used in view/artefactchooser.json.php to build pagination for * the element. * - * The element returned MUST have the name key set to either 'artefactid' + * The element returned MUST have the name key set to either 'artefactid' * or 'artefactids', depending on whether 'selectone' is true or false. * - * The element must also have the 'blocktype' key set to the name of the + * The element must also have the 'blocktype' key set to the name of the * blocktype that the form is for. * * @param mixed $default The default value for the element @@ -103,7 +103,7 @@ abstract class PluginBlocktype extends Plugin { /** * subclasses can override this if they need to do something a bit special * eg more than just what the BlockInstance->delete function does. - * + * * @param BlockInstance $instance */ public static function delete_instance(BlockInstance $instance) { } @@ -125,16 +125,16 @@ abstract class PluginBlocktype extends Plugin { } /** - * Blocktype plugins can implement this to perform custom pieform + * Blocktype plugins can implement this to perform custom pieform * validation, should they need it */ public static function instance_config_validate(Pieform $form, $values) { } /** * Most blocktype plugins will attach to artefacts. - * They should implement this function to keep a list of which ones. The - * result of this method is used to populate the view_artefact table, and - * thus decide whether an artefact is in a view for the purposes of access. + * They should implement this function to keep a list of which ones. The + * result of this method is used to populate the view_artefact table, and + * thus decide whether an artefact is in a view for the purposes of access. * See {@link artefact_in_view} for more information about this. * * Note that it should just handle top level artefacts. @@ -153,7 +153,7 @@ abstract class PluginBlocktype extends Plugin { return false; } - /** + /** * this is different to has_config - has_config is plugin wide config settings * this is specific to this TYPE of plugin and relates to whether individual instances * can be configured within a view @@ -178,7 +178,7 @@ abstract class PluginBlocktype extends Plugin { public static function get_blocktypes_for_category($category, View $view) { $sql = 'SELECT bti.name, bti.artefactplugin - FROM {blocktype_installed} bti + FROM {blocktype_installed} bti JOIN {blocktype_installed_category} btic ON btic.blocktype = bti.name JOIN {blocktype_installed_viewtype} btiv ON btiv.blocktype = bti.name WHERE btic.category = ? AND bti.active = 1 AND btiv.viewtype = ? @@ -198,19 +198,19 @@ abstract class PluginBlocktype extends Plugin { if (isset($localallowed) && is_array($localallowed) && !in_array($namespaced, $localallowed)) { continue; } - safe_require('blocktype', $namespaced); - // Note for later: this is Blocktype::allowed_in_view, which - // returns true if the blocktype should be insertable into the + safe_require('blocktype', $namespaced); + // Note for later: this is Blocktype::allowed_in_view, which + // returns true if the blocktype should be insertable into the // given view. - // e.g. for blogs it returns false when view owner is not set, + // e.g. for blogs it returns false when view owner is not set, // because blogs can't be inserted into group views. - // This could be different from whether a blockinstance is allowed - // to be copied into a View (see the other place in this file where + // This could be different from whether a blockinstance is allowed + // to be copied into a View (see the other place in this file where // allowed_in_view is called) // - // Note also that if we want templates to be able to have all - // blocktypes, we can add $view->get('template') here as part of - // the condition, and also to View::addblocktype and + // Note also that if we want templates to be able to have all + // blocktypes, we can add $view->get('template') here as part of + // the condition, and also to View::addblocktype and // View::get_category_data if (call_static_method(generate_class_name('blocktype', $namespaced), 'allowed_in_view', $view)) { $blocktypes[] = array( @@ -227,20 +227,20 @@ abstract class PluginBlocktype extends Plugin { } /** - * Takes config data for an existing blockinstance of this class and rewrites it so + * Takes config data for an existing blockinstance of this class and rewrites it so * it can be used to configure a block instance being put in a new view * - * This is used at view copy time, to give blocktypes the chance to change - * the configuration for a block based on aspects about the new view - for + * This is used at view copy time, to give blocktypes the chance to change + * the configuration for a block based on aspects about the new view - for * example, who will own it. * - * As an example - when the profile information blocktype is copied, we - * want it so that all the fields that were configured previously are + * As an example - when the profile information blocktype is copied, we + * want it so that all the fields that were configured previously are * pointing to the new owner's versions of those fields. * * The base method clears out any artefact IDs that are set. * - * @param View $view The view that the blocktype will be placed into (e.g. + * @param View $view The view that the blocktype will be placed into (e.g. * the View being created as a result of the copy) * @param array $configdata The configuration data for the old blocktype * @return array The new configuration data. @@ -275,19 +275,19 @@ abstract class PluginBlocktype extends Plugin { /** * Whether this blocktype is allowed in the given View. * - * Some blocktypes may wish to limit whether they're allowed in a View if, - * for example, they make no sense when the view is owned by a certain type + * Some blocktypes may wish to limit whether they're allowed in a View if, + * for example, they make no sense when the view is owned by a certain type * of owner. * - * For example, the 'profile information' blocktype makes no sense in a + * For example, the 'profile information' blocktype makes no sense in a * group View. * - * Of course, blocktypes could implement stranger rules - e.g. only allow - * when the view has 'ponies' in its description (BTW: such blocktypes + * Of course, blocktypes could implement stranger rules - e.g. only allow + * when the view has 'ponies' in its description (BTW: such blocktypes * would be totally awesome). * * @param View The View to check - * @return boolean Whether blocks of this blocktype are allowed in the + * @return boolean Whether blocks of this blocktype are allowed in the * given view. */ public static function allowed_in_view(View $view) { @@ -295,11 +295,11 @@ abstract class PluginBlocktype extends Plugin { } /** - * Given a block instance, returns a hash with enough information so that + * Given a block instance, returns a hash with enough information so that * we could reconstruct it if given this information again. * - * Import/Export routines can serialise this information appropriately, and - * unserialise it on the way back in, where it is passed to {@link + * Import/Export routines can serialise this information appropriately, and + * unserialise it on the way back in, where it is passed to {@link * import_create_blockinstance()} for creation of a new block instance. * * @param BlockInstance $bi The block instance to export config for @@ -309,8 +309,8 @@ abstract class PluginBlocktype extends Plugin { $configdata = $bi->get('configdata'); if (is_array($configdata)) { - // Unset a bunch of stuff that we don't want to export. These fields - // weren't being cleaned up before blockinstances were being saved + // Unset a bunch of stuff that we don't want to export. These fields + // weren't being cleaned up before blockinstances were being saved // previously, so we make sure they're not going to be in the result unset($configdata['blockconfig']); unset($configdata['id']); @@ -435,9 +435,9 @@ class BlockInstance { if (!empty($id)) { if (empty($data)) { if (!$data = get_record('block_instance','id',$id)) { - // TODO: 1) doesn't need get string here if this is the - // only place the exception is used - can be done in the - // class itself. 2) String needs to be defined, or taken + // TODO: 1) doesn't need get string here if this is the + // only place the exception is used - can be done in the + // class itself. 2) String needs to be defined, or taken // from lang/*/view.php where there is already one for it throw new BlockInstanceNotFoundException(get_string('blockinstancenotfound', 'error', $id)); } @@ -475,8 +475,8 @@ class BlockInstance { // only fetch this when we're asked, it's a db query. if (empty($this->maxorderincolumn)) { $this->maxorderincolumn = get_field( - 'block_instance', - 'max("order")', + 'block_instance', + 'max("order")', 'view', $this->view, 'column', $this->column); } } @@ -632,10 +632,10 @@ class BlockInstance { } /** - * Builds the HTML for the block, inserting the blocktype content at the + * Builds the HTML for the block, inserting the blocktype content at the * appropriate place * - * @param bool $configure Whether to render the block instance in configure + * @param bool $configure Whether to render the block instance in configure * mode * @return array Array with two keys: 'html' for raw html, 'javascript' for * javascript to run @@ -664,9 +664,9 @@ class BlockInstance { $js = $this->get_get_javascript_javascript($jsfiles) . $inlinejs; } catch (NotFoundException $e) { - // Whoops - where did the image go? There is possibly a bug - // somewhere else that meant that this blockinstance wasn't - // told that the image was previously deleted. But the block + // Whoops - where did the image go? There is possibly a bug + // somewhere else that meant that this blockinstance wasn't + // told that the image was previously deleted. But the block // instance is not allowed to treat this as a failure log_debug('Artefact not found when rendering a block instance. ' . 'There might be a bug with deleting artefacts of this type? ' @@ -954,8 +954,8 @@ class BlockInstance { } // We need to load any javascript required for the pieform. We do this - // by checking for an api function that has been added especially for - // the purpose, but that is not part of Pieforms. Maybe one day later + // by checking for an api function that has been added especially for + // the purpose, but that is not part of Pieforms. Maybe one day later // it will be though // $js = ''; foreach ($elements as $key => $element) { @@ -998,8 +998,8 @@ class BlockInstance { } $fordb = new StdClass; foreach (get_object_vars($this) as $k => $v) { - // The configdata is initially fetched from the database in string - // form. Calls to get() will convert it to an array on the fly. We + // The configdata is initially fetched from the database in string + // form. Calls to get() will convert it to an array on the fly. We // ensure that it is a string again here if ($k == 'configdata' && is_array($v)) { $fordb->{$k} = serialize($v); @@ -1119,7 +1119,7 @@ class BlockInstance { db_begin(); safe_require('blocktype', $this->get('blocktype')); call_static_method(generate_class_name('blocktype', $this->get('blocktype')), 'delete_instance', $this); - + delete_records('view_artefact', 'block', $this->id); delete_records('block_instance', 'id', $this->id); db_commit(); @@ -1130,14 +1130,14 @@ class BlockInstance { /** * Deletes an artefact from the blockinstance. * - * This is implemented in the baseclass by looking for arrays in the block - * instance configuration called 'artefactid' or 'artefactids', and + * This is implemented in the baseclass by looking for arrays in the block + * instance configuration called 'artefactid' or 'artefactids', and * removing the one we were looking to delete. This means two things: * - * 1) In order to not have to re-implement this method for new blocktypes, - * your blocktype should ALWAYS store its artefact IDs in the config data + * 1) In order to not have to re-implement this method for new blocktypes, + * your blocktype should ALWAYS store its artefact IDs in the config data * value 'artefactid' or in the array 'artefactids' - * 2) The block must ALWAYS continue to work even when artefacts are + * 2) The block must ALWAYS continue to work even when artefacts are * removed from it * * Don't override this method without doing the right thing in bulk_delete_artefacts too. @@ -1204,7 +1204,7 @@ class BlockInstance { } } - /** + /** * Get an artefact instance, checking republish permissions */ public function get_artefact_instance($id) { @@ -1234,11 +1234,11 @@ class BlockInstance { } /** - * Builds a new block instance as a copy of this one, taking into account + * Builds a new block instance as a copy of this one, taking into account * the Views being copied from and to. * - * Blocktypes can decide whether they want to be copied to the new View. The - * return value of this method should indicate whether the blocktype was + * Blocktypes can decide whether they want to be copied to the new View. The + * return value of this method should indicate whether the blocktype was * copied or not. * * @param View $view The view that this new blockinstance is being created for @@ -1263,9 +1263,9 @@ class BlockInstance { // Check to see if the block is allowed to be copied into the new View // - // Note for later: this is Blockinstance->allowed_in_view. This - // determines whether this blockinstance should be copied into a view. - // This could be a different question from BlockType::allowed_in_view! + // Note for later: this is Blockinstance->allowed_in_view. This + // determines whether this blockinstance should be copied into a view. + // This could be a different question from BlockType::allowed_in_view! // But for now they use the same method. if (!call_static_method($blocktypeclass, 'allowed_in_view', $view)) { return false; diff --git a/htdocs/blocktype/myfriends/lib.php b/htdocs/blocktype/myfriends/lib.php index 35a124b3fc..d4cf2b724a 100644 --- a/htdocs/blocktype/myfriends/lib.php +++ b/htdocs/blocktype/myfriends/lib.php @@ -88,7 +88,7 @@ class PluginBlocktypeMyfriends extends SystemBlocktype { $smarty->assign('friends', $friends); $smarty->assign('searchingforfriends', array('
', '')); - // If the user has no friends, try and display something useful, such + // If the user has no friends, try and display something useful, such // as a 'request friendship' button if (!$friends) { $loggedinid = $USER->get('id'); diff --git a/htdocs/blocktype/myviews/lib.php b/htdocs/blocktype/myviews/lib.php index b1c69b37cc..8e520a53d8 100644 --- a/htdocs/blocktype/myviews/lib.php +++ b/htdocs/blocktype/myviews/lib.php @@ -20,7 +20,7 @@ class PluginBlocktypeMyviews extends SystemBlocktype { public static function get_description() { return get_string('description', 'blocktype.myviews'); } - + public static function single_only() { return true; } diff --git a/htdocs/blocktype/wall/lib.php b/htdocs/blocktype/wall/lib.php index a49caddfed..0e72706747 100644 --- a/htdocs/blocktype/wall/lib.php +++ b/htdocs/blocktype/wall/lib.php @@ -40,7 +40,7 @@ class PluginBlocktypeWall extends SystemBlocktype { return ''; } $userid = (!empty($USER) ? $USER->get('id') : 0); - + $returnstr = ''; if (!$editing && $userid != 0) { $returnstr .= self::wallpost_form($instance); @@ -50,7 +50,7 @@ class PluginBlocktypeWall extends SystemBlocktype { $smarty = smarty_core(); $smarty->assign('instanceid', $instance->get('id')); $smarty->assign('ownwall', (!empty($USER) && $USER->get('id') == $owner)); - if ($posts = self::fetch_posts($instance)) { + if ($posts = self::fetch_posts($instance)) { $smarty->assign('wallposts', $posts); } else { @@ -236,17 +236,17 @@ EOF; $owner = $instance->get_view()->get('owner'); $userid = (!empty($USER) ? $USER->get('id') : 0); - // We select u.id because display_name uses the 'id' field to get - // information (we really should be passing objects with just user - // information to it, for safety). We select it again as 'userid' to + // We select u.id because display_name uses the 'id' field to get + // information (we really should be passing objects with just user + // information to it, for safety). We select it again as 'userid' to // avoid confusion in the templates $sql = ' SELECT bwp.id AS postid, bwp.instance, bwp.from, bwp.replyto, bwp.private, bwp.postdate, bwp.text,' . db_format_tsfield('postdate') . ', u.id, u.id AS userid, u.username, u.firstname, u.lastname, u.preferredname, u.staff, u.admin, u.email, u.profileicon, u.urlid - FROM {blocktype_wall_post} bwp + FROM {blocktype_wall_post} bwp JOIN {usr} u ON bwp.from = u.id WHERE bwp.instance = ? AND u.deleted = 0 - ' . (($owner != $userid) ? ' + ' . (($owner != $userid) ? ' AND (bwp.private = 0 OR bwp.from = ' . db_quote($userid) . ') ' : '' ) . ' ORDER BY bwp.postdate DESC '; @@ -255,7 +255,7 @@ EOF; if ($records = get_records_sql_array($sql, $params, $nolimit ? '' : 0, $nolimit ? '' : 10)) { return array_map( create_function( - '$item', + '$item', '$item->displayname = display_name($item); $item->profileurl = profile_url($item); $item->deletable = PluginBlocktypeWall::can_delete_wallpost($item->from, ' . intval($owner) .'); diff --git a/htdocs/blocktype/wall/theme/raw/pieforms/wallpost.php b/htdocs/blocktype/wall/theme/raw/pieforms/wallpost.php index 9116fc97af..dd4b02b293 100644 --- a/htdocs/blocktype/wall/theme/raw/pieforms/wallpost.php +++ b/htdocs/blocktype/wall/theme/raw/pieforms/wallpost.php @@ -1,6 +1,6 @@ id] = array( - 'type' => 'checkbox', + 'type' => 'checkbox', 'title' => $a->title, ); } diff --git a/htdocs/export/download.php b/htdocs/export/download.php index 094fbf8d96..9d05b3830d 100644 --- a/htdocs/export/download.php +++ b/htdocs/export/download.php @@ -47,7 +47,7 @@ function export_iframe_die($message, $link=null) { } /** - * Registered as the progress report handler for the export. Streams updates + * Registered as the progress report handler for the export. Streams updates * back to the browser * * @param int $percent How far complete the export is @@ -94,8 +94,8 @@ try { export_iframe_die($e->getMessage(), get_config('wwwroot') . 'view/index.php'); } -// Store the filename in the session, and redirect the iframe to it to trigger -// the download. Here it would be nice to trigger the download for everyone, +// Store the filename in the session, and redirect the iframe to it to trigger +// the download. Here it would be nice to trigger the download for everyone, // but alas this is not possible for people without javascript. $SESSION->set('exportfile', $exporter->get('exportdir') . $zipfile); $continueurl = 'download.php'; diff --git a/htdocs/export/html/lib.php b/htdocs/export/html/lib.php index ed4df26020..ccc5f562fa 100644 --- a/htdocs/export/html/lib.php +++ b/htdocs/export/html/lib.php @@ -22,7 +22,7 @@ class PluginExportHtml extends PluginExport { protected $zipfile; /** - * The name of the directory under which all the other directories and + * The name of the directory under which all the other directories and * files will be placed in the export */ protected $rootdir; @@ -35,14 +35,14 @@ class PluginExportHtml extends PluginExport { /** * List of stylesheets to include in the export. * - * This is keyed by artefact plugin name, the empty string key contains + * This is keyed by artefact plugin name, the empty string key contains * stylesheets that will be included on all pages. */ private $stylesheets = array('' => array()); /** * Whether the user requested to export just one view. In this case, - * the generated export doesn't have the home page - just the View is + * the generated export doesn't have the home page - just the View is * exported (plus artefacts of course) */ protected $exportingoneview = false; @@ -115,7 +115,7 @@ class PluginExportHtml extends PluginExport { $progressend = 25; $plugincount = count($plugins); - // First pass: find out which plugins are exporting like us, and ask + // First pass: find out which plugins are exporting like us, and ask // them about the static data they want to include in every template $i = 0; foreach ($plugins as $plugin) { @@ -257,7 +257,7 @@ class PluginExportHtml extends PluginExport { } /** - * Converts a relative path to a static file that the HTML export theme + * Converts a relative path to a static file that the HTML export theme * should have, to a path in the static export where the file will reside. * * This returns the path in the most appropriate theme. @@ -302,7 +302,7 @@ class PluginExportHtml extends PluginExport { /** * Sanitises a string meant to be used as a filesystem path. * - * Mahara allows file/folder artefact names to have slashes in them, which + * Mahara allows file/folder artefact names to have slashes in them, which * aren't legal on most real filesystems. */ public static function sanitise_path($path) { @@ -580,10 +580,10 @@ abstract class HtmlExportArtefactPlugin { } /** - * Provides a mechanism for converting the HTML generated by views and + * Provides a mechanism for converting the HTML generated by views and * artefacts for the HTML export. * - * Mostly, this means rewriting links to artefacts to point the correct place + * Mostly, this means rewriting links to artefacts to point the correct place * in the export. */ class HtmlExportOutputFilter { @@ -700,7 +700,7 @@ class HtmlExportOutputFilter { } /** - * Callback to replace links to views to point to the correct location in + * Callback to replace links to views to point to the correct location in * the HTML export */ private function replace_view_link($matches) { @@ -716,7 +716,7 @@ class HtmlExportOutputFilter { } /** - * Callback to replace links to artefact to point to the correct location + * Callback to replace links to artefact to point to the correct location * in the HTML export */ private function replace_artefact_link($matches) { @@ -750,7 +750,7 @@ class HtmlExportOutputFilter { } /** - * Callback to replace links to artefact/file/download.php to point to the + * Callback to replace links to artefact/file/download.php to point to the * correct file in the HTML export */ private function replace_download_link($matches) { @@ -762,7 +762,7 @@ class HtmlExportOutputFilter { return ''; } - // If artefact type not something that would be served by download.php, + // If artefact type not something that would be served by download.php, // replace link with nothing if ($artefact->get_plugin_name() != 'file') { return ''; @@ -778,7 +778,7 @@ class HtmlExportOutputFilter { } /** - * Callback to replace links to thumb.php to point to the correct file in + * Callback to replace links to thumb.php to point to the correct file in * the HTML export */ private function replace_thumbnail_link($matches) { @@ -861,20 +861,20 @@ class HtmlExportOutputFilter { } /** - * Generates a path, relative to the root of the export, that the given + * Generates a path, relative to the root of the export, that the given * file will appear in the export. * - * If the file is a thumbnail, the copy proxy is informed about it so that + * If the file is a thumbnail, the copy proxy is informed about it so that * the image can later be copied in to place. * * @param ArtefactTypeFileBase $file The file to get the exported path for - * @param array $options Options from the URL that was linking - * to the image - most importantly, size - * related options about how the image + * @param array $options Options from the URL that was linking + * to the image - most importantly, size + * related options about how the image * was thumbnailed, if it was. - * @param string $basefolder What folder in the export to dump the + * @param string $basefolder What folder in the export to dump the * file in - * @return string The relative path to where the file + * @return string The relative path to where the file * will be placed */ private function get_export_path_for_file(ArtefactTypeFileBase $file, array $options, $basefolder=null) { @@ -929,7 +929,7 @@ class HtmlExportOutputFilter { } /** - * Gathers a list of files that need to be copied into the export, as they're + * Gathers a list of files that need to be copied into the export, as they're * found by the HtmlExportOutputFilter */ class HtmlExportCopyProxy { diff --git a/htdocs/export/leap/lib.php b/htdocs/export/leap/lib.php index 2ba1080de1..ffe0bcfbed 100644 --- a/htdocs/export/leap/lib.php +++ b/htdocs/export/leap/lib.php @@ -880,7 +880,7 @@ class LeapExportElement { /** * The content type of whatever is going in the element. * - * Can only be one of 'text', 'html' or 'xhtml', and we're currently not + * Can only be one of 'text', 'html' or 'xhtml', and we're currently not * using XHTML in Mahara. * * @return string @@ -893,7 +893,7 @@ class LeapExportElement { /** * The main content of the element, which goes between tags. * - * Escaping of this value happens in the template, depending on the content + * Escaping of this value happens in the template, depending on the content * type, which can be set with {@link get_content_type()}. * * The default is to use the artefact description. @@ -1010,7 +1010,7 @@ class LeapExportElement { } /** - * Converts a tag to a 'normalised' tag, as per + * Converts a tag to a 'normalised' tag, as per * http://wiki.cetis.ac.uk/2009-03/Leap2A_categories#Plain_tags * * The method of normalisation isn't specified at @@ -1062,10 +1062,10 @@ function export_leap_rewrite_links($html) { return $outputfilter->filter($html); } /** - * Provides a mechanism for converting the HTML generated by views and + * Provides a mechanism for converting the HTML generated by views and * artefacts for the LEAP export. * - * This is primarily so that the content of view blocktypes and links to + * This is primarily so that the content of view blocktypes and links to * artefacts get rewritten to point to entries within the export. */ class LeapExportOutputFilter { @@ -1110,7 +1110,7 @@ class LeapExportOutputFilter { } /** - * Callback to replace links to artefact to point to the correct entry + * Callback to replace links to artefact to point to the correct entry * in the LEAP export */ private function replace_artefact_link($matches) { @@ -1119,14 +1119,14 @@ class LeapExportOutputFilter { return ''; } - // If the artefact isn't in the export, then we can't provide an + // If the artefact isn't in the export, then we can't provide an // export-relative link to it log_debug("Not providing an export-relative link for $artefactid"); return $matches[0]; } /** - * Callback to replace links to artefact/file/download.php to point to the + * Callback to replace links to artefact/file/download.php to point to the * correct entry in the LEAP export */ private function replace_download_link($matches) { diff --git a/htdocs/export/lib.php b/htdocs/export/lib.php index 948b999fe1..efcbb5b98b 100644 --- a/htdocs/export/lib.php +++ b/htdocs/export/lib.php @@ -17,12 +17,12 @@ require_once(get_config('docroot') . '/artefact/lib.php'); /** * Base class for all Export plugins. * - * This class does some basic setup for export plugins, as well as interfacing - * with the Mahara Plugin API. Mostly, the work of generating exports is + * This class does some basic setup for export plugins, as well as interfacing + * with the Mahara Plugin API. Mostly, the work of generating exports is * delegated to the plugins themselves. * - * TODO: split generation of an archive file from the export() method, - * implement zipping the export in a method in this class to reduce + * TODO: split generation of an archive file from the export() method, + * implement zipping the export in a method in this class to reduce * duplication. */ abstract class PluginExport extends Plugin { @@ -33,7 +33,7 @@ abstract class PluginExport extends Plugin { const EXPORT_ALL_VIEWS = -1; /** - * Export only certain views - used internally when a list of views is + * Export only certain views - used internally when a list of views is * passed to the constructor */ const EXPORT_LIST_OF_VIEWS = -2; @@ -49,7 +49,7 @@ abstract class PluginExport extends Plugin { const EXPORT_ARTEFACTS_FOR_VIEWS = -4; /** - * Export only certain artefacts - used internally when a list of artefacts + * Export only certain artefacts - used internally when a list of artefacts * is passed to the constructor */ const EXPORT_LIST_OF_ARTEFACTS = -5; @@ -106,13 +106,13 @@ abstract class PluginExport extends Plugin { protected $user; /** - * Represents the mode for exporting views - one of the class consts + * Represents the mode for exporting views - one of the class consts * defined above */ protected $viewexportmode; /** - * Represents the mode for exporting artefacts - one of the class consts + * Represents the mode for exporting artefacts - one of the class consts * defined above */ protected $artefactexportmode; @@ -120,7 +120,7 @@ abstract class PluginExport extends Plugin { /** * The time the export was generated. * - * Technically, this is the time at which the export object was created, + * Technically, this is the time at which the export object was created, * not the time at which export() was called. */ protected $exporttime; @@ -305,7 +305,7 @@ abstract class PluginExport extends Plugin { /** * Accessor * - * @param string $field The field to get (see the class definition to find + * @param string $field The field to get (see the class definition to find * which fields are available) */ public function get($field) { @@ -318,19 +318,19 @@ abstract class PluginExport extends Plugin { /** * Notifies the registered progress callback about the progress in generating the export. * - * This is provided as exports can take a long time to generate. Export - * plugins are encouraged to call this at least after performing some major - * operation, and should always call it saying when the execution of + * This is provided as exports can take a long time to generate. Export + * plugins are encouraged to call this at least after performing some major + * operation, and should always call it saying when the execution of * export() is done. However, it is unnecessary to call it too often. * - * For testing purposes, you may find it useful to register a progress - * callback that simply log_debug()s the data, so you can check that the + * For testing purposes, you may find it useful to register a progress + * callback that simply log_debug()s the data, so you can check that the * percentage is always increasing, for example. * - * @param int $percent The total percentage of the way through generating - * the export. The base class constructor hands over + * @param int $percent The total percentage of the way through generating + * the export. The base class constructor hands over * control claiming 10% of the work is done. - * @param string $status A string describing the current status of the + * @param string $status A string describing the current status of the * export - e.g. 'Exporting Artefact (20/75)' */ protected function notify_progress_callback($percent, $status) { @@ -379,7 +379,7 @@ abstract class PluginExport extends Plugin { } /** - * Looks in the export staging area in dataroot and deletes old, unneeded + * Looks in the export staging area in dataroot and deletes old, unneeded * exports. */ function export_cleanup_old_exports() { @@ -395,13 +395,13 @@ function export_cleanup_old_exports() { $exportdir = new DirectoryIterator($basedir); $mintime = time() - (12 * 60 * 60); // delete exports older than 12 hours - // The export dir contains one directory for each user who has created + // The export dir contains one directory for each user who has created // an export, named after their UID foreach ($exportdir as $userdir) { if ($userdir->isDot()) continue; - // Each user's directory contains one directory for each export - // they made, named as the unix timestamp of the time they + // Each user's directory contains one directory for each export + // they made, named as the unix timestamp of the time they // generated it $udir = new DirectoryIterator($basedir . $userdir->getFilename()); foreach ($udir as $dir) { diff --git a/htdocs/group/interactions.php b/htdocs/group/interactions.php index be55770594..21fd32a28b 100644 --- a/htdocs/group/interactions.php +++ b/htdocs/group/interactions.php @@ -32,7 +32,7 @@ $interactiontypes = array_flip( ) ); -if (!$interactions = get_records_select_array('interaction_instance', +if (!$interactions = get_records_select_array('interaction_instance', '"group" = ? AND deleted = ?', array($group->id, 0), 'plugin, ctime', 'id, plugin, title')) { $interactions = array(); diff --git a/htdocs/group/requestjoin.php b/htdocs/group/requestjoin.php index 059de38ded..a8eb0d057b 100644 --- a/htdocs/group/requestjoin.php +++ b/htdocs/group/requestjoin.php @@ -66,7 +66,7 @@ function requestjoingroup_submit(Pieform $form, $values) { 'group' => $group->id, 'member' => $USER->get('id'), 'ctime' => db_format_timestamp(time()), - 'reason' => isset($values['reason']) ? $values['reason'] : null + 'reason' => isset($values['reason']) ? $values['reason'] : null ) ); // Send request to all group admins @@ -76,7 +76,7 @@ function requestjoingroup_submit(Pieform $form, $values) { $adminlang = get_user_language($groupadmin); if (isset($values['reason']) && $values['reason'] != '') { $message = get_string_from_language($adminlang, 'grouprequestmessagereason', 'group', display_name($USER, get_record('usr', 'id', $groupadmin)), $group->name, $values['reason']); - } + } else { $message = get_string_from_language($adminlang, 'grouprequestmessage', 'group', display_name($USER, get_record('usr', 'id', $groupadmin)), $group->name); } diff --git a/htdocs/grouptype/lib.php b/htdocs/grouptype/lib.php index 1b8fda8d45..e0f29c8837 100644 --- a/htdocs/grouptype/lib.php +++ b/htdocs/grouptype/lib.php @@ -60,7 +60,7 @@ abstract class GroupType { public static abstract function user_allowed_join_types($user); /** - * Returns whether the currently logged in user can create a group of this + * Returns whether the currently logged in user can create a group of this * grouptype */ public static function can_be_created_by_user() { diff --git a/htdocs/init.php b/htdocs/init.php index 3cc376c187..d1647b4288 100644 --- a/htdocs/init.php +++ b/htdocs/init.php @@ -140,7 +140,7 @@ try { } if (!empty($CFG->dbpersist)) { // Use persistent connection (default) $dbconnected = $db->PConnect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname); - } + } else { // Use single connection $dbconnected = $db->Connect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname); } @@ -181,7 +181,7 @@ try { db_ignore_sql_exceptions(true); load_config(); db_ignore_sql_exceptions(false); -} +} catch (SQLException $e) { db_ignore_sql_exceptions(false); } @@ -274,13 +274,13 @@ if (!isset($CFG->noreplyaddress) && isset($_SERVER['HTTP_HOST'])) { } } -if (!get_config('theme')) { - // if it's not set, we're probably not installed, +if (!get_config('theme')) { + // if it's not set, we're probably not installed, // so set it in $CFG directly rather than the db which doesn't yet exist - $CFG->theme = 'default'; + $CFG->theme = 'default'; } -if (defined('INSTALLER')) { +if (defined('INSTALLER')) { // Custom themes sometimes cause upgrades to fail. $CFG->theme = 'default'; } @@ -402,15 +402,15 @@ else { * Initializes our performance info early. * * Pairs up with get_performance_info() which is actually - * in lib/mahara.php. This function is here so that we can - * call it before all the libs are pulled in. + * in lib/mahara.php. This function is here so that we can + * call it before all the libs are pulled in. * * @uses $PERF */ function init_performance_info() { global $PERF; - + $PERF = new StdClass; $PERF->dbreads = $PERF->dbwrites = $PERF->dbcached = 0; $PERF->logwrites = 0; @@ -421,6 +421,6 @@ function init_performance_info() { $PERF->startmemory = memory_get_usage(); } if (function_exists('posix_times')) { - $PERF->startposixtimes = posix_times(); + $PERF->startposixtimes = posix_times(); } } diff --git a/htdocs/interaction/forum/lib.php b/htdocs/interaction/forum/lib.php index 90244f226c..e10904a9fc 100644 --- a/htdocs/interaction/forum/lib.php +++ b/htdocs/interaction/forum/lib.php @@ -412,7 +412,7 @@ EOF; } /** - * When a user joins a group, subscribe them automatically to all forums + * When a user joins a group, subscribe them automatically to all forums * that should be subscribable * * @param array $eventdata @@ -476,7 +476,7 @@ EOF; } /** - * Optional method. Takes a list of forums and sorts them according to + * Optional method. Takes a list of forums and sorts them according to * their weights for the sideblock * * @param array $forums An array of hashes of forum data @@ -489,10 +489,10 @@ EOF; $weights = get_records_assoc('interaction_forum_instance_config', 'field', 'weight', 'forum', 'forum, value'); foreach ($forums as &$forum) { - // Note: forums expect every forum to have a 'weight' record in the - // forum instance config table, so we don't need to check that - // there is a weight for the forum here - there should be, - // otherwise someone has futz'd with the database or there's a bug + // Note: forums expect every forum to have a 'weight' record in the + // forum instance config table, so we don't need to check that + // there is a weight for the forum here - there should be, + // otherwise someone has futz'd with the database or there's a bug // elsewhere that allowed this to happen $forum->weight = $weights[$forum->id]->value; } @@ -535,7 +535,7 @@ EOF; /** * Generates a random key to use for unsubscription requests. * - * See the interaction_forum_subscription_* tables and related operations + * See the interaction_forum_subscription_* tables and related operations * on them for more information. * * @return string A random key diff --git a/htdocs/interaction/forum/topic.php b/htdocs/interaction/forum/topic.php index a90775b8ed..6f3f553973 100644 --- a/htdocs/interaction/forum/topic.php +++ b/htdocs/interaction/forum/topic.php @@ -304,7 +304,7 @@ function renderpost($post, $indent) { function subscribe_topic_validate(Pieform $form, $values) { if (!is_logged_in()) { - // This page is public, so the access denied exception will cause a + // This page is public, so the access denied exception will cause a // login attempt throw new AccessDeniedException(); } diff --git a/htdocs/interaction/lib.php b/htdocs/interaction/lib.php index b521cc362f..a110fef873 100644 --- a/htdocs/interaction/lib.php +++ b/htdocs/interaction/lib.php @@ -16,7 +16,7 @@ defined('INTERNAL') || die(); * Base interaction plugin class * @abstract */ -abstract class PluginInteraction extends Plugin { +abstract class PluginInteraction extends Plugin { /** * override this to add extra pieform elements to the edit instance form @@ -82,7 +82,7 @@ abstract class PluginInteraction extends Plugin { } -/** +/** * Base class for interaction instances */ abstract class InteractionInstance { @@ -169,7 +169,7 @@ abstract class InteractionInstance { $this->dirty = false; return; } - + set_field('interaction_instance', 'deleted', 1, 'id', $this->id); $this->dirty = false; @@ -231,7 +231,7 @@ function edit_interaction_submit(Pieform $form, $values) { } function delete_interaction_submit(Pieform $form, $values) { - + require_once(get_config('docroot') . 'interaction/lib.php'); $instance = interaction_instance_from_id($values['id']); diff --git a/htdocs/json/taglist.php b/htdocs/json/taglist.php index a1b4ca753d..0c589eb60d 100644 --- a/htdocs/json/taglist.php +++ b/htdocs/json/taglist.php @@ -37,7 +37,7 @@ if ($USER->is_logged_in()) { SELECT tag,COUNT(*) AS count FROM {collection_tag} t INNER JOIN {collection} c ON t.collection=c.id WHERE c.owner=? GROUP BY 1 " . $usertags . " ) tags - GROUP BY tag + GROUP BY tag ORDER BY LOWER(tag) ", array($userid, $userid, $userid) diff --git a/htdocs/lib/activity.php b/htdocs/lib/activity.php index c0f01be8b9..4100ad0bb2 100644 --- a/htdocs/lib/activity.php +++ b/htdocs/lib/activity.php @@ -14,9 +14,9 @@ defined('INTERNAL') || die(); /** * This is the function to call whenever anything happens * that is going to end up on a user's activity page. - * + * * @param string $activitytype type of activity - * @param mixed $data data + * @param mixed $data data */ function activity_occurred($activitytype, $data, $plugintype=null, $pluginname=null, $delay=null) { $at = activity_locate_typerecord($activitytype, $plugintype, $pluginname); @@ -35,14 +35,14 @@ function activity_occurred($activitytype, $data, $plugintype=null, $pluginname=n } } -/** - * This function dispatches all the activity stuff to whatever notification - * plugin it needs to, and figures out all the implications of activity and who +/** + * This function dispatches all the activity stuff to whatever notification + * plugin it needs to, and figures out all the implications of activity and who * needs to know about it. - * + * * @param object $activitytype record from database table activity_type * @param mixed $data must contain message to save. - * each activity type has different requirements of $data - + * each activity type has different requirements of $data - * - viewaccess must contain $owner userid of view owner AND $view (id of view) and $oldusers array of userids before access change was committed. * @param $cron = true if called by a cron job * @param object $queuedactivity record of the activity in the queue (from the table activity_queue) @@ -56,9 +56,9 @@ function handle_activity($activitytype, $data, $cron=false, $queuedactivity=null $classname = 'ActivityType' . ucfirst($activitytype->name); if (!empty($activitytype->plugintype)) { safe_require($activitytype->plugintype, $activitytype->pluginname); - $classname = 'ActivityType' . - ucfirst($activitytype->plugintype) . - ucfirst($activitytype->pluginname) . + $classname = 'ActivityType' . + ucfirst($activitytype->plugintype) . + ucfirst($activitytype->pluginname) . ucfirst($activitytype->name); } @@ -76,7 +76,7 @@ function handle_activity($activitytype, $data, $cron=false, $queuedactivity=null } /** - * this function returns an array of users who subsribe to a particular activitytype + * this function returns an array of users who subsribe to a particular activitytype * including the notification method they are using to subscribe to it. * * @param int $activitytype the id of the activity type @@ -91,7 +91,7 @@ function activity_get_users($activitytype, $userids=null, $userobjs=null, $admin $values = array($activitytype); $sql = ' SELECT - u.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, u.admin, u.staff, + u.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, u.admin, u.staff, p.method, ap.value AS lang, apm.value AS maildisabled, aic.value AS mnethostwwwroot, h.appname AS mnethostapp FROM {usr} u @@ -114,7 +114,7 @@ function activity_get_users($activitytype, $userids=null, $userobjs=null, $admin if (!empty($userobjs) && is_array($userobjs)) { $sql .= ' AND u.id IN (' . implode(',',db_array_to_ph($userobjs)) . ')'; $values = array_merge($values, array_to_fields($userobjs)); - } + } else if (!empty($userids) && is_array($userids)) { $sql .= ' AND u.id IN (' . implode(',',db_array_to_ph($userids)) . ')'; $values = array_merge($values, $userids); @@ -185,7 +185,7 @@ function activity_process_queue() { $last_processed_userid = handle_activity($activity->type, $data, true, $activity); } catch (MaharaException $e) { - // Exceptions can happen while processing the queue, we just + // Exceptions can happen while processing the queue, we just // log them and continue log_debug($e->getMessage()); } @@ -436,15 +436,15 @@ function activity_get_viewaccess_users($view, $owner, $type) { $type = activity_locate_typerecord($type); $sql = "SELECT userid, u.*, p.method, ap.value AS lang FROM ( - SELECT (CASE WHEN usr1 = ? THEN usr2 ELSE usr1 END) AS userid + SELECT (CASE WHEN usr1 = ? THEN usr2 ELSE usr1 END) AS userid FROM {usr_friend} f JOIN {view} v ON (v.owner = f.usr1 OR v.owner = f.usr2) JOIN {view_access} vu ON vu.view = v.id - WHERE (usr1 = ? OR usr2 = ?) AND vu.accesstype = 'friends' AND v.id = ? - UNION SELECT usr AS userid - FROM {view_access} u + WHERE (usr1 = ? OR usr2 = ?) AND vu.accesstype = 'friends' AND v.id = ? + UNION SELECT usr AS userid + FROM {view_access} u WHERE u.view = ? - UNION SELECT m.member + UNION SELECT m.member FROM {group_member} m JOIN {view_access} vg ON vg.group = m.group JOIN {group} g ON (g.id = vg.group AND g.deleted = 0 AND g.viewnotify = 1) @@ -470,10 +470,10 @@ function activity_locate_typerecord($activitytype, $plugintype=null, $pluginname } else { if (empty($plugintype) && empty($pluginname)) { - $at = get_record_select('activity_type', - 'name = ? AND plugintype IS NULL AND pluginname IS NULL', + $at = get_record_select('activity_type', + 'name = ? AND plugintype IS NULL AND pluginname IS NULL', array($activitytype)); - } + } else { $at = get_record('activity_type', 'name', $activitytype, 'plugintype', $plugintype, 'pluginname', $pluginname); } @@ -540,8 +540,8 @@ abstract class ActivityType { protected $fromuser; /** - * When sending notifications, should the email of the person sending it be - * hidden? (Almost always yes, will cause the email to appear to come from + * When sending notifications, should the email of the person sending it be + * hidden? (Almost always yes, will cause the email to appear to come from * the 'noreply' address) */ protected $hideemail = true; @@ -611,7 +611,7 @@ abstract class ActivityType { } public function to_stdclass() { - return (object)get_object_vars($this); + return (object)get_object_vars($this); } public function get_string_for_user($user, $string) { @@ -651,7 +651,7 @@ abstract class ActivityType { } return $this->message; } - + public function get_subject($user) { if (empty($this->subject)) { return $this->get_string_for_user($user, 'subject'); @@ -797,7 +797,7 @@ abstract class ActivityType { } -abstract class ActivityTypeAdmin extends ActivityType { +abstract class ActivityTypeAdmin extends ActivityType { public function __construct($data, $cron=false) { parent::__construct($data, $cron); @@ -806,7 +806,7 @@ abstract class ActivityTypeAdmin extends ActivityType { } class ActivityTypeContactus extends ActivityTypeAdmin { - + protected $fromname; protected $fromemail; protected $hideemail = false; @@ -819,7 +819,7 @@ class ActivityTypeContactus extends ActivityTypeAdmin { * - fromaddress (email address) * - fromuser (int) (if a logged in user) */ - function __construct($data, $cron=false) { + function __construct($data, $cron=false) { parent::__construct($data, $cron); if (!empty($this->fromuser)) { $this->url = profile_url($this->fromuser, false); @@ -836,7 +836,7 @@ class ActivityTypeContactus extends ActivityTypeAdmin { } function get_message($user) { - return get_string_from_language($user->lang, 'newcontactusfrom', 'activity') . ' ' . $this->fromname + return get_string_from_language($user->lang, 'newcontactusfrom', 'activity') . ' ' . $this->fromname . ' <' . $this->fromemail .'>' . (isset($this->subject) ? ': ' . $this->subject : '') . "\n\n" . $this->message; } @@ -861,7 +861,7 @@ class ActivityTypeObjectionable extends ActivityTypeAdmin { * - reporter (int) * - ctime (int) (optional) */ - function __construct($data, $cron=false) { + function __construct($data, $cron=false) { parent::__construct($data, $cron); require_once('view.php'); @@ -963,7 +963,7 @@ class ActivityTypeVirusRepeat extends ActivityTypeAdmin { protected $fullname; protected $userid; - public function __construct($data, $cron=false) { + public function __construct($data, $cron=false) { parent::__construct($data, $cron); } @@ -983,7 +983,7 @@ class ActivityTypeVirusRepeat extends ActivityTypeAdmin { class ActivityTypeVirusRelease extends ActivityTypeAdmin { - public function __construct($data, $cron=false) { + public function __construct($data, $cron=false) { parent::__construct($data, $cron); } @@ -1000,7 +1000,7 @@ class ActivityTypeMaharamessage extends ActivityType { * - message (string) * - users (list of user ids) */ - public function __construct($data, $cron=false) { + public function __construct($data, $cron=false) { parent::__construct($data, $cron); $this->users = activity_get_users($this->get_id(), $this->users); } @@ -1034,10 +1034,10 @@ class ActivityTypeInstitutionmessage extends ActivityType { public function get_subject($user) { if ($this->messagetype == 'request') { $userstring = $this->fullname . ' (' . $this->username . ')'; - return get_string_from_language($user->lang, 'institutionrequestsubject', 'activity', $userstring, + return get_string_from_language($user->lang, 'institutionrequestsubject', 'activity', $userstring, $this->institution->displayname); } else if ($this->messagetype == 'invite') { - return get_string_from_language($user->lang, 'institutioninvitesubject', 'activity', + return get_string_from_language($user->lang, 'institutioninvitesubject', 'activity', $this->institution->displayname); } } @@ -1055,7 +1055,7 @@ class ActivityTypeInstitutionmessage extends ActivityType { } } -class ActivityTypeUsermessage extends ActivityType { +class ActivityTypeUsermessage extends ActivityType { protected $userto; protected $userfrom; @@ -1068,7 +1068,7 @@ class ActivityTypeUsermessage extends ActivityType { * - message (string) * - parent (int) */ - public function __construct($data, $cron=false) { + public function __construct($data, $cron=false) { parent::__construct($data, $cron); if ($this->userfrom) { $this->fromuser = $this->userfrom; @@ -1078,7 +1078,7 @@ class ActivityTypeUsermessage extends ActivityType { 'key' => 'Reply', 'section' => 'group', )); - } + } public function get_subject($user) { if (empty($this->subject)) { @@ -1096,10 +1096,10 @@ class ActivityTypeUsermessage extends ActivityType { public function get_required_parameters() { return array('message', 'userto', 'userfrom'); } - + } -class ActivityTypeWatchlist extends ActivityType { +class ActivityTypeWatchlist extends ActivityType { protected $view; @@ -1110,8 +1110,8 @@ class ActivityTypeWatchlist extends ActivityType { * @param array $data Parameters: * - view (int) */ - public function __construct($data, $cron) { - parent::__construct($data, $cron); + public function __construct($data, $cron) { + parent::__construct($data, $cron); require_once('view.php'); if ($this->viewinfo = new View($this->view)) { @@ -1237,14 +1237,14 @@ class ActivityTypeWatchlistnotification extends ActivityTypeWatchlist{ } } -class ActivityTypeNewview extends ActivityType { +class ActivityTypeNewview extends ActivityType { protected $owner; protected $view; private $viewinfo; - public function __construct($data, $cron=false) { + public function __construct($data, $cron=false) { parent::__construct($data, $cron); if (!$this->viewinfo = get_record_sql('SELECT u.*, v.title FROM {usr} u JOIN {view} v ON v.owner = u.id @@ -1258,24 +1258,24 @@ class ActivityTypeNewview extends ActivityType { $this->url = 'view/view.php?id=' . $this->view; // add users on friendslist or userlist... - $this->users = activity_get_viewaccess_users($this->view, $this->owner, $this->get_id()); + $this->users = activity_get_viewaccess_users($this->view, $this->owner, $this->get_id()); } public function get_subject($user) { return get_string_from_language($user->lang, 'newviewsubject', 'activity'); } - + public function get_message($user) { - return get_string_from_language($user->lang, 'newviewmessage', 'activity', + return get_string_from_language($user->lang, 'newviewmessage', 'activity', display_name($this->viewinfo, $user), $this->viewinfo->title); } - + public function get_required_parameters() { return array('owner', 'view'); } } -class ActivityTypeViewaccess extends ActivityType { +class ActivityTypeViewaccess extends ActivityType { protected $view; protected $owner; @@ -1289,7 +1289,7 @@ class ActivityTypeViewaccess extends ActivityType { * - view (int) * - oldusers (array of user IDs) */ - public function __construct($data, $cron=false) { + public function __construct($data, $cron=false) { parent::__construct($data, $cron); if (!$viewinfo = new View($this->view)) { if (!empty($this->cron)) { // probably deleted already @@ -1310,7 +1310,7 @@ class ActivityTypeViewaccess extends ActivityType { public function get_subject($user) { return get_string('newviewaccesssubject1', 'activity', $this->title); } - + public function get_message($user) { if ($this->ownername) { return get_string_from_language($user->lang, 'newviewaccessmessage', 'activity', @@ -1318,7 +1318,7 @@ class ActivityTypeViewaccess extends ActivityType { } return get_string_from_language($user->lang, 'newviewaccessmessagenoowner', 'activity', $this->title); } - + public function get_required_parameters() { return array('view', 'owner', 'oldusers'); } diff --git a/htdocs/lib/antispam/SimpleSpamTrap.php b/htdocs/lib/antispam/SimpleSpamTrap.php index 8364dbfb1c..6fd18d35cc 100644 --- a/htdocs/lib/antispam/SimpleSpamTrap.php +++ b/htdocs/lib/antispam/SimpleSpamTrap.php @@ -27,16 +27,16 @@ class SimpleSpamTrap extends NoneSpamTrap { } return false; } - + protected function valid_email($email) { return $this->email_form($email); - } + } protected function get_urls($text) { preg_match_all('#(?:https?|ftp)://[^\s\'"<>()]+#S', $text, $urls); return $urls[0]; } - + protected function evaluate_name($name) { $score = 0; // a name should not contain a newline character diff --git a/htdocs/lib/collection.php b/htdocs/lib/collection.php index aa635ca82e..f8a9e11b54 100644 --- a/htdocs/lib/collection.php +++ b/htdocs/lib/collection.php @@ -485,7 +485,7 @@ class Collection { /** * Returns array of views in the current collection * - * @return array views + * @return array views */ public function views() { diff --git a/htdocs/lib/cron.php b/htdocs/lib/cron.php index 953927bbf4..bb5d794479 100644 --- a/htdocs/lib/cron.php +++ b/htdocs/lib/cron.php @@ -92,7 +92,7 @@ foreach (plugin_types() as $plugintype) { set_field( $plugintype . '_cron', 'nextrun', - db_format_timestamp($nextrun), + db_format_timestamp($nextrun), 'plugin', $job->plugin, 'callfunction', @@ -147,9 +147,9 @@ if ($jobs) { echo "$output\n"; // Don't call handle_exception; try to update next run time and free the lock } - + $nextrun = cron_next_run_time($start, (array)$job); - + // update next run time set_field('cron', 'nextrun', db_format_timestamp($nextrun), 'id', $job->id); @@ -225,7 +225,7 @@ function datearray_to_timestamp($date_array) { * * This function is designed to parse a cron field specification and then * given a current value of the field, determine the next value of that field. - * + * * @param $fieldspec Cron field specification (e.g. "3,7,20-30,40-50/2") * @param $currentvalue Current value of this field * @param $ceiling Maximum value this field can take (e.g. for minutes this would be set to 60) diff --git a/htdocs/lib/dml.php b/htdocs/lib/dml.php index ed64a09e28..73807b6326 100644 --- a/htdocs/lib/dml.php +++ b/htdocs/lib/dml.php @@ -21,7 +21,7 @@ function db_table_name($name) { } /** - * Searches through a query for strings looking like {name}, to replace with + * Searches through a query for strings looking like {name}, to replace with * correctly quoted and prefixed table names * * @param string $sql The SQL to replace the placeholders in @@ -47,7 +47,7 @@ function _db_quote_table_placeholders_callback($matches) { * @return string */ function db_quote_identifier($identifier) { - // Currently, postgres and mysql (in postgres compat. mode) both support + // Currently, postgres and mysql (in postgres compat. mode) both support // the sql standard " if (strpos($identifier, '"') !== false) { return $identifier; @@ -127,7 +127,7 @@ function column_collation_is_default($table, $column) { */ function execute_sql($command, $values=null) { global $db; - + if (!is_a($db, 'ADOConnection')) { throw new SQLException('Database connection is not available '); } @@ -179,7 +179,7 @@ function record_exists($table, $field1=null, $value1=null, $field2=null, $value2 * Test whether any records exists in a table which match a particular WHERE clause. * * This function returns true if at least one record is returned - * + * * @param string $table The database table to be checked against. * @param string $select A fragment of SQL to be used in a WHERE clause in the SQL call. * @param array $values When using prepared statements, this is the value array (optional). @@ -317,7 +317,7 @@ function get_record_sql($sql, $values=null) { if ($recordcount == 0) { // Found no records return false; } - else if ($recordcount == 1) { // Found one record + else if ($recordcount == 1) { // Found one record return (object)$rs->fields; } else { // Error: found more than one record @@ -469,7 +469,7 @@ function get_recordset_sql($sql, $values=null, $limitfrom=null, $limitnum=null) catch (ADODB_Exception $e) { throw new SQLException(create_sql_exception_message($e, $sql, $values)); } - + return $rs; } @@ -518,7 +518,7 @@ function recordset_to_assoc($rs) { if ($records = $rs->GetAssoc(true)) { foreach ($records as $key => $record) { $record[$firstcolumn->name] = $key; - $objects[$key] = (object) $record; + $objects[$key] = (object) $record; } return $objects; } else { @@ -765,7 +765,7 @@ function get_records_sql_menu($sql,$values=null) { function get_field($table, $field, $field1=null, $value1=null, $field2=null, $value2=null, $field3=null, $value3=null) { $select = where_clause_prepared($field1, $field2, $field3); $values = where_values_prepared($value1, $value2, $value3); - + return get_field_sql('SELECT ' . $field . ' FROM ' . db_table_name($table) . ' ' . $select, $values); } @@ -808,7 +808,7 @@ function get_field_sql($sql, $values=null) { function get_column($table, $field, $field1=null, $value1=null, $field2=null, $value2=null, $field3=null, $value3=null) { $select = where_clause_prepared($field1, $field2, $field3); $values = where_values_prepared($value1, $value2, $value3); - + return get_column_sql('SELECT ' . $field . ' FROM ' . db_table_name($table) . ' ' . $select, $values); } @@ -937,8 +937,8 @@ function delete_records_select($table, $select='',$values=null) { } /** - * @todo This function does nothing delete specific. The functionality - * it has with the $values parameter should be merged with the execute_sql + * @todo This function does nothing delete specific. The functionality + * it has with the $values parameter should be merged with the execute_sql * function */ function delete_records_sql($sql, $values=null) { @@ -976,15 +976,15 @@ function delete_records_sql($sql, $values=null) { */ function insert_record($table, $dataobject, $primarykey=false, $returnpk=false) { // $INSERTRECORD_NOCACHE is yet another work around of dmllib/adodb's ineptitude. - // It's all nice to cache the table columns lookup, but what if the table - // columns change over the life of the page load? This happens when an - // upgrade is running. All of a sudden, the table_column cache is out of + // It's all nice to cache the table columns lookup, but what if the table + // columns change over the life of the page load? This happens when an + // upgrade is running. All of a sudden, the table_column cache is out of // date and we can't insert new data properly. - // Temporary solution: set INSERTRECORD_NOCACHE to true before your calls + // Temporary solution: set INSERTRECORD_NOCACHE to true before your calls // that need a new lookup, and unset it afterwards global $db, $INSERTRECORD_NOCACHE; static $table_columns; - + // Determine all the fields in the table if (empty($INSERTRECORD_NOCACHE) && is_array($table_columns) && array_key_exists($table, $table_columns)) { $columns = $table_columns[$table]; @@ -995,7 +995,7 @@ function insert_record($table, $dataobject, $primarykey=false, $returnpk=false) } $table_columns[$table] = $columns; } - + if (!empty($primarykey)) { unset($dataobject->{$primarykey}); if (!empty($returnpk) && is_postgres()) { @@ -1058,9 +1058,9 @@ function insert_record($table, $dataobject, $primarykey=false, $returnpk=false) } // This only gets triggered with non-Postgres databases - // however we have some postgres fallback in case we failed + // however we have some postgres fallback in case we failed // to find the sequence. - $id = $db->Insert_ID(); + $id = $db->Insert_ID(); if (is_postgres()) { // try to get the primary key based on id @@ -1073,7 +1073,7 @@ function insert_record($table, $dataobject, $primarykey=false, $returnpk=false) throw new SQLException('WTF: somehow got more than one record when searching for a primary key'); } catch (ADODB_Exception $e) { - throw new SQLException("Trying to get pk from oid failed: " + throw new SQLException("Trying to get pk from oid failed: " . $e->getMessage() . " sql was $oidsql"); } } @@ -1082,7 +1082,7 @@ function insert_record($table, $dataobject, $primarykey=false, $returnpk=false) } /** - * Inserts a record, only if the record does not already exist. + * Inserts a record, only if the record does not already exist. * If the record DOES exist, it is updated. * * @uses $db @@ -1116,7 +1116,7 @@ function ensure_record_exists($table, $whereobject, $dataobject, $primarykey=fal else { // @TODO maybe some mysql specific stuff here } - + db_begin(); if ($exists = get_record_select($table, $where, $values)) { if ($returnpk) { @@ -1147,7 +1147,7 @@ function ensure_record_exists($table, $whereobject, $dataobject, $primarykey=fal * @param string $table The database table to be checked against. * @param array $dataobject An object with contents equal to fieldname=>fieldvalue. Must have an entry for 'id' to map to the table specified. * @param mixed $where defines the WHERE part of the upgrade. Can be string (key) or array (keys) or hash (keys/values). - * If the first two, values are expected to be in $dataobject. + * If the first two, values are expected to be in $dataobject. * @return bool * @throws SQLException */ @@ -1161,7 +1161,7 @@ function update_record($table, $dataobject, $where=null) { if (empty($where)) { $where = 'id'; - if (!isset($dataobject->id) ) { + if (!isset($dataobject->id) ) { // nothing to put in the where clause and we don't want to update everything throw new SQLException('update_record called with no where clause and no ID'); } @@ -1171,7 +1171,7 @@ function update_record($table, $dataobject, $where=null) { $wherevalues = array(); $values = array(); - if (is_string($where)) { + if (is_string($where)) { // treat it like a stack (ie, field in dataobject) $where = array($where); } @@ -1199,7 +1199,7 @@ function update_record($table, $dataobject, $where=null) { } static $table_columns; - + // Determine all the fields in the table if (is_array($table_columns) && isset($table_columns[$table])) { $columns = $table_columns[$table]; @@ -1251,7 +1251,7 @@ function update_record($table, $dataobject, $where=null) { } $sql = 'UPDATE '. db_table_name($table) .' SET '. $update .' WHERE ' . $whereclause; - try { + try { $stmt = $db->Prepare($sql); $rs = $db->Execute($stmt,array_merge($values, $wherevalues)); return true; @@ -1294,7 +1294,7 @@ function where_clause($field1='', $value1='', $field2='', $value2='', $field3='' /** * Prepares a SQL WHERE clause to select records where the given fields match some values. * Uses ? as placeholders for prepared statments - * + * * @param string $field1 the first field to check (optional). * @param string $field2 the second field to check (optional). * @param string $field3 the third field to check (optional). @@ -1310,12 +1310,12 @@ function where_clause_prepared($field1='', $field2='', $field3='') { $select .= " AND \"$field3\" = ? "; } } - } + } return $select; } /* - * Useful helper function to only push optional values into the array + * Useful helper function to only push optional values into the array * for prepared statements to avoid empty slots. * all parameters are optional. * @@ -1361,7 +1361,7 @@ function column_type($table, $column) { * This function will execute an array of SQL commands, returning * true/false if any error is found and stopping/continue as desired. * It's widely used by all the ddllib.php functions - * + * * @private * @param array sqlarr array of sql statements to execute * @param boolean continue to specify if must continue on error (true) or stop (false) @@ -1401,7 +1401,7 @@ function execute_sql_arr($sqlarr, $continue=true, $feedback=true) { * Unix integer timestamp or an ISO format Y-m-d H:i:s. Uses the fmtTimeStamp * field, which holds the format to use. If null or false or '' is passed in, * it will be converted to an SQL null. - * + * * Returns the timestamp as a quoted string. * * @param ts a timestamp in Unix date time format. @@ -1411,7 +1411,7 @@ function execute_sql_arr($sqlarr, $continue=true, $feedback=true) { function db_format_timestamp($ts) { global $db; - // Otherwise $db->BindTimeStamp() returns the string 'null', which is not + // Otherwise $db->BindTimeStamp() returns the string 'null', which is not // what we want if (empty($ts)) { return null; @@ -1422,7 +1422,7 @@ function db_format_timestamp($ts) { /** * Given a field name, this returns a function call suitable for the current * database to return a unix timestamp - * + * * @param field the field to apply the function to * @param as what to name the field (optional, defaults to $field). If false, * no naming is done. @@ -1493,7 +1493,7 @@ function is_mysql() { /** * function to convert an array to - * an array of placeholders (?) + * an array of placeholders (?) * with the right number of values * * @param array $array input array @@ -1508,7 +1508,7 @@ $GLOBALS['_TRANSACTION_LEVEL'] = 0; /** * This function starts a smart transaction - * + * */ function db_begin() { global $db; @@ -1593,14 +1593,14 @@ function increment_perf_db_cached($db, $secs2cache, $sql, $inputarray) { } /** - * Gives the caller the ability to disable logging of SQL exceptions in the + * Gives the caller the ability to disable logging of SQL exceptions in the * SQLException constructor. * - * This is only used by the config loading code to prevent spurious errors - * about the config table not existing going to the logs. If you are going to + * This is only used by the config loading code to prevent spurious errors + * about the config table not existing going to the logs. If you are going to * use this function, you had better have a very good reason! * - * @param bool $status Whether to ignore logging exceptions or not. If null, + * @param bool $status Whether to ignore logging exceptions or not. If null, * you can retrieve the current value of this setting */ function db_ignore_sql_exceptions($status=null) { @@ -1622,7 +1622,7 @@ function db_ignore_sql_exceptions($status=null) { /** * Returns the SQL keyword required to do LIKE in a case insensitive fashion. * - * MySQL, as long as you use a case insensitive collation (as is the default), + * MySQL, as long as you use a case insensitive collation (as is the default), * uses LIKE for this, while real databases use ILIKE. */ function db_ilike() { diff --git a/htdocs/lib/file.php b/htdocs/lib/file.php index caa239821b..176cfce4ef 100644 --- a/htdocs/lib/file.php +++ b/htdocs/lib/file.php @@ -461,28 +461,28 @@ function is_image_file($path) { * If the file with the ID exists but not of the correct size, this function * will make a copy that is resized to the correct size. * - * @param string $path The base path in dataroot where the image is stored. For - * example, 'artefact/file/profileicons/' for profile + * @param string $path The base path in dataroot where the image is stored. For + * example, 'artefact/file/profileicons/' for profile * icons - * @param int $id The ID of the image to return. Is typically the ID of an + * @param int $id The ID of the image to return. Is typically the ID of an * artefact * @param mixed $size The size the image should be. * * As a two element hash with 'w' and 'h' keys: - * - If 'w' and 'h' are not empty, the image will be + * - If 'w' and 'h' are not empty, the image will be * exactly that size - * - If just 'w' is not empty, the image will be that wide, - * and the height will be set to make the image scale + * - If just 'w' is not empty, the image will be that wide, + * and the height will be set to make the image scale * correctly - * - If just 'h' is not empty, the image will be that high, - * and the width will be set to make the image scale + * - If just 'h' is not empty, the image will be that high, + * and the width will be set to make the image scale * correctly - * - If neither are set or the parameter is not set, the + * - If neither are set or the parameter is not set, the * image will not be resized * - * As a number, the path returned will have the largest side being + * As a number, the path returned will have the largest side being * the length specified. - * @return string The path on disk where the appropriate file resides, or false + * @return string The path on disk where the appropriate file resides, or false * if an appropriate file could not be located or generated */ function get_dataroot_image_path($path, $id, $size=null) { @@ -500,8 +500,8 @@ function get_dataroot_image_path($path, $id, $size=null) { // Work out the location of the original image $originalimage = $imagepath . '/originals/' . ($id % 256) . "/$id"; - // If the original has been deleted, then don't show any image, even a cached one. - // delete_image only deletes the original, not any cached ones, so we have + // If the original has been deleted, then don't show any image, even a cached one. + // delete_image only deletes the original, not any cached ones, so we have // to make sure the original is still around if (!is_readable($originalimage)) { return false; @@ -608,8 +608,8 @@ function get_dataroot_image_path($path, $id, $size=null) { $newih = imagecreatetruecolor($newdimensions['w'], $newdimensions['h']); if ($originalmimetype == 'image/png' || $originalmimetype == 'image/gif') { - // Create a new destination image which is completely - // transparent and turn off alpha blending for it, so that when + // Create a new destination image which is completely + // transparent and turn off alpha blending for it, so that when // the PNG source file is copied, the alpha channel is retained. // Thanks to http://alexle.net/archives/131 @@ -620,8 +620,8 @@ function get_dataroot_image_path($path, $id, $size=null) { imagesavealpha($newih, true); } else { - // imagecopyresized is faster, but results in noticeably worse image quality. - // Given the images are resized only once each time they're + // imagecopyresized is faster, but results in noticeably worse image quality. + // Given the images are resized only once each time they're // made, I suggest you just leave the good quality one in place imagecopyresampled($newih, $oldih, 0, 0, 0, 0, $newdimensions['w'], $newdimensions['h'], $oldx, $oldy); //imagecopyresized($newih, $oldih, 0, 0, 0, 0, $newdimensions['w'], $newdimensions['h'], $oldx, $oldy); @@ -640,8 +640,8 @@ function get_dataroot_image_path($path, $id, $size=null) { } /** - * Given the old dimensions of an image and a size object as obtained from - * get_imagesize_parameters(), calculates what the new size of the image should + * Given the old dimensions of an image and a size object as obtained from + * get_imagesize_parameters(), calculates what the new size of the image should * be * * @param int $oldx The width of the image to calculate the new size for @@ -756,12 +756,12 @@ function rmdirr($dirname) if (!file_exists($dirname)) { return false; } - + // Simple delete for a file if (is_file($dirname) || is_link($dirname)) { return unlink($dirname); } - + // Loop through the folder $dir = dir($dirname); while (false !== $entry = $dir->read()) { @@ -769,11 +769,11 @@ function rmdirr($dirname) if ($entry == '.' || $entry == '..') { continue; } - + // Recurse rmdirr($dirname . '/' . $entry); } - + // Clean up $dir->close(); return rmdir($dirname); diff --git a/htdocs/lib/form/elements/artefactchooser.php b/htdocs/lib/form/elements/artefactchooser.php index 134184ec1d..d95bb3de0d 100644 --- a/htdocs/lib/form/elements/artefactchooser.php +++ b/htdocs/lib/form/elements/artefactchooser.php @@ -34,8 +34,8 @@ function pieform_element_artefactchooser(Pieform $form, $element) { $formname = $form->get_name(); $smarty->assign('blockinstance', substr($formname, strpos($formname, '_') + 1)); - // Save the pagination javascript for later, when it is asked for. This is - // messy, but can't be helped until Pieforms goes to a more OO way of + // Save the pagination javascript for later, when it is asked for. This is + // messy, but can't be helped until Pieforms goes to a more OO way of // managing stuff. $pagination_js = $pagination['javascript']; $pagination_js .= "\nvar acSelectArtefacts = " . json_encode($artefactdata) . "\n"; @@ -113,8 +113,8 @@ function pieform_element_artefactchooser_set_attributes($element) { } /** - * Extension by Mahara. This api function returns the javascript required to - * set up the element, assuming the element has been placed in the page using + * Extension by Mahara. This api function returns the javascript required to + * set up the element, assuming the element has been placed in the page using * javascript. This feature is used in the views interface. * * In theory, this could go upstream to pieforms itself @@ -131,7 +131,7 @@ function pieform_element_artefactchooser_views_js(Pieform $form, $element) { $pagination_js = 'var p = ' . $pagination_js; - // TODO: This is quite a lot of javascript to be sending inline, especially the ArtefactChooserData + // TODO: This is quite a lot of javascript to be sending inline, especially the ArtefactChooserData // class. if (!empty($element['selectone'])) { @@ -304,7 +304,7 @@ EOF; if (empty($element['selectone'])) { $pagination_js .=<<#s'; $pre_replace = '\1'; return preg_replace($pre_regex, $pre_replace, $html); } - + public function postFilter($html, $config, $context) { $post_regex = '#([a-zA-Z0-9_,\.-]+)'. '()#'; $post_replace = '\2'; return preg_replace($post_regex, $post_replace, $html); } - + } diff --git a/htdocs/lib/htmlpurifiercustom/Twitter.php b/htdocs/lib/htmlpurifiercustom/Twitter.php index c0d6d36d47..827846801f 100644 --- a/htdocs/lib/htmlpurifiercustom/Twitter.php +++ b/htdocs/lib/htmlpurifiercustom/Twitter.php @@ -2,9 +2,9 @@ class HTMLPurifier_Filter_Twitter extends HTMLPurifier_Filter { - + public $name = 'Twitter'; - + public function preFilter($html, $config, $context) { $pre_regex = array( '#
\s*\s*
    \s*
\s*
\s*(?:

)?\s*'. @@ -20,7 +20,7 @@ class HTMLPurifier_Filter_Twitter extends HTMLPurifier_Filter ); return preg_replace($pre_regex, $pre_replace, $html); } - + public function postFilter($html, $config, $context) { $post_regex = array( '##', @@ -54,5 +54,5 @@ class HTMLPurifier_Filter_Twitter extends HTMLPurifier_Filter ); return preg_replace($post_regex, $post_replace, $html); } - + } diff --git a/htdocs/lib/institution.php b/htdocs/lib/institution.php index 26f93f59b4..e90203a8c5 100644 --- a/htdocs/lib/institution.php +++ b/htdocs/lib/institution.php @@ -677,7 +677,7 @@ class Institution { } /** - * Returns true if the institution already has its full quota of users + * Returns true if the institution already has its full quota of users * assigned to it. * * @return bool @@ -905,7 +905,7 @@ function institution_selector_for_page($institution, $page) { else { $institutionelement['defaultvalue'] = $institution; } - + $institutionselector = pieform(array( 'name' => 'institutionselect', 'elements' => array( @@ -935,7 +935,7 @@ addLoadEvent(function() { } }); EOF; - + return array( 'institution' => $institution, 'institutionselector' => $institutionselector, diff --git a/htdocs/lib/layoutpreviewimage.php b/htdocs/lib/layoutpreviewimage.php index 7a01dcaa7d..ceb5d3be9d 100644 --- a/htdocs/lib/layoutpreviewimage.php +++ b/htdocs/lib/layoutpreviewimage.php @@ -13,7 +13,7 @@ defined('INTERNAL') || die(); /* This class is for the construction of a preview image - * for the various custom layout choices. The image is a visual + * for the various custom layout choices. The image is a visual * representation of the layout rows/columns matrix. */ class LayoutPreviewImage { @@ -30,13 +30,13 @@ class LayoutPreviewImage { public static $destinationfolder = 'images/layoutpreviewthumbs'; /* Constructor. - * @param data containing 'layout' (required) that consists of + * @param data containing 'layout' (required) that consists of * an array of columns per row eg. * array('row1' => '30-30-30', * 'row2' => '25-25-25-25'); - * image manupulation information and place to + * image manupulation information and place to * save the resulting image file. - * + * * The image manipulation information can be left out and * the pre-defined defaults will be used. */ @@ -58,10 +58,10 @@ class LayoutPreviewImage { } } - /* Generates the preview image (.png) for a custom layout and - * saves it in the specified $destinationfolder within + /* Generates the preview image (.png) for a custom layout and + * saves it in the specified $destinationfolder within * the $dataroot directory - * + * * @return bool true on successful creation and saving of image. */ public function create_preview() { diff --git a/htdocs/lib/mahara.php b/htdocs/lib/mahara.php index f3ede9db50..8e7298d19b 100644 --- a/htdocs/lib/mahara.php +++ b/htdocs/lib/mahara.php @@ -11,7 +11,7 @@ defined('INTERNAL') || die(); -/** +/** * work around silly php settings * and broken setup stuff about the install * and raise a warning/fail depending on severity @@ -162,7 +162,7 @@ function ensure_sanity() { } /** - * Check sanity of things that we only check at installation time - not on + * Check sanity of things that we only check at installation time - not on * every request, like ensure_sanity() does */ function ensure_install_sanity() { @@ -279,7 +279,7 @@ function get_string($identifier, $section='mahara') { else { $variables = array(); } - + return get_string_location($identifier, $section, $variables); } @@ -294,7 +294,7 @@ function get_string_from_language($lang, $identifier, $section='mahara') { else { $variables = array(); } - + return get_string_location($identifier, $section, $variables, 'format_langstring', $lang); } @@ -317,7 +317,7 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page= } else { $subdir .= 'pages/' . $pluginname . '/' . join('/', $pagebits) . '/'; - } + } } else if ($section) { $subdir .= 'sections/'; @@ -463,7 +463,7 @@ function get_string_location($identifier, $section, $variables, $replacefunc='fo // Define the locations of language strings for this section $langstringroot = get_language_root($lang); $langdirectory = ''; // The directory in which the language file for this string should ideally reside, if the language has implemented it - + if (false === strpos($section, '.')) { $langdirectory = 'lang/'; } @@ -472,7 +472,7 @@ function get_string_location($identifier, $section, $variables, $replacefunc='fo foreach ($extras as $tocheck) { if (strpos($section, $tocheck . '.') === 0) { $pluginname = substr($section ,strlen($tocheck) + 1); - if ($tocheck == 'blocktype' && + if ($tocheck == 'blocktype' && strpos($pluginname, '/') !== false) { // it belongs to an artefact plugin $bits = explode('/', $pluginname); $langdirectory = 'artefact/' . $bits[0] . '/blocktype/' . $bits[1] . '/lang/'; @@ -622,7 +622,7 @@ function language_get_searchpaths() { /** * Get the directory in which the specified language pack resides. * - * Defaults to getting the directory for the current_language() - i.e. the + * Defaults to getting the directory for the current_language() - i.e. the * language the user is using * * Returns null if the language can't be found @@ -841,8 +841,8 @@ function load_config() { /** * This function returns a value from $CFG * or null if it is not found - * - * @param string $key config setting to look for + * + * @param string $key config setting to look for * @return mixed */ function get_config($key) { @@ -869,7 +869,7 @@ function set_config($key, $value) { if (set_field('config', 'value', $value, 'field', $key)) { $status = true; } - } + } else { $config = new StdClass; $config->field = $key; @@ -995,7 +995,7 @@ function set_config_plugin($plugintype, $pluginname, $key, $value) { /** * This function returns a value for $CFG for a plugin instance - * or null if it is not found. Initially this is interesting only + * or null if it is not found. Initially this is interesting only * for multiauth. Note that it may go and look in the database * * @param string $plugintype E.g. auth @@ -1030,7 +1030,7 @@ function get_config_plugin_instance($plugintype, $pluginid, $key) { /** * This function returns a value for $CFG for a plugin instance - * or null if it is not found. Initially this is interesting only + * or null if it is not found. Initially this is interesting only * for multiauth. Note that it may go and look in the database * * @param string $plugintype E.g. auth @@ -1168,7 +1168,7 @@ function get_configs_user_institutions($key, $userid = null) { /** * This function prints an array or object * wrapped inside


- * 
+ *
  * @param $mixed value to print
  */
 function print_object($mixed) {
@@ -1301,7 +1301,7 @@ function get_user_institution_language($userid = null, &$sourceinst = null) {
 /**
  * Helper function to sprintf language strings
  * with a variable number of arguments
- * 
+ *
  * @param mixed $string raw string to use, or an array of strings, one for each plural form
  * @param array $args arguments to sprintf
  * @param string $lang The language
@@ -1364,7 +1364,7 @@ function check_dir_exists($dir, $create=true, $recursive=true) {
 
 
 /**
- * Function to require a plugin file. This is to avoid doing 
+ * Function to require a plugin file. This is to avoid doing
  * require and include directly with variables.
  *
  * This function is the one safe point to require plugin files.
@@ -1447,7 +1447,7 @@ function safe_require($plugintype, $pluginname, $filename='lib.php', $function='
     if ($function == 'include') { return include($realpath); }
     if ($function == 'require_once') { return require_once($realpath); }
     if ($function == 'include_once') { return include_once($realpath); }
-    
+
 }
 
 /**
@@ -1519,10 +1519,10 @@ function plugin_types_installed() {
     return $plugins;
 }
 
-/** 
- * This return returns the names of plugins installed 
+/**
+ * This return returns the names of plugins installed
  * for the given plugin type.
- * 
+ *
  * @param string $plugintype type of plugin
  * @return array of objects with fields (version (int), release (str), active (bool), name (str))
  */
@@ -1595,7 +1595,7 @@ function blocktype_single_to_namespaced($blocktype, $artefact='') {
 /**
  * Given a blocktype name, convert it to the namespaced version.
  *
- * This will be $artefacttype/$blocktype, or just plain $blocktype for system 
+ * This will be $artefacttype/$blocktype, or just plain $blocktype for system
  * blocktypes.
  *
  * This is useful for language strings
@@ -1704,9 +1704,9 @@ function handle_event($event, $data) {
 }
 
 /**
- * function to convert an array of objects to 
+ * function to convert an array of objects to
  * an array containing one field per place
- * 
+ *
  * @param array $array input array
  * @param mixed $field field to look for in each object
  */
@@ -1727,25 +1727,25 @@ function xmldb_dbg($message) {
 }
 define('DEBUG_DEVELOPER', 'whocares');
 
-/** 
+/**
  * Base class for all plugintypes.
  */
 class Plugin {
-    
+
     /**
      * This function returns an array of crons it wants to have run
-     * Each item should be a StdClass object containing - 
+     * Each item should be a StdClass object containing -
      * - callfunction (static function on the Plugin Class)
-     * - any or all of minute, hour, day, month, dayofweek 
+     * - any or all of minute, hour, day, month, dayofweek
      * (will default to * if not supplied)
      */
     public static function get_cron() {
         return array();
     }
 
-    /** 
+    /**
      * This function returns an array of events to subscribe to
-     * by unique name. 
+     * by unique name.
      * If an event the plugin is trying to subscribe to is unknown by the
      * core, an exception will be thrown.
      * @return array
@@ -1757,7 +1757,7 @@ class Plugin {
 
     /**
      * This function will be run after every upgrade to the plugin.
-     * 
+     *
      * @param int $fromversion version upgrading from (or 0 if installing)
      */
     public static function postinst($fromversion) {
@@ -1775,7 +1775,7 @@ class Plugin {
 
     /**
     * Does this plugin offer any activity types
-    * If it does, you must subclass ActivityTypePlugin like 
+    * If it does, you must subclass ActivityTypePlugin like
     * ActivityType{$PluginType}{$Pluginname}
     */
     public static function get_activity_types() {
@@ -1803,7 +1803,7 @@ class Plugin {
 
 /**
  * formats a unix timestamp to a nice date format.
- * 
+ *
  * @param int $date unix timestamp to format
  * @param string $formatkey language key to fetch the format from
  * @param string $notspecifiedkey (optional) language key to fetch 'not specified string' from
@@ -1936,7 +1936,7 @@ function pieform_reply($code, $data) {
     if (isset($data['goto'])) {
         redirect($data['goto']);
     }
-    // NOT explicitly exiting here. Pieforms will throw an exception which will 
+    // NOT explicitly exiting here. Pieforms will throw an exception which will
     // force the user to fix their form
 }
 
@@ -1958,13 +1958,13 @@ function pieform_element_textarea_configure($element) {
 }
 
 /**
- * Should be used to provide the 'templatedir' directive to pieforms using a 
+ * Should be used to provide the 'templatedir' directive to pieforms using a
  * template for layout.
  *
- * @param string $file The file to be used as a pieform template, e.g. 
- *                     "admin/site/files.php". This is the value you used as 
+ * @param string $file The file to be used as a pieform template, e.g.
+ *                     "admin/site/files.php". This is the value you used as
  *                     the 'template' option for your pieform
- * @param string $pluginlocation Which plugin to search for the template, e.g. 
+ * @param string $pluginlocation Which plugin to search for the template, e.g.
  *                               artefact/file
  */
 function pieform_template_dir($file, $pluginlocation='') {
@@ -2271,7 +2271,7 @@ function get_views($users, $userlooking=null, $limit=5, $type=null) {
             ' . db_format_tsfield('atime') . ',
             ' . db_format_tsfield('mtime') . ',
             ' . db_format_tsfield('v.ctime', 'ctime') . '
-        FROM 
+        FROM
             {view} v
             INNER JOIN {view_access} a ON
                 v.id=a.view
@@ -2311,7 +2311,7 @@ function get_views($users, $userlooking=null, $limit=5, $type=null) {
             ' . db_format_tsfield('atime') . ',
             ' . db_format_tsfield('mtime') . ',
             ' . db_format_tsfield('v.ctime', 'ctime') . '
-        FROM 
+        FROM
             {view} v
             INNER JOIN {view_access} a ON v.id=a.view AND a.usr=?
         WHERE
@@ -2338,7 +2338,7 @@ function get_views($users, $userlooking=null, $limit=5, $type=null) {
             ' . db_format_tsfield('v.atime','atime') . ',
             ' . db_format_tsfield('v.mtime','mtime') . ',
             ' . db_format_tsfield('v.ctime','ctime') . '
-        FROM 
+        FROM
             {view} v
             INNER JOIN {view_access} a ON v.id=a.view
             INNER JOIN {group_member} m ON m.group=a.group AND m.member=?
@@ -2791,7 +2791,7 @@ function profile_sideblock() {
 /**
  * Gets data about users who have been online in the last while.
  *
- * The time is configured by setting the 'accessidletimeout' configuration 
+ * The time is configured by setting the 'accessidletimeout' configuration
  * option.
  *
  * Limits the number of users to display based on the 'onlineuserssideblockmaxusers'
@@ -3141,10 +3141,10 @@ function progressbar_sideblock($preview=false) {
 
 
 /**
- * Cronjob to recalculate how much quota each user is using and update it as 
+ * Cronjob to recalculate how much quota each user is using and update it as
  * appropriate.
  *
- * This gives a backstop for the possibility that there is a bug elsewhere that 
+ * This gives a backstop for the possibility that there is a bug elsewhere that
  * has caused the quota count to get out of sync
  */
 function recalculate_quota() {
diff --git a/htdocs/lib/peer.php b/htdocs/lib/peer.php
index 507e49f1d6..b601756da2 100644
--- a/htdocs/lib/peer.php
+++ b/htdocs/lib/peer.php
@@ -61,10 +61,10 @@ class Peer {
                 $this->application = Application::findByName($value);
             } elseif ($name == 'wwwroot') {
                 if (!empty($this->appname) && is_object($this->application) && !empty($this->application->xmlrpcserverurl)) {
-                    
+
                 }
             } elseif ($name == 'appname') {
-                
+
             }
             $this->members[$name] = $value;
             $this->changed = true;
@@ -183,7 +183,7 @@ class Peer {
                 $institution = new Institution;
                 $institution->name = preg_replace('/[^a-zA-Z]/', '', $this->name);
 
-                // Check that the institution name has not already been taken. 
+                // Check that the institution name has not already been taken.
                 // If it has, we change it until we find a name that works
                 $existinginstitutionnames = get_column('institution', 'name');
                 if (in_array($institution->name, $existinginstitutionnames)) {
@@ -242,6 +242,6 @@ class Peer {
         }
 
         return true;
-        
+
     }
 }
diff --git a/htdocs/lib/pieforms/pieform.php b/htdocs/lib/pieforms/pieform.php
index 82306ba274..33b9234ff4 100644
--- a/htdocs/lib/pieforms/pieform.php
+++ b/htdocs/lib/pieforms/pieform.php
@@ -106,7 +106,7 @@ class Pieform {/*{{{*/
     private $data = array();
 
     /**
-     * A hash of references to the elements of the form, not including 
+     * A hash of references to the elements of the form, not including
      * fieldsets/containers (although including all elements inside any fieldsets/containers. Used
      * internally for simplifying looping over elements
      *
@@ -132,7 +132,7 @@ class Pieform {/*{{{*/
     private $submitted = false;
 
     /**
-     * Whether the form has been submitted by javasccript. Available through 
+     * Whether the form has been submitted by javasccript. Available through
      * the {@link submitted_by_js} method.
      *
      * @var bool
@@ -318,7 +318,7 @@ class Pieform {/*{{{*/
 
         // Get references to all the elements in the form, excluding fieldsets/containers
         foreach ($this->data['elements'] as $name => &$element) {
-            // The name can be in the element itself. This is compatibility for 
+            // The name can be in the element itself. This is compatibility for
             // the perl version
             if (isset($element['name'])) {
                 $name = $element['name'];
@@ -349,7 +349,7 @@ class Pieform {/*{{{*/
         }
         unset($element);
 
-        // Check that all elements have names compliant to PHP's variable naming policy 
+        // Check that all elements have names compliant to PHP's variable naming policy
         // (otherwise things get messy later)
         foreach (array_keys($this->elementrefs) as $name) {
             if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $name)) {
@@ -358,7 +358,7 @@ class Pieform {/*{{{*/
         }
 
         // Remove elements to ignore
-        // This can't be done using $this->elementrefs, because you can't unset 
+        // This can't be done using $this->elementrefs, because you can't unset
         // an entry in there and have it unset the entry in $this->data['elements']
         foreach ($this->data['elements'] as $name => $element) {
             if (isset($element['type']) && ($element['type'] == 'fieldset' || $element['type'] == 'container')) {
@@ -408,11 +408,11 @@ class Pieform {/*{{{*/
                 }
 
                 // vvv --------------------------------------------------- vvv
-                // After this point Pieforms can set or override attributes 
+                // After this point Pieforms can set or override attributes
                 // without fear that the developer will be able to change them.
 
                 // This function is defined by the plugin itself, to set
-                // fields on the element that need to be set but should not 
+                // fields on the element that need to be set but should not
                 // be set by the application
                 $function = 'pieform_element_' . $element['type'] . '_set_attributes';
                 if (function_exists($function)) {
@@ -462,7 +462,7 @@ class Pieform {/*{{{*/
             if ($this->data['submit']) {
                 $this->submitted = true;
 
-                // If the hidden value the JS code inserts into the form is 
+                // If the hidden value the JS code inserts into the form is
                 // present, then the form was submitted by JS
                 if (!empty($global['pieform_jssubmission'])) {
                     $this->submitted_by_js = true;
@@ -556,11 +556,11 @@ class Pieform {/*{{{*/
             if (is_callable($function)) {
                 call_user_func_array($function, array($this));
             }
-            
+
             // If the form has been submitted by javascript, return json
             if ($this->submitted_by_js) {
-                // TODO: get error messages in a 'third person' type form to 
-                // use here maybe? Would have to work for non js forms too. See 
+                // TODO: get error messages in a 'third person' type form to
+                // use here maybe? Would have to work for non js forms too. See
                 // the TODO file
                 //$errors = $this->get_errors();
                 //$json = array();
@@ -591,7 +591,7 @@ class Pieform {/*{{{*/
      * set in the form data array, so developers can pass in random stuff and
      * get access to it.
      *
-     * @param string The key of the property to return. If the property doesn't 
+     * @param string The key of the property to return. If the property doesn't
      *               exist, null is returned
      * @return mixed
      */
@@ -649,7 +649,7 @@ class Pieform {/*{{{*/
     }/*}}}*/
 
     /**
-     * Builds and returns the HTML for the form, using the chosen renderer or 
+     * Builds and returns the HTML for the form, using the chosen renderer or
      * template
      *
      * Note that the "action" attribute for the form tag is NOT HTML escaped
@@ -663,7 +663,7 @@ class Pieform {/*{{{*/
     public function build($outputformtags=true) {/*{{{*/
         $result = '';
 
-        // Builds the HTML each element (see the build_element_html method for 
+        // Builds the HTML each element (see the build_element_html method for
         // more information)
         foreach ($this->data['elements'] as &$element) {
             if ($element['type'] == 'fieldset' || $element['type'] == 'container') {
@@ -682,7 +682,7 @@ class Pieform {/*{{{*/
         if (!empty($this->data['template'])) {
             $form_tag = $this->get_form_tag();
 
-            // $elements is a convenience variable that contains all of the form elements (minus fieldsets and 
+            // $elements is a convenience variable that contains all of the form elements (minus fieldsets and
             // hidden elements)
             $elements = array();
             foreach ($this->elementrefs as $element) {
@@ -769,17 +769,17 @@ class Pieform {/*{{{*/
             }
         }
 
-        // Output the javascript to wire things up, but only if it is needed. 
+        // Output the javascript to wire things up, but only if it is needed.
         // The two cases where it is needed is when:
-        // 1) The form is a JS form that hasn't been submitted yet. When the 
-        // form has been submitted the javascript from the first page load is 
+        // 1) The form is a JS form that hasn't been submitted yet. When the
+        // form has been submitted the javascript from the first page load is
         // still active in the document
         // 2) The form is NOT a JS form, but has a presubmitcallback
         if ($outputformtags &&
             (($this->data['jsform'] && !$this->submitted)
              || (!$this->data['jsform'] && $this->data['presubmitcallback']))) {
-            // Establish which buttons in the form are submit buttons. This is 
-            // used to detect which button was pressed to cause the form 
+            // Establish which buttons in the form are submit buttons. This is
+            // used to detect which button was pressed to cause the form
             // submission
             $submitbuttons = array();
             foreach ($this->elementrefs as $element) {
@@ -844,7 +844,7 @@ class Pieform {/*{{{*/
      * This flattens fieldsets/containers, and ignores the actual fieldset/container elements
      *
      * @return array The elements of the form
-     */ 
+     */
     public function get_elements() {/*{{{*/
         $elements = array();
         foreach ($this->data['elements'] as $name => $element) {
@@ -896,17 +896,17 @@ class Pieform {/*{{{*/
     /**
      * Sends a message back to a jsform.
      *
-     * The message can contain almost any data, although how it is used is up to 
-     * the javascript callbacks.  The message must contain a return code (the 
+     * The message can contain almost any data, although how it is used is up to
+     * the javascript callbacks.  The message must contain a return code (the
      * first parameter of this method.
      *
-     * - The return code of the result. Either one of the PIEFORM_OK, 
-     *   PIEFORM_ERR or PIEFORM_CANCEL codes, or a custom error code at the 
+     * - The return code of the result. Either one of the PIEFORM_OK,
+     *   PIEFORM_ERR or PIEFORM_CANCEL codes, or a custom error code at the
      *   choice of the application using pieforms
-     * - A message. This is just a string that can be used as a status message, 
+     * - A message. This is just a string that can be used as a status message,
      *   e.g. 'Form failed submission'
-     * - HTML to replace the form with. By default, the form is built and used, 
-     *   but for example, you could replace the form with a "thank you" message 
+     * - HTML to replace the form with. By default, the form is built and used,
+     *   but for example, you could replace the form with a "thank you" message
      *   after successful submission if you want
      */
     public function json_reply($returncode, $data=array(), $replacehtml=null) {/*{{{*/
@@ -1145,7 +1145,7 @@ EOF;
                 $result .= ($attribute == 'readonly') ? ' readonly="readonly" disabled="disabled"' : " $attribute=\"$attribute\"";
             }
         }
-        
+
         return $result;
     }/*}}}*/
 
@@ -1404,10 +1404,10 @@ EOF;
     }/*}}}*/
 
     /**
-     * Given an element, builds all of the HTML for it - for example, the label 
+     * Given an element, builds all of the HTML for it - for example, the label
      * and the raw HTML of the element itself
      *
-     * The element is passed by reference, and various properties are set 
+     * The element is passed by reference, and various properties are set
      * directly on the element, namely:
      *
      * * 'html' - The element in its built, HTML form
@@ -1475,7 +1475,7 @@ EOF;
             $function = $this->get_property('helpcallback');
             if (function_exists($function)) {
                 $element['helphtml'] = $function($this, $element);
-            } 
+            }
             else {
                 $element['helphtml'] = '?';
             }
@@ -1533,7 +1533,7 @@ EOF;
             // button in the form
             'successcallback' => '',
 
-            // The PHP callback called to handle replying to the form after 
+            // The PHP callback called to handle replying to the form after
             // either a success or fail. Optional
             'replycallback' => '',
 
@@ -1549,8 +1549,8 @@ EOF;
             // submitted.
             'newiframeonsubmit' => false,
 
-            // The URL where pieforms.js and other related pieforms javascript 
-            // files can be accessed. Best specified as an absolute path in 
+            // The URL where pieforms.js and other related pieforms javascript
+            // files can be accessed. Best specified as an absolute path in
             // pieform_configure()
             'jsdirectory' => '',
 
@@ -1559,7 +1559,7 @@ EOF;
             'presubmitcallback' => '',
 
             // The javascript function called after submission of a form. As non-js
-            // forms will trigger a page load on submit, this has no effect for them. 
+            // forms will trigger a page load on submit, this has no effect for them.
             'postsubmitcallback' => '',
 
             // The javascript function called if the form submission was successful
@@ -1619,7 +1619,7 @@ EOF;
             // Whether to add * markers after each required field
             'requiredmarker' => false,
 
-            // Whether to show the description as well as the error message 
+            // Whether to show the description as well as the error message
             // when displaying errors
             'showdescriptiononerror' => true,
 
@@ -1669,7 +1669,7 @@ EOF;
  * {@internal This is separate so that child element types can nest other
  * elements inside them (like the fieldset and container elements do for example).}}
  *
- * NOTE: This function is SCHEDULED FOR REMOVAL. Nicer ways of getting built 
+ * NOTE: This function is SCHEDULED FOR REMOVAL. Nicer ways of getting built
  * elements are available
  *
  * @param Pieform  $form    The form to render the element for
@@ -1708,10 +1708,10 @@ function pieform_render_element(Pieform $form, $element) {/*{{{*/
 }/*}}}*/
 
 /**
- * Returns an array of HTML elements to be placed in the  section of the 
+ * Returns an array of HTML elements to be placed in the  section of the
  * page.
  *
- * This works for all forms that have been built at the time this function is 
+ * This works for all forms that have been built at the time this function is
  * called - so call this function after all forms are built!
  *
  * @return array
diff --git a/htdocs/lib/pieforms/pieform/elements/button.php b/htdocs/lib/pieforms/pieform/elements/button.php
index 90cf5f1b0c..2aab4764d0 100644
--- a/htdocs/lib/pieforms/pieform/elements/button.php
+++ b/htdocs/lib/pieforms/pieform/elements/button.php
@@ -25,10 +25,10 @@
  */
 
 /**
- * Renders an  element. 
+ * Renders an  element.
  *
  * The element must have the 'value' field set.
- * 
+ *
  * @param Pieform $form    The form to render the element for
  * @param array   $element The element to render
  * @return string          The HTML for the element
diff --git a/htdocs/lib/pieforms/pieform/elements/image.php b/htdocs/lib/pieforms/pieform/elements/image.php
index f0dd45e627..e4d08173dd 100644
--- a/htdocs/lib/pieforms/pieform/elements/image.php
+++ b/htdocs/lib/pieforms/pieform/elements/image.php
@@ -64,7 +64,7 @@ function pieform_element_image_get_value(Pieform $form, $element) {/*{{{*/
     if (isset($element['value'])) {
         return $element['value'];
     }
-    
+
     $global = $form->get_property('method') == 'get' ? $_GET : $_POST;
     if ($form->is_submitted() && isset($global[$element['name'] . '_x'])) {
         return true;
diff --git a/htdocs/lib/pieforms/pieform/renderers/div.php b/htdocs/lib/pieforms/pieform/renderers/div.php
index 1ab232cea2..6fa828298a 100644
--- a/htdocs/lib/pieforms/pieform/renderers/div.php
+++ b/htdocs/lib/pieforms/pieform/renderers/div.php
@@ -63,7 +63,7 @@ function pieform_renderer_div(Pieform $form, $element) {/*{{{*/
     }
 
     // Description - optional description of the element, or other note that should be visible
-    // on the form itself (without the user having to hover over contextual help 
+    // on the form itself (without the user having to hover over contextual help
     if ((!$form->has_errors() || $form->get_property('showdescriptiononerror')) && !empty($element['descriptionhtml'])) {
         $result .= '
' . $element['descriptionhtml'] . "
"; } diff --git a/htdocs/lib/pieforms/pieform/renderers/table.php b/htdocs/lib/pieforms/pieform/renderers/table.php index 6b20abe4ff..9e4e04d65a 100644 --- a/htdocs/lib/pieforms/pieform/renderers/table.php +++ b/htdocs/lib/pieforms/pieform/renderers/table.php @@ -60,7 +60,7 @@ function pieform_renderer_table(Pieform $form, $element) {/*{{{*/ $result .= "\n\t"; return $result; } - + $result = "\t to match that of the element @@ -89,7 +89,7 @@ function pieform_renderer_table(Pieform $form, $element) {/*{{{*/ $result .= "\n\t\n"; // Description - optional description of the element, or other note that should be visible - // on the form itself (without the user having to hover over contextual help + // on the form itself (without the user having to hover over contextual help if ((!$form->has_errors() || $form->get_property('showdescriptiononerror')) && !empty($element['descriptionhtml'])) { $result .= "\t to match that of the element diff --git a/htdocs/lib/recaptcha/recaptchalib.php b/htdocs/lib/recaptcha/recaptchalib.php index fb2db04f24..170023cf71 100644 --- a/htdocs/lib/recaptcha/recaptchalib.php +++ b/htdocs/lib/recaptcha/recaptchalib.php @@ -212,7 +212,7 @@ function _recaptcha_aes_encrypt($val,$ky) { if (! function_exists ("mcrypt_encrypt")) { die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); } - $mode=MCRYPT_MODE_CBC; + $mode=MCRYPT_MODE_CBC; $enc=MCRYPT_RIJNDAEL_128; $val=_recaptcha_aes_pad($val); return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); diff --git a/htdocs/lib/registration.php b/htdocs/lib/registration.php index d85913ea5c..3475438f7f 100644 --- a/htdocs/lib/registration.php +++ b/htdocs/lib/registration.php @@ -11,14 +11,14 @@ /** * @defgroup Registration Registration * Send site information to mahara.org - * + * */ - + defined('INTERNAL') || die(); /** * @return string that is the registation form - * @ingroup Registration + * @ingroup Registration */ function register_site() { $strfield = get_string('Field', 'admin'); @@ -64,7 +64,7 @@ EOF; ), ) ); - + return pieform($form); } /** diff --git a/htdocs/lib/user.php b/htdocs/lib/user.php index 4b9b875310..668518d877 100644 --- a/htdocs/lib/user.php +++ b/htdocs/lib/user.php @@ -13,10 +13,10 @@ defined('INTERNAL') || die(); define('MAX_USERNAME_DISPLAY', 30); -/** +/** * loads up activity preferences for a given user * - * @param int $userid to load preferences for + * @param int $userid to load preferences for * @todo caching */ function load_activity_preferences($userid) { @@ -32,14 +32,14 @@ function load_activity_preferences($userid) { return $prefs; } -/** +/** * loads up account preferences for a given user * if you want them for the current user * use $SESSION->accountprefs * - * @param int $userid to load preferences for + * @param int $userid to load preferences for * @todo caching - * @todo defaults? + * @todo defaults? */ function load_account_preferences($userid) { $prefs = array(); @@ -61,10 +61,10 @@ function load_account_preferences($userid) { } -/** +/** * sets a user preference in the database * if you want to set it in the session as well - * use SESSION->set_account_preference + * use SESSION->set_account_preference * * @param int $userid user id to set preference for * @param string $field preference field to set @@ -105,7 +105,7 @@ function set_account_preference($userid, $field, $value) { } -/** +/** * Change language-specific stuff in the db for a user. Currently * changes the name of the 'assessmentfiles' folder in the user's * files area and the views and artefacts tagged for the profile @@ -125,10 +125,10 @@ function change_language($userid, $oldlang, $newlang) { set_field_select('collection_tag', 'tag', get_string_from_language($newlang, 'profile'), 'WHERE tag = ? AND "collection" IN (SELECT id FROM {collection} WHERE "owner" = ?)', array(get_string_from_language($oldlang, 'profile'), $userid)); } -/** +/** * sets an activity preference in the database * if you want to set it in the session as well - * use $SESSION->set_activity_preference + * use $SESSION->set_activity_preference * * @param int $userid user id to set preference for * @param int $activity activity type to set @@ -154,7 +154,7 @@ function set_activity_preference($userid, $activity, $method) { } /** - * gets an account preference for the user, + * gets an account preference for the user, * or the default if not set for that user, * as specified in {@link expected_account_preferences} * @@ -189,7 +189,7 @@ function get_user_language($userid) { /** * default account settings - * + * * @returns array of fields => values */ function expected_account_preferences() { @@ -466,9 +466,9 @@ function get_profile_field($userid, $field) { return null; } -/** +/** * Always use this function for all emails to users - * + * * @param object $userto user object to send email to. must contain firstname,lastname,preferredname,email * @param object $userfrom user object to send email from. If null, email will come from mahara * @param string $subject email subject @@ -477,13 +477,13 @@ function get_profile_field($userid, $field) { * @param array $customheaders email headers * @throws EmailException * @throws EmailDisabledException - */ + */ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='', $customheaders=null) { global $IDPJUMPURL; static $mnetjumps = array(); if (!get_config('sendemail')) { - // You can entirely disable Mahara from sending any e-mail via the + // You can entirely disable Mahara from sending any e-mail via the // 'sendemail' configuration variable return true; } @@ -529,14 +529,14 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='', // Leaving this commented out - there's no reason for people to know this //$mail->Version = 'Mahara ' . get_config('release'); $mail->PluginDir = get_config('libroot') . 'phpmailer/'; - + $mail->CharSet = 'UTF-8'; $smtphosts = get_config('smtphosts'); if ($smtphosts == 'qmail') { // use Qmail system $mail->IsQmail(); - } + } else if (empty($smtphosts)) { // use PHP mail() = sendmail $mail->IsMail(); @@ -641,14 +641,14 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='', throw new InvalidEmailException("Cannot send email to $usertoname with subject $subject. Error from phpmailer was: " . $mail->ErrorInfo); } - $mail->WordWrap = 79; + $mail->WordWrap = 79; - if ($messagehtml) { + if ($messagehtml) { $mail->IsHTML(true); $mail->Encoding = 'quoted-printable'; $mail->Body = $messagehtml; $mail->AltBody = $messagetext; - } + } else { $mail->IsHTML(false); $mail->Body = $messagetext; @@ -679,7 +679,7 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='', } return true; - } + } throw new EmailException("Couldn't send email to $usertoname with subject $subject. " . "Error from phpmailer was: " . $mail->ErrorInfo ); } @@ -1107,7 +1107,7 @@ function optional_userid($userid) { if (!is_logged_in()) { throw new InvalidArgumentException("optional_userid no userid and no logged in user"); } - + global $USER; return $USER->get('id'); } @@ -1135,7 +1135,7 @@ function optional_userobj($user) { if (!is_logged_in()) { throw new InvalidArgumentException("optional_userobj no userid and no logged in user"); } - + global $USER; return $USER->to_stdclass(); } @@ -1158,12 +1158,12 @@ function is_logged_in() { /** * is there a friend relationship between these two users? * - * @param int $userid1 + * @param int $userid1 * @param int $userid2 */ function is_friend($userid1, $userid2) { - return record_exists_select('usr_friend', '(usr1 = ? AND usr2 = ?) OR (usr2 = ? AND usr1 = ?)', + return record_exists_select('usr_friend', '(usr1 = ? AND usr2 = ?) OR (usr2 = ? AND usr1 = ?)', array($userid1, $userid2, $userid1, $userid2)); } @@ -1176,8 +1176,8 @@ function is_friend($userid1, $userid2) { function get_friend_request($userid1, $userid2) { return get_record_select('usr_friend_request', '("owner" = ? AND requester = ?) OR (requester = ? AND "owner" = ?)', array($userid1, $userid2, $userid1, $userid2)); - -} + +} /** * Returns an object containing information about a user, including account @@ -1271,8 +1271,8 @@ function unsuspend_user($userid) { /** * Deletes a user * - * This function ensures that a user is deleted according to how Mahara wants a - * deleted user to be. You can call it multiple times on the same user without + * This function ensures that a user is deleted according to how Mahara wants a + * deleted user to be. You can call it multiple times on the same user without * harm. * * @param int $userid The ID of the user to delete @@ -1280,7 +1280,7 @@ function unsuspend_user($userid) { function delete_user($userid) { db_begin(); - // We want to append 'deleted.timestamp' to some unique fields in the usr + // We want to append 'deleted.timestamp' to some unique fields in the usr // table, so they can be reused by new accounts $fieldstomunge = array('username', 'email'); $datasuffix = '.deleted.' . microtime(true); @@ -1388,10 +1388,10 @@ function delete_user($userid) { /** * Undeletes a user * - * NOTE: changing their email addresses to remove the .deleted.timestamp part - * has not been implemented yet! This function is not actually used anywhere in - * Mahara, so hasn't really been tested because of this. It's a simple enough - * job for the first person who gets there - see how delete_user works to see + * NOTE: changing their email addresses to remove the .deleted.timestamp part + * has not been implemented yet! This function is not actually used anywhere in + * Mahara, so hasn't really been tested because of this. It's a simple enough + * job for the first person who gets there - see how delete_user works to see * what you must undo. * * @param int $userid The ID of the user to undelete @@ -1499,9 +1499,9 @@ function get_message_thread($replyto) { * * @param object $to User to send the message to * @param string $message The message to send - * @param object $from Who to send the message from. If not set, defaults to + * @param object $from Who to send the message from. If not set, defaults to * the currently logged in user - * @throws AccessDeniedException if the message is not allowed to be sent (as + * @throws AccessDeniedException if the message is not allowed to be sent (as * configured by the 'to' user's settings) */ function send_user_message($to, $message, $parent, $from=null) { @@ -1514,10 +1514,10 @@ function send_user_message($to, $message, $parent, $from=null) { $messagepref = get_account_preference($to->id, 'messages'); if ($messagepref == 'allow' || ($messagepref == 'friends' && is_friend($from->id, $to->id)) || $from->get('admin')) { require_once('activity.php'); - activity_occurred('usermessage', + activity_occurred('usermessage', array( - 'userto' => $to->id, - 'userfrom' => $from->id, + 'userto' => $to->id, + 'userfrom' => $from->id, 'message' => $message, 'parent' => $parent, ) @@ -1564,7 +1564,7 @@ function load_user_institutions($userid) { /** * Return a username which isn't taken and which is similar to a desired username - * + * * @param string $desired */ function get_new_username($desired) { @@ -2327,7 +2327,7 @@ function update_user($user, $profile, $remotename=null, $accountprefs=array(), $ } /** - * Given a user, makes sure they have been added to all groups that are marked + * Given a user, makes sure they have been added to all groups that are marked * as ones that users should be auto-added to * * @param array $eventdata Event data passed from activity_occured, the key 'id' = userid diff --git a/htdocs/local/upgrade.php b/htdocs/local/upgrade.php index 6830f6b36d..b203d1ce8f 100644 --- a/htdocs/local/upgrade.php +++ b/htdocs/local/upgrade.php @@ -1,6 +1,6 @@ url)) { $toinsert->url = $data->url; } - + insert_record('notification_emaildigest_queue', $toinsert); } @@ -45,7 +45,7 @@ class PluginNotificationEmaildigest extends PluginNotification { $types = get_records_assoc('activity_type', 'admin', 0, 'plugintype,pluginname,name', 'id,name,plugintype,pluginname'); foreach ($types as &$type) { - if (!empty($type->plugintype)) { + if (!empty($type->plugintype)) { $type->section = "{$type->plugintype}.{$type->pluginname}"; } else { @@ -55,7 +55,7 @@ class PluginNotificationEmaildigest extends PluginNotification { $sql = 'SELECT q.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, u.admin, u.staff, p.value AS lang, q.*,' . db_format_tsfield('q.ctime', 'qctime').' - FROM {usr} u + FROM {usr} u JOIN {notification_emaildigest_queue} q ON q.usr = u.id LEFT OUTER JOIN {usr_account_preference} p ON (p.usr = u.id AND p.field = \'lang\') @@ -65,7 +65,7 @@ class PluginNotificationEmaildigest extends PluginNotification { foreach ($tosend as $queue) { if (!isset($users[$queue->usr])) { $users[$queue->usr] = new StdClass; - + $users[$queue->usr]->user = new StdClass; $users[$queue->usr]->user->username = $queue->username; $users[$queue->usr]->user->firstname = $queue->firstname; @@ -76,10 +76,10 @@ class PluginNotificationEmaildigest extends PluginNotification { $users[$queue->usr]->user->staff = $queue->staff; $users[$queue->usr]->user->id = $queue->usr; $users[$queue->usr]->user->lang = (empty($queue->lang) || $queue->lang == 'default') ? get_config('lang') : $queue->lang; - + $users[$queue->usr]->entries = array(); } - $queue->nicetype = get_string_from_language($users[$queue->usr]->user->lang, + $queue->nicetype = get_string_from_language($users[$queue->usr]->user->lang, 'type' . $types[$queue->type]->name, $types[$queue->type]->section); $users[$queue->usr]->entries[$queue->id] = $queue; } @@ -89,7 +89,7 @@ class PluginNotificationEmaildigest extends PluginNotification { $subject = get_string_from_language($lang, 'emailsubject', 'notification.emaildigest', $sitename); $body = get_string_from_language($lang, 'emailbodynoreply', 'notification.emaildigest', $sitename); foreach ($user->entries as $entry) { - $body .= get_string_from_language($lang, 'type', 'activity') . ': ' . $entry->nicetype + $body .= get_string_from_language($lang, 'type', 'activity') . ': ' . $entry->nicetype . ' ' . get_string_from_language($lang, 'attime', 'activity') . ' ' . format_date($entry->qctime) . "\n"; if (!empty($entry->subject)) { $body .= get_string_from_language($lang, 'subject') . $entry->subject ."\n"; @@ -109,12 +109,12 @@ class PluginNotificationEmaildigest extends PluginNotification { $body .= "\n\n" . get_string_from_language($lang, 'emailbodyending', 'notification.emaildigest', $prefurl); try { email_user($user->user, null, $subject, $body); - //only delete them if the email succeeded! + //only delete them if the email succeeded! $in = db_array_to_ph($user->entries); - delete_records_select('notification_emaildigest_queue', - 'id IN (' . implode(', ', $in) . ')', + delete_records_select('notification_emaildigest_queue', + 'id IN (' . implode(', ', $in) . ')', array_keys($user->entries)); - } + } catch (Exception $e) { // @todo } diff --git a/htdocs/notification/internal/lib.php b/htdocs/notification/internal/lib.php index 675e4261a5..713896e4a8 100644 --- a/htdocs/notification/internal/lib.php +++ b/htdocs/notification/internal/lib.php @@ -21,7 +21,7 @@ class PluginNotificationInternal extends PluginNotification { $toinsert->usr = $user->id; if (!empty($user->markasread)) { $toinsert->read = 1; - } + } else { $toinsert->read = 0; } @@ -42,7 +42,7 @@ class PluginNotificationInternal extends PluginNotification { return insert_record('notification_internal_activity', $toinsert, 'id', true); } - + public static function postinst($prevversion) { if ($prevversion == 0) { // Add triggers to update user unread message count when updating diff --git a/htdocs/register.php b/htdocs/register.php index 7777396e80..0d96fa088d 100644 --- a/htdocs/register.php +++ b/htdocs/register.php @@ -33,7 +33,7 @@ if (!session_id()) { session_start(); } -// Logged in people can't register. If someone passes a key however, log the +// Logged in people can't register. If someone passes a key however, log the // user out and see if this key registers someone if (is_logged_in()) { if ($key) { diff --git a/htdocs/thumb.php b/htdocs/thumb.php index b7c5fdbc4a..6c51a1c691 100644 --- a/htdocs/thumb.php +++ b/htdocs/thumb.php @@ -87,7 +87,7 @@ switch ($type) { redirect($gravatarurl); } - // We couldn't find an image for this user. Attempt to use the 'no user + // We couldn't find an image for this user. Attempt to use the 'no user // photo' image for the current theme if (!get_config('nocache')) { @@ -106,7 +106,7 @@ switch ($type) { readfile_exit($path); } - // If we couldn't find the no user photo picture, we put it into + // If we couldn't find the no user photo picture, we put it into // dataroot if we can $nouserphotopic = $THEME->get_path('images/no_userphoto.png'); if ($nouserphotopic) { @@ -149,7 +149,7 @@ switch ($type) { case 'blocktype': $bt = param_alpha('bt'); // blocktype $ap = param_alpha('ap', null); // artefact plugin (optional) - + $basepath = 'blocktype/' . $bt; if (!empty($ap)) { $basepath = 'artefact/' . $ap . '/' . $basepath; diff --git a/htdocs/user/denyrequest.php b/htdocs/user/denyrequest.php index 1fbb609ca8..e5d8e683d7 100644 --- a/htdocs/user/denyrequest.php +++ b/htdocs/user/denyrequest.php @@ -74,7 +74,7 @@ function denyrequest_submit(Pieform $form, $values) { // friend db record $f = new StdClass; $f->ctime = db_format_timestamp(time()); - + // notification info $n = new StdClass; $n->url = profile_url($USER, false); diff --git a/htdocs/user/removefriend.php b/htdocs/user/removefriend.php index b76ef3f807..5619d75304 100644 --- a/htdocs/user/removefriend.php +++ b/htdocs/user/removefriend.php @@ -65,14 +65,14 @@ $smarty->display('user/removefriend.tpl'); function removefriend_submit(Pieform $form, $values) { global $USER, $SESSION, $id; - + $loggedinid = $USER->get('id'); $user = get_record('usr', 'id', $id); // friend db record $f = new StdClass; $f->ctime = db_format_timestamp(time()); - + // notification info $n = new StdClass; $n->url = profile_url($USER, false); @@ -81,10 +81,10 @@ function removefriend_submit(Pieform $form, $values) { $displayname = display_name($USER, $user); $n->urltext = $displayname; - delete_records_select('usr_friend', '(usr1 = ? AND usr2 = ?) OR (usr2 = ? AND usr1 = ?)', + delete_records_select('usr_friend', '(usr1 = ? AND usr2 = ?) OR (usr2 = ? AND usr1 = ?)', array($id, $loggedinid, $id, $loggedinid)); $n->subject = get_string_from_language($lang, 'removedfromfriendslistsubject', 'group'); - + if (isset($values['reason']) && !empty($values['reason'])) { $n->message = get_string_from_language($lang, 'removedfromfriendslistmessage', 'group', $displayname) . $values['reason']; } diff --git a/htdocs/user/view.php b/htdocs/user/view.php index 436efa43e1..961f88ea7d 100644 --- a/htdocs/user/view.php +++ b/htdocs/user/view.php @@ -10,7 +10,7 @@ */ define('INTERNAL', 1); define('PUBLIC', 1); -// Technically these are lies, but we set them like this to hook in the right +// Technically these are lies, but we set them like this to hook in the right // plugin stylesheet. This file should be provided by artefact/internal anyway. define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'internal'); @@ -223,7 +223,7 @@ if (!empty($loggedinid) && $loggedinid != $userid) { ), 'member' => array( 'type' => 'hidden', - 'value' => $userid, + 'value' => $userid, ), 'submit' => array( 'type' => 'submit', @@ -232,7 +232,7 @@ if (!empty($loggedinid) && $loggedinid != $userid) { ), )); $grouprequestedlistform = $addform; - } + } } if ($is_friend) { diff --git a/htdocs/view/blocks.php b/htdocs/view/blocks.php index 9a5097313f..e5a7b9684d 100644 --- a/htdocs/view/blocks.php +++ b/htdocs/view/blocks.php @@ -194,13 +194,13 @@ $smarty->assign('blocktype_list', $view->build_blocktype_list($category)); // Tell smarty we're editing rather than just rendering $smarty->assign('editing', true); -// Work out what action is being performed. This is used to put a hidden submit -// button right at the very start of the form, so that hitting enter in any +// Work out what action is being performed. This is used to put a hidden submit +// button right at the very start of the form, so that hitting enter in any // form fields will cause the correct action to be performed foreach (array_keys($_POST + $_GET) as $key) { if (substr($key, 0, 7) == 'action_') { if (param_boolean('s')) { - // When configuring a blockinstance and the search tab is open, + // When configuring a blockinstance and the search tab is open, // pressing enter should search $key = str_replace('configureblockinstance', 'acsearch', $key); if (substr($key, -2) == '_x') { -- GitLab