Location: PHPKode > projects > O - OpenSource GroupWare > osgw/admin/plugin_manager.php
<?php
/**************************************************************************
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   @Authors:	Ryan Thompson(hide@address.com)
***************************************************************************/

include("./data.php");
$service['add_header'] = TRUE;
include("../config.inc.php");

include($here. "/class.admin.php");
$admin = new admin;
echo $layout->page_header;
echo $layout->service_header($text['service_name'] . ' - '. $text['plugin_manager'],$admin->nav_buttons());


	
	echo $buffer = $html->create_list(
		 array(	"STYLE"		=>  "list_header",
			"SERVICE_NAME" => $text['service'],
			"CURRENT_VERSION"	=> $text['current_version'],
			"FILE_VERSION"	=> $text['file_version'],
			"STATUS"	=> $text['status']),
		$O->dir ."/admin/html/plugin_hdr.html");


$i = 0;
$handle = opendir($O->dir);
{
	while (false !== ($file = readdir($handle))) {
		if(is_dir($O->dir ."/". $file) && !in_array($file, $system_dirs) && $file != 'osgw')	
		{
			include($O->dir ."/$file/data.php");
			$existing_services[$i] =$service;
			$existing_services[$i]['location'] = $file;
			$i++;
		}
	}
}
		
		
$sql = "SELECT * FROM o_services";
$db->query($sql);
while($db->fetch_results())
{
	$service_data[$db->record['code']] = $db->record;
}

foreach($existing_services AS $key => $value)
{
	$class = $html->list_class($class);

	$sql = "SELECT messages FROM o_text WHERE id_text='service_name' AND service='{$value['code']}'";
	$db->query($sql);
	$db->fetch_results();
	if(is_null($db->record['messages']))
	{
		$service_name = $value['name'];
	} else {
		$service_name = $db->record['messages'];
	}

	if($service_data[$value['code']]['code'] == $value['code'])
	{
		$status = 'INSTALLED';
		include($O->dir . "/{$service_data[$value['code']]['location']}/data.php");
		if($service['version'] > $service_data[$value['code']]['version'])
		{
			$status = "NEEDS UPGRADING";
			$class = 'expired';
		}
	} else {
		$status = $O->create_link("/admin/service_install.php?sv={$value['location']}", $text['install_service'], $class);
		//$installed = 'NOT INSTALLED';
	}
	echo $buffer = $html->create_list(
		array(	"STYLE"		=>  $class,
			"SERVICE_NAME" => $service_name,
			"CURRENT_VERSION"	=> $service_data[$value['code']]['version'],
			"FILE_VERSION"	=> $value['version'],
			"STATUS"	=> $status),
		$O->dir ."/admin/html/plugin_list.html");
		

}
	echo $buffer = $html->create_list(array(''), $O->dir ."/admin/html/plugin_ftr.html"); 
		
	echo $layout->create_footer();
?>
Return current item: O - OpenSource GroupWare