Clean up link editing code
This commit is contained in:
committed by
WineHQ
parent
4f44475b6f
commit
6a92f95a6d
@@ -571,100 +571,6 @@ function process_app_version_changes($bIsVersion)
|
||||
{
|
||||
$oApp->GetOutputEditorValues($aClean);
|
||||
$oApp->update();
|
||||
} else if($aClean['sSubmit'] == "Update URL")
|
||||
{
|
||||
$sWhatChanged = "";
|
||||
$bAppChanged = false;
|
||||
|
||||
if (!empty($aClean['sUrlDesc']) && !empty($aClean['sUrl']) )
|
||||
{
|
||||
// process added URL
|
||||
if($_SESSION['current']->showDebuggingInfos()) { echo "<p align=center><b>{$aClean['sUrl']}:</b> {$aClean['sUrlDesc']} </p>"; }
|
||||
|
||||
if($bIsVersion)
|
||||
{
|
||||
$hResult = query_parameters("INSERT INTO appData (versionId, type, description, url) ".
|
||||
"VALUES ('?', '?', '?', '?')",
|
||||
$aClean['iVersionId'], "url", $aClean['sUrlDesc'],
|
||||
$aClean['sUrl']);
|
||||
} else
|
||||
{
|
||||
$hResult = query_parameters("INSERT INTO appData (appId, type, description, url) ".
|
||||
"VALUES ('?', '?', '?', '?')",
|
||||
$aClean['iAppId'], "url", $aClean['sUrlDesc'],
|
||||
$aClean['sUrl']);
|
||||
|
||||
}
|
||||
|
||||
if ($hResult)
|
||||
{
|
||||
addmsg("The URL was successfully added into the database", "green");
|
||||
$sWhatChanged .= " Added Url: Description: ".stripslashes($aClean['sUrlDesc'])."\n";
|
||||
$sWhatChanged .= " Url: ".stripslashes($aClean['sUrl'])."\n";
|
||||
$bAppChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Process changed URLs
|
||||
for($i = 0; $i < $aClean['iRows']; $i++)
|
||||
{
|
||||
if($_SESSION['current']->showDebuggingInfos()) { echo "<p align=center><b>{$aClean['adescription'][$i]}:</b> {$aClean['aURL'][$i]}: {$aClean['adelete'][$i]} : {$aClean['aId'][$i]} : .{$aClean['aOldDesc'][$i]}. : {$aClean['aOldURL'][$i]}</p>"; }
|
||||
|
||||
if ($aClean['adelete'][$i] == "on")
|
||||
{
|
||||
$hResult = query_parameters("DELETE FROM appData WHERE id = '?'", $aClean['aId'][$i]);
|
||||
|
||||
if($hResult)
|
||||
{
|
||||
addmsg("<p><b>Successfully deleted URL ".$aClean['aOldDesc'][$i]." (".$aClean['aOldURL'][$i].")</b></p>\n",'green');
|
||||
$sWhatChanged .= "Deleted Url: Description: ".stripslashes($aClean['aOldDesc'][$i])."\n";
|
||||
$sWhatChanged .= " url: ".stripslashes($aClean['aOldURL'][$i])."\n";
|
||||
$bAppChanged = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if( $aClean['aURL'][$i] != $aClean['aOldURL'][$i] || $aClean['adescription'][$i] != $aClean['aOldDesc'][$i])
|
||||
{
|
||||
if(empty($aClean['aURL'][$i]) || empty($aClean['adescription'][$i]))
|
||||
addmsg("The URL or description was blank. URL not changed in the database", "red");
|
||||
else
|
||||
{
|
||||
if (query_parameters("UPDATE appData SET description = '?', url = '?' WHERE id = '?'",
|
||||
$aClean['adescription'][$i], $aClean['aURL'][$i],
|
||||
$aClean['aId'][$i]))
|
||||
{
|
||||
addmsg("<p><b>Successfully updated ".$aClean['aOldDesc'][$i]." (".$aClean['aOldURL'][$i].")</b></p>\n",'green');
|
||||
$sWhatChanged .= "Changed Url: Old Description: ".stripslashes($aClean['aOldDesc'][$i])."\n";
|
||||
$sWhatChanged .= " Old Url: ".stripslashes($aClean['aOldURL'][$i])."\n";
|
||||
$sWhatChanged .= " New Description: ".stripslashes($aClean['adescription'][$i])."\n";
|
||||
$sWhatChanged .= " New url: ".stripslashes($aClean['aURL'][$i])."\n";
|
||||
$bAppChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($bAppChanged)
|
||||
{
|
||||
$sEmail = User::get_notify_email_address_list($aClean['iAppId']);
|
||||
$oApp = new Application($aClean['iAppId']);
|
||||
if($sEmail)
|
||||
{
|
||||
if($bIsVersion)
|
||||
$sSubject = "Links for ".$oApp->sName." ".$oVersion->sName." have been updated by ".$_SESSION['current']->sRealname;
|
||||
else
|
||||
$sSubject = "Links for ".$oApp->sName." have been updated by ".$_SESSION['current']->sRealname;
|
||||
|
||||
$sMsg = APPDB_ROOT."appview.php?iAppId=".$aClean['iAppId']."\n";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= "The following changes have been made:";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= $sWhatChanged."\n";
|
||||
$sMsg .= "\n";
|
||||
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user