diff --git a/account.php b/account.php
index 0343fc6..51d4276 100644
--- a/account.php
+++ b/account.php
@@ -11,11 +11,15 @@ require(BASE."include/mail.php");
header("Pragma: no-cache");
header("Cache-control: no-cache");
+$aClean = array(); //array of filtered user input
+
// check command and process
-if(isset($_POST['cmd']))
- do_account($_POST['cmd']);
+if(!empty($_POST['cmd']))
+ $aClean['cmd'] = makeSafe( $_POST['cmd'] );
else
- do_account($_GET['cmd']);
+ $aClean['cmd'] = makeSafe( $_GET['cmd'] );
+
+do_account($aClean['cmd']);
/**
@@ -76,25 +80,31 @@ function retry($cmd, $msg)
*/
function cmd_do_new()
{
-
- if(!ereg("^.+@.+\\..+$", $_POST['ext_email']))
+ $aClean = array(); //array of filtered user input
+
+ $aClean['ext_email'] = makeSafe($_POST['ext_email']);
+ $aClean['ext_password'] = makeSafe($_POST['ext_password']);
+ $aClean['ext_password2'] = makeSafe($_POST['ext_password2']);
+ $aClean['CVSrelease'] = makeSafe($_POST['CVSrelease']);
+ $aClean['ext_realname']= makeSafe($_POST['ext_realname']);
+
+ if(!ereg("^.+@.+\\..+$", $aClean['ext_email']))
{
- $_POST['ext_email'] = "";
+ $aClean['ext_email'] = "";
retry("new", "Invalid email address");
return;
}
- if(strlen($_POST['ext_password']) < 5)
+ if(strlen($aClean['ext_password']) < 5)
{
retry("new", "Password must be at least 5 characters");
return;
}
- if($_POST['ext_password'] != $_POST['ext_password2'])
+ if($aClean['ext_password'] != $aClean['ext_password2'])
{
retry("new", "Passwords don't match");
return;
}
- $_POST['ext_realname']=trim($_POST['ext_realname']);
- if(empty($_POST['ext_realname']))
+ if(empty($aClean['ext_realname']))
{
retry("new", "You don't have a Real name?");
return;
@@ -102,15 +112,15 @@ function cmd_do_new()
$user = new User();
- $result = $user->create($_POST['ext_email'], $_POST['ext_password'], $_POST['ext_realname'], $_POST['CVSrelease'] );
+ $result = $user->create($aClean['ext_email'], $aClean['ext_password'], $aClean['ext_realname'], $aClean['CVSrelease'] );
if($result == true)
{
/* if we can log the user in, log them in automatically */
- if($user->login($_POST['ext_email'], $_POST['ext_password']))
+ if($user->login($aClean['ext_email'], $aClean['ext_password']))
$_SESSION['current'] = $user;
- addmsg("Account created! (".$_POST['ext_email'].")", "green");
+ addmsg("Account created! (".$aClean['ext_email'].")", "green");
redirect(apidb_fullurl());
}
else
@@ -126,10 +136,14 @@ function cmd_do_new()
function cmd_send_passwd()
{
+ $aClean = array(); //array of filtered user input
+
+ $aClean['ext_email'] = makeSafe($_POST['ext_email']);
+
$note = '(Note: accounts for appdb.winehq.org and bugs.winehq.org '
.'are separated, so You might need to create second account for appdb.)';
- $userid = user_exists($_POST['ext_email']);
+ $userid = user_exists($aClean['ext_email']);
$passwd = generate_passwd();
$user = new User($userid);
if ($userid)
@@ -159,7 +173,7 @@ function cmd_send_passwd()
}
else
{
- addmsg("Sorry, that user (".$_POST['ext_email'].") does not exist.
"
+ addmsg("Sorry, that user (".$aClean['ext_email'].") does not exist.
"
.$note, "red");
}
@@ -171,8 +185,13 @@ function cmd_send_passwd()
*/
function cmd_do_login()
{
+ $aClean = array(); //array of filtered user input
+
+ $aClean['ext_email'] = makeSafe($_POST['ext_email']);
+ $aClean['ext_password'] = makeSafe($_POST['ext_password']);
+
$user = new User();
- $result = $user->login($_POST['ext_email'], $_POST['ext_password']);
+ $result = $user->login($aClean['ext_email'], $aClean['ext_password']);
if($result == true)
{
diff --git a/addcomment.php b/addcomment.php
index 4e71b0a..a54fa1c 100644
--- a/addcomment.php
+++ b/addcomment.php
@@ -1,4 +1,16 @@
isLoggedIn())
{
@@ -19,24 +26,24 @@ if(!$_SESSION['current']->isLoggedIn())
exit;
}
-if(!is_numeric($_REQUEST['versionId']))
+if( !is_numeric($aClean['versionId']) )
{
errorpage('Internal Database Access Error');
exit;
}
-if(!is_numeric($_REQUEST['thread']))
+if(!is_numeric($aClean['thread']))
{
- $_REQUEST['thread'] = 0;
+ $aClean['thread'] = 0;
}
############################
# ADDS COMMENT TO DATABASE #
############################
-if(isset($_REQUEST['body']))
+if(!empty($aClean['body']))
{
$oComment = new Comment();
- $oComment->create($_REQUEST['subject'], $_REQUEST['body'], $_REQUEST['thread'], $_REQUEST['versionId']);
+ $oComment->create($aClean['subject'], $aClean['body'], $aClean['thread'], $aClean['versionId']);
redirect(apidb_fullurl("appview.php?versionId=".$oComment->iVersionId));
}
@@ -49,9 +56,9 @@ else
$mesTitle = "Post New Comment";
- if($_REQUEST['thread'] > 0)
+ if($aClean['thread'] > 0)
{
- $result = query_appdb("SELECT * FROM appComments WHERE commentId = ".$_REQUEST['thread']);
+ $result = query_appdb("SELECT * FROM appComments WHERE commentId = ".$aClean['thread']);
$ob = mysql_fetch_object($result);
if($ob)
{
@@ -71,8 +78,8 @@ else
echo "
Enter note here
"; + if ( $aClean['noteDesc'] == "" ) $aClean['noteDesc']="Enter note here
"; echo '', "\n"; - echo '',"\n"; + echo '',"\n"; echo '
'; echo 'The application data was successfully added into the database
\n"; @@ -175,7 +184,7 @@ if (!$_REQUEST['id']) { $sSubject = "Application Data Request Report"; $sMsg = "Your submission of an application data for ".lookup_app_name($obj_row->appId).lookup_version_name($obj_row->versionId)." has been accepted. "; - $sMsg .= $_REQUEST['replyText']; + $sMsg .= $aClean['replyText']; $sMsg .= "We appreciate your help in making the Application Database better for all users.\r\n"; mail_appdb($oUser->sEmail, $sSubject ,$sMsg); @@ -183,7 +192,7 @@ if (!$_REQUEST['id']) } } redirect(apidb_fullurl("admin/adminAppDataQueue.php")); - } elseif ($_REQUEST['reject']) + } elseif ($aClean['reject']) { if($obj_row->type == "image") { @@ -197,7 +206,7 @@ if (!$_REQUEST['id']) { $sSubject = "Application Data Request Report"; $sMsg = "Your submission of an application data for ".lookup_app_name($obj_row->appId).lookup_version_name($obj_row->versionId)." was rejected. "; - $sMsg .= $_REQUEST['replyText']; + $sMsg .= $aClean['replyText']; mail_appdb($oUser->sEmail, $sSubject ,$sMsg); } diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index e0f1e92..28a90ed 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -10,6 +10,20 @@ require(BASE."include/application.php"); require(BASE."include/mail.php"); require_once(BASE."include/testResults.php"); +$aClean = array(); //array of filtered user input + +$aClean['iTestingId'] = makeSafe($_REQUEST['iTestingId']); +$aClean['sub'] = makeSafe($_REQUEST['sub'] ); +$aClean['apptype'] = makeSafe($_REQUEST['apptype']); +$aClean['appId'] = makeSafe($_REQUEST['appId']); +$aClean['versionId'] = makeSafe($_REQUEST['versionId']); +$aClean['appVendorName'] = makeSafe($_REQUEST['appVendorName']); +$aClean['appVendorId'] = makeSafe($_REQUEST['appVendorId']); +$aClean['appWebpage'] = makeSafe($_REQUEST['appWebpage']); +$aClean['appIdMergeTo'] = makeSafe($_REQUEST['appIdMergeTo']); +$aClean['replyText'] = makeSafe($_REQUEST['replyText']); +$aClean['versionIdMergeTo'] = makeSafe($_REQUEST['versionIdMergeTo']); +$aClean['sDistribution'] = makeSafe($_REQUEST['sDistribution']); function get_vendor_from_keywords($sKeywords) { @@ -120,11 +134,11 @@ if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isSuperMain errorpage("Insufficient privileges."); exit; } -$oTest = new testData($_REQUEST['iTestingId']); +$oTest = new testData($aClean['iTestingId']); -if ($_REQUEST['sub']) +if ($aClean['sub']) { - if($_REQUEST['apptype'] == 'application') + if($aClean['apptype'] == 'application') { /* make sure the user is authorized to view this application request */ if(!$_SESSION['current']->hasPriv("admin")) @@ -133,21 +147,21 @@ if ($_REQUEST['sub']) exit; } - $oApp = new Application($_REQUEST['appId']); + $oApp = new Application($aClean['appId']); // if we are processing a queued application there MUST be an implicitly queued // version to go along with it. - $sQuery = "Select versionId from appVersion where appId='".$_REQUEST['appId']."';"; + $sQuery = "Select versionId from appVersion where appId='".$aClean['appId']."';"; $hResult = query_appdb($sQuery); $oRow = mysql_fetch_object($hResult); $oVersion = new Version($oRow->versionId); } - else if($_REQUEST['apptype'] == 'version') + else if($aClean['apptype'] == 'version') { /* make sure the user has permission to view this version */ - $oVersion = new Version($_REQUEST['versionId']); + $oVersion = new Version($aClean['versionId']); if(!$_SESSION['current']->hasAppVersionModifyPermission($oVersion)) { errorpage("Insufficient privileges."); @@ -173,21 +187,21 @@ if ($_REQUEST['sub']) $oTest = new testResult(); } - if($_REQUEST['sub'] == 'add') + if($aClean['sub'] == 'add') { - $oVersion = new Version($_REQUEST['versionId']); - $oTest = new testData($_REQUEST['iTestingId']); + $oVersion = new Version($aClean['versionId']); + $oTest = new testData($aClean['iTestingId']); $oVersion->GetOutputEditorValues(); $oTest->GetOutputEditorValues(); - if ($_REQUEST['apptype'] == "application") // application + if ($aClean['apptype'] == "application") // application { - $oApp = new Application($_REQUEST['appId']); + $oApp = new Application($aClean['appId']); $oApp->GetOutputEditorValues(); // load the values from $_REQUEST // add new vendor - if($_REQUEST['appVendorName'] and !$_REQUEST['appVendorId']) + if($aClean['appVendorName'] and !$aClean['appVendorId']) { $oVendor = new Vendor(); - $oVendor->create($_REQUEST['appVendorName'],$_REQUEST['appWebpage']); + $oVendor->create($aClean['appVendorName'],$aClean['appWebpage']); $oApp->iVendorId = $oVendor->iVendorId; } $oApp->update(true); @@ -199,16 +213,16 @@ if ($_REQUEST['sub']) $oTest->unQueue(); redirect($_SERVER['PHP_SELF']); } - else if ($_REQUEST['sub'] == 'duplicate') + else if ($aClean['sub'] == 'duplicate') { - if(is_numeric($_REQUEST['appIdMergeTo'])) + if(is_numeric($aClean['appIdMergeTo'])) { /* move this version submission under the existing app */ - $oVersion->iAppId = $_REQUEST['appIdMergeTo']; + $oVersion->iAppId = $aClean['appIdMergeTo']; $oVersion->update(); /* delete the appId that is the duplicate */ - $_REQUEST['replyText'] = "Your Vesion information was moved to an existing Application"; + $aClean['replyText'] = "Your Vesion information was moved to an existing Application"; $oAppDelete = new Application($oApp->iAppId); $oAppDelete->delete(); } @@ -216,51 +230,51 @@ if ($_REQUEST['sub']) /* redirect back to the main page */ redirect(apidb_fullurl("admin/adminAppQueue.php")); } - else if ($_REQUEST['sub'] == 'movetest') + else if ($aClean['sub'] == 'movetest') { - if(is_numeric($_REQUEST['versionIdMergeTo'])) + if(is_numeric($aClean['versionIdMergeTo'])) { // move this Test submission under the existing version // - $oTest->iVersionId = $_REQUEST['versionIdMergeTo']; + $oTest->iVersionId = $aClean['versionIdMergeTo']; $oTest->update(); // delete the Version entry - $_REQUEST['replyText'] = "Your Test results were moved to existing version"; - $oVersion = new Version($_REQUEST['versionId']); + $aClean['replyText'] = "Your Test results were moved to existing version"; + $oVersion = new Version($aClean['versionId']); $oVersion->delete(); } // redirect back to the main page redirect(apidb_fullurl("admin/adminAppQueue.php")); } - else if ($_REQUEST['sub'] == 'Delete') + else if ($aClean['sub'] == 'Delete') { - if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application + if (($aClean['apptype'] == "application") && is_numeric($aClean['appId'])) // application { // delete the application entry - $oApp = new Application($_REQUEST['appId']); + $oApp = new Application($aClean['appId']); $oApp->delete(); - } else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version + } else if(($aClean['apptype'] == "version") && is_numeric($aClean['versionId'])) // version { // delete the Version entry - $oVersion = new Version($_REQUEST['versionId']); + $oVersion = new Version($aClean['versionId']); $oVersion->delete(); } redirect(apidb_fullurl("admin/adminAppQueue.php")); } - else if ($_REQUEST['sub'] == 'Reject') + else if ($aClean['sub'] == 'Reject') { - $oVersion = new Version($_REQUEST['versionId']); - $oTest = new testData($_REQUEST['iTestingId']); + $oVersion = new Version($aClean['versionId']); + $oTest = new testData($aClean['iTestingId']); $oVersion->GetOutputEditorValues(); $oTest->GetOutputEditorValues(); - if ($_REQUEST['apptype'] == "application") // application + if ($aClean['apptype'] == "application") // application { - $oApp = new Application($_REQUEST['appId']); + $oApp = new Application($aClean['appId']); $oApp->GetOutputEditorValues(); // load the values from $_REQUEST $oApp->update(true); $oApp->reject(); @@ -273,7 +287,7 @@ if ($_REQUEST['sub']) } //process according to sub flag - if ($_REQUEST['sub'] == 'view') + if ($aClean['sub'] == 'view') { $x = new TableVE("view"); apidb_header("Admin App Queue"); @@ -385,7 +399,7 @@ if ($_REQUEST['sub']) { $oVersion->OutputEditor(false, false); } - $oTest->OutputEditor($_REQUEST['sDistribution']); + $oTest->OutputEditor($aClean['sDistribution']); echo html_frame_start("Reply text", "90%", "", 0); echo "$statusMessage
", 'green'); } - else if (($_REQUEST['reject'] || ($_REQUEST['sub'] == 'reject')) && $_REQUEST['queueId']) + else if (($aClean['reject'] || ($aClean['sub'] == 'reject')) && $aClean['queueId']) { $sEmail = $oUser->sEmail; if ($sEmail) @@ -193,7 +201,7 @@ if ($_REQUEST['sub']) $oVersion = new Version($ob->versionId); $sSubject = "Application Maintainer Request Report"; $sMsg = "Your application to be the maintainer of ".$oApp->sName." ".$oVersion->sName." was rejected. "; - $sMsg .= $_REQUEST['replyText']; + $sMsg .= $aClean['replyText']; $sMsg .= ""; $sMsg .= "-The AppDB admins\n"; @@ -201,7 +209,7 @@ if ($_REQUEST['sub']) } //delete main item - $query = "DELETE from appMaintainerQueue where queueId = ".$_REQUEST['queueId'].";"; + $query = "DELETE from appMaintainerQueue where queueId = ".$aClean['queueId'].";"; $result = query_appdb($query,"unable to delete selected maintainer application"); echo html_frame_start("Delete maintainer application",400,"",0); if($result) diff --git a/admin/adminMaintainers.php b/admin/adminMaintainers.php index 9568cb3..1385f50 100644 --- a/admin/adminMaintainers.php +++ b/admin/adminMaintainers.php @@ -9,6 +9,11 @@ include("path.php"); require(BASE."include/incl.php"); +$aClean = array(); //array of filtered user input + +$aClean['sub'] = makeSafe($_REQUEST['sub']); +$aClean['maintainerId'] = makeSafe($_REQUEST['maintainerId']); + // deny access if not logged in if(!$_SESSION['current']->hasPriv("admin")) { @@ -19,13 +24,13 @@ if(!$_SESSION['current']->hasPriv("admin")) apidb_header("Admin Maintainers"); echo '