mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-14 03:09:08 +00:00
function to install update in the plugin
This commit is contained in:
parent
6bf7b3dea9
commit
b654096371
3 changed files with 37 additions and 0 deletions
|
@ -75,6 +75,7 @@ ac_error = "Plugin facing some error in activating. Please try again later."
|
|||
dc_success = "Plugin de-Activated successfuly."
|
||||
dc_error = "Plugin facing some error in de-activating. Please try again later."
|
||||
up_success = "Update added successfully. Go to Updates page for installing updates."
|
||||
up_install_success = "Update installed successfully."
|
||||
|
||||
[install_plugin]
|
||||
ip_title = "Install a new Plugin"
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* This function is used in installing updates for plugins.
|
||||
*
|
||||
* @author Shubham Meena, mentored by Matthew Lagoe
|
||||
*/
|
||||
function update_plugin() {
|
||||
|
||||
// if logged in
|
||||
if ( WebUsers :: isLoggedIn() ) {
|
||||
|
||||
if ( isset( $_GET['id'] ) )
|
||||
{
|
||||
// id of plugin to delete
|
||||
$id = filter_var( $_GET['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
||||
$db = new DBLayer( 'lib' );
|
||||
$sth = $db -> executeWithoutParams( "SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId Where plugins.Id=$id" );
|
||||
$row = $sth -> fetch();
|
||||
print_r( $row );
|
||||
|
||||
// replacing update in the database
|
||||
Plugincache :: rrmdir( $row['FileName'] );
|
||||
Plugincache :: zipExtraction( $row['UpdatePath'], rtrim( $row['FileName'], strtolower( $row['Name'] ) ) );
|
||||
|
||||
$db -> update( "plugins", array( 'Info' => $row['UpdateInfo'] ), "Id=$row[Id]" );
|
||||
|
||||
// deleting the previous update
|
||||
$db -> delete( "updates", array( 'id' => $row['s.no'] ), "s.no=:id" );
|
||||
|
||||
header( "Location: index.php?page=plugins&result=8" );
|
||||
exit;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@
|
|||
{if isset($smarty.get.result) and $smarty.get.result eq "5"}<div class="alert alert-error"><p>{$dc_success}</p></div>{/if}
|
||||
{if isset($smarty.get.result) and $smarty.get.result eq "6"}<div class="alert alert-error"><p>{$dc_error}</p></div>{/if}
|
||||
{if isset($smarty.get.result) and $smarty.get.result eq "7"}<div class="alert alert-error"><p>{$up_success}</p></div>{/if}
|
||||
{if isset($smarty.get.result) and $smarty.get.result eq "8"}<div class="alert alert-error"><p>{$up_install_success}</p></div>{/if}
|
||||
<div class="box-content">
|
||||
<center><p>{$plugin_info}</p></center>
|
||||
<center>
|
||||
|
|
Loading…
Reference in a new issue