Eliminate some php notices caused by use of uninitialized variables

This commit is contained in:
Edwin Smulders
2007-07-24 01:45:19 +00:00
committed by WineHQ
parent f961187287
commit 023ece493b
26 changed files with 150 additions and 110 deletions

View File

@@ -6,8 +6,9 @@ require_once(BASE."include/category.php");
if(!$_SESSION['current']->hasPriv("admin")) if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page_and_exit(); util_show_error_page_and_exit();
$oCat = new Category($aClean['iCatId']); $aClean['iCatId'] = (isset($aClean['iCatId']) ? $aClean['iCatId'] : '');
if($aClean['sSubmit']) $oCat = new Category( $aClean['iCatId'] );
if(isset($aClean['sSubmit']))
{ {
$oCat->update($aClean['sName'],$aClean['sDescription'],$aClean['iParentId']); $oCat->update($aClean['sName'],$aClean['sDescription'],$aClean['iParentId']);
util_redirect_and_exit(apidb_fullurl("appbrowse.php?iCatId=".$oCat->iCatId)); util_redirect_and_exit(apidb_fullurl("appbrowse.php?iCatId=".$oCat->iCatId));

View File

@@ -14,7 +14,7 @@ require_once(BASE."include/bugs.php");
if(!$_SESSION['current']->hasPriv("admin")) if(!$_SESSION['current']->hasPriv("admin"))
util_show_error_page_and_exit("Insufficient privileges."); util_show_error_page_and_exit("Insufficient privileges.");
if ($aClean['sSub']) if (isset($aClean['sSub']))
{ {
if(($aClean['sSub'] == 'delete' ) && ($aClean['iBuglinkId'])) if(($aClean['sSub'] == 'delete' ) && ($aClean['iBuglinkId']))
{ {
@@ -34,15 +34,12 @@ if ($aClean['sSub'])
apidb_header("Administer Bugs"); apidb_header("Administer Bugs");
$pageRange = 10; $pageRange = 10;
$ItemsPerPage = 10;
$currentPage = 1;
$QueuedOnly = empty($aClean['sQueuedOnly'])? NULL: $aClean['sQueuedOnly']; $QueuedOnly = empty($aClean['sQueuedOnly'])? NULL: $aClean['sQueuedOnly'];
$BugLinks = ($QueuedOnly == 'on')?getNumberOfQueuedBugLinks():getNumberOfBugLinks(); $BugLinks = ($QueuedOnly == 'on')?getNumberOfQueuedBugLinks():getNumberOfBugLinks();
if($aClean['iItemsPerPage'])
$ItemsPerPage = $aClean['iItemsPerPage'];
if($aClean['iPage']) $ItemsPerPage = isset($aClean['iItemsPerPage']) ? $aClean['iItemsPerPage'] : 10;
$currentPage = $aClean['iPage']; $currentPage = isset($aClean['iPage']) ? $aClean['iPage'] : 1;
$ItemsPerPage = min($ItemsPerPage,100); $ItemsPerPage = min($ItemsPerPage,100);
$totalPages = max(ceil($BugLinks/$ItemsPerPage),1); $totalPages = max(ceil($BugLinks/$ItemsPerPage),1);

View File

@@ -12,13 +12,8 @@ apidb_header("Comments");
/* display a range of 10 pages */ /* display a range of 10 pages */
$pageRange = 10; $pageRange = 10;
$ItemsPerPage = 10; $ItemsPerPage = isset($aClean['iItemsPerPage']) ? $aClean['iItemsPerPage'] : 10;
$currentPage = 1; $currentPage = isset($aClean['iPage']) ? $aClean['iPage'] : 1;
if($aClean['iItemsPerPage'])
$ItemsPerPage = $aClean['iItemsPerPage'];
if($aClean['iPage'])
$currentPage = $aClean['iPage'];
$totalPages = ceil(getNumberOfComments()/$ItemsPerPage); $totalPages = ceil(getNumberOfComments()/$ItemsPerPage);

View File

@@ -16,7 +16,7 @@ if(!$_SESSION['current']->hasPriv("admin"))
apidb_header("Admin Maintainers"); apidb_header("Admin Maintainers");
echo '<form name="sQform" action="adminMaintainers.php" method="post" enctype="multipart/form-data">',"\n"; echo '<form name="sQform" action="adminMaintainers.php" method="post" enctype="multipart/form-data">',"\n";
if ($aClean['sSub']) if (isset($aClean['sSub']))
{ {
if($aClean['sSub'] == 'delete') if($aClean['sSub'] == 'delete')
{ {

View File

@@ -16,7 +16,7 @@ if(!$_SESSION['current']->hasPriv("admin"))
/* /*
* We issued a delete command. * We issued a delete command.
*/ */
if($aClean['sCmd']) if(isset($aClean['sCmd']))
{ {
// process screenshot deletion // process screenshot deletion
if($aClean['sCmd'] == "delete" && is_numeric($aClean['iImageId'])) if($aClean['sCmd'] == "delete" && is_numeric($aClean['iImageId']))
@@ -33,7 +33,7 @@ if($aClean['sCmd'])
apidb_header("Screenshots"); apidb_header("Screenshots");
// regenerate all screenshots // regenerate all screenshots
if($aClean['sRegenerate']) if(isset($aClean['sRegenerate']))
{ {
$sQuery = "SELECT id FROM appData WHERE type = 'screenshot'"; $sQuery = "SELECT id FROM appData WHERE type = 'screenshot'";
$hResult = query_parameters($sQuery); $hResult = query_parameters($sQuery);
@@ -55,13 +55,8 @@ echo "</center>";
/* display a range of 10 pages */ /* display a range of 10 pages */
$pageRange = 10; $pageRange = 10;
$ItemsPerPage = 6; $ItemsPerPage = isset($aClean['iItemsPerPage']) ? $aClean['iItemsPerPage'] : 6;
$currentPage = 1; $currentPage = isset($aClean['iPage']) ? $aClean['iPage'] : 1;
if($aClean['iItemsPerPage'])
$ItemsPerPage = $aClean['iItemsPerPage'];
if($aClean['iPage'])
$currentPage = $aClean['iPage'];
$ItemsPerPage = min($ItemsPerPage,100); $ItemsPerPage = min($ItemsPerPage,100);
$totalPages = ceil(appData::objectGetEntriesCount("all", false, $totalPages = ceil(appData::objectGetEntriesCount("all", false,

View File

@@ -13,28 +13,70 @@ if(!$_SESSION['current']->hasPriv("admin"))
// we want to delete a user // we want to delete a user
if($aClean['sAction'] == "delete" && is_numeric($aClean['iUserId'])) if(isset($aClean['sAction']) && $aClean['sAction'] == "delete" &&
is_numeric($aClean['iUserId']))
{ {
$oUser = new User($aClean['iUserId']); $oUser = new User($aClean['iUserId']);
$oUser->delete(); $oUser->delete();
} }
// search form // search form
echo html_frame_start("Users Management","400","",0) echo html_frame_start("Users Management","400","",0);
$aClean['sSearch'] = isset($aClean['sSearch']) ? $aClean['sSearch'] : '';
$sLimit100 = $sLimit200 = $sLimit500 = '';
if ( isset($aClean['iLimit']) )
{
switch ($aClean['iLimit'])
{
case '100':
$sLimit100 = 'selected';
break;
case '200':
$sLimit200 = 'selected';
break;
case '500':
$sLimit500 = 'selected';
break;
}
}
$sOrder1 = $sOrder2 = $sOrder3 = '';
if ( isset($aClean['sOrderBy']) )
{
switch ($aClean['sOrderBy'])
{
case 'email':
$sOrder1 = 'selected';
break;
case 'realname':
$sOrder2 = 'selected';
break;
case 'created':
$sOrder3 = 'selected';
break;
}
}
?> ?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<table width="100%" border=0 cellpadding=0 cellspacing=0> <table width="100%" border=0 cellpadding=0 cellspacing=0>
<tr> <tr>
<td class="color1">Pattern</td> <td class="color1">Pattern</td>
<td><input type="text" name="sSearch" value="<?php echo $aClean['sSearch'];?>"/><br /><small>(leave blank to match all)</small></td> <td>
<input type="text" name="sSearch" value="<?php echo $aClean['sSearch'];?>"/>
<br /><small>(leave blank to match all)</small>
</td>
</tr> </tr>
<tr> <tr>
<td class="color1">Show first</td> <td class="color1">Show first</td>
<td> <td>
<select name="iLimit"> <select name="iLimit">
<option value="100"<?php if($aClean['iLimit']=="100")echo" SELECTED";?>>100 results</option> <option value="100" <?php echo $sLimit100; ?>>100 results</option>
<option value="200"<?php if($aClean['iLimit']=="200")echo" SELECTED";?>>200 results</option> <option value="200" <?php echo $sLimit200; ?>>200 results</option>
<option value="500"<?php if($aClean['iLimit']=="500")echo" SELECTED";?>>500 result</option> <option value="500" <?php echo $sLimit500; ?>>500 results</option>
</select> </select>
</td> </td>
</tr> </tr>
@@ -42,9 +84,9 @@ echo html_frame_start("Users Management","400","",0)
<td class="color1">Order by</td> <td class="color1">Order by</td>
<td> <td>
<select name="sOrderBy"> <select name="sOrderBy">
<option value="email"<?php if($aClean['sOrderBy']=="email")echo" SELECTED";?>>e-mail</option> <option value="email" <?php echo $sOrder1;?>>e-mail</option>
<option value="realname"<?php if($aClean['sOrderBy']=="realname")echo" SELECTED";?>>real name</option> <option value="realname" <?php echo $sOrder2;?>>real name</option>
<option value="created"<?php if($aClean['sOrderBy']=="created")echo" SELECTED";?>>creation date</option> <option value="created" <?php echo $sOrder3;?>>creation date</option>
</select> </select>
</td> </td>
</tr> </tr>
@@ -57,7 +99,7 @@ echo html_frame_start("Users Management","400","",0)
echo html_frame_end(); echo html_frame_end();
// if the search form was submitted // if the search form was submitted
if($aClean['sSubmit']) if(isset($aClean['sSubmit']))
{ {
echo html_frame_start("Query Results","90%","",0); echo html_frame_start("Query Results","90%","",0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n"; echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";

View File

@@ -24,13 +24,14 @@ function admin_menu()
$m->done(); $m->done();
} }
$iCatId = isset($aClean['iCatId']) ? $aClean['iCatId'] : 0;
// list sub categories // list sub categories
$oCat = new Category($aClean['iCatId']?$aClean['iCatId']:"0"); $oCat = new Category( $iCatId );
$sCatFullPath = Category::make_cat_path($oCat->getCategoryPath()); $sCatFullPath = Category::make_cat_path($oCat->getCategoryPath());
$subs = $oCat->aSubcatsIds; $subs = $oCat->aSubcatsIds;
//display admin box //display admin box
if($_SESSION['current']->hasPriv("admin") && $aClean['iCatId'] != 0) if($_SESSION['current']->hasPriv("admin") && isset($aClean['iCatId']) && $aClean['iCatId'] != 0 )
apidb_sidebar_add("admin_menu"); apidb_sidebar_add("admin_menu");
//output header //output header
@@ -96,7 +97,7 @@ if($subs)
// output the table // output the table
echo $oTable->GetString(); echo $oTable->GetString();
echo html_frame_end("$c categories"); echo html_frame_end( count($subs) . ' categories');
} }
@@ -156,7 +157,7 @@ if($apps)
// output table // output table
echo $oTable->GetString(); echo $oTable->GetString();
echo html_frame_end("$c applications in this category"); echo html_frame_end( count($apps) . " applications in this category");
} }
// Disabled for now // Disabled for now

View File

@@ -27,8 +27,6 @@ require_once(BASE."include/category.php");
require_once(BASE."include/maintainer.php"); require_once(BASE."include/maintainer.php");
require_once(BASE."include/monitor.php"); require_once(BASE."include/monitor.php");
$oApp = new Application($aClean['iAppId']);
$oVersion = new Version($aClean['iVersionId']);
/** /**
* Displays the SUB apps that belong to this application. * Displays the SUB apps that belong to this application.
@@ -76,7 +74,7 @@ function display_bundle($iAppId)
if(empty($aClean['iAppId']) && empty($aClean['iVersionId'])) if(empty($aClean['iAppId']) && empty($aClean['iVersionId']))
util_show_error_page_and_exit("Something went wrong with the application or version id"); util_show_error_page_and_exit("Something went wrong with the application or version id");
if ($aClean['sSub']) if (isset($aClean['sSub']))
{ {
if(($aClean['sSub'] == 'delete' ) && ($aClean['iBuglinkId'])) if(($aClean['sSub'] == 'delete' ) && ($aClean['iBuglinkId']))
{ {
@@ -135,14 +133,15 @@ if ($aClean['sSub'])
/** /**
* We want to see an application family (=no version). * We want to see an application family (=no version).
*/ */
if($aClean['iAppId']) if( isset($aClean['iAppId']) )
{ {
$oApp = new Application($aClean['iAppId']); $oApp = new Application($aClean['iAppId']);
$oApp->display(); $oApp->display();
} else if($aClean['iVersionId']) // We want to see a particular version. } else if( isset($aClean['iVersionId']) ) // We want to see a particular version.
{ {
$oVersion = new Version($aClean['iVersionId']); $oVersion = new Version($aClean['iVersionId']);
$oVersion->display($aClean['iTestingId']); $iTestingId = isset($aClean['iTestingId']) ? $aClean['iTestingId'] : null;
$oVersion->display($iTestingId);
} else } else
{ {
// Oops! Called with no params, bad llamah! // Oops! Called with no params, bad llamah!

View File

@@ -12,13 +12,14 @@ apidb_header("Browse Downloadable Applications");
echo "<div class='default_container'>\n"; echo "<div class='default_container'>\n";
/* Match specific license? */ /* Match specific license? */
$sLicense = version::checkLicense($aClean['sLicense']); $sLicenseString = isset($aClean['sLicense']) ? $aClean['sLicense'] : '';
$sLicense = version::checkLicense( $sLicenseString );
/* Set default values */ /* Set default values */
if(!$aClean['iNumVersions'] || $aClean['iNumVersions'] > 200 || $aClean['iNumVersions'] < 0) if(!isset($aClean['iNumVersions']) || $aClean['iNumVersions'] > 200 || $aClean['iNumVersions'] < 0)
$aClean['iNumVersions'] = 25; $aClean['iNumVersions'] = 25;
if(!$aClean['iPage']) if( !isset($aClean['iPage']) )
$aClean['iPage'] = 1; $aClean['iPage'] = 1;
/* Count the possible matches */ /* Count the possible matches */
@@ -39,7 +40,7 @@ else
if($hResult && mysql_num_rows($hResult)) if($hResult && mysql_num_rows($hResult))
$num = mysql_num_rows($hResult); $num = mysql_num_rows($hResult);
$iNumPages = ceil($num / $aClean['iNumVersions']); $iNumPages = isset($num) ? ceil($num/$aClean['iNumVersions']) : 0;
/* Check page logic */ /* Check page logic */
$aClean['iPage'] = min($aClean['iPage'], $iNumPages); $aClean['iPage'] = min($aClean['iPage'], $iNumPages);
@@ -50,9 +51,11 @@ $iLimitLower = ($aClean['iPage'] - 1) * $aClean['iNumVersions'];
/* Page selection */ /* Page selection */
echo "<div align=\"center\">\n"; echo "<div align=\"center\">\n";
echo "<b>Page ".$aClean['iPage']." of $iNumPages</b><br />\n"; echo "<b>Page ".$aClean['iPage']." of $iNumPages</b><br />\n";
// $iPageRange is non-existent here? creating it
$iPageRange = 10;
display_page_range($aClean['iPage'], $iPageRange, $iNumPages, display_page_range($aClean['iPage'], $iPageRange, $iNumPages,
$_SERVER['PHP_SELF']."?iNumVersions=".$aClean['iNumVersions']."&sLicense=". $_SERVER['PHP_SELF']."?iNumVersions=".$aClean['iNumVersions']."&sLicense=".
$aClean['sLicense']); $sLicenseString);
/* Selector for how many versions to display */ /* Selector for how many versions to display */
echo "<form method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">\n"; echo "<form method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">\n";
@@ -78,7 +81,7 @@ echo $oVersion->makeLicenseList($sLicense);
echo " <input type=\"submit\" value=\"Refresh\" />\n"; echo " <input type=\"submit\" value=\"Refresh\" />\n";
echo "</form></div>\n<br />\n"; echo "</form></div>\n<br />\n";
if(!$num) if(!isset($num))
{ {
echo "<div align=\"center\"><font color=\"red\">No matches found</font></div>\n"; echo "<div align=\"center\"><font color=\"red\">No matches found</font></div>\n";
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");

View File

@@ -8,7 +8,7 @@ require(BASE."include/"."incl.php");
$help_path = BASE."/help"; $help_path = BASE."/help";
if($aClean['sTopic']) if(isset($aClean['sTopic']))
{ {
display_help($aClean['sTopic']); display_help($aClean['sTopic']);
} else { } else {

View File

@@ -258,6 +258,8 @@ class appData
{ {
if($sQueued == "true" || $sQueued == "false") if($sQueued == "true" || $sQueued == "false")
$sAppDataQueued = " AND appData.queued = '$sQueued'"; $sAppDataQueued = " AND appData.queued = '$sQueued'";
else
$sAppDataQueued = '';
if($sType) if($sType)
$sSelectType = " AND type = '?'"; $sSelectType = " AND type = '?'";

View File

@@ -879,7 +879,7 @@ class Application {
if($_SESSION['current']->hasPriv("admin")) if($_SESSION['current']->hasPriv("admin"))
return TRUE; return TRUE;
if(is_object($this) && $this->iAppId) if(isset($this) && is_object($this) && $this->iAppId)
{ {
if(maintainer::isUserSuperMaintainer($_SESSION['current'], if(maintainer::isUserSuperMaintainer($_SESSION['current'],
$this->iAppId)) $this->iAppId))

View File

@@ -435,7 +435,7 @@ class Comment {
else else
$mode = "threaded"; /* default non-logged in users to threaded comment display mode */ $mode = "threaded"; /* default non-logged in users to threaded comment display mode */
if ($aClean['sMode']=="nested") if ( isset($aClean['sMode']) && $aClean['sMode']=="nested")
$mode = "nested"; $mode = "nested";
switch ($mode) switch ($mode)

View File

@@ -50,6 +50,8 @@ class downloadurl
if(!($hResult = appData::getData($iVersionId, "downloadurl"))) if(!($hResult = appData::getData($iVersionId, "downloadurl")))
return FALSE; return FALSE;
// we're appending, so initialize it
$sReturn = '';
for($i = 0; $oRow = mysql_fetch_object($hResult); $i++) for($i = 0; $oRow = mysql_fetch_object($hResult); $i++)
{ {
$sReturn .= html_tr(array( $sReturn .= html_tr(array(

View File

@@ -22,9 +22,10 @@ class error_log
$sQuery = 'INSERT INTO error_log (submitTime, userid, type, log_text, request_text, deleted) '. $sQuery = 'INSERT INTO error_log (submitTime, userid, type, log_text, request_text, deleted) '.
"VALUES(?, '?', '?', '?', '?', '?')"; "VALUES(?, '?', '?', '?', '?', '?')";
$iUser = (isset($_SESSION['current']) ? $_SESSION['current']->iUserId : 0);
$hResult = query_parameters($sQuery, $hResult = query_parameters($sQuery,
"NOW()", "NOW()",
$_SESSION['current']->iUserId, $iUser,
$sErrorType, $sErrorType,
$sLogText, $sLogText,
$sRequestText, $sRequestText,

View File

@@ -9,7 +9,7 @@ echo '<form method="post" name="sFlogin" action="account.php">',"\n";
echo html_frame_start("Login to Application DB","400","",0); echo html_frame_start("Login to Application DB","400","",0);
/* Pass on the URL we should return to after log-in */ /* Pass on the URL we should return to after log-in */
global $aClean; global $aClean;
echo '<input type="hidden" name="sReturnTo" value="'.$aClean['sReturnTo'].'" />'; echo '<input type="hidden" name="sReturnTo" value="' . (isset($aClean['sReturnTo']) ? $aClean['sReturnTo'] : '') . '" />';
?> ?>
<!-- start of login form --> <!-- start of login form -->

View File

@@ -31,7 +31,7 @@ echo html_frame_start("Create New Application DB Account","400","",0)
<?php <?php
echo "<tr><td class=color1>&nbsp; Wine version </td><td class=color0>"; echo "<tr><td class=color1>&nbsp; Wine version </td><td class=color0>";
make_bugzilla_version_list("sWineRelease", $aClean['sWineRelease']); echo make_bugzilla_version_list("sWineRelease", isset($aClean['sWineRelease']) ? $aClean['sWineRelease'] : '');
echo "</td></tr>"; echo "</td></tr>";
?> ?>

View File

@@ -47,11 +47,13 @@ class Monitor {
WHERE userId = '".$iUserId."' WHERE userId = '".$iUserId."'
AND versionId = '".$iVersionId."'"; AND versionId = '".$iVersionId."'";
$hResult = query_appdb($sQuery); $hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult); if( $oRow = mysql_fetch_object($hResult) )
$this->iMonitorId = $oRow->monitorId; {
$this->iAppId = $oRow->appId; $this->iMonitorId = $oRow->monitorId;
$this->iVersionId = $oRow->versionId; $this->iAppId = $oRow->appId;
$this->iUserId = $oRow->userId; $this->iVersionId = $oRow->versionId;
$this->iUserId = $oRow->userId;
}
} }
} }

View File

@@ -492,7 +492,7 @@ class ObjectManager
// is the value we modify and we'll be passing that into methods in the future // is the value we modify and we'll be passing that into methods in the future
global $aClean; global $aClean;
if(!$aClean['sSubmit']) if(!isset($aClean['sSubmit']))
return; return;
$this->checkMethods(array("getOutputEditorValues", "update", "create", $this->checkMethods(array("getOutputEditorValues", "update", "create",
@@ -513,12 +513,11 @@ class ObjectManager
// handle the common response radio button value // handle the common response radio button value
// if sReplyText is empty, if sOMCommonReply was set because // if sReplyText is empty, if sOMCommonReply was set because
// the user selected a radio button then use that text instead // the user selected a radio button then use that text instead
if(($aClean['sReplyText'] == "") && isset($aClean['sOMCommonReply'])) if( isset($aClean['sReplyText']) && $aClean['sReplyText'] == "" && isset($aClean['sOMCommonReply']))
{ {
$aClean['sReplyText'] = $aClean['sOMCommonReply']; $aClean['sReplyText'] = $aClean['sOMCommonReply'];
} }
$oObject->getOutputEditorValues($aClean); $oObject->getOutputEditorValues($aClean);
/* Check input, if necessary */ /* Check input, if necessary */
@@ -635,10 +634,7 @@ class ObjectManager
function getIdFromInput($aClean) function getIdFromInput($aClean)
{ {
$sId = "i".ucfirst($this->sClass)."Id"; $sId = "i".ucfirst($this->sClass)."Id";
$iId = $aClean['sId']; $iId = isset($aClean['sId']) ? $aClean['sId'] : $aClean['iId'];
if(!$iId)
$iId = $aClean['iId'];
return $iId; return $iId;
} }
@@ -678,12 +674,11 @@ class ObjectManager
$aItemsPerPage = $aReturn[0]; $aItemsPerPage = $aReturn[0];
$iDefaultPerPage = $aReturn[1]; $iDefaultPerPage = $aReturn[1];
$iItemsPerPage = $iDefaultPerPage; $iItemsPerPage = $iDefaultPerPage;
foreach($aItemsPerPage as $iNum)
{ if ( isset($aClean['iItemsPerPage']) && in_array($aClean['iItemsPerPage'], $aItemsPerPage) )
if($iNum == $aClean['iItemsPerPage']) $iItemsPerPage = $aClean['iItemsPerPage'];
$iItemsPerPage = $aClean['iItemsPerPage'];
}
$sControls = "<form action=\"".$this->makeUrl()."\" method=\"get\">"; $sControls = "<form action=\"".$this->makeUrl()."\" method=\"get\">";
@@ -705,9 +700,7 @@ class ObjectManager
$iNumPages = ceil($iTotalEntries / $iItemsPerPage); $iNumPages = ceil($iTotalEntries / $iItemsPerPage);
/* Check current page value */ /* Check current page value */
$iPage = $aClean['iPage']; $iPage = isset($aClean['iPage']) ? $aClean['iPage'] : 1;
if(!$iPage)
$iPage = 1;
$iCurrentPage = min($iPage, $iNumPages); $iCurrentPage = min($iPage, $iNumPages);
/* Display selectors and info */ /* Display selectors and info */
@@ -778,7 +771,7 @@ class MultiPage
function getDataFromInput($aClean) function getDataFromInput($aClean)
{ {
if($aClean['iItemsPerPage'] && $aClean['iPage']) if(isset($aClean['iItemsPerPage']) && isset($aClean['iPage']))
$this->bEnabled = TRUE; $this->bEnabled = TRUE;
else else
return; return;

View File

@@ -401,6 +401,9 @@ class screenshot
function get_random_screenshot_img($iAppId = null, $iVersionId = null, function get_random_screenshot_img($iAppId = null, $iVersionId = null,
$bFormatting = true) $bFormatting = true)
{ {
// initialize variables to avoid notices when appending to them
$sImgFile = '';
$sImg = '';
// we want a random screenshots for this app // we want a random screenshots for this app
if($iAppId && !$iVersionId) if($iAppId && !$iVersionId)
{ {

View File

@@ -444,7 +444,7 @@ class testData{
$link = mysql_real_escape_string($link); $link = mysql_real_escape_string($link);
$iDisplayLimit = mysql_real_escape_string($iDisplayLimit); $iDisplayLimit = mysql_real_escape_string($iDisplayLimit);
$sShowAll = $aClean['sShowAll']; $sShowAll = isset($aClean['sShowAll']) ? $aClean['sShowAll'] : false;
$sQuery = "SELECT * $sQuery = "SELECT *
FROM testResults FROM testResults

View File

@@ -402,6 +402,8 @@ function cleanupSearchWords($search_words)
/* search each word in $search_words */ /* search each word in $search_words */
$split_words = split(" ", $search_words); $split_words = split(" ", $search_words);
$removed_words = '';
foreach($split_words as $key=>$value) foreach($split_words as $key=>$value)
{ {
/* see if this word is in the ignore list */ /* see if this word is in the ignore list */

View File

@@ -67,15 +67,18 @@ if(!$_SESSION['current']->isLoggedIn())
echo "There are <b>$iNumApps</b> applications currently in the database"; echo "There are <b>$iNumApps</b> applications currently in the database";
// don't mention the top application if there are no votes yet // don't mention the top application if there are no votes yet
if($oRow->versionId) if( !empty($oRow) )
{ {
$shVoteAppLink = version::fullNameLink($oRow->versionId); if($oRow->versionId)
echo " with $shVoteAppLink being the\n"; {
echo "top <a href='votestats.php'>voted</a> application.\n"; $shVoteAppLink = version::fullNameLink($oRow->versionId);
} else echo " with $shVoteAppLink being the\n";
{ echo "top <a href='votestats.php'>voted</a> application.\n";
echo " please <a href=\"".BASE."help/?sTopic=voting\" title=\"help on voting\"". } else
"style=\"cursor: help\">vote</a> for your favourite application.\n"; {
echo " please <a href=\"".BASE."help/?sTopic=voting\" title=\"help on voting\"".
"style=\"cursor: help\">vote</a> for your favourite application.\n";
}
} }
?> ?>

View File

@@ -25,7 +25,7 @@ require_once(BASE.'include/testData_queue.php');
require_once(BASE.'include/browse_newest_apps.php'); require_once(BASE.'include/browse_newest_apps.php');
/* if we have no valid class name we should abort */ /* if we have no valid class name we should abort */
if(!$aClean['sClass']) if(!isset($aClean['sClass']))
{ {
echo "No class defined.\n"; echo "No class defined.\n";
exit; exit;
@@ -38,13 +38,16 @@ if(!class_exists($aClean['sClass']))
exit; exit;
} }
$aClean['iId'] = isset($aClean['iId']) ? $aClean['iId'] : 0;
$oObject = new objectManager($aClean['sClass'], $aClean['sTitle'], $aClean['iId']); $oObject = new objectManager($aClean['sClass'], $aClean['sTitle'], $aClean['iId']);
if($aClean['bIsQueue'] == 'true') if(isset($aClean['bIsQueue']) && $aClean['bIsQueue'] == 'true')
$oObject->bIsQueue = true; $oObject->bIsQueue = true;
else else
$oObject->bIsQueue = false; $oObject->bIsQueue = false;
$aClean['bIsRejected'] = isset($aClean['bIsRejected']) ? $aClean['bIsRejected'] : false;
/* If it is rejected it is defined as queued */ /* If it is rejected it is defined as queued */
if($aClean['bIsRejected'] == 'true') if($aClean['bIsRejected'] == 'true')
{ {
@@ -65,7 +68,7 @@ $sErrors = $oObject->processForm($aClean);
if($oObject->iId && $aClean['sAction'] == "delete") if($oObject->iId && $aClean['sAction'] == "delete")
$oObject->delete_entry(); $oObject->delete_entry();
if($aClean['sAction'] == "add") if(isset($aClean['sAction']) && $aClean['sAction'] == "add")
$oObject->handle_anonymous_submission(); $oObject->handle_anonymous_submission();
/* Provided the necessary values are present, an object's children may be moved /* Provided the necessary values are present, an object's children may be moved
@@ -96,7 +99,7 @@ if($oObject->iId)
$oObject->view($_SERVER['REQUEST_URI']); $oObject->view($_SERVER['REQUEST_URI']);
break; break;
} }
} else if ($aClean['sAction'] == "add") } else if (isset($aClean['sAction']) && $aClean['sAction'] == "add")
{ {
$oObject->add_entry($_SERVER['REQUEST_URI'], $sErrors); $oObject->add_entry($_SERVER['REQUEST_URI'], $sErrors);
} else } else

View File

@@ -108,9 +108,10 @@ if(!$_SESSION['current']->isLoggedIn())
// we come from the administration to edit an user // we come from the administration to edit an user
if($_SESSION['current']->hasPriv("admin") && if($_SESSION['current']->hasPriv("admin") &&
is_numeric($aClean['iUserId']) && isset($aClean['iUserId']) &&
is_numeric($aClean['iLimit']) && isset($aClean['iLimit']) &&
in_array($aClean['sOrderBy'],array("email","realname","created")) isset($aClean['sOrderBy']) &&
in_array($aClean['sOrderBy'],array("email","realname","created"))
) )
{ {
$oUser = new User($aClean['iUserId']); $oUser = new User($aClean['iUserId']);
@@ -119,7 +120,7 @@ if($_SESSION['current']->hasPriv("admin") &&
$oUser = &$_SESSION['current']; $oUser = &$_SESSION['current'];
} }
if($aClean['sSubmit'] == "Update") if(isset($aClean['sSubmit']) && $aClean['sSubmit'] == "Update")
{ {
while(list($sKey, $sValue) = each($aClean)) while(list($sKey, $sValue) = each($aClean))
{ {
@@ -182,7 +183,7 @@ echo "<div class='default_container'>\n";
echo "<form method=\"post\" action=\"preferences.php\">\n"; echo "<form method=\"post\" action=\"preferences.php\">\n";
// if we manage another user we give the parameters to go back to the admin // if we manage another user we give the parameters to go back to the admin
if($oUser->iUserId == $aClean['iUserId']) if( isset($aClean['iUserId']) && $oUser->iUserId == $aClean['iUserId'])
{ {
echo "<input type=\"hidden\" name=\"iLimit\" value=\"".$aClean['iLimit']."\">\n"; echo "<input type=\"hidden\" name=\"iLimit\" value=\"".$aClean['iLimit']."\">\n";
echo "<input type=\"hidden\" name=\"sOrderBy\" value=\"".$aClean['sOrderBy']."\">\n"; echo "<input type=\"hidden\" name=\"sOrderBy\" value=\"".$aClean['sOrderBy']."\">\n";
@@ -210,7 +211,7 @@ foreach($aTableRows as $oTableRow)
$oTable->AddRow($oTableRow); $oTable->AddRow($oTableRow);
// if we don't manage another user // if we don't manage another user
if($oUser->iUserId != $aClean['iUserId']) if( !isset($aClean['iUserId']) || $oUser->iUserId != $aClean['iUserId'])
{ {
$aTableRows = build_prefs_list($oUser); $aTableRows = build_prefs_list($oUser);
foreach($aTableRows as $oTableRow) foreach($aTableRows as $oTableRow)

View File

@@ -16,13 +16,8 @@ echo "<div class='default_container'>\n";
/* display a range of 10 pages */ /* display a range of 10 pages */
$pageRange = 10; $pageRange = 10;
$ItemsPerPage = 6; $ItemsPerPage = isset($aClean['iItemsPerPage']) ? $aClean['iItemsPerPage'] : 6;
$currentPage = 1; $currentPage = isset($aClean['iPage']) ? $aClean['iPage'] : 1;
if($aClean['iItemsPerPage'])
$ItemsPerPage = $aClean['iItemsPerPage'];
if($aClean['iPage'])
$currentPage = $aClean['iPage'];
$ItemsPerPage = min($ItemsPerPage,100); $ItemsPerPage = min($ItemsPerPage,100);
$totalPages = ceil(appData::objectGetEntriesCount("false", false, $totalPages = ceil(appData::objectGetEntriesCount("false", false,