| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:31:32 2008 ] | [ phpAdsNew 2.0.8 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php // $Revision: 2.0.2.6 $ 2 3 /************************************************************************/ 4 /* phpAdsNew 2 */ 5 /* =========== */ 6 /* */ 7 /* Copyright (c) 2000-2006 by the phpAdsNew developers */ 8 /* For more information visit: http://www.phpadsnew.com */ 9 /* */ 10 /* This program is free software. You can redistribute it and/or modify */ 11 /* it under the terms of the GNU General Public License as published by */ 12 /* the Free Software Foundation; either version 2 of the License. */ 13 /************************************************************************/ 14 15 16 17 // Figure out our location 18 define ('phpAds_path', '.'); 19 20 21 // Set invocation type 22 define ('phpAds_invocationType', 'xmlrpc'); 23 24 25 26 /*********************************************************/ 27 /* Include required files */ 28 /*********************************************************/ 29 30 require (phpAds_path."/config.inc.php"); 31 require (phpAds_path."/libraries/lib-db.inc.php"); 32 require (phpAds_path."/libraries/lib-xmlrpcs.inc.php"); 33 34 if (($phpAds_config['log_adviews'] && !$phpAds_config['log_beacon']) || $phpAds_config['acl']) 35 { 36 require (phpAds_path."/libraries/lib-remotehost.inc.php"); 37 38 if ($phpAds_config['log_adviews'] && !$phpAds_config['log_beacon']) 39 require (phpAds_path."/libraries/lib-log.inc.php"); 40 41 if ($phpAds_config['acl']) 42 require (phpAds_path."/libraries/lib-limitations.inc.php"); 43 } 44 45 require (phpAds_path."/libraries/lib-view-main.inc.php"); 46 47 48 49 /*********************************************************/ 50 /* Wrapper function to view_raw() */ 51 /*********************************************************/ 52 53 function phpAds_xmlrpcView ($msg) 54 { 55 global $xmlrpcerruser; 56 57 $view_params = array(); 58 59 // Parse parameters 60 for ($i = 0; $i < $msg->getNumParams(); $i++) 61 { 62 $p = $msg->getParam($i); 63 64 if ($i) 65 { 66 // Put the decoded value the view arg array 67 $view_params[] = phpAds_xmlrpcDecode($p); 68 } 69 else 70 { 71 // First parameter: Remote information supplied be XML-RPC client 72 $p = phpAds_xmlrpcDecode($p); 73 74 if (!isset($p['remote_addr'])) 75 return new xmlrpcresp(0, $xmlrpcerruser + 1, 76 "Missing 'remote_addr' member!"); 77 78 while (list($k, $v) = each($p)) 79 { 80 switch ($k) 81 { 82 case 'remote_addr': 83 $GLOBALS['HTTP_SERVER_VARS']['REMOTE_ADDR'] = 84 $GLOBALS['REMOTE_ADDR'] = $v; 85 break; 86 87 case 'remote_host': 88 $GLOBALS['HTTP_SERVER_VARS']['REMOTE_HOST'] = 89 $GLOBALS['REMOTE_HOST'] = $v; 90 break; 91 92 default: 93 $varname = 'HTTP_'.strtoupper($k); 94 $GLOBALS['HTTP_SERVER_VARS'][$varname] = 95 $GLOBALS[$varname] = $v; 96 break; 97 } 98 } 99 } 100 } 101 102 // Call view with supplied parameters 103 $output = call_user_func_array('view_raw', $view_params); 104 105 // What parameter should be always set 106 if (!is_array($output)) 107 return new xmlrpcresp(0, $xmlrpcerruser + 99, 108 "An error occurred while fetching banner code"); 109 110 if (isset($GLOBALS['phpAds_xmlError'])) 111 return $GLOBALS['phpAds_xmlError']; 112 113 return new xmlrpcresp(phpAds_xmlrpcEncode($output)); 114 } 115 116 117 118 119 /*********************************************************/ 120 /* XML-RPC error handler */ 121 /*********************************************************/ 122 123 function phpAds_xmlrpcErrorHandler ($errno, $errstr, $errfile, $errline) 124 { 125 global $xmlrpcerruser, $phpAds_xmlError; 126 127 if ($errno & (E_ERROR|E_USER_ERROR)) 128 $phpAds_xmlError = new xmlrpcresp(0, $xmlrpcerruser + 100, 129 "Error in '$errfile' at line $errline: $errstr"); 130 } 131 132 133 134 /*********************************************************/ 135 /* Main code */ 136 /*********************************************************/ 137 138 139 // Register function to send error as an XML-RPC error message - PHP4 only 140 if (function_exists('set_error_handler')) 141 set_error_handler('phpAds_xmlrpcErrorHandler'); 142 143 144 // Open a connection to the database 145 phpAds_dbConnect(); 146 147 148 // Create server for the view method with possible signatures 149 $server = new xmlrpc_server(array( 150 "phpAds.view" => array( 151 "function" => 'phpAds_xmlrpcView', 152 "signature" => array( 153 array($xmlrpcStruct, $xmlrpcStruct, $xmlrpcString, $xmlrpcInt, $xmlrpcString, $xmlrpcString, $xmlrpcBoolean), 154 array($xmlrpcStruct, $xmlrpcStruct, $xmlrpcString, $xmlrpcInt, $xmlrpcString, $xmlrpcString, $xmlrpcBoolean, $xmlrpcArray) 155 ) 156 ) 157 ) 158 ); 159 160 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |