Esempio n. 1
0
function getPluginVersion()
{
    $version = OA_Dal_ApplicationVariables::get('apStatsGraphsUI_version');
    if (class_exists('RV_Sync') || @(include MAX_PATH . '/lib/RV/Sync.php')) {
        return RV_Sync::getConfigVersion($version);
    }
    require_once MAX_PATH . '/lib/OA/Sync.php';
    return OA_Sync::getConfigVersion($version);
}
Esempio n. 2
0
 /**
  * Update checkForUpdates value into Settings
  *
  * @param boolean $syncEnabled
  * @return boolean
  */
 function putSyncSettings($syncEnabled)
 {
     require_once MAX_PATH . '/lib/OA/Admin/Settings.php';
     require_once MAX_PATH . '/lib/OA/Sync.php';
     $oSettings = new OA_Admin_Settings();
     $oSettings->settingChange('sync', 'checkForUpdates', $syncEnabled);
     // Reset Sync cache
     OA_Dal_ApplicationVariables::delete('sync_cache');
     OA_Dal_ApplicationVariables::delete('sync_timestamp');
     OA_Dal_ApplicationVariables::delete('sync_last_seen');
     if (!$oSettings->writeConfigChange()) {
         $this->oLogger->logError('Error saving Sync settings to the config file');
         return false;
     }
     // Generate a new Platform Hash if empty
     $platformHash = OA_Dal_ApplicationVariables::get('platform_hash');
     if (empty($platformHash) && !OA_Dal_ApplicationVariables::set('platform_hash', OA_Dal_ApplicationVariables::generatePlatformHash())) {
         $this->oLogger->logError('Error inserting Platform Hash into database');
         return false;
     }
     $oSync = new OA_Sync();
     OA::disableErrorHandling();
     $oSync->checkForUpdates();
     OA::enableErrorHandling();
     return true;
 }
echo "<br />" . $current . ".<br /><br />";
phpAds_ShowBreak();
if (!isset($session['maint_update'])) {
    if (function_exists('xml_parser_create')) {
        // Show wait please text with rotating logo
        echo "<br />";
        echo "<table border='0' cellspacing='1' cellpadding='2'><tr><td>";
        echo "<img src='" . OX::assetPath() . "/images/install-busy.gif' width='16' height='16'>";
        echo "</td><td class='install'>" . $strSearchingUpdates . "</td></tr></table>";
        // Send the output to the browser
        if (false !== ob_get_contents()) {
            ob_flush();
        }
        flush();
        // Get updates info and store them into a session var
        $oSync = new OA_Sync();
        $res = $oSync->checkForUpdates();
        phpAds_SessionDataRegister('maint_update', $res);
        phpAds_SessionDataStore();
        echo "<script language='JavaScript'>\n";
        echo "<!--\n";
        echo "document.location.replace('updates-product.php');\n";
        echo "//-->\n";
        echo "</script>\n";
        exit;
    } else {
        echo "<br />" . $strNotAbleToCheck . "<br /><br />";
        echo "<br /><br />" . $strForUpdatesLookOnWebsite . "<br /><br />";
        echo "<b><img src='" . OX::assetPath() . "/images/caret-r.gif'>&nbsp;<a href='http://" . $phpAds_producturl . "' target='_blank'>" . $strClickToVisitWebsite . "</a></b>";
    }
} else {
Esempio n. 4
0
 /**
  * A private method to run OpenX Sync.
  *
  * @access private
  */
 function _runOpenadsSync()
 {
     OA::debug('  Starting OpenX Sync process.', PEAR_LOG_DEBUG);
     require_once MAX_PATH . '/lib/OA/Sync.php';
     $oSync = new OA_Sync($this->aConf, $this->aPref);
     $res = $oSync->checkForUpdates(0);
     if ($res[0] != 0 && $res[0] != 800) {
         OA::debug("   - OpenX Sync error ({$res['0']}): {$res['1']}", PEAR_LOG_INFO);
     }
     OA::debug('  Finished OpenX Sync process.', PEAR_LOG_DEBUG);
 }
 /**
  * A private method to run OpenX Sync.
  *
  * @access private
  */
 function _runOpenadsSync()
 {
     $delay = mt_rand(0, 10000000);
     OA::debug(sprintf('  Starting OpenX Sync process in %dms.', $delay / 1000), PEAR_LOG_DEBUG);
     usleep($delay);
     require_once MAX_PATH . '/lib/OA/Sync.php';
     $oSync = new OA_Sync($this->aConf, $this->aPref);
     $oSync->checkForUpdates(0);
     OA::debug('  Finished OpenX Sync process.', PEAR_LOG_DEBUG);
 }
Esempio n. 6
0
 /**
  * A method to perform a call to the OAC XML-RPC server
  *
  * @param string $methodName The RPC method name
  * @param int    $authType   Type of required authentication, see constants
  * @param array  $aParams    Array of XML_RPC_Values
  * @return mixed The returned value or PEAR_Error on error
  */
 function call($methodName, $authType, $aParams = null, $recursionLevel = 0)
 {
     $aPref = $GLOBALS['_MAX']['PREF'];
     $oMsg = new XML_RPC_Message('oac.' . $methodName);
     $oMsg->remove_extra_lines = $this->remove_extra_lines;
     $aHeader = array('protocolVersion' => OA_DAL_CENTRAL_PROTOCOL_VERSION, 'ph' => OA_Dal_ApplicationVariables::get('platform_hash'));
     if ($authType & OA_DAL_CENTRAL_AUTH_M2M) {
         if (empty($this->oCentral)) {
             MAX::raiseError('M2M authentication used with a non M2M-enabled OA_Central object');
         }
         $aHeader['accountId'] = (int) $this->oCentral->accountId;
         $aHeader['m2mPassword'] = OA_Dal_Central_M2M::getM2MPassword($this->oCentral->accountId);
         if (empty($aHeader['m2mPassword']) || isset($GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->oCentral->accountId]) && $GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->oCentral->accountId] == true) {
             // No password stored, connect!
             $result = $this->oCentral->connectM2M();
             if (PEAR::isError($result)) {
                 return $result;
             }
             $aHeader['m2mPassword'] = $result;
         }
     }
     if ($authType & OA_DAL_CENTRAL_AUTH_SSO) {
         $aHeader['ssoUsername'] = $this->ssoUsername;
         $aHeader['ssoPassword'] = $this->ssoPassword;
     }
     if ($authType & OA_DAL_CENTRAL_AUTH_CAPTCHA) {
         $aHeader['ssoCaptcha'] = isset($_REQUEST['captcha-value']) ? $_REQUEST['captcha-value'] : '';
         $aHeader['ssoCaptchaRandom'] = isset($_REQUEST['captcha-random']) ? $_REQUEST['captcha-random'] : '';
     }
     $oMsg->addParam(XML_RPC_encode($aHeader));
     if (is_array($aParams)) {
         foreach ($aParams as $oParam) {
             $oMsg->addParam($oParam);
         }
     }
     OA::disableErrorHandling();
     $oResponse = $this->oXml->send($oMsg, OAC_RPC_TIMEOUT);
     OA::enableErrorHandling();
     if (!$oResponse) {
         return new PEAR_Error('XML-RPC connection error', OA_CENTRAL_ERROR_XML_RPC_CONNECTION_ERROR);
     }
     if ($oResponse->faultCode() || $oResponse->faultString()) {
         // Deal with particular response codes at Rpc level, avoiding endless recursion
         if (!$recursionLevel) {
             switch ($oResponse->faultCode()) {
                 case OA_CENTRAL_ERROR_PLATFORM_DOES_NOT_EXIST:
                     OA::disableErrorHandling();
                     $oSync = new OA_Sync();
                     $oSync->checkForUpdates();
                     OA::enableErrorHandling();
                     return $this->call($methodName, $authType, $aParams, ++$recursionLevel);
                 case OA_CENTRAL_ERROR_ERROR_NOT_AUTHORIZED:
                     if (!($authType & OA_DAL_CENTRAL_AUTH_M2M)) {
                         break;
                     } else {
                         // Go with OA_CENTRAL_ERROR_M2M_PASSWORD_INVALID
                     }
                 case OA_CENTRAL_ERROR_M2M_PASSWORD_INVALID:
                     // OAP was asked to connect the account to get a password
                     // Set clear the password and retry (old password is in DB in case of problems with receiving new one)
                     $GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->oCentral->accountId] = true;
                     return $this->call($methodName, $authType, $aParams, ++$recursionLevel, true);
                 case OA_CENTRAL_ERROR_M2M_PASSWORD_EXPIRED:
                     $result = $this->_reconnectM2M();
                     if (PEAR::isError($result)) {
                         return $result;
                     }
                     return $this->call($methodName, $authType, $aParams, ++$recursionLevel);
             }
         }
         return new PEAR_Error($oResponse->faultString(), $oResponse->faultCode());
     }
     $ret = XML_RPC_decode($oResponse->value());
     // handling unknown server errors
     // this may happen due to difference in Java/PHP XML-RPC handling errors
     if (is_array($ret) && (isset($ret['faultCode']) || isset($ret['faultCode']))) {
         return new PEAR_Error('Unknown server error', OA_CENTRAL_ERROR_SERVER_ERROR);
     }
     return $ret;
 }