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