Commit c0249dba authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1785114: Standardise code call to stdClass();



behatnotneeded

Change-Id: I4b7b4d95bd17ff2fea81e3b750f9978471ec5d7a
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 8a066c83
......@@ -236,7 +236,7 @@ function accountprefs_submit(Pieform $form, $values) {
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
$u = new StdClass;
$u = new stdClass();
$u->email = $USER->get('email');
$u->id = $USER->get('id');
update_bounce_count($u,true);
......
......@@ -16,7 +16,7 @@ define('INSTITUTIONALADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('searchlib.php');
$params = new StdClass;
$params = new stdClass();
$params->query = trim(param_variable('query', ''));
$params->institution = param_alphanum('institution', null);
$params->sortby = param_alpha('sortby', 'firstname');
......
......@@ -47,7 +47,7 @@ function groupquotasform_submit(Pieform $form, $values) {
global $SESSION;
$oldquota = get_field('group', 'quota', 'id', $values['groupid']);
$group = new StdClass;
$group = new stdClass();
$group->id = $values['groupid'];
$group->quota = $values['quota'];
update_record('group', $group);
......
......@@ -20,7 +20,7 @@ json_headers();
$name = param_variable('name');
$itemid = param_variable('itemid');
$data = new StdClass;
$data = new stdClass();
$data->title = $name;
try {
......
......@@ -279,7 +279,7 @@ function uploadcsv_submit(Pieform $form, $values) {
}
$key++;
$group = new StdClass;
$group = new stdClass();
$group->name = $record[$formatkeylookup['displayname']];
$group->shortname = $record[$formatkeylookup['shortname']];
$group->institution = $institution;
......
......@@ -100,7 +100,7 @@ $form = pieform(array(
function license_submit(Pieform $form, $values) {
global $SESSION;
$data = new StdClass;
$data = new stdClass();
foreach (array('name', 'displayname', 'shortname', 'icon') as $f) {
$data->{$f} = trim($values[$f]);
}
......
......@@ -79,7 +79,7 @@ function editsitepage_submit(Pieform $form, $values) {
$pagetext = EmbeddedImage::prepare_embedded_images($values['pagetext'], 'staticpages', $id);
global $USER;
$data = new StdClass;
$data = new stdClass();
$data->name = $values['pagename'];
$data->content = $pagetext;
$data->mtime = db_format_timestamp(time());
......
......@@ -94,7 +94,7 @@ function editsitepage_validate(Pieform $form, $values) {
function editsitepage_submit(Pieform $form, $values) {
global $USER, $SESSION;
$data = new StdClass;
$data = new stdClass();
$data->content = $values['pagetext'];
$data->author = $USER->get('id');
$data->institution = $values['pageinstitution'];
......
......@@ -23,7 +23,7 @@ $linkedto = param_variable('linkedto');
$itemid = param_variable('itemid');
$public = (int) param_boolean('public');
$data = new StdClass;
$data = new stdClass();
if ($type == 'sitefile') {
// Get file id.
$data->file = $linkedto;
......
......@@ -48,7 +48,7 @@ if ($install) {
log_info('- ' . $data['key']);
if ($name == 'localpostinst') {
// Update local version
$config = new StdClass;
$config = new stdClass();
require(get_config('docroot') . 'local/version.php');
set_config('localversion', $config->version);
set_config('localrelease', $config->release);
......
......@@ -124,7 +124,7 @@ function approveregistration_submit(Pieform $form, $values) {
// this column; if so, leave them in the db.
$extra = unserialize($values['extra']);
}
$extra = (!empty($extra) && $extra instanceof Stdclass) ? $extra : new StdClass;
$extra = (!empty($extra) && $extra instanceof stdClass) ? $extra : new stdClass();
// Get additional values to pass through to user creation
if (!empty($values['institutionstaff'])) {
......
......@@ -491,7 +491,7 @@ function edituser_site_submit(Pieform $form, $values) {
if ($values['maildisabled'] == 0 && get_account_preference($user->id, 'maildisabled') == 1) {
// Reset the sent and bounce counts otherwise mail will be disabled
// on the next send attempt
$u = new StdClass;
$u = new stdClass();
$u->email = $user->email;
$u->id = $user->id;
update_bounce_count($u,true);
......
......@@ -16,7 +16,7 @@ define('INSTITUTIONALADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('searchlib.php');
$params = new StdClass;
$params = new stdClass();
$params->query = trim(param_variable('query', ''));
$params->institution = param_alphanum('institution', null);
$params->sortby = param_alpha('sortby', 'firstname');
......
......@@ -112,7 +112,7 @@ function editsitepage_validate(Pieform $form, $values) {
function editsitepage_submit(Pieform $form, $values) {
global $USER;
$data = new StdClass;
$data = new stdClass();
$data->name = $values['pagename'];
if (empty($values['pageusedefault'])) {
$id = get_field('site_content', 'id', 'name', $values['pagename'], 'institution', $values['pageinstitution']);
......@@ -126,7 +126,7 @@ function editsitepage_submit(Pieform $form, $values) {
$data->institution = $values['pageinstitution'];
// update the institution config if needed
if (isset($values['pageusedefault'])) {
$configdata = new StdClass;
$configdata = new stdClass();
$configdata->institution = $data->institution;
$configdata->field = 'sitepages_' . $data->name;
$whereobj = clone $configdata;
......
......@@ -137,7 +137,7 @@ function editsitepage_validate(Pieform $form, $values) {
function editsitepage_submit(Pieform $form, $values) {
global $USER, $SESSION;
$data = new StdClass;
$data = new stdClass();
$data->content = $values['pagetext'];
$data->author = $USER->get('id');
$data->institution = $values['pageinstitution'];
......
......@@ -256,7 +256,7 @@ if ($institution || $add) {
$authtypes = auth_get_available_auth_types($institution);
}
else {
$data = new StdClass;
$data = new stdClass();
$data->displayname = '';
$data->expiry = null;
if (!get_config('usersuniquebyusername')) {
......@@ -982,7 +982,7 @@ function institution_submit(Pieform $form, $values) {
// Should never happen:
throw new SystemException('Attempt to update AND delete an auth instance');
}
$record = new StdClass;
$record = new stdClass();
$record->priority = $priority;
$record->id = $instanceid;
update_record('auth_instance', $record, array('id' => $instanceid));
......@@ -1147,7 +1147,7 @@ function institution_submit(Pieform $form, $values) {
delete_records('institution_locked_profile_field', 'name', $institution);
foreach (ArtefactTypeProfile::get_all_fields() as $field => $type) {
if ($values[$field]) {
$profilefield = new StdClass;
$profilefield = new stdClass();
$profilefield->name = $institution;
$profilefield->profilefield = $field;
insert_record('institution_locked_profile_field', $profilefield);
......
......@@ -17,7 +17,7 @@ define('SECTION_PAGE', 'usersearch');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('searchlib.php');
$params = new StdClass;
$params = new stdClass();
$params->query = trim(param_variable('query', ''));
$params->institution = param_alphanum('institution', null);
$params->f = param_alpha('f', null);
......
......@@ -509,7 +509,7 @@ function uploadcsv_submit(Pieform $form, $values) {
}
$key++;
$user = new StdClass;
$user = new stdClass();
foreach ($FORMAT as $field) {
if ($field == 'username' ||
$field == 'firstname' ||
......@@ -526,7 +526,7 @@ function uploadcsv_submit(Pieform $form, $values) {
$user->quota = $values['quota'];
}
$profilefields = new StdClass;
$profilefields = new stdClass();
$remoteuser = null;
foreach ($FORMAT as $field) {
if ($field == 'username' || $field == 'password') {
......
......@@ -15,7 +15,7 @@ define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('searchlib.php');
$params = new StdClass;
$params = new stdClass();
$params->query = trim(param_variable('query', ''));
$params->institution = param_alphanum('institution', null);
$params->lastinstitution = param_alphanum('lastinstitution', null);
......
......@@ -501,7 +501,7 @@ function send_content_ready($token, $username, $format, $importdata, $fetchnow=f
}
$result = new StdClass;
$result = new stdClass();
if ($fetchnow && PluginImport::import_immediately_allowed()) {
// either immediately spawn a curl request to go fetch the file
$importer = PluginImport::create_importer($queue->id, $tr, $queue);
......@@ -669,7 +669,7 @@ function get_groups_for_user($username) {
require_once('group.php');
$USER->reanimate($user->id, $authinstance->instanceid);
$groupdata = group_get_associated_groups($USER->get('id'), 'all', null, null);
$data = new stdclass();
$data = new stdClass();
$data->data = array();
$data->count = $groupdata['count'];
$data->displayname = display_name($user);
......@@ -714,7 +714,7 @@ function get_notifications_for_user($username, $notificationtypes, $maxitems) {
$params[] = $maxitems;
$records = get_records_sql_array($sql, $params);
$data = new stdclass;
$data = new stdClass();
$data->data = $records;
$data->count = count($records);
$data->displayname = display_name($user);
......@@ -743,7 +743,7 @@ function get_watchlist_for_user($username, $maxitems) {
$records = get_records_sql_array($sql, array($USER->get('id'), $maxitems));
$data = new stdclass;
$data = new stdClass();
$data->data = array();
$data->count = count($records);
$data->displayname = display_name($user);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment