- use queued screenshot directory instead of mysql to store queued data
- use the config file to determine thumbnail size
This commit is contained in:
@@ -22,12 +22,8 @@ if(!loggedin())
|
|||||||
if (!$_REQUEST['queueId'])
|
if (!$_REQUEST['queueId'])
|
||||||
{
|
{
|
||||||
//get available appData
|
//get available appData
|
||||||
$query = "SELECT queueId, queueappId, queueversionId,".
|
$str_query = "SELECT * from appDataQueue;";
|
||||||
"queuetype, queuedescription,".
|
$result = mysql_query($str_query);
|
||||||
"queueurl,queuecontent,queueuserId,".
|
|
||||||
"UNIX_TIMESTAMP(submitTime) as submitTime ".
|
|
||||||
"from appDataQueue;";
|
|
||||||
$result = mysql_query($query);
|
|
||||||
|
|
||||||
if(!$result || !mysql_num_rows($result))
|
if(!$result || !mysql_num_rows($result))
|
||||||
{
|
{
|
||||||
@@ -68,14 +64,14 @@ if (!$_REQUEST['queueId'])
|
|||||||
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
|
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
|
||||||
echo "<tr class=$bgcolor>\n";
|
echo "<tr class=$bgcolor>\n";
|
||||||
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." </td>\n";
|
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." </td>\n";
|
||||||
echo " <td><a href='adminAppDataQueue.php?queueId=$ob->queueId'>$ob->queueId</a></td>\n";
|
echo " <td><a href='adminAppDataQueue.php?queueId=$ob->queueId'>".$ob->queueId."</a></td>\n";
|
||||||
if($ob->queueuserId)
|
if($ob->userId)
|
||||||
echo " <td>".lookupUsername($ob->queueuserId)." (".lookupEmail($ob->queueuserId).")</td>\n";
|
echo " <td>".lookupUsername($ob->userId)." (".lookupEmail($ob->userId).")</td>\n";
|
||||||
else
|
else
|
||||||
echo " <td>Anonymous</td>\n";
|
echo " <td>Anonymous</td>\n";
|
||||||
echo "<td>".appIdToName($ob->queueappId)."</td>\n";
|
echo "<td>".appIdToName($ob->appId)."</td>\n";
|
||||||
echo "<td>".versionIdToName($ob->queueversionId)."</td>\n";
|
echo "<td>".versionIdToName($ob->versionId)."</td>\n";
|
||||||
echo "<td>".$ob->queuetype."</td>\n";
|
echo "<td>".$ob->type."</td>\n";
|
||||||
echo "</tr>\n\n";
|
echo "</tr>\n\n";
|
||||||
$c++;
|
$c++;
|
||||||
}
|
}
|
||||||
@@ -101,7 +97,7 @@ if (!$_REQUEST['queueId'])
|
|||||||
if(!$_REQUEST['sub']=="inside_form")
|
if(!$_REQUEST['sub']=="inside_form")
|
||||||
{
|
{
|
||||||
|
|
||||||
echo '<form name="qform" action="adminAppDataQueue.php" method="get">',"\n";
|
echo '<form name="qform" action="adminAppDataQueue.php" method="post">',"\n";
|
||||||
// help
|
// help
|
||||||
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
|
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
|
||||||
echo "Please enter an accurate and personalized reply anytime a submitted scrrenshot is rejected.\n";
|
echo "Please enter an accurate and personalized reply anytime a submitted scrrenshot is rejected.\n";
|
||||||
@@ -114,29 +110,39 @@ if (!$_REQUEST['queueId'])
|
|||||||
|
|
||||||
// app name
|
// app name
|
||||||
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
|
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
|
||||||
echo "<td>".appIdToName($obj_row->queueappId)."</td></tr>\n";
|
echo "<td>".appIdToName($obj_row->appId)."</td></tr>\n";
|
||||||
|
|
||||||
// version
|
// version
|
||||||
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
|
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
|
||||||
echo "<td>".versionIdToName($obj_row->queueversionId)."</td></tr>\n";
|
echo "<td>".versionIdToName($obj_row->versionId)."</td></tr>\n";
|
||||||
|
|
||||||
//dataDescription
|
//dataDescription
|
||||||
echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n";
|
echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n";
|
||||||
echo '<td><textarea name="description" rows=10 cols=35>'.stripslashes($obj_row->queuedescription).'</textarea></td></tr>',"\n";
|
echo '<td><textarea name="description" rows=10 cols=35>'.stripslashes($obj_row->description).'</textarea></td></tr>',"\n";
|
||||||
|
|
||||||
//data
|
//data
|
||||||
if($obj_row->queuetype == "image")
|
if($obj_row->type == "image")
|
||||||
{
|
{
|
||||||
$tmpfname = rand()."screenshotQueue".$obj_row->queueId;
|
|
||||||
$handle = fopen("../data/screenshots/".$tmpfname, "wb");
|
|
||||||
fwrite($handle, $obj_row->queuecontent);
|
|
||||||
fclose($handle);
|
|
||||||
echo '<tr valign=top><td class=color0><b>Submited image</b></td>',"\n";
|
echo '<tr valign=top><td class=color0><b>Submited image</b></td>',"\n";
|
||||||
echo '<td><img src="screenshotQueue.php?file='.$tmpfname.'" title="'.stripslashes($obj_row->queueurl).'" /></td></tr>',"\n";
|
echo '<td>';
|
||||||
} elseif($obj_row->queuetype == "url")
|
$imgSRC = '<img width="'.APPDB_THUMBNAIL_WIDTH.'" height="'.APPDB_THUMBNAIL_HEIGHT.'" src="screenshotQueue.php?queueId='.$obj_row->queueId.'" />';
|
||||||
|
// generate random tag for popup window
|
||||||
|
$randName = generate_passwd(5);
|
||||||
|
// set image link based on user pref
|
||||||
|
$img = '<a href="javascript:openWin(\'screenshotQueue.php?queueId='.$obj_row->queueId.'\',\''.$randName.'\','.APPDB_SCREENSHOT_MAXWIDTH.','.APPDB_SCREENSHOT_MAXHEIGHT.');">'.$imgSRC.'</a>';
|
||||||
|
if (loggedin())
|
||||||
|
{
|
||||||
|
if ($_SESSION['current']->getpref("window:screenshot") == "no")
|
||||||
|
{
|
||||||
|
$img = '<a href="screenshotQueue.php?queueId='.$obj_row->queueId.'">'.$imgSRC.'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo $img;
|
||||||
|
echo '</td></tr>',"\n";
|
||||||
|
} elseif($obj_row->type == "url")
|
||||||
{
|
{
|
||||||
echo '<tr valign=top><td class=color0><b>Submitted link</b></td>',"\n";
|
echo '<tr valign=top><td class=color0><b>Submitted link</b></td>',"\n";
|
||||||
echo '<td><textarea name="content" rows=10 cols=35>'.stripslashes($obj_row->queueurl).'</textarea></td></tr>',"\n";
|
echo '<td><textarea name="content" rows=10 cols=35>'.stripslashes($obj_row->url).'</textarea></td></tr>',"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
//email response
|
//email response
|
||||||
@@ -160,30 +166,33 @@ if (!$_REQUEST['queueId'])
|
|||||||
$statusMessage = "";
|
$statusMessage = "";
|
||||||
$goodtogo = 0;
|
$goodtogo = 0;
|
||||||
|
|
||||||
if($obj_row->queuetype == "image")
|
if($obj_row->type == "image")
|
||||||
{
|
{
|
||||||
// we write the content in a realfile
|
$str_query = "INSERT INTO appData VALUES (null, ".$obj_row->appId.", ".$obj_row->versionId.", 'image', ".
|
||||||
$fname = $obj_row->queuappId."-".$obj_row->queueversionId."-".$obj_row->queueurl;
|
"'".addslashes($_REQUEST['description'])."', '')";
|
||||||
$handle = fopen("../data/screenshots/".$fname, "wb");
|
mysql_query($str_query);
|
||||||
fwrite($handle, $obj_row->queuecontent);
|
$int_id = mysql_insert_id();
|
||||||
fclose($handle);
|
|
||||||
|
// we move the content in the live directory
|
||||||
$query = "INSERT INTO appData VALUES (null, ".$obj_row->queueappId.", ".$obj_row->queueversionId.", 'image', ".
|
rename("../data/queued/screenshots/".$obj_row->queueId, "../data/screenshots/".$int_id);
|
||||||
"'".addslashes($_REQUEST['description'])."', '".$fname."')";
|
|
||||||
|
// we have to update the entry now that we know its name
|
||||||
|
$str_query = "UPDATE appData SET url = '".$int_id."' WHERE id = '".$int_id."'";
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif ($obj_row->queuetype == "url") {
|
elseif ($obj_row->type == "url") {
|
||||||
$query = "INSERT INTO appData VALUES (null, ".$obj_row->queueappId.", ".$obj_row->queueversionId.", 'url', ".
|
$query = "INSERT INTO appData VALUES (null, ".$obj_row->appId.", ".$obj_row->versionId.", 'url', ".
|
||||||
"'".addslashes($_REQUEST['description'])."', '".$obj_row->url."')";
|
"'".addslashes($_REQUEST['description'])."', '".$obj_row->url."')";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(debugging()) addmsg("<p align=center><b>query:</b> $query </p>","green");
|
if(debugging()) addmsg("<p align=center><b>query:</b> $query </p>","green");
|
||||||
|
|
||||||
if (mysql_query($query))
|
if (mysql_query($str_query))
|
||||||
{
|
{
|
||||||
$statusMessage = "<p>The application data was successfully added into the database</p>\n";
|
$statusMessage = "<p>The application data was successfully added into the database</p>\n";
|
||||||
|
|
||||||
//delete the item from the queue
|
//delete the item from the queue
|
||||||
mysql_query("DELETE from appDataQueue where queueId = ".$_REQUEST['queueId'].";");
|
mysql_query("DELETE from appDataQueue where queueId = ".$obj_row->queueId.";");
|
||||||
|
|
||||||
$goodtogo = 1; /* set to 1 so we send the response email */
|
$goodtogo = 1; /* set to 1 so we send the response email */
|
||||||
} else
|
} else
|
||||||
@@ -193,17 +202,17 @@ if (!$_REQUEST['queueId'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Send Status Email
|
//Send Status Email
|
||||||
if (lookupEmail($obj_row->queueuserId) && $goodtogo)
|
if (lookupEmail($obj_row->userId) && $goodtogo)
|
||||||
{
|
{
|
||||||
$ms = "Application Data Request Report\n";
|
$ms = "Application Data Request Report\n";
|
||||||
$ms .= "----------------------------------\n\n";
|
$ms .= "----------------------------------\n\n";
|
||||||
$ms .= "Your submission of an application data for ".appIdToName($obj_row->queueappId).versionIdToName($obj_row->queueversionId)." has been accepted. ";
|
$ms .= "Your submission of an application data for ".appIdToName($obj_row->appId).versionIdToName($obj_row->versionId)." has been accepted. ";
|
||||||
$ms .= $_REQUEST['replyText'];
|
$ms .= $_REQUEST['replyText'];
|
||||||
$ms .= "We appreciate your help in making the Application Database better for all users.\n\n";
|
$ms .= "We appreciate your help in making the Application Database better for all users.\n\n";
|
||||||
$ms .= "Thanks!\n";
|
$ms .= "Thanks!\n";
|
||||||
$ms .= "-The AppDB admins\n";
|
$ms .= "-The AppDB admins\n";
|
||||||
|
|
||||||
mail(stripslashes(lookupEmail($obj_row->queueuserId)),'[AppDB] Application Data Request Report',$ms);
|
mail(stripslashes(lookupEmail($obj_row->userId)),'[AppDB] Application Data Request Report',$ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
//done
|
//done
|
||||||
@@ -220,12 +229,14 @@ if (!$_REQUEST['queueId'])
|
|||||||
$ms .= "";
|
$ms .= "";
|
||||||
$ms .= "-The AppDB admins\n";
|
$ms .= "-The AppDB admins\n";
|
||||||
|
|
||||||
mail(stripslashes(lookupEmail($obj_row->queueuserId)),'[AppDB] Application Data Request Report',$ms);
|
mail(stripslashes(lookupEmail($obj_row->userId)),'[AppDB] Application Data Request Report',$ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete main item
|
//delete main item
|
||||||
$query = "DELETE from appDataQueue where queueId = ".$_REQUEST['queueId'].";";
|
$str_query = "DELETE from appDataQueue where queueId = ".$obj_row->queueId.";";
|
||||||
$result = mysql_query($query);
|
unlink("../data/queued/screenshots/".$obj_row->queueId);
|
||||||
|
|
||||||
|
$result = mysql_query($str_query);
|
||||||
echo html_frame_start("Delete application data submission",400,"",0);
|
echo html_frame_start("Delete application data submission",400,"",0);
|
||||||
if(!$result)
|
if(!$result)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* code to show an image stored in mysql */
|
/* code to show a queued image */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
include("path.php");
|
include("path.php");
|
||||||
require(BASE."include/"."incl.php");
|
if($info=getimagesize("../data/queued/screenshots/".$_REQUEST['queueId']))
|
||||||
if($info=getimagesize("../data/screenshots/".$_REQUEST['file']))
|
|
||||||
{
|
{
|
||||||
header('Content-type: '.$info['mime']);
|
header('Content-type: '.$info['mime']);
|
||||||
$handle = fopen("../data/screenshots/".$_REQUEST['file'], "rb");
|
$handle = fopen("../data/queued/screenshots/".$_REQUEST['queueId'], "rb");
|
||||||
echo fread($handle, filesize("../data/screenshots/".$_REQUEST['file']));
|
echo fread($handle, filesize("../data/queued/screenshots/".$_REQUEST['queueId']));
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
}
|
}
|
||||||
unlink("../data/screenshots/".$_REQUEST['file']);
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -8,8 +8,10 @@
|
|||||||
* global params
|
* global params
|
||||||
*/
|
*/
|
||||||
define("APPDB_DEBUG","0"); //turns debugging on/off
|
define("APPDB_DEBUG","0"); //turns debugging on/off
|
||||||
define("APPDB_THUMBNAIL_WIDTH","100"); // width of the screenshot's thumbnails
|
define("APPDB_THUMBNAIL_WIDTH","128"); // width of the screenshot's thumbnails
|
||||||
define("APPDB_THUMBNAIL_HEIGHT","75"); // height of the screenshot's thumbnails
|
define("APPDB_THUMBNAIL_HEIGHT","128"); // height of the screenshot's thumbnails
|
||||||
|
define("APPDB_SCREENSHOT_MAXWIDTH","800"); // width of the screenshot's thumbnails
|
||||||
|
define("APPDB_SCREENSHOT_MAXHEIGHT","600"); // height of the screenshot's thumbnails
|
||||||
define("APPDB_ROOT", "http://appdb.winehq.org/"); // path to AppDB
|
define("APPDB_ROOT", "http://appdb.winehq.org/"); // path to AppDB
|
||||||
define("STANDARD_NOTIFY_FOOTER","------- You are receiving this mail because: -------\n".
|
define("STANDARD_NOTIFY_FOOTER","------- You are receiving this mail because: -------\n".
|
||||||
"You are an maintainer of this application or an AppDB administrator\n".
|
"You are an maintainer of this application or an AppDB administrator\n".
|
||||||
|
|||||||
174
screenshots.php
174
screenshots.php
@@ -11,98 +11,119 @@
|
|||||||
include("path.php");
|
include("path.php");
|
||||||
require(BASE."include/"."incl.php");
|
require(BASE."include/"."incl.php");
|
||||||
require(BASE."include/"."application.php");
|
require(BASE."include/"."application.php");
|
||||||
|
|
||||||
if($_REQUEST['cmd'])
|
if($_REQUEST['cmd'])
|
||||||
{
|
{
|
||||||
//process screenshot upload
|
//process screenshot upload
|
||||||
if($_REQUEST['cmd'] == "screenshot_upload")
|
if($_REQUEST['cmd'] == "screenshot_upload")
|
||||||
{
|
{
|
||||||
if(havepriv("admin") ||
|
if(havepriv("admin") ||
|
||||||
$_SESSION['current']->is_maintainer($_REQUEST['appId'],
|
(loggedin() && $_SESSION['current']->is_maintainer($_REQUEST['appId'],
|
||||||
$_REQUEST['versionId']))
|
$_REQUEST['versionId'])))
|
||||||
{
|
{
|
||||||
if(!copy($_FILES['imagefile']['tmp_name'], "data/screenshots/".$_REQUEST['appId']."-".$_REQUEST['versionId']."-".basename($_FILES['imagefile']['name'])))
|
$str_query = "INSERT INTO appData VALUES (null, ".$_REQUEST['appId'].", ".$_REQUEST['versionId'].
|
||||||
{
|
", 'image', '".addslashes($_REQUEST['screenshot_desc'])."', '')";
|
||||||
// whoops, copy failed. do something
|
|
||||||
errorpage("debug: copy failed; (".$_FILES['imagefile']['tmp_name'].";".$_FILES['imagefile']['name']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = "INSERT INTO appData VALUES (null, ".$_REQUEST['appId'].", ".$_REQUEST['versionId'].", 'image', ".
|
|
||||||
"'".addslashes($_REQUEST['screenshot_desc'])."', '".$_REQUEST['appId']."-".$_REQUEST['versionId']."-".basename($_FILES['imagefile']['name'])."')";
|
|
||||||
|
|
||||||
if(debugging()) addmsg("<p align=center><b>query:</b> $query </p>","green");
|
|
||||||
|
|
||||||
if (mysql_query($query))
|
|
||||||
{
|
|
||||||
//success
|
|
||||||
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
|
|
||||||
if($email)
|
|
||||||
{
|
|
||||||
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
|
|
||||||
$ms .= APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
|
|
||||||
$ms .= "\n";
|
|
||||||
$ms .= $_SESSION['current']->username." added screenshot ".$_REQUEST['screenshot_desc']." to ".$fullAppName."\n";
|
|
||||||
$ms .= "\n";
|
|
||||||
$ms .= STANDARD_NOTIFY_FOOTER;
|
|
||||||
|
|
||||||
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
$email = "no one";
|
|
||||||
}
|
|
||||||
addmsg("mesage sent to: ".$email, "green");
|
|
||||||
|
|
||||||
addmsg("The image was successfully added into the database", "green");
|
|
||||||
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//error
|
|
||||||
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
|
|
||||||
addmsg($statusMessage, "red");
|
|
||||||
}
|
|
||||||
} else // we are a normal user or an anonymous and submitted a screenshot
|
|
||||||
{
|
|
||||||
if(!$str_data = addslashes(fread(fopen($_FILES['imagefile']['tmp_name'], "rb"), filesize($_FILES['imagefile']['tmp_name']))))
|
|
||||||
{
|
|
||||||
// whoops, copy failed. do something
|
|
||||||
errorpage("debug: reading of file failed; (".$_FILES['imagefile']['tmp_name'].";".$_FILES['imagefile']['name']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$str_query = "INSERT INTO appDataQueue VALUES (null, ".$_REQUEST['appId'].", ".$_REQUEST['versionId'].", 'image', ".
|
|
||||||
"'".addslashes($_REQUEST['screenshot_desc'])."', '".$_REQUEST['appId']."-".$_REQUEST['versionId']."-".basename($_FILES['imagefile']['name'])."', '$str_data', '".$_SESSION['current']->userid."', NOW())";
|
|
||||||
|
|
||||||
if(debugging()) addmsg("<p align=center><b>query:</b> $str_query </p>","green");
|
if(debugging()) addmsg("<p align=center><b>query:</b> $str_query </p>","green");
|
||||||
|
|
||||||
if (mysql_query($str_query))
|
if (mysql_query($str_query))
|
||||||
{
|
{
|
||||||
//success
|
$int_id = mysql_insert_id();
|
||||||
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
|
|
||||||
if($email)
|
if(!copy($_FILES['imagefile']['tmp_name'], "data/screenshots/".$int_id))
|
||||||
{
|
{
|
||||||
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
|
// whoops, copy failed. do something
|
||||||
$ms .= APPDB_ROOT."admin/adminAppDataQueue.php?queueId=".mysql_insert_id()."\n";
|
errorpage("debug: copy failed; (".$_FILES['imagefile']['tmp_name'].";".$_FILES['imagefile']['name']);
|
||||||
$ms .= "\n";
|
$str_query = "DELETE FROM appData WHERE id = '".$int_id."'";
|
||||||
$ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "an anonymous user")." submitted a screenshot ".$_REQUEST['screenshot_desc']." for ".$fullAppName."\n";
|
mysql_query($str_query);
|
||||||
$ms .= "\n";
|
exit;
|
||||||
$ms .= STANDARD_NOTIFY_FOOTER;
|
} else
|
||||||
|
{
|
||||||
|
// we have to update the entry now that we know it's name
|
||||||
|
$str_query = "UPDATE appData SET url = '".$int_id."' WHERE id = '".$int_id."'";
|
||||||
|
if (mysql_query($str_query))
|
||||||
|
{
|
||||||
|
//success
|
||||||
|
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
|
||||||
|
if($email)
|
||||||
|
{
|
||||||
|
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
|
||||||
|
$ms .= APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
|
||||||
|
$ms .= "\n";
|
||||||
|
$ms .= $_SESSION['current']->username." added screenshot ".$_REQUEST['screenshot_desc']." to ".$fullAppName."\n";
|
||||||
|
$ms .= "\n";
|
||||||
|
$ms .= STANDARD_NOTIFY_FOOTER;
|
||||||
|
|
||||||
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
|
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$email = "no one";
|
$email = "no one";
|
||||||
}
|
}
|
||||||
addmsg("mesage sent to: ".$email, "green");
|
addmsg("mesage sent to: ".$email, "green");
|
||||||
|
|
||||||
addmsg("The image you submitted will be added to the database database after being reviewed", "green");
|
addmsg("The image was successfully added into the database", "green");
|
||||||
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//error
|
||||||
|
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
|
||||||
|
addmsg($statusMessage, "red");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
} else // we are a normal user or an anonymous and submitted a screenshot
|
||||||
|
{
|
||||||
|
$str_query = "INSERT INTO appDataQueue VALUES (null, ".$_REQUEST['appId'].", ".$_REQUEST['versionId'].
|
||||||
|
", 'image', '".addslashes($_REQUEST['screenshot_desc'])."', '','".$_SESSION['current']->userid.
|
||||||
|
"', NOW())";
|
||||||
|
|
||||||
|
if(debugging()) addmsg("<p align=center><b>query:</b> $str_query </p>","green");
|
||||||
|
|
||||||
|
if (mysql_query($str_query))
|
||||||
{
|
{
|
||||||
//error
|
$int_queueId = mysql_insert_id();
|
||||||
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
|
|
||||||
addmsg($statusMessage, "red");
|
if(!copy($_FILES['imagefile']['tmp_name'], "data/queued/screenshots/".$int_queueId))
|
||||||
|
{
|
||||||
|
// whoops, copy failed. do something
|
||||||
|
errorpage("debug: copy failed; (".$_FILES['imagefile']['tmp_name'].";".$_FILES['imagefile']['name']);
|
||||||
|
$str_query = "DELETE FROM appDataQueue WHERE queueId = '".$int_queueId."'";
|
||||||
|
mysql_query($str_query);
|
||||||
|
exit;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
// we have to update the queued entry now that we know it's name
|
||||||
|
$str_query = "UPDATE appDataQueue SET url = '".$int_queueId."' WHERE queueId = '".$int_queueId."'";
|
||||||
|
if (mysql_query($str_query))
|
||||||
|
{
|
||||||
|
//success
|
||||||
|
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
|
||||||
|
if($email)
|
||||||
|
{
|
||||||
|
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
|
||||||
|
$ms .= APPDB_ROOT."admin/adminAppDataQueue.php?queueId=".mysql_insert_id()."\n";
|
||||||
|
$ms .= "\n";
|
||||||
|
$ms .= ($_SESSION['current']->username ? $_SESSION['current']->username : "an anonymous user")." submitted a screenshot ".$_REQUEST['screenshot_desc']." for ".$fullAppName."\n";
|
||||||
|
$ms .= "\n";
|
||||||
|
$ms .= STANDARD_NOTIFY_FOOTER;
|
||||||
|
|
||||||
|
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$email = "no one";
|
||||||
|
}
|
||||||
|
addmsg("mesage sent to: ".$email, "green");
|
||||||
|
|
||||||
|
addmsg("The image you submitted will be added to the database database after being reviewed", "green");
|
||||||
|
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//error
|
||||||
|
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
|
||||||
|
addmsg($statusMessage, "red");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif($_REQUEST['cmd'] == "delete")
|
} elseif($_REQUEST['cmd'] == "delete")
|
||||||
@@ -131,7 +152,6 @@ if($_REQUEST['cmd'])
|
|||||||
$email = "no one";
|
$email = "no one";
|
||||||
}
|
}
|
||||||
addmsg("mesage sent to: ".$email, "green");
|
addmsg("mesage sent to: ".$email, "green");
|
||||||
|
|
||||||
addmsg("Image deleted", "green");
|
addmsg("Image deleted", "green");
|
||||||
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -206,18 +206,17 @@ create table appData (
|
|||||||
* links to screenshots and other stuff waiting to be accepted
|
* links to screenshots and other stuff waiting to be accepted
|
||||||
*/
|
*/
|
||||||
create table appDataQueue (
|
create table appDataQueue (
|
||||||
queueid int not null auto_increment,
|
queueId int not null auto_increment,
|
||||||
queueappId int not null,
|
appId int not null,
|
||||||
queueversionId int default 0,
|
versionId int default 0,
|
||||||
queuetype enum('image', 'url'),
|
type enum('image', 'url'),
|
||||||
queuedescription text,
|
description text,
|
||||||
queueurl varchar(255),
|
url varchar(255),
|
||||||
queuecontent longblob,
|
userId int not null,
|
||||||
queueuserId int not null,
|
|
||||||
submitTime timestamp,
|
submitTime timestamp,
|
||||||
key(queueid),
|
key(queueid),
|
||||||
index(queueappId),
|
index(appId),
|
||||||
index(queueversionId)
|
index(versionId)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user