ultimix
sape_site_api.php
Go to the documentation of this file.
1 <?php
2 
3  /*
4  * This source code is a part of the Ultimix Project.
5  * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6  * it's own license wich could be found from the corresponding files or sources.
7  * This source code is provided "as is" without any warranties or garanties.
8  *
9  * Have a nice day!
10  *
11  * @url http://ultimix.sorceforge.net
12  *
13  * @author Alexey "gdever" Dodonov
14  */
15 
27 
38  var $SapeCommonApi = false;
39  var $SapeUtilities = false;
40  var $Security = false;
41 
56  function __construct()
57  {
58  try
59  {
60  $this->SapeCommonApi = get_package( 'sape::sape_common_api' , 'last' , __FILE__ );
61  $this->SapeUtilities = get_package( 'sape::sape_utilities' , 'last' , __FILE__ );
62  $this->Security = get_package( 'security' , 'last' , __FILE__ );
63  }
64  catch( Exception $e )
65  {
66  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
67  }
68  }
69 
88  function get_sites()
89  {
90  try
91  {
92  $Response = $this->SapeUtilities->call_method(
93  $this->SapeCommonApi->Client , 'sape.get_sites' , array() , 'Can\'t get sites'
94  );
95 
96  return( php_xmlrpc_decode( $Response->value() ) );
97  }
98  catch( Exception $e )
99  {
100  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
101  }
102  }
103 
130  private function get_site_money_stats_parameters( $SiteId , $Year , $Month , $Day )
131  {
132  try
133  {
134  $SiteId = $this->Security->get( $SiteId , 'integer' );
135 
136  $Parameters = array( new xmlrpcval( $SiteId , 'int' ) );
137  if( $Year !== false )
138  {
139  $Parameters [] = new xmlrpcval( $this->Security->get( $Year , 'integer' ) , 'int' );
140  if( $Month !== false )
141  {
142  $Parameters [] = new xmlrpcval( $this->Security->get( $Month , 'integer' ) , 'int' );
143  if( $Day !== false )
144  {
145  $Parameters [] = new xmlrpcval( $this->Security->get( $Day , 'integer' ) , 'int' );
146  }
147  }
148  }
149 
150  return( $Parameters );
151  }
152  catch( Exception $e )
153  {
154  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
155  }
156  }
157 
192  function get_site_money_stats( $SiteId , $Year = false , $Month = false , $Day = false )
193  {
194  try
195  {
196  $Parameters = $this->get_site_money_stats_parameters( $SiteId , $Year , $Month , $Day );
197 
198  $Method = 'sape.get_site_money_stats';
199  $Response = $this->SapeUtilities->call_method(
200  $this->SapeCommonApi->Client , $Method , $Parameters , 'Can\'t get site money stats'
201  );
202 
203  return( php_xmlrpc_decode( $Response->value() ) );
204  }
205  catch( Exception $e )
206  {
207  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
208  }
209  }
210 
233  function get_site_pages( $SiteId )
234  {
235  try
236  {
237  $SiteId = $this->Security->get( $SiteId , 'integer' );
238 
239  $Parameters = array( new xmlrpcval( $SiteId , 'int' ) );
240 
241  $Response = $this->SapeUtilities->call_method(
242  $this->SapeCommonApi->Client , 'sape.get_site_pages' , $Parameters , 'Can\'t get site pages'
243  );
244 
245  return( php_xmlrpc_decode( $Response->value() ) );
246  }
247  catch( Exception $e )
248  {
249  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
250  }
251  }
252 
279  function get_site_links( $SiteId , $Status = false )
280  {
281  try
282  {
283  $SiteId = $this->Security->get( $SiteId , 'string' );
284  $Parameters = array( new xmlrpcval( $SiteId , 'int' ) );
285 
286  if( $Status !== false )
287  {
288  $Status = $this->Security->get( $Status , 'command' );
289  $Parameters [] = new xmlrpcval( $Status , 'string' );
290  }
291 
292  $Response = $this->SapeUtilities->call_method(
293  $this->SapeCommonApi->Client , 'sape.get_site_links' , $Parameters , 'Can\'t get site links'
294  );
295 
296  return( php_xmlrpc_decode( $Response->value() ) );
297  }
298  catch( Exception $e )
299  {
300  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
301  }
302  }
303  }
304 
305 ?>