[ PHPXref.com ] [ Generated: Sun Jul 20 19:31:32 2008 ] [ phpAdsNew 2.0.8 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/admin/ -> lib-updates.inc.php (source)

   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  // Prevent full path disclosure
  18  if (!defined('phpAds_path')) die();
  19  
  20  
  21  
  22  // Set define to prevent duplicate include
  23  define ('LIBUPDATES_INCLUDED', true);
  24  
  25  
  26  // Include required files
  27  require (phpAds_path.'/libraries/lib-xmlrpc.inc.php');
  28  
  29  
  30  
  31  /*********************************************************/
  32  /* XML-RPC server settings                               */
  33  /*********************************************************/
  34  
  35  $phpAds_updatesServer = array(
  36      'host'     => 'www.phpadsnew.com',
  37      'script' => '/update/xmlrpc.php',
  38      'port'     => 80
  39  );
  40  
  41  
  42  
  43  /*********************************************************/
  44  /* Check for updates via XML-RPC                         */
  45  /*********************************************************/
  46  
  47  function phpAds_checkForUpdates($already_seen = 0)
  48  {
  49      global $phpAds_config, $phpAds_updatesServer;
  50      global $xmlrpcerruser;
  51  
  52      // Create client object
  53      $client = new xmlrpc_client($phpAds_updatesServer['script'],
  54          $phpAds_updatesServer['host'], $phpAds_updatesServer['port']);
  55      
  56      // Create XML-RPC request message
  57      $msg = new xmlrpcmsg("updateAdsNew.check", array(
  58          new xmlrpcval($phpAds_config['config_version'], "string"),
  59          new xmlrpcval($already_seen, "string"),
  60          new xmlrpcval($phpAds_config['updates_dev_builds'] ? 'dev' : '', "string")
  61      ));
  62  
  63      // Send XML-RPC request message
  64      if($response = $client->send($msg, 10))
  65      {
  66          // XML-RPC server found, now checking for errors
  67          if (!$response->faultCode())
  68          {
  69              $ret = array(0, phpAds_xmlrpcDecode($response->value()));
  70              
  71              phpAds_dbQuery("
  72                  UPDATE
  73                      ".$phpAds_config['tbl_config']."
  74                  SET
  75                      updates_last_seen = '".$ret[1]['config_version']."',
  76                      updates_timestamp = ".time()."
  77              ");
  78          }
  79          else
  80              $ret = array($response->faultCode(), $response->faultString());
  81          
  82          return $ret;
  83      }
  84      
  85      return array(-1, 'No response from the server');
  86  }
  87  
  88  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]