|
|
|
@ -59,17 +59,17 @@ function install_plugin() {
|
|
|
|
|
if ( $x == '1' )
|
|
|
|
|
{
|
|
|
|
|
echo "update found";
|
|
|
|
|
exit();
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
else if ( $x == '2' )
|
|
|
|
|
{
|
|
|
|
|
echo "Plugin already exists with same name .";
|
|
|
|
|
exit();
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
else if ( $x == '3' )
|
|
|
|
|
{
|
|
|
|
|
echo "Update info is not present in the update";
|
|
|
|
|
exit();
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -80,18 +80,18 @@ function install_plugin() {
|
|
|
|
|
{
|
|
|
|
|
if ( move_uploaded_file( $fileTmpLoc, $temp_path . "/" . $fileName ) ) {
|
|
|
|
|
echo "$fileName upload is complete.</br>" . "<button type='submit' class='btn btn-primary' style='margin-left:5px; margin-top:10px;' name='install_plugin'>Install Plugin</button></br>";
|
|
|
|
|
exit();
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
echo "Error in uploading file.";
|
|
|
|
|
exit();
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
echo "Please select a file with .zip extension to upload.";
|
|
|
|
|
exit();
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -125,29 +125,32 @@ function install_plugin() {
|
|
|
|
|
$dbr -> insert( "plugins", $install_result );
|
|
|
|
|
|
|
|
|
|
// if everything is successfull redirecting to the plugin template
|
|
|
|
|
header("Cache-Control: max-age=1");
|
|
|
|
|
header( "Location: index.php?page=plugins&result=1" );
|
|
|
|
|
exit;
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// file .info not exists
|
|
|
|
|
rmdir( $target_path );
|
|
|
|
|
header("Cache-Control: max-age=1");
|
|
|
|
|
header( "Location: index.php?page=install_plugin&result=2" );
|
|
|
|
|
exit;
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
// extraction failed
|
|
|
|
|
header("Cache-Control: max-age=1");
|
|
|
|
|
header( "Location: index.php?page=install_plugin&result=0" );
|
|
|
|
|
exit;
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
echo "Please Browse for a file before clicking the upload button";
|
|
|
|
|
exit();
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -279,7 +282,7 @@ function checkForUpdate( $fileName, $findPath, $tempFile, $tempPath )
|
|
|
|
|
if ( pluginUpdateExists( $info['Id'], $tempPath . "/" . trim( $fileName, ".zip" ) . "_" . $result['Version'] . ".zip" ) )
|
|
|
|
|
{
|
|
|
|
|
echo "Update already exists";
|
|
|
|
|
exit;
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// removing the preivous update
|
|
|
|
@ -293,8 +296,9 @@ function checkForUpdate( $fileName, $findPath, $tempFile, $tempPath )
|
|
|
|
|
$update['UpdatePath'] = $tempPath . "/" . trim( $fileName, ".zip" ) . "_" . $result['Version'] . ".zip";
|
|
|
|
|
$update['UpdateInfo'] = json_encode( $result );
|
|
|
|
|
$dbr -> insert( "updates", $update );
|
|
|
|
|
header("Cache-Control: max-age=1");
|
|
|
|
|
header( "Location: index.php?page=plugins&result=7" );
|
|
|
|
|
exit;
|
|
|
|
|
throw new SystemExit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|