t('SabreAMF'), 'value' => t('1.2'), ); if (!file_exists(realpath(dirname(__FILE__) . '/SabreAMF/Server.php'))) { $requirements['sabreamf']['value'] = t('SabreAMF framework was not found'); $requirements['sabreamf']['description'] = t('You must dowload SabreAMF framework and install it into modules/sabreamf/SabreAMF.'); $requirements['sabreamf']['severity'] = REQUIREMENT_ERROR; } return $requirements; } /* * Implementation of hook_server_info() */ function sabreamf_server_info() { return array( '#name' => 'SabreAMF', '#path' => 'sabreamf', ); } /* * Implementation of hook_server() */ function sabreamf_server() { $path = $_SERVER['DOCUMENT_ROOT'] . base_path() . drupal_get_path('module', 'sabreamf'); if(!(isset($_SERVER['CONTENT_TYPE']) && ($_SERVER['CONTENT_TYPE'] == 'application/x-amf'))) { $media_url = base_path().drupal_get_path('module', 'sabreamf').'/media'; $html = ' '; $html .= 'SabreAMF gateway ready'; $html .= ''; $html .= ''; $html .= ''; echo $html; } else { set_include_path(get_include_path().PATH_SEPARATOR.$path); require_once $path . '/SabreAMF/CallbackServer.php'; $server = new SabreAMF_CallbackServer(); $server->onInvokeService = '_sabreamf_server_callback'; $server->exec(); } } function _sabreamf_server_callback($serviceName, $methodName, $arguments) { $method = $serviceName.'.'.$methodName; // this is only a convenience method so that you can test sabreamf drupal module // using a php script (running from browser or from the console(ie: command line in windows)) // this "if" block bellow can be removed with no issue if($methodName == 'sabreamf_pingme') { return array($method, $arguments); } return sabreamf_method_call($method, array($method, $arguments)); } /* * Implementation of hook_method_call() */ function sabreamf_method_call($method_name, $args) { return services_method_call($method_name, $args); } /* * Implementation of hook_server_error() */ function sabreamf_server_error($message) { watchdog('sabreamf server', $message, NULL, WATCHDOG_ERROR); } /* function trace_dump_sabreamf() { $args = func_get_args(); $fp = fopen(dirname(__FILE__).'/log.txt', 'a+'); fwrite($fp, print_r($args, true)."\n"); fclose($fp); } */