All pastes #451654 Raw Edit

Mine

public php v1 · immutable
·published 2007-04-21 18:42 UTC
rendered paste body
<?php	/**	 * @author DarkStar Communications, by Nobis Technology Group, LLC.	 * @package Reseller Control Panel API Implementation Example	 * @version 1.0.0	 * 	 * @desc 	 * This file will control the nitty gritty handling of our 	 * Ventrilo servers. This class should extend the services 	 * class to allow it perform generic functionality defined there.	 * 	 * @link 	 * http://support.darkstarllc.com/	 */		class Ventrilo extends Services	{				/**		 * This will retrieve IP and PORT information relating to 		 * the appropriate server passed.		 * 		 * @param Array $server		 * @return Array		 */		public function retrieveDetails($server)		{			/** As always, we need our API to be scoped for here. **/			global $api;						return $api->get_xml_response("reseller", "getVentriloServerDetails", $server, REMOTE_ID, REMOTE_KEY);		}				/**		 * This formats our server status to online or offline.		 * 		 * @param Boolean $status		 */		public function formatStatus($status)		{			switch($status)			{				case 1:					return "<font color=\"green\">Online</font>";					break;				case 0:					return "<font color=\"red\">Offline</font>";					break;			}		}				/**		 * This function will load all servers and display them on the page.		 * 		 * @return void		 */		public function loadServersListing()		{			/** 			 * Load our servers!			 */			$servers = Services::fetchServicesArray('ventrilo', $_SESSION['client_id']);			if(!empty($servers))			{				/**				 * Display servers message.				 */				echo "<p>The following Ventrilo Servers are listed on your account.</p>";								/** 				 * We have servers, let's build our new table!				 */				$htmlTable = new Html_Table();				$htmlTable->setParameter('width', '100%');				$htmlTable->setParameter('cellspacing', '5');				$htmlTable->setParameter('style', 'border: 1px solid black; background-color: silver;');										/**				 * Add our table header.				 */				$row = new Html_Row();				$row->addColumn(new Html_Column("<b>#</b>"));				$row->addColumn(new Html_Column("<b>Server Address</b>"));				$row->addColumn(new Html_Column("<b>Status</b>"));				$row->addColumn(new Html_Column("<b>Manage</b>"));				$htmlTable->addRow($row);								/** 				 * Let's begin looping				 */					$count = 1;				foreach($servers AS $server)				{					$details = Ventrilo::retrieveDetails($server);										$row = new Html_Row();					$row->addColumn(new Html_Column($count));					$row->addColumn(new Html_Column($details['ip_address'] .":". $details['port']));					$row->addColumn(new Html_Column(Ventrilo::formatStatus($details['status'])));					$row->addColumn(new Html_Column("<a href=\"ventrilo/manage.php?serverId=". $server['id'] ."\">Manage Server</a>"));					$htmlTable->addRow($row);					$count++;				}								/** 				 * Draw our Table				 */				echo $htmlTable->draw();			}						/**			 * We do not have any servers listed.			 */			else			{				echo "<p>Sorry, your account does not have any Ventrilo Servers associated with it.</p>";				}		}	}	?>