diff --git a/admin/addAppNote.php b/admin/addAppNote.php index 23ac5f7..99568d6 100644 --- a/admin/addAppNote.php +++ b/admin/addAppNote.php @@ -37,7 +37,7 @@ else exit; $oNote = new Note(); -$oNote->GetOutputEditorValues(); +$oNote->GetOutputEditorValues($_REQUEST); if($aClean['sSub'] == "Submit") { diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index a84d0bf..9098465 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -184,12 +184,12 @@ if ($aClean['sSub']) { $oVersion = new Version($aClean['iVersionId']); $oTest = new testData($aClean['iTestingId']); - $oVersion->GetOutputEditorValues(); - $oTest->GetOutputEditorValues(); + $oVersion->GetOutputEditorValues($_REQUEST); + $oTest->GetOutputEditorValues($_REQUEST); if ($aClean['sAppType'] == "application") // application { $oApp = new Application($aClean['iAppId']); - $oApp->GetOutputEditorValues(); // load the values from $_REQUEST + $oApp->GetOutputEditorValues($_REQUEST); // load the values from $_REQUEST // add new vendor if($aClean['sAppVendorName'] and !$aClean['iAppVendorId']) { @@ -263,12 +263,12 @@ if ($aClean['sSub']) { $oVersion = new Version($aClean['iVersionId']); $oTest = new testData($aClean['iTestingId']); - $oVersion->GetOutputEditorValues(); - $oTest->GetOutputEditorValues(); + $oVersion->GetOutputEditorValues($_REQUEST); + $oTest->GetOutputEditorValues($_REQUEST); if ($aClean['sAppType'] == "application") // application { $oApp = new Application($aClean['iAppId']); - $oApp->GetOutputEditorValues(); // load the values from $_REQUEST + $oApp->GetOutputEditorValues($_REQUEST); // load the values from $_REQUEST $oApp->update(true); $oApp->reject(); } diff --git a/admin/adminTestResults.php b/admin/adminTestResults.php index 4bf8b1d..68ba175 100644 --- a/admin/adminTestResults.php +++ b/admin/adminTestResults.php @@ -29,7 +29,7 @@ if ($aClean['sSub']) if(is_numeric($aClean['iTestingId'])) { $oTest = new testData($aClean['iTestingId']); - $oTest->GetOutputEditorValues(); + $oTest->GetOutputEditorValues($_REQUEST); if($aClean['sSub'] == 'Submit') // submit the testing results { diff --git a/admin/editAppNote.php b/admin/editAppNote.php index 1467cfc..d0e9773 100644 --- a/admin/editAppNote.php +++ b/admin/editAppNote.php @@ -26,7 +26,7 @@ if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintaine if(!empty($aClean['sSub'])) { - $oNote->GetOutputEditorValues(); /* retrieve the updated values */ + $oNote->GetOutputEditorValues($_REQUEST); /* retrieve the updated values */ if ($aClean['sSub'] == 'Delete') { @@ -45,7 +45,7 @@ if(!empty($aClean['sSub'])) /* if preview is set display the note for review */ if($aClean['sPreview']) { - $oNote->GetOutputEditorValues(); /* retrieve the updated values */ + $oNote->GetOutputEditorValues($_REQUEST); /* retrieve the updated values */ $oNote->show(true); } diff --git a/admin/editDistribution.php b/admin/editDistribution.php index 1c3b95b..3637db8 100644 --- a/admin/editDistribution.php +++ b/admin/editDistribution.php @@ -15,7 +15,7 @@ if(!$_SESSION['current']->hasPriv("admin")) $oDistribution = new distribution($aClean['iDistributionId']); if($aClean['sSubmit']) { - $oDistribution->GetOutputEditorValues(); + $oDistribution->GetOutputEditorValues($_REQUEST); if($oDistribution->iDistributionId) $oDistribution->update(); diff --git a/appsubmit.php b/appsubmit.php index 2f8c7fd..259231d 100644 --- a/appsubmit.php +++ b/appsubmit.php @@ -158,15 +158,15 @@ if ($aClean['sSub']) $errors = ""; $oVersion = new Version($aClean['iVersionId']); $oTest = new testData($aClean['iTestingId']); - $errors .= $oVersion->CheckOutputEditorInput(); - $errors .= $oTest->CheckOutputEditorInput(); - $oVersion->GetOutputEditorValues(); - $oTest->GetOutputEditorValues(); + $errors .= $oVersion->CheckOutputEditorInput($_REQUEST); + $errors .= $oTest->CheckOutputEditorInput($_REQUEST); + $oVersion->GetOutputEditorValues($_REQUEST); + $oTest->GetOutputEditorValues($_REQUEST); if ($aClean['sAppType'] == "application") // application { $oApp = new Application($aClean['iAppId']); - $errors .= $oApp->CheckOutputEditorInput(); - $oApp->GetOutputEditorValues(); // load the values from $_REQUEST + $errors .= $oApp->CheckOutputEditorInput($_REQUEST); + $oApp->GetOutputEditorValues($_REQUEST); // load the values from $_REQUEST if(empty($errors)) { diff --git a/include/application.php b/include/application.php index 9ef9b71..e471d0e 100644 --- a/include/application.php +++ b/include/application.php @@ -457,58 +457,40 @@ class Application { echo html_frame_end(); } - function CheckOutputEditorInput() + function CheckOutputEditorInput($aValues) { - - $aClean = array(); //array of filtered user input - - $aClean['iAppCatId'] = makeSafe($_REQUEST['iAppCatId']); - $aClean['sAppName'] = makeSafe($_REQUEST['sAppName']); - $aClean['sAppVendorName'] = makeSafe($_REQUEST['sAppVendorName']); - $aClean['iAppVendorId'] = makeSafe($_REQUEST['iAppVendorId']); - $aClean['shAppDescription'] = makeSafe($_REQUEST['shAppDescription']); - $errors = ""; - if (empty($aClean['iAppCatId'])) + if (empty($aValues['iAppCatId'])) $errors .= "
  • Please enter a category for your application.
  • \n"; - if (strlen($aClean['sAppName']) > 200 ) + if (strlen($aValues['sAppName']) > 200 ) $errors .= "
  • Your application name is too long.
  • \n"; - if (empty($aClean['sAppName'])) + if (empty($aValues['sAppName'])) $errors .= "
  • Please enter an application name.
  • \n"; // No vendor entered, and nothing in the list is selected - if (empty($aClean['sAppVendorName']) && !$aClean['iAppVendorId']) + if (empty($aValues['sAppVendorName']) && !$aValues['iAppVendorId']) $errors .= "
  • Please enter a vendor.
  • \n"; - if (empty($aClean['shAppDescription'])) + if (empty($aValues['shAppDescription'])) $errors .= "
  • Please enter a description of your application.
  • \n"; return $errors; } /* retrieves values from $_REQUEST that were output by OutputEditor() */ - function GetOutputEditorValues() + /* $aValues can be $_REQUEST or any array with the values from OutputEditor() */ + function GetOutputEditorValues($aValues) { - $aClean = array(); //array of filtered user input - - $aClean['iAppId'] = makeSafe($_REQUEST['iAppId']); - $aClean['iAppVendorId'] = makeSafe($_REQUEST['iAppVendorId']); - $aClean['sAppName'] = makeSafe($_REQUEST['sAppName']); - $aClean['shAppDescription'] = makeSafe($_REQUEST['shAppDescription']); - $aClean['iAppCatId'] = makeSafe($_REQUEST['iAppCatId']); - $aClean['sAppWebpage'] = makeSafe($_REQUEST['sAppWebpage']); - $aClean['sAppKeywords'] = makeSafe($_REQUEST['sAppKeywords']); - - $this->iAppId = $aClean['iAppId']; - $this->sName = $aClean['sAppName']; - $this->sDescription = $aClean['shAppDescription']; - $this->iCatId = $aClean['iAppCatId']; - $this->iVendorId = $aClean['iAppVendorId']; - $this->sWebpage = $aClean['sAppWebpage']; - $this->sKeywords = $aClean['sAppKeywords']; + $this->iAppId = $aValues['iAppId']; + $this->sName = $aValues['sAppName']; + $this->sDescription = $aValues['shAppDescription']; + $this->iCatId = $aValues['iAppCatId']; + $this->iVendorId = $aValues['iAppVendorId']; + $this->sWebpage = $aValues['sAppWebpage']; + $this->sKeywords = $aValues['sAppKeywords']; } /* display this application */ diff --git a/include/distributions.php b/include/distributions.php index d65e200..8bf65db 100644 --- a/include/distributions.php +++ b/include/distributions.php @@ -378,20 +378,13 @@ class distribution{ } /* retrieves values from $_REQUEST that were output by OutputEditor() */ - function GetOutputEditorValues() + /* $aValues can be $_REQUEST or any array with the values from OutputEditor() */ + function GetOutputEditorValues($aValues) { - - $aClean = array(); //array of filtered user input - - $aClean['iDistributionId'] = makeSafe($_REQUEST['iDistributionId']); - $aClean['sName'] = makeSafe($_REQUEST['sName']); - $aClean['sUrl'] = makeSafe($_REQUEST['sUrl']); - - $this->iDistributionId = $aClean['iDistributionId']; - $this->sName = $aClean['sName']; - $this->sUrl = $aClean['sUrl']; + $this->iDistributionId = $aValues['iDistributionId']; + $this->sName = $aValues['sName']; + $this->sUrl = $aValues['sUrl']; } - } /* Make a dropdown list of distributions */ diff --git a/include/note.php b/include/note.php index 37f5ee4..1f8e863 100644 --- a/include/note.php +++ b/include/note.php @@ -245,19 +245,13 @@ class Note { } /* retrieves values from $_REQUEST that were output by OutputEditor() */ - function GetOutputEditorValues() + /* $aValues can be $_REQUEST or any array with the values from OutputEditor() */ + function GetOutputEditorValues($aValues) { - $aClean = array(); //array of filtered user input - - $aClean['iVersionId'] = makeSafe($_REQUEST['iVersionId']); - $aClean['iAppId'] = makeSafe( $_REQUEST['iAppId']); - $aClean['sNoteTitle'] = makeSafe($_REQUEST['sNoteTitle']); - $aClean['sNoteDesc'] = makeSafe($_REQUEST['sNoteDesc']); - - $this->iVersionId = $aClean['iVersionId']; - $this->iAppId = $aClean['iAppId']; - $this->sTitle = $aClean['sNoteTitle']; - $this->sDescription = $aClean['sNoteDesc']; + $this->iVersionId = $aValues['iVersionId']; + $this->iAppId = $aValues['iAppId']; + $this->sTitle = $aValues['sNoteTitle']; + $this->sDescription = $aValues['sNoteDesc']; } } ?> diff --git a/include/testResults.php b/include/testResults.php index f142c75..0d5ebea 100644 --- a/include/testResults.php +++ b/include/testResults.php @@ -547,48 +547,37 @@ class testData{ echo html_frame_end(); } - function CheckOutputEditorInput($sDistribution="") + + /* $aValues can be $_REQUEST or any array with the values from OutputEditor() */ + function CheckOutputEditorInput($aValues, $sDistribution="") { - - $aClean = array(); //array of filtered user input - $aClean['sWhatWorks'] = trim(makeSafe($_REQUEST['sWhatWorks'])); - $aClean['sWhatDoesnt'] = trim(makeSafe($_REQUEST['sWhatDoesnt'])); - $aClean['sWhatNotTested'] = trim(makeSafe($_REQUEST['sWhatNotTested'])); - $aClean['sDistribution'] = makeSafe($_REQUEST['sDistribution']); - $aClean['sTestedDate'] = makeSafe($_REQUEST['sTestedDate']); - $aClean['sTestedRelease'] = makeSafe($_REQUEST['sTestedRelease']); - $aClean['iDistributionId'] = makeSafe($_REQUEST['iDistributionId']); - $aClean['sInstalls'] = makeSafe($_REQUEST['sInstalls']); - $aClean['sRuns'] = makeSafe($_REQUEST['sRuns']); - $aClean['sTestedRating'] = makeSafe($_REQUEST['sTestedRating']); - - $errors = ""; - if (empty($aClean['sWhatWorks'])) + $errors = ""; + if (empty($aValues['sWhatWorks'])) $errors .= "
  • Please enter what worked.
  • \n"; - if (empty($aClean['sWhatDoesnt'])) + if (empty($aValues['sWhatDoesnt'])) $errors .= "
  • Please enter what did not work.
  • \n"; - if (empty($aClean['sWhatNotTested'])) + if (empty($aValues['sWhatNotTested'])) $errors .= "
  • Please enter what was not tested.
  • \n"; - if (empty($aClean['sTestedDate'])) + if (empty($aValues['sTestedDate'])) $errors .= "
  • Please enter the date and time when you tested.
  • \n"; - if (empty($aClean['sTestedRelease'])) + if (empty($aValues['sTestedRelease'])) $errors .= "
  • Please enter the version of Wine that you tested with.
  • \n"; // No Distribution entered, and nothing in the list is selected - if (empty($aClean['sDistribution']) && !$aClean['iDistributionId']) + if (empty($aValues['sDistribution']) && !$aValues['iDistributionId']) $errors .= "
  • Please enter a distribution.
  • \n"; - if (empty($aClean['sInstalls'])) + if (empty($aValues['sInstalls'])) $errors .= "
  • Please enter whether this application installs or not.
  • \n"; - if (empty($aClean['sRuns'])) + if (empty($aValues['sRuns'])) $errors .= "
  • Please enter whether this application runs or not.
  • \n"; - if (empty($aClean['sTestedRating'])) + if (empty($aValues['sTestedRating'])) $errors .= "
  • Please enter a rating based on how well this application runs.
  • \n"; return $errors; @@ -596,35 +585,21 @@ class testData{ } /* retrieves values from $_REQUEST that were output by OutputEditor() */ - function GetOutputEditorValues() + /* $aValues can be $_REQUEST or any array with the values from OutputEditor() */ + function GetOutputEditorValues($aValues) { - $aClean = array(); //array of filtered user input - - $aClean['iTestingId'] = makeSafe($_REQUEST['iTestingId']); - $aClean['iVersionId'] = makeSafe($_REQUEST['iVersionId']); - $aClean['sWhatWorks'] = makeSafe($_REQUEST['sWhatWorks']); - $aClean['sWhatDoesnt'] = makeSafe($_REQUEST['sWhatDoesnt']); - $aClean['sWhatNotTested'] = makeSafe($_REQUEST['sWhatNotTested']); - $aClean['sTestedDate'] = makeSafe($_REQUEST['sTestedDate']); - $aClean['iDistributionId'] = makeSafe($_REQUEST['iDistributionId']); - $aClean['sTestedRelease'] = makeSafe($_REQUEST['sTestedRelease']); - $aClean['sInstalls'] = makeSafe($_REQUEST['sInstalls']); - $aClean['sRuns'] = makeSafe($_REQUEST['sRuns']); - $aClean['sTestedRating'] = makeSafe($_REQUEST['sTestedRating']); - $aClean['sComments'] = makeSafe($_REQUEST['sComments']); - - $this->iTestingId = $aClean['iTestingId']; - $this->iVersionId = $aClean['iVersionId']; - $this->sWhatWorks = $aClean['sWhatWorks']; - $this->sWhatDoesnt = $aClean['sWhatDoesnt']; - $this->sWhatNotTested = $aClean['sWhatNotTested']; - $this->sTestedDate = $aClean['sTestedDate']; - $this->iDistributionId = $aClean['iDistributionId']; - $this->sTestedRelease = $aClean['sTestedRelease']; - $this->sInstalls = $aClean['sInstalls']; - $this->sRuns = $aClean['sRuns']; - $this->sTestedRating = $aClean['sTestedRating']; - $this->sComments = $aClean['sComments']; + $this->iTestingId = $aValues['iTestingId']; + $this->iVersionId = $aValues['iVersionId']; + $this->sWhatWorks = $aValues['sWhatWorks']; + $this->sWhatDoesnt = $aValues['sWhatDoesnt']; + $this->sWhatNotTested = $aValues['sWhatNotTested']; + $this->sTestedDate = $aValues['sTestedDate']; + $this->iDistributionId = $aValues['iDistributionId']; + $this->sTestedRelease = $aValues['sTestedRelease']; + $this->sInstalls = $aValues['sInstalls']; + $this->sRuns = $aValues['sRuns']; + $this->sTestedRating = $aValues['sTestedRating']; + $this->sComments = $aValues['sComments']; } diff --git a/include/util.php b/include/util.php index efb39a6..37dd9f7 100644 --- a/include/util.php +++ b/include/util.php @@ -592,11 +592,11 @@ function process_app_version_changes($isVersion) // commit changes of form to database if(($_REQUEST['sSubmit'] == "Update Database") && $isVersion) /* is a version */ { - $oVersion->GetOutputEditorValues(); + $oVersion->GetOutputEditorValues($_REQUEST); $oVersion->update(); } else if(($_REQUEST['sSubmit'] == "Update Database") && !$isVersion) /* is an application */ { - $oApp->GetOutputEditorValues(); + $oApp->GetOutputEditorValues($_REQUEST); $oApp->update(); } else if($_REQUEST['sSubmit'] == "Update URL") { diff --git a/include/version.php b/include/version.php index 4133b11..9771d73 100644 --- a/include/version.php +++ b/include/version.php @@ -578,41 +578,29 @@ class Version { } } - function CheckOutputEditorInput() + function CheckOutputEditorInput($aValues) { - $aClean = array(); //array of filtered user input - - $aClean['sVersionName'] = makeSafe($_REQUEST['sVersionName']); - $aClean['shVersionDescription'] = makeSafe($_REQUEST['shVersionDescription']); - $errors = ""; - if (empty($aClean['sVersionName'])) + if (empty($aValues['sVersionName'])) $errors .= "
  • Please enter an application version.
  • \n"; - if (empty($aClean['shVersionDescription'])) + if (empty($aValues['shVersionDescription'])) $errors .= "
  • Please enter a version description.
  • \n"; return $errors; } /* retrieves values from $_REQUEST that were output by OutputEditor() */ - function GetOutputEditorValues() + /* $aValues can be $_REQUEST or any array with the values from OutputEditor() */ + function GetOutputEditorValues($aValues) { - $aClean = array(); //array of filtered user input - $aClean['iAppId'] = makeSafe($_REQUEST['iAppId']); - $aClean['iVersionId'] = makeSafe($_REQUEST['iVersionId']); - $aClean['sVersionName'] = makeSafe($_REQUEST['sVersionName']); - $aClean['shVersionDescription'] = makeSafe($_REQUEST['shVersionDescription']); - $aClean['sMaintainerRating'] = makeSafe($_REQUEST['sMaintainerRating']); - $aClean['sMaintainerRelease'] = makeSafe($_REQUEST['sMaintainerRelease']); - - $this->iAppId = $aClean['iAppId']; - $this->iVersionId = $aClean['iVersionId']; - $this->sName = $aClean['sVersionName']; - $this->sDescription = $aClean['shVersionDescription']; - $this->sTestedRating = $aClean['sMaintainerRating']; - $this->sTestedRelease = $aClean['sMaintainerRelease']; + $this->iAppId = $aValues['iAppId']; + $this->iVersionId = $aValues['iVersionId']; + $this->sName = $aValues['sVersionName']; + $this->sDescription = $aValues['shVersionDescription']; + $this->sTestedRating = $aValues['sMaintainerRating']; + $this->sTestedRelease = $aValues['sMaintainerRelease']; } function display() diff --git a/testResults.php b/testResults.php index ea54ce8..1e7830f 100644 --- a/testResults.php +++ b/testResults.php @@ -29,8 +29,8 @@ if ($aClean['sSub']) // Submit or Resubmit the new testing results if (($aClean['sSub'] == 'Submit') || ($aClean['sSub'] == 'Resubmit')) { - $errors = $oTest->CheckOutputEditorInput(); - $oTest->GetOutputEditorValues(); // retrieve the values from the current $_REQUEST + $errors = $oTest->CheckOutputEditorInput($_REQUEST); + $oTest->GetOutputEditorValues($_REQUEST); // retrieve the values from the current $_REQUEST if(empty($errors)) { if(!$aClean['iDistributionId'])