- improve appData and related classes
- don't use a full table for queued appdata but only one field in theapplication and version tables - simplify the code in many places - fixes some bugs with screenshots
This commit is contained in:
@@ -19,15 +19,15 @@ if(!$_SESSION['current']->hasPriv("admin"))
|
|||||||
|
|
||||||
|
|
||||||
// shows the list of appdata in queue
|
// shows the list of appdata in queue
|
||||||
if (!$_REQUEST['queueId'])
|
if (!$_REQUEST['id'])
|
||||||
{
|
{
|
||||||
|
|
||||||
apidb_header("Admin Application Data Queue");
|
apidb_header("Admin Application Data Queue");
|
||||||
|
|
||||||
// get available appData
|
// get available appData
|
||||||
$sQuery = "SELECT appDataQueue.*, appVersion.appId AS appId
|
$sQuery = "SELECT appData.*, appVersion.appId AS appId
|
||||||
FROM appDataQueue, appVersion
|
FROM appData, appVersion
|
||||||
WHERE appVersion.versionId = appDataQueue.versionID;";
|
WHERE appVersion.versionId = appData.versionID AND appData.queued = 'true';";
|
||||||
$hResult = query_appdb($sQuery);
|
$hResult = query_appdb($sQuery);
|
||||||
|
|
||||||
if(!$hResult || !mysql_num_rows($hResult))
|
if(!$hResult || !mysql_num_rows($hResult))
|
||||||
@@ -51,7 +51,7 @@ if (!$_REQUEST['queueId'])
|
|||||||
|
|
||||||
echo "<tr class=color4>\n";
|
echo "<tr class=color4>\n";
|
||||||
echo " <td><font color=white>Submission Date</font></td>\n";
|
echo " <td><font color=white>Submission Date</font></td>\n";
|
||||||
echo " <td><font color=white>Queue Id</font></td>\n";
|
echo " <td><font color=white>Id</font></td>\n";
|
||||||
echo " <td><font color=white>Name (e-mail)</font></td>\n";
|
echo " <td><font color=white>Name (e-mail)</font></td>\n";
|
||||||
echo " <td><font color=white>Application Name</font></td>\n";
|
echo " <td><font color=white>Application Name</font></td>\n";
|
||||||
echo " <td><font color=white>Version</font></td>\n";
|
echo " <td><font color=white>Version</font></td>\n";
|
||||||
@@ -64,7 +64,7 @@ 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?id=$ob->id'>".$ob->id."</a></td>\n";
|
||||||
if($ob->userId)
|
if($ob->userId)
|
||||||
{
|
{
|
||||||
$oUser = new User($ob->userId);
|
$oUser = new User($ob->userId);
|
||||||
@@ -83,10 +83,10 @@ if (!$_REQUEST['queueId'])
|
|||||||
}
|
}
|
||||||
} else // shows a particular appdata
|
} else // shows a particular appdata
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT appDataQueue.*, appVersion.appId AS appId
|
$sQuery = "SELECT appData.*, appVersion.appId AS appId
|
||||||
FROM appDataQueue,appVersion
|
FROM appData,appVersion
|
||||||
WHERE appVersion.versionId = appDataQueue.versionId
|
WHERE appVersion.versionId = appData.versionId
|
||||||
AND queueId='".$_REQUEST['queueId']."'";
|
AND id='".$_REQUEST['id']."'";
|
||||||
$hResult = query_appdb($sQuery);
|
$hResult = query_appdb($sQuery);
|
||||||
$obj_row = mysql_fetch_object($hResult);
|
$obj_row = mysql_fetch_object($hResult);
|
||||||
|
|
||||||
@@ -120,19 +120,19 @@ if (!$_REQUEST['queueId'])
|
|||||||
//data
|
//data
|
||||||
if($obj_row->type == "image")
|
if($obj_row->type == "image")
|
||||||
{
|
{
|
||||||
$oScreenshot = new Screenshot($obj_row->queueId,true);
|
$oScreenshot = new Screenshot($obj_row->id);
|
||||||
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>';
|
echo '<td>';
|
||||||
$imgSRC = '<img width="'.$oScreenshot->oThumbnailImage->width.'" height="'.$oScreenshot->oThumbnailImage->height.'" src="../appimage.php?queued=true&id='.$obj_row->queueId.'" />';
|
$imgSRC = '<img width="'.$oScreenshot->oThumbnailImage->width.'" height="'.$oScreenshot->oThumbnailImage->height.'" src="../appimage.php?queued=true&id='.$obj_row->id.'" />';
|
||||||
// generate random tag for popup window
|
// generate random tag for popup window
|
||||||
$randName = generate_passwd(5);
|
$randName = generate_passwd(5);
|
||||||
// set image link based on user pref
|
// set image link based on user pref
|
||||||
$img = '<a href="javascript:openWin(\'../appimage.php?queued=true&id='.$obj_row->queueId.'\',\''.$randName.'\','.$oScreenshot->oScreenshotImage->width.','.($oScreenshot->oScreenshotImage->height+4).');">'.$imgSRC.'</a>';
|
$img = '<a href="javascript:openWin(\'../appimage.php?queued=true&id='.$obj_row->id.'\',\''.$randName.'\','.$oScreenshot->oScreenshotImage->width.','.($oScreenshot->oScreenshotImage->height+4).');">'.$imgSRC.'</a>';
|
||||||
if ($_SESSION['current']->isLoggedIn())
|
if ($_SESSION['current']->isLoggedIn())
|
||||||
{
|
{
|
||||||
if ($_SESSION['current']->getpref("window:screenshot") == "no")
|
if ($_SESSION['current']->getpref("window:screenshot") == "no")
|
||||||
{
|
{
|
||||||
$img = '<a href="../appimage.php?queued=true&id='.$obj_row->queueId.'">'.$imgSRC.'</a>';
|
$img = '<a href="../appimage.php?queued=true&id='.$obj_row->id.'">'.$imgSRC.'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo $img;
|
echo $img;
|
||||||
@@ -157,7 +157,7 @@ if (!$_REQUEST['queueId'])
|
|||||||
|
|
||||||
echo '</table>',"\n";
|
echo '</table>',"\n";
|
||||||
echo '<input type=hidden name="sub" value="inside_form" />',"\n";
|
echo '<input type=hidden name="sub" value="inside_form" />',"\n";
|
||||||
echo '<input type=hidden name="queueId" value="'.$_REQUEST['queueId'].'" />',"\n";
|
echo '<input type=hidden name="id" value="'.$_REQUEST['id'].'" />',"\n";
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
} elseif ($_REQUEST['add']) // we accepted the request
|
} elseif ($_REQUEST['add']) // we accepted the request
|
||||||
{
|
{
|
||||||
@@ -166,7 +166,7 @@ if (!$_REQUEST['queueId'])
|
|||||||
|
|
||||||
if($obj_row->type == "image")
|
if($obj_row->type == "image")
|
||||||
{
|
{
|
||||||
$oScreenshot = new Screenshot($obj_row->queueId,true);
|
$oScreenshot = new Screenshot($obj_row->id);
|
||||||
$oScreenshot->unQueue();
|
$oScreenshot->unQueue();
|
||||||
}
|
}
|
||||||
elseif ($obj_row->type == "url")
|
elseif ($obj_row->type == "url")
|
||||||
@@ -178,7 +178,7 @@ if (!$_REQUEST['queueId'])
|
|||||||
$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
|
||||||
query_appdb("DELETE from appDataQueue where queueId = ".$obj_row->queueId.";");
|
query_appdb("DELETE from appData where id = ".$obj_row->id.";");
|
||||||
|
|
||||||
//Send Status Email
|
//Send Status Email
|
||||||
$oUser = new User($obj_row->userId);
|
$oUser = new User($obj_row->userId);
|
||||||
@@ -198,7 +198,7 @@ if (!$_REQUEST['queueId'])
|
|||||||
{
|
{
|
||||||
if($obj_row->type == "image")
|
if($obj_row->type == "image")
|
||||||
{
|
{
|
||||||
$oScreenshot = new Screenshot($obj_row->queueId,true);
|
$oScreenshot = new Screenshot($obj_row->id);
|
||||||
$oScreenshot->delete();
|
$oScreenshot->delete();
|
||||||
}
|
}
|
||||||
elseif ($obj_row->type == "url")
|
elseif ($obj_row->type == "url")
|
||||||
@@ -213,7 +213,7 @@ if (!$_REQUEST['queueId'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
//delete main item
|
//delete main item
|
||||||
$sQuery = "DELETE from appDataQueue where queueId = ".$obj_row->queueId.";";
|
$sQuery = "DELETE from appData where id = ".$obj_row->id.";";
|
||||||
$hResult = query_appdb($sQuery);
|
$hResult = query_appdb($sQuery);
|
||||||
if($hResult)
|
if($hResult)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,56 +15,39 @@ class Screenshot {
|
|||||||
var $sDescription;
|
var $sDescription;
|
||||||
var $oScreenshotImage;
|
var $oScreenshotImage;
|
||||||
var $oThumbnailImage;
|
var $oThumbnailImage;
|
||||||
var $sTable;
|
|
||||||
var $sTableId;
|
|
||||||
var $userId;
|
|
||||||
var $bQueued;
|
var $bQueued;
|
||||||
var $iVersionId;
|
var $iVersionId;
|
||||||
var $iAppId;
|
var $iAppId;
|
||||||
var $sDirectory;
|
|
||||||
var $sUrl;
|
var $sUrl;
|
||||||
|
var $sSubmitTime;
|
||||||
var $iSubmitterId;
|
var $iSubmitterId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor, fetches the data and image objects if $iScreenshotId is given.
|
* Constructor, fetches the data and image objects if $iScreenshotId is given.
|
||||||
*/
|
*/
|
||||||
function Screenshot($iScreenshotId = null,$bQueued = false)
|
function Screenshot($iScreenshotId = null)
|
||||||
{
|
{
|
||||||
if($bQueued)
|
|
||||||
{
|
|
||||||
$this->bQueued = true;
|
|
||||||
$this->sTable = appDataQueue;
|
|
||||||
$this->sTableId = queueId;
|
|
||||||
$this->sDirectory = "queued/screenshots";
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
$this->bQueued = false;
|
|
||||||
$this->sTable = appData;
|
|
||||||
$this->sTableId = id;
|
|
||||||
$this->sDirectory = "screenshots";
|
|
||||||
}
|
|
||||||
|
|
||||||
// we are working on an existing screenshot
|
// we are working on an existing screenshot
|
||||||
if($iScreenshotId)
|
if($iScreenshotId)
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT ".$this->sTable.".*, appVersion.appId AS appId
|
$sQuery = "SELECT appData.*, appVersion.appId AS appId
|
||||||
FROM ".$this->sTable.", appVersion
|
FROM appData, appVersion
|
||||||
WHERE ".$this->sTable.".versionId = appVersion.versionId
|
WHERE appData.versionId = appVersion.versionId
|
||||||
AND ".$this->sTableId." = ".$iScreenshotId."
|
AND id = ".$iScreenshotId."
|
||||||
AND type = 'image'";
|
AND type = 'image'";
|
||||||
if($hResult = query_appdb($sQuery))
|
if($hResult = query_appdb($sQuery))
|
||||||
{
|
{
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iScreenshotId = $iScreenshotId;
|
$this->iScreenshotId = $iScreenshotId;
|
||||||
$this->sDescription = $oRow->description;
|
$this->sDescription = $oRow->description;
|
||||||
$this->oScreenshotImage = new Image("/data/".$this->sDirectory."/".$oRow->url);
|
$this->oScreenshotImage = new Image("/data/screenshots/".$oRow->url);
|
||||||
$this->oThumbnailImage = new Image("/data/".$this->sDirectory."/thumbnails/".$oRow->url);
|
$this->oThumbnailImage = new Image("/data/screenshots/thumbnails/".$oRow->url);
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
|
||||||
$this->iAppId = $oRow->appId;
|
$this->iAppId = $oRow->appId;
|
||||||
$this->iVersionId = $oRow->versionId;
|
$this->iVersionId = $oRow->versionId;
|
||||||
$this->sUrl = $oRow->url;
|
$this->sUrl = $oRow->url;
|
||||||
if(!$this->iSubmitterId && $oRow->userId)
|
$this->bQueued = $oRow->queued;
|
||||||
$this->iSubmitterId = $oRow->userId;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,38 +58,31 @@ class Screenshot {
|
|||||||
*/
|
*/
|
||||||
function create($iVersionId = null, $sDescription = null, $hFile = null)
|
function create($iVersionId = null, $sDescription = null, $hFile = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$aInsert = compile_insert_string(array( 'versionId' => $iVersionId,
|
|
||||||
'type' => "image",
|
|
||||||
'description' => $sDescription ));
|
|
||||||
|
|
||||||
// Security, if we are not an administrator or a maintainer, the screenshot must be queued.
|
// Security, if we are not an administrator or a maintainer, the screenshot must be queued.
|
||||||
if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($_REQUEST['versionId'])))
|
if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($_REQUEST['versionId'])))
|
||||||
{
|
{
|
||||||
$this->bQueued = true;
|
$this->bQueued = true;
|
||||||
$this->sTable = appDataQueue;
|
|
||||||
$this->sTableId = queueId;
|
|
||||||
$this->iUserId = $userId;
|
|
||||||
$this->sDirectory = "queued/screenshots";
|
|
||||||
$sFields = "({$aInsert['FIELDS']}, userId)";
|
|
||||||
$sValues = "({$aInsert['VALUES']}, '".$_SESSION['current']->iUserId."')";
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
$sFields = "({$aInsert['FIELDS']})";
|
|
||||||
$sValues = "({$aInsert['VALUES']})";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(query_appdb("INSERT INTO ".$this->sTable." $sFields VALUES $sValues", "Error while creating a new screenshot."))
|
$aInsert = compile_insert_string(array( 'versionId' => $iVersionId,
|
||||||
|
'type' => "image",
|
||||||
|
'description' => $sDescription,
|
||||||
|
'queued' => $this->bQueued,
|
||||||
|
'submitterId' => $_SESSION['current']->iUserId ));
|
||||||
|
$sFields = "({$aInsert['FIELDS']})";
|
||||||
|
$sValues = "({$aInsert['VALUES']})";
|
||||||
|
|
||||||
|
if(query_appdb("INSERT INTO appData $sFields VALUES $sValues", "Error while creating a new screenshot."))
|
||||||
{
|
{
|
||||||
$this->iScreenshotId = mysql_insert_id();
|
$this->iScreenshotId = mysql_insert_id();
|
||||||
if(!move_uploaded_file($hFile['tmp_name'], "data/".$this->sDirectory."/originals/".$this->iScreenshotId))
|
if(!move_uploaded_file($hFile['tmp_name'], "data/screenshots/originals/".$this->iScreenshotId))
|
||||||
{
|
{
|
||||||
|
|
||||||
// whoops, moving failed, do something
|
// whoops, moving failed, do something
|
||||||
addmsg("Unable to move screenshot from ".$hFile['tmp_name']." to data/".$this->sDirectory."/originals/".$this->iScreenshotId, "red");
|
addmsg("Unable to move screenshot from ".$hFile['tmp_name']." to data/screenshots/originals/".$this->iScreenshotId, "red");
|
||||||
$sQuery = "DELETE
|
$sQuery = "DELETE
|
||||||
FROM ".$this->sTable."
|
FROM appData
|
||||||
WHERE ".$this->sTableId." = '".$this->iScreenshotId."'";
|
WHERE id = '".$this->iScreenshotId."'";
|
||||||
query_appdb($sQuery);
|
query_appdb($sQuery);
|
||||||
return false;
|
return false;
|
||||||
} else // we managed to copy the file, now we have to process the image
|
} else // we managed to copy the file, now we have to process the image
|
||||||
@@ -114,9 +90,9 @@ class Screenshot {
|
|||||||
$this->sUrl = $this->iScreenshotId;
|
$this->sUrl = $this->iScreenshotId;
|
||||||
$this->generate();
|
$this->generate();
|
||||||
// we have to update the entry now that we know its name
|
// we have to update the entry now that we know its name
|
||||||
$sQuery = "UPDATE ".$this->sTable."
|
$sQuery = "UPDATE appData
|
||||||
SET url = '".$this->iScreenshotId."'
|
SET url = '".$this->iScreenshotId."'
|
||||||
WHERE ".$this->sTableId." = '".$this->iScreenshotId."'";
|
WHERE id = '".$this->iScreenshotId."'";
|
||||||
if (!query_appdb($sQuery)) return false;
|
if (!query_appdb($sQuery)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,15 +111,15 @@ class Screenshot {
|
|||||||
*/
|
*/
|
||||||
function delete($bSilent=false)
|
function delete($bSilent=false)
|
||||||
{
|
{
|
||||||
$sQuery = "DELETE FROM ".$this->sTable."
|
$sQuery = "DELETE FROM appData
|
||||||
WHERE ".$this->sTableId." = ".$this->iScreenshotId."
|
WHERE id = ".$this->iScreenshotId."
|
||||||
AND type = 'image'
|
AND type = 'image'
|
||||||
LIMIT 1";
|
LIMIT 1";
|
||||||
if($hResult = query_appdb($sQuery))
|
if($hResult = query_appdb($sQuery))
|
||||||
{
|
{
|
||||||
$this->oScreenshotImage->delete();
|
$this->oScreenshotImage->delete();
|
||||||
$this->oThumbnailImage->delete();
|
$this->oThumbnailImage->delete();
|
||||||
unlink($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/originals/".$this->iScreenshotId);
|
unlink($_SERVER['DOCUMENT_ROOT']."/data/screenshots/originals/".$this->iScreenshotId);
|
||||||
if(!$bSilent)
|
if(!$bSilent)
|
||||||
$this->mailMaintainers(true);
|
$this->mailMaintainers(true);
|
||||||
}
|
}
|
||||||
@@ -162,37 +138,13 @@ class Screenshot {
|
|||||||
// If we are not in the queue, we can't move the screenshot out of the queue.
|
// If we are not in the queue, we can't move the screenshot out of the queue.
|
||||||
if(!$this->bQueued)
|
if(!$this->bQueued)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$aInsert = compile_insert_string(array( 'versionId' => $this->iVersionId,
|
$sUpdate = compile_update_string(array('queued' => "false"));
|
||||||
'type' => "image",
|
if(query_appdb("UPDATE appData SET ".$sUpdate." WHERE id=".$this->iScreenshotId))
|
||||||
'description' => $this->$sDescription ));
|
|
||||||
$sFields = "({$aInsert['FIELDS']})";
|
|
||||||
$sValues = "({$aInsert['VALUES']})";
|
|
||||||
if(query_appdb("INSERT INTO appData $sFields VALUES $sValues", "Error while unqueueing a screenshot."))
|
|
||||||
{
|
{
|
||||||
$iId = mysql_insert_id();
|
|
||||||
|
|
||||||
// we move the content in the live directory
|
|
||||||
copy("../data/queued/screenshots/".$this->iScreenshotId, "../data/screenshots/".$iId);
|
|
||||||
copy("../data/queued/screenshots/originals/".$this->iScreenshotId, "../data/screenshots/originals/".$iId);
|
|
||||||
copy("../data/queued/screenshots/thumbnails/".$this->iScreenshotId, "../data/screenshots/thumbnails/".$iId);
|
|
||||||
|
|
||||||
// now that we know the url of the screenshot we can update the database
|
|
||||||
$sQuery = "UPDATE appData
|
|
||||||
SET url = '".$iId."'
|
|
||||||
WHERE id = '".$iId."'";
|
|
||||||
query_appdb($sQuery);
|
|
||||||
|
|
||||||
// we have to delete the queued entry
|
|
||||||
$this->delete(true);
|
|
||||||
|
|
||||||
// we fetch the new unqueued entry
|
|
||||||
$this->screenshot($iId);
|
|
||||||
|
|
||||||
// we send an e-mail to intersted people
|
// we send an e-mail to intersted people
|
||||||
$this->mailSubmitter();
|
$this->mailSubmitter();
|
||||||
$this->mailMaintainers();
|
$this->mailMaintainers();
|
||||||
|
|
||||||
// the screenshot has been unqueued
|
// the screenshot has been unqueued
|
||||||
addmsg("The screenshot has been unqueued.", "green");
|
addmsg("The screenshot has been unqueued.", "green");
|
||||||
}
|
}
|
||||||
@@ -216,7 +168,7 @@ class Screenshot {
|
|||||||
*/
|
*/
|
||||||
function setDescription($sDescription)
|
function setDescription($sDescription)
|
||||||
{
|
{
|
||||||
$sQuery = "UPDATE ".$this->sTableId." SET description = '".$sDescription."' WHERE ".$this->sTableId." = ".$this->iScreenshotId." AND type = 'image'";
|
$sQuery = "UPDATE id SET description = '".$sDescription."' WHERE id = ".$this->iScreenshotId." AND type = 'image'";
|
||||||
if($hResult = query_appdb($sQuery))
|
if($hResult = query_appdb($sQuery))
|
||||||
$this->sDescription = $sDescription;
|
$this->sDescription = $sDescription;
|
||||||
}
|
}
|
||||||
@@ -231,25 +183,25 @@ class Screenshot {
|
|||||||
global $watermark;
|
global $watermark;
|
||||||
// first we will create the thumbnail
|
// first we will create the thumbnail
|
||||||
// load the screenshot
|
// load the screenshot
|
||||||
$this->oThumbnailImage = new Image("/data/".$this->sDirectory."/originals/".$this->sUrl);
|
$this->oThumbnailImage = new Image("/data/screenshots/originals/".$this->sUrl);
|
||||||
$this->oThumbnailImage->make_thumb(0,0,1,'#000000');
|
$this->oThumbnailImage->make_thumb(0,0,1,'#000000');
|
||||||
// store the image
|
// store the image
|
||||||
$this->oThumbnailImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/thumbnails/".$this->sUrl);
|
$this->oThumbnailImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/screenshots/thumbnails/".$this->sUrl);
|
||||||
|
|
||||||
// now we'll process the screenshot image for watermarking
|
// now we'll process the screenshot image for watermarking
|
||||||
// load the screenshot
|
// load the screenshot
|
||||||
$this->oScreenshotImage = new Image("/data/".$this->sDirectory."/originals/".$this->sUrl);
|
$this->oScreenshotImage = new Image("/data/screenshots/originals/".$this->sUrl);
|
||||||
// resize the image
|
// resize the image
|
||||||
$this->oScreenshotImage->make_full();
|
$this->oScreenshotImage->make_full();
|
||||||
// store the resized image
|
// store the resized image
|
||||||
$this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/".$this->sUrl);
|
$this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/screenshots/".$this->sUrl);
|
||||||
// reload the resized screenshot
|
// reload the resized screenshot
|
||||||
$this->oScreenshotImage = new Image("/data/".$this->sDirectory."/".$this->sUrl);
|
$this->oScreenshotImage = new Image("/data/screenshots/".$this->sUrl);
|
||||||
|
|
||||||
// add the watermark to the screenshot
|
// add the watermark to the screenshot
|
||||||
$this->oScreenshotImage->add_watermark($watermark->get_image_resource());
|
$this->oScreenshotImage->add_watermark($watermark->get_image_resource());
|
||||||
// store the watermarked image
|
// store the watermarked image
|
||||||
$this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/".$this->sDirectory."/".$this->sUrl);
|
$this->oScreenshotImage->output_to_file($_SERVER['DOCUMENT_ROOT']."/data/screenshots/".$this->sUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -358,7 +310,7 @@ function get_screenshot_img($iAppId = null, $iVersionId = null)
|
|||||||
return $sImg;
|
return $sImg;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_screenshots($iAppId = null, $iVersionId = null)
|
function get_screenshots($iAppId = null, $iVersionId = null, $bQueued = "false")
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We want all screenshots for this app.
|
* We want all screenshots for this app.
|
||||||
@@ -369,7 +321,8 @@ function get_screenshots($iAppId = null, $iVersionId = null)
|
|||||||
FROM appData, appVersion
|
FROM appData, appVersion
|
||||||
WHERE appVersion.versionId = appData.versionId
|
WHERE appVersion.versionId = appData.versionId
|
||||||
AND type = 'image'
|
AND type = 'image'
|
||||||
AND appData.appId = ".$iAppId;
|
AND appVersion.appId = ".$iAppId."
|
||||||
|
AND appData.queued = '".$bQueued."'";
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We want all screenshots for this version.
|
* We want all screenshots for this version.
|
||||||
@@ -380,7 +333,8 @@ function get_screenshots($iAppId = null, $iVersionId = null)
|
|||||||
FROM appData, appVersion
|
FROM appData, appVersion
|
||||||
WHERE appVersion.versionId = appData.versionId
|
WHERE appVersion.versionId = appData.versionId
|
||||||
AND type = 'image'
|
AND type = 'image'
|
||||||
AND appData.versionId = ".$iVersionId;
|
AND appData.versionId = ".$iVersionId."
|
||||||
|
AND appData.queued = '".$bQueued."'";
|
||||||
}
|
}
|
||||||
if($sQuery)
|
if($sQuery)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user