Commit 21d5712f authored by Aaron Wells's avatar Aaron Wells
Browse files

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
parent e46afb22
......@@ -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) .');
......
<?php
// Note: this template isn't echoing the description or error keys for each
// Note: this template isn't echoing the description or error keys for each
// element, but there's no validation or descriptions on this form currently
echo $form_tag;
......
......@@ -18,7 +18,7 @@ safe_require('blocktype', 'wall');
define('TITLE', get_string('viewwall', 'blocktype.wall'));
$instanceid = param_integer('id');
$reply = param_boolean('reply', false); // TODO send this to the form
$reply = param_boolean('reply', false); // TODO send this to the form
$postid = 0;
if ($reply) {
$postid = param_integer('postid'); // TODO just fetch this thread
......
......@@ -98,7 +98,7 @@ $viewsform = null;
if ($available = Collection::available_views($owner, $groupid, $institutionname)) {
foreach ($available as $a) {
$elements['view_'.$a->id] = array(
'type' => 'checkbox',
'type' => 'checkbox',
'title' => $a->title,
);
}
......
......@@ -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';
......
......@@ -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 {
......
......@@ -880,7 +880,7 @@ class LeapExportElement {
/**
* The content type of whatever is going in the <content> 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 <content> 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 '<a rel="leap2:has_part" href="portfolio:artefact' . hsc($artefactid) . '"' . $matches[5] . '>';
}
// 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) {
......
......@@ -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) {
......
......@@ -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();
......
......@@ -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);
}
......
......@@ -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() {
......
......@@ -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();
}
}
......@@ -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
......
......@@ -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();
}
......
......@@ -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']);
......
......@@ -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)
......
......@@ -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
}
}