mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-24 07:46:20 +00:00
template for updates of plugins
This commit is contained in:
parent
f391817c4a
commit
ede1539b6d
3 changed files with 69 additions and 12 deletions
|
@ -14,7 +14,7 @@ class Plugincache {
|
|||
private $plugin_permission;
|
||||
private $plugin_status;
|
||||
private $plugin_info = array();
|
||||
|
||||
private $update_info = array();
|
||||
/**
|
||||
* A constructor.
|
||||
* Empty constructor
|
||||
|
@ -30,11 +30,13 @@ class Plugincache {
|
|||
$this -> setPluginPermission( $values['Permission'] );
|
||||
$this -> setPluginStatus( $values['Status'] );
|
||||
$this -> setPluginInfo( json_decode( $values['Info'] ) );
|
||||
@$this -> setUpdateInfo( json_decode( $values['UpdateInfo'] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* loads the object's attributes.
|
||||
*/
|
||||
|
||||
public function load_With_SID() {
|
||||
$dbl = new DBLayer( "lib" );
|
||||
$statement = $dbl -> executeWithoutParams( "SELECT * FROM plugins" );
|
||||
|
@ -140,14 +142,33 @@ class Plugincache {
|
|||
$this -> plugin_info = $p_n;
|
||||
}
|
||||
|
||||
/**
|
||||
* functionalities for plugin updates
|
||||
*/
|
||||
|
||||
/**
|
||||
* set update info attribute array of the object.
|
||||
*
|
||||
* @param $p_n array
|
||||
*/
|
||||
public function setUpdateInfo( $p_n ) {
|
||||
$this -> update_info = $p_n;
|
||||
}
|
||||
|
||||
/**
|
||||
* get update info array attribute of the object.
|
||||
*/
|
||||
public function getUpdateInfo() {
|
||||
return $this -> update_info;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* some more plugin function that requires during plugin operations
|
||||
*
|
||||
* /
|
||||
*
|
||||
*
|
||||
* /**
|
||||
*/
|
||||
|
||||
/**
|
||||
* function to remove a non empty directory
|
||||
*
|
||||
* @param $dir directory address
|
||||
|
|
|
@ -86,11 +86,11 @@ ip_file_nfnd="Please upload a plugin before clicking on install button"
|
|||
[plugins_update]
|
||||
up_title = "Updates for Plugins"
|
||||
up_info = "Here you can see the entire list of available updates for plugins."
|
||||
up_serial = "Serial No."
|
||||
up_description = "Updates Info"
|
||||
plugin_name = "Name"
|
||||
plugin_version = "Version"
|
||||
up_updated_version = "New Version"
|
||||
up_action = "Actions"
|
||||
up_actions = "Actions"
|
||||
|
||||
[show_ticket]
|
||||
t_title = "Ticket"
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* function plugins_update to get
|
||||
* plugins updates from the Database using pagination object
|
||||
*
|
||||
* @author shubham meena mentored by Matthew Lagoe
|
||||
*/
|
||||
|
||||
function plugins_update()
|
||||
{
|
||||
if ( Ticket_User :: isMod( unserialize( $_SESSION['ticket_user'] ) ) ) {
|
||||
$pagination = new Pagination( "SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId", "lib", 5, "Plugincache" );
|
||||
$pageResult['plug'] = Gui_Elements :: make_table( $pagination -> getElements(), Array( "getId", "getPluginName", "getPluginInfo", "getUpdateInfo" ), Array( "id", "plugin_name", "plugin_info", "update_info" ) );
|
||||
$pageResult['links'] = $pagination -> getLinks( 5 );
|
||||
$pageResult['lastPage'] = $pagination -> getLast();
|
||||
$pageResult['currentPage'] = $pagination -> getCurrent();
|
||||
|
||||
global $INGAME_WEBPATH;
|
||||
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
|
||||
|
||||
// check if shard is online
|
||||
try {
|
||||
$dbs = new DBLayer( "shard" );
|
||||
$pageResult['shard'] = "online";
|
||||
}
|
||||
catch( PDOException $e ) {
|
||||
$pageResult['shard'] = "offline";
|
||||
}
|
||||
return( $pageResult );
|
||||
} else {
|
||||
// ERROR: No access!
|
||||
$_SESSION['error_code'] = "403";
|
||||
header( "Location: index.php?page=error" );
|
||||
exit;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue