Skip to content

Commit

Permalink
System: Deprecate getMaxUpload $guid parameter (#1754)
Browse files Browse the repository at this point in the history
  • Loading branch information
yookoala authored Oct 20, 2023
1 parent 3d50b06 commit 74c333f
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 15 deletions.
17 changes: 15 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,22 @@ function msort($array, $id = 'id', $sort_ascending = true)
}
}

//Print out, preformatted indicator of max file upload size
function getMaxUpload($guid, $multiple = '')
/**
* Returns preformatted HTML indicator of max file upload size
*
* @since 2013
* @version v26
*
* @param bool $multiple Whether to show text about multiple files.
*/
function getMaxUpload($multiple = false)
{
// For backwards compatibilty
global $guid;
if ($multiple === $guid) {
$multiple = func_get_args()[1] ?? false;
}

$output = '';
$post = substr(ini_get('post_max_size'), 0, (strlen(ini_get('post_max_size')) - 1));
$file = substr(ini_get('upload_max_filesize'), 0, (strlen(ini_get('upload_max_filesize')) - 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
$row->addDate('completeDate');

$row = $form->addRow();
$row->addContent(getMaxUpload($guid, true));
$row->addContent(getMaxUpload(true));
$row->addSubmit();

$form->loadAllValuesFrom($values);
Expand Down
2 changes: 1 addition & 1 deletion modules/Markbook/markbook_edit_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ function enterKey(){
$row->addDate('completeDate');

$row = $form->addRow()->addClass('submitRow sticky -bottom-px bg-gray-100 border-t -mt-px mb-px z-50');
$row->addContent(getMaxUpload($guid, true));
$row->addContent(getMaxUpload(true));
$row->addSubmit();

$form->loadAllValuesFrom($values);
Expand Down
2 changes: 1 addition & 1 deletion modules/Planner/resources_addQuick_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
$row->addSelect('imagesAsLinks')->fromArray(array('N' => __('Image'), 'Y' => __('Link')))->required();

$row = $form->addRow();
$row->addContent(getMaxUpload($guid, true));
$row->addContent(getMaxUpload(true));
$row->addSubmit(__('Upload'), 'bg-purple');

$output .= $form->getOutput();
Expand Down
4 changes: 2 additions & 2 deletions modules/Staff/applicationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
// CUSTOM FIELDS FOR USER: STAFF
$params = ['staff' => 1, 'applicationForm' => 1, 'headingLevel' => 'h4'];
$customFieldHandler->addCustomFieldsToForm($form, 'User', $params);

// REQURIED DOCUMENTS
$staffApplicationFormRequiredDocuments = $settingGateway->getSettingByScope('Staff', 'staffApplicationFormRequiredDocuments');

Expand Down Expand Up @@ -261,7 +261,7 @@
->setMaxUpload(false);
}

$row = $form->addRow()->addContent(getMaxUpload($guid));
$row = $form->addRow()->addContent(getMaxUpload());
$form->addHiddenValue('fileCount', count($requiredDocumentsList));
}

Expand Down
8 changes: 4 additions & 4 deletions modules/Staff/applicationForm_manage_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
if ($gibbonStaffApplicationFormID == '') {
$page->addError(__('You have not specified one or more required parameters.'));
} else {

$data = array('gibbonStaffApplicationFormID' => $gibbonStaffApplicationFormID);
$sql = 'SELECT gibbonStaffApplicationForm.*, gibbonStaffJobOpening.jobTitle, gibbonStaffJobOpening.type FROM gibbonStaffApplicationForm JOIN gibbonStaffJobOpening ON (gibbonStaffApplicationForm.gibbonStaffJobOpeningID=gibbonStaffJobOpening.gibbonStaffJobOpeningID) LEFT JOIN gibbonPerson ON (gibbonStaffApplicationForm.gibbonPersonID=gibbonPerson.gibbonPersonID) WHERE gibbonStaffApplicationFormID=:gibbonStaffApplicationFormID';
$result = $connection2->prepare($sql);
Expand Down Expand Up @@ -140,7 +140,7 @@
$column->addTextArea('notes')->setRows(5)->setClass('fullWidth');

$form->addRow()->addHeading('Job Related Information', __('Job Related Information'));

$form->addHiddenValue('type', $values['type']);

$row = $form->addRow();
Expand Down Expand Up @@ -287,7 +287,7 @@
$row = $form->addRow();
$row->addLabel('file'.$i, $requiredDocumentsList[$i]);


$dataFile = array('gibbonStaffApplicationFormID' => $gibbonStaffApplicationFormID, 'name' => $requiredDocumentsList[$i]);
$sqlFile = 'SELECT * FROM gibbonStaffApplicationFormFile WHERE gibbonStaffApplicationFormID=:gibbonStaffApplicationFormID AND name=:name ORDER BY name';
$resultFile = $connection2->prepare($sqlFile);
Expand All @@ -306,7 +306,7 @@
}
}

$row = $form->addRow()->addContent(getMaxUpload($guid));
$row = $form->addRow()->addContent(getMaxUpload());
$form->addHiddenValue('fileCount', count($requiredDocumentsList));
}

Expand Down
4 changes: 2 additions & 2 deletions modules/Students/applicationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@
->setMaxUpload(false);
}

$row = $form->addRow()->addContent(getMaxUpload($guid));
$row = $form->addRow()->addContent(getMaxUpload());
$form->addHiddenValue('fileCount', count($requiredDocumentsList));
}

Expand Down Expand Up @@ -893,7 +893,7 @@

// Honey pot field
$form->addRow()->addClass('hidden')->addTextField('emailAddress');

// AGREEMENT
$agreement = $settingGateway->getSettingByScope('Application Form', 'agreement');
if (!empty($agreement)) {
Expand Down
2 changes: 1 addition & 1 deletion modules/User Admin/user_manage_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@

// SUBMIT
$row = $form->addRow();
$row->addFooter()->append('<small>'.getMaxUpload($guid, true).'</small>');
$row->addFooter()->append('<small>'.getMaxUpload(true).'</small>');
$row->addSubmit();

echo $form->getOutput();
Expand Down
2 changes: 1 addition & 1 deletion modules/User Admin/user_manage_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@
$container->get(CustomFieldHandler::class)->addCustomFieldsToForm($form, 'User', $params, $values['fields']);

$row = $form->addRow();
$row->addFooter()->append('<small>'.getMaxUpload($guid, true).'</small>');
$row->addFooter()->append('<small>'.getMaxUpload(true).'</small>');
$row->addSubmit();

$form->loadAllValuesFrom($values);
Expand Down

0 comments on commit 74c333f

Please sign in to comment.