khanat-opennel-code/code/web/public_php/ams/inc/plugins_update.php

38 lines
1.4 KiB
PHP
Raw Normal View History

2014-06-19 17:11:10 +05:30
<?php
/**
* function plugins_update to get
* plugins updates from the Database using pagination object.
2014-09-03 07:06:43 +02:00
*
* @author shubham meena mentored by Matthew Lagoe
2014-06-19 17:11:10 +05:30
*/
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();
2014-09-03 07:06:43 +02:00
2014-06-19 17:11:10 +05:30
global $INGAME_WEBPATH;
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
2014-09-03 07:06:43 +02:00
2014-06-19 17:11:10 +05:30
// check if shard is online
try {
$dbs = new DBLayer( "shard" );
$pageResult['shard'] = "online";
2014-09-03 07:06:43 +02:00
}
2014-06-19 17:11:10 +05:30
catch( PDOException $e ) {
$pageResult['shard'] = "offline";
2014-09-03 07:06:43 +02:00
}
2014-06-19 17:11:10 +05:30
return( $pageResult );
} else {
// ERROR: No access!
$_SESSION['error_code'] = "403";
2014-09-03 07:36:10 +02:00
header("Cache-Control: max-age=1");
2014-06-19 17:11:10 +05:30
header( "Location: index.php?page=error" );
2014-09-03 07:23:39 +02:00
throw new SystemExit();
2014-09-03 07:06:43 +02:00
}
2014-06-19 17:11:10 +05:30
}