本文整理汇总了PHP中OA_Dal_ApplicationVariables类的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal_ApplicationVariables类的具体用法?PHP OA_Dal_ApplicationVariables怎么用?PHP OA_Dal_ApplicationVariables使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Dal_ApplicationVariables类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getId
/**
* A method to generate a lock id.
*
* @access protected
*
* @param string The lock name.
* @return string The lock id.
*/
function _getId($sName)
{
$platformHash = OA_Dal_ApplicationVariables::get('platform_hash');
// PostgreSQL needs two int4, we generate them using crc32
$sId = array(crc32($platformHash) & 0x7fffffff, crc32($sName) & 0x7fffffff);
return serialize($sId);
}
示例2: getPlatformHash
/**
* Try to get platform hash.
* If it's upgrade it try to read database (searches old config/preference tables)
* If this fails it returns 'OXP_upgrade-unknown_platform_hash'
* If it's fresh install then it checks if there is already generated
* platformHash by previous call of this method, or use suggested one, or generate new one.
* New platform hash is stored as already generated.
*
* @param string $suggestedPlatformHash
* @param boolean $forceCheck should check be done once again (or we can use cached results)
* @return string platform Hash
*/
public function getPlatformHash($suggestedPlatformHash = null, $forceCheck = false)
{
if (!$forceCheck && isset(self::$foundPlatformHash)) {
return self::$foundPlatformHash;
}
// is it upgrade?
$oUpgrader = new OA_Upgrade();
if (!$oUpgrader->isFreshInstall()) {
// YES:
// prepare database connection data
$oUpgrader->canUpgradeOrInstall();
$oUpgrader->initDatabaseConnection();
// try read platform hash from database (3 possible locations)
$platformHash = $this->readPlatformHashFromDatabase();
// if can't find platformHash - set 'OXP_upgrade-unknown_platform_hash'
$platformHash = $platformHash ? $platformHash : self::$UNKNOWN_PLATFORM_HASH;
} else {
// NO:
// is already set generatedPlatformHash
if (isset(self::$generatedPlatformHash)) {
$platformHash = self::$generatedPlatformHash;
} else {
// use sugested or generate new one (and remember)
if (isset($suggestedPlatformHash)) {
$platformHash = $suggestedPlatformHash;
} else {
$platformHash = OA_Dal_ApplicationVariables::generatePlatformHash();
}
// remember genereted platform hash
self::$generatedPlatformHash = $platformHash;
}
}
self::$foundPlatformHash = $platformHash;
return $platformHash;
}
示例3: getOwningAccountIds
/**
* A method to return an array of account IDs of the account(s) that
* should "own" any audit trail entries for this entity type; these
* are NOT related to the account ID of the currently active account
* (which is performing some kind of action on the entity), but is
* instead related to the type of entity, and where in the account
* heirrachy the entity is located.
*
* @return array An array containing up to three indexes:
* - "OA_ACCOUNT_ADMIN" or "OA_ACCOUNT_MANAGER":
* Contains the account ID of the manager account
* that needs to be able to see the audit trail
* entry, or, the admin account, if the entity
* is a special case where only the admin account
* should see the entry.
* - "OA_ACCOUNT_ADVERTISER":
* Contains the account ID of the advertiser account
* that needs to be able to see the audit trail
* entry, if such an account exists.
* - "OA_ACCOUNT_TRAFFICKER":
* Contains the account ID of the trafficker account
* that needs to be able to see the audit trail
* entry, if such an account exists.
*/
function getOwningAccountIds()
{
// Special case - return the admin account ID only,
// as changes to the types of preferences in the
// system need only be viewed by the admin
$aAccountIds = array(OA_ACCOUNT_ADMIN => OA_Dal_ApplicationVariables::get('admin_account_id'));
return $aAccountIds;
}
示例4: getPluginVersion
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);
}
示例5: setVariables
/**
* A helper method to set applicationvariables
*
* @param Date $oScheduledDate
* @param Date $oDate
*/
function setVariables($oScheduledDate, $oDate)
{
if (isset($oScheduledDate)) {
OA_Dal_ApplicationVariables::set('maintenance_cron_timestamp', $oScheduledDate->getDate(DATE_FORMAT_UNIXTIME));
} else {
OA_Dal_ApplicationVariables::delete('maintenance_cron_timestamp');
}
if (isset($oDate)) {
OA_Dal_ApplicationVariables::set('maintenance_timestamp', $oDate->getDate(DATE_FORMAT_UNIXTIME));
} else {
OA_Dal_ApplicationVariables::delete('maintenance_timestamp');
}
}
示例6: autoLogin
function autoLogin()
{
$oPlugin =& OA_Auth::staticGetAuthPlugin();
phpAds_SessionStart();
// No auto-login if auth is external
if (empty($oPlugin) || get_class($oPlugin) != 'Plugins_Authentication') {
phpAds_SessionDataDestroy();
return;
}
$adminAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
if (isset($adminAccountId)) {
// Fetch the user linked to the admin account
$doUser = OA_Dal::factoryDO('users');
$doAUA = OA_Dal::factoryDO('account_user_assoc');
$doAUA->account_id = $adminAccountId;
$doUser->joinAdd($doAUA);
$doUser->find();
if ($doUser->fetch()) {
phpAds_SessionDataRegister(OA_Auth::getSessionData($doUser));
phpAds_SessionDataStore();
}
}
}
示例7: call
/**
* 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;
}
示例8: processDatabaseAction
/**
* Process input from user and creates/upgrades DB etc....
*
* @param OA_Admin_UI_Component_Form $oForm
* @param OX_Admin_UI_Install_Wizard $oWizard
*/
protected function processDatabaseAction($oForm, $oWizard)
{
$oUpgrader = $this->getUpgrader();
$upgraderSuccess = false;
$aDbConfig = $oForm->populateDbConfig();
if ($oUpgrader->canUpgradeOrInstall()) {
$installStatus = $oUpgrader->existing_installation_status;
define('DISABLE_ALL_EMAILS', 1);
OA_Permission::switchToSystemProcessUser('Installer');
if ($installStatus == OA_STATUS_NOT_INSTALLED) {
if ($oUpgrader->install($aDbConfig)) {
$message = $GLOBALS['strDBInstallSuccess'];
$upgraderSuccess = true;
}
} else {
if ($oUpgrader->upgrade($oUpgrader->package_file)) {
// Timezone support - hack
if ($oUpgrader->versionInitialSchema['tables_core'] < 538 && empty($aDbConfig['noTzAlert'])) {
OA_Dal_ApplicationVariables::set('utc_update', OA::getNowUTC());
}
// Clear the menu cache to built a new one with the new settings
OA_Admin_Menu::_clearCache(OA_ACCOUNT_ADMIN);
OA_Admin_Menu::_clearCache(OA_ACCOUNT_MANAGER);
OA_Admin_Menu::_clearCache(OA_ACCOUNT_ADVERTISER);
OA_Admin_Menu::_clearCache(OA_ACCOUNT_TRAFFICKER);
OA_Admin_Menu::singleton();
$message = $GLOBALS['strDBUpgradeSuccess'];
$upgraderSuccess = true;
}
}
OA_Permission::switchToSystemProcessUser();
//get back to normal user previously logged in
} else {
if ($oUpgrader->existing_installation_status == OA_STATUS_CURRENT_VERSION) {
$upgraderSuccess = true;
//rare but can occur if DB has been installed and user revisits the screen
}
}
$dbSuccess = $upgraderSuccess && !$oUpgrader->oLogger->errorExists;
if ($dbSuccess) {
//show success status
OA_Admin_UI::getInstance()->queueMessage($message, 'global', 'info');
} else {
//sth went wrong, display messages from upgrader
$aMessages = OX_Admin_UI_Install_InstallUtils::getMessagesWithType($oUpgrader->getMessages());
$this->setModelProperty('aMessages', $aMessages);
}
return $dbSuccess;
}
示例9: updateLastRun
/**
* A method to update maintenance last run information for
* old maintenance code.
*/
function updateLastRun($bScheduled = false)
{
$sField = $bScheduled ? 'maintenance_cron_timestamp' : 'maintenance_timestamp';
OA_Dal_ApplicationVariables::set($sField, OA::getNow('U'));
// Make sure that the maintenance delivery cache is regenerated
MAX_cacheCheckIfMaintenanceShouldRun(false);
}
示例10: getOwningManagerId
/**
* A method to return the ID of the manager account
* that "owns" this advertiser account.
*
* @return integer The account ID of the "owning"
* manager account. Returns the
* admin account ID if no owning
* manager account can be found.
*/
function getOwningManagerId()
{
$doAgency = OA_Dal::factoryDO('agency');
$doAgency->agencyid = $this->agencyid;
$doAgency->find();
if ($doAgency->getRowCount() == 1) {
$doAgency->fetch();
return $doAgency->account_id;
} else {
// Could not find the owning manager
// account ID, return the ID of the
// admin account instead
return OA_Dal_ApplicationVariables::get('admin_account_id');
}
}
示例11: _getOwningAccountIdsByAccountId
/**
* A private method to return the owning account IDs in a format suitable
* for use by the DB_DataObjectCommon::getOwningAccountIds() method as a
* return parameter, given the account ID of the account that is the owner
* of the entity being audited.
*
* @access private
* @param integer $accountId The account ID that "owns" the entity being
* audited.
* @return array An array with the same format as the return array of the
* DB_DataObjectCommon::getOwningAccountIds() method.
*/
protected function _getOwningAccountIdsByAccountId($accountId)
{
// Get the type of the "owning" account
$accountType = OA_Permission::getAccountTypeByAccountId($accountId);
if ($accountType == OA_ACCOUNT_ADMIN) {
// Simply return the admin account ID
$aAccountIds = array(OA_ACCOUNT_ADMIN => $accountId);
} else {
if ($accountType == OA_ACCOUNT_MANAGER) {
// Simply return the manager account ID
$aAccountIds = array(OA_ACCOUNT_MANAGER => $accountId);
} else {
if ($accountType == OA_ACCOUNT_ADVERTISER) {
// Set the owning manager account ID to the admin
// account ID, in case something goes wrong
$managerAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
// This is an advertiser account, so find the
// "owning" manager account ID
$doClients = OA_Dal::factoryDO('clients');
$doClients->account_id = $accountId;
$doClients->find();
if ($doClients->getRowCount() == 1) {
$doClients->fetch();
$managerAccountId = $doClients->getOwningManagerId();
}
// Return the manager and advertiser account IDs
$aAccountIds = array(OA_ACCOUNT_MANAGER => $managerAccountId, OA_ACCOUNT_ADVERTISER => $accountId);
} else {
if ($accountType == OA_ACCOUNT_TRAFFICKER) {
// Set the owning manager account ID to the admin
// account ID, in case something goes wrong
$managerAccountId = OA_Dal_ApplicationVariables::get('admin_account_id');
// This is a trafficker account, so find the
// "owning" manager account ID
$doAffiliates = OA_Dal::factoryDO('affiliates');
$doAffiliates->account_id = $accountId;
$doAffiliates->find();
if ($doAffiliates->getRowCount() == 1) {
$doAffiliates->fetch();
$managerAccountId = $doAffiliates->getOwningManagerId();
}
// Return the manager and trafficker account IDs
$aAccountIds = array(OA_ACCOUNT_MANAGER => $managerAccountId, OA_ACCOUNT_TRAFFICKER => $accountId);
}
}
}
}
return $aAccountIds;
}
示例12: getOwningAccountIds
/**
* A method to return an array of account IDs of the account(s) that
* should "own" any audit trail entries for this entity type; these
* are NOT related to the account ID of the currently active account
* (which is performing some kind of action on the entity), but is
* instead related to the type of entity, and where in the account
* heirrachy the entity is located.
*
* @return array An array containing up to three indexes:
* - "OA_ACCOUNT_ADMIN" or "OA_ACCOUNT_MANAGER":
* Contains the account ID of the manager account
* that needs to be able to see the audit trail
* entry, or, the admin account, if the entity
* is a special case where only the admin account
* should see the entry.
* - "OA_ACCOUNT_ADVERTISER":
* Contains the account ID of the advertiser account
* that needs to be able to see the audit trail
* entry, if such an account exists.
* - "OA_ACCOUNT_TRAFFICKER":
* Contains the account ID of the trafficker account
* that needs to be able to see the audit trail
* entry, if such an account exists.
*/
public function getOwningAccountIds($resetCache = false)
{
// Special case - return the admin account ID only.
// This is because we can only store one account ID for each
// type of account, however, it's possible for a user to be
// linked to (for example) multiple accounts, which are in turn
// owned by multiple manager accounts, so it's simply not possible
// to record all possible manager account IDs; so, we restrict
// auditing of user entities to be only visible to the admin
// account
$aAccountIds = array(OA_ACCOUNT_ADMIN => OA_Dal_ApplicationVariables::get('admin_account_id'));
return $aAccountIds;
}
示例13: _checkStatsAccuracy
/**
* A private method to check if the returned stats may be inaccurate
* becuase of an upgrade from a non TZ-enabled version
*
*/
function _checkStatsAccuracy()
{
$utcUpdate = OA_Dal_ApplicationVariables::get('utc_update');
if (!empty($utcUpdate)) {
$oUpdate = new Date($utcUpdate);
$oUpdate->setTZbyID('UTC');
// Add 12 hours
$oUpdate->addSeconds(3600 * 12);
if (!empty($this->aDates['day_begin']) && !empty($this->aDates['day_end'])) {
$startDate = new Date($this->aDates['day_begin']);
$endDate = new Date($this->aDates['day_end']);
if ($oUpdate->after($endDate) || $oUpdate->after($startDate)) {
$this->displayInaccurateStatsWarning = true;
}
} else {
// All statistics
$this->displayInaccurateStatsWarning = true;
}
}
}
示例14: _isAdmin
/**
* A private method to check if the current user is linked to the admin account
*
* @return bool True if the user is linked to the admin account
*/
function _isAdmin()
{
$doUsers = OA_Dal::factoryDO('users');
$doUsers->user_id = $this->aUser['user_id'];
$doAUA = OA_Dal::factoryDO('account_user_assoc');
$doAUA->account_id = OA_Dal_ApplicationVariables::get('admin_account_id');
$doUsers->joinAdd($doAUA);
return (bool) $doUsers->count();
}
示例15: checkForUpdates
/**
* Connect to OpenX Sync to check for updates
*
* @param float $already_seen Only check for updates newer than this value.
* @return array An array of two items:
*
* Item 0 is the XML-RPC error code. Meanings:
* -2 => The admin user has disabled update checking
* -1 => No response from the server
* 0 - 799 => XML-RPC library error codes
* 0 => No error
* 800 => No updates
* 801+ => Error codes from the remote XML-RPC server
*
* Item 1 is either the error message (item 1 != 0), or an array containing update info
*/
function checkForUpdates($already_seen = 0)
{
global $XML_RPC_erruser;
if (!$this->aConf['sync']['checkForUpdates']) {
// Checking for updates has been disabled by the admin user,
// so do not communicate with the server that provides the
// details of what upgrades are available - just return an
// 800 "error"
$aReturn = array(-2, 'Check for updates has been disabled by the administrator.');
return $aReturn;
}
// Create the XML-RPC client object
$client = OA_Central::getXmlRpcClient($this->_conf);
// Prepare the installation's platform hash
$platform_hash = OA_Dal_ApplicationVariables::get('platform_hash');
if (!$platform_hash) {
// The installation does not have a platform hash; generate one,
// and save it to the database for later use
OA::debug("Generating a new platform_hash for the installation", PEAR_LOG_INFO);
$platform_hash = OA_Dal_ApplicationVariables::generatePlatformHash();
if (!OA_Dal_ApplicationVariables::set('platform_hash', $platform_hash)) {
OA::debug("Could not save the new platform_hash to the database", PEAR_LOG_ERR);
unset($platform_hash);
OA::debug("Sync process proceeding without a platform_hash", PEAR_LOG_INFO);
}
}
// Prepare the parameters required for the XML-RPC call to
// obtain if an update is available for this installation
$params = array(new XML_RPC_Value(PRODUCT_NAME, 'string'), new XML_RPC_Value($this->getConfigVersion(OA_Dal_ApplicationVariables::get('oa_version')), 'string'), new XML_RPC_Value($already_seen, 'string'), new XML_RPC_Value($platform_hash, 'string'));
// Has the Revive Adserver admin user kindly agreed to share the
// technology stack that it is running on, to help the community?
$aTechStack = array('data' => false);
if ($this->aConf['sync']['shareStack']) {
// Thanks, admin user! You're a star! Prepare the technology stack
// data and add it to the XML-RPC call
if ($this->oDbh->dbsyntax == 'mysql') {
$dbms = 'MySQL';
} else {
if ($this->oDbh->dbsyntax == 'pgsql') {
$dbms = 'PostgreSQL';
} else {
$dbms = 'UnknownSQL';
}
}
$aTechStack = array('os_type' => php_uname('s'), 'os_version' => php_uname('r'), 'webserver_type' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^(.*?)/.*$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'webserver_version' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^.*?/(.*?)(?: .*)?$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'db_type' => $dbms, 'db_version' => $this->oDbh->queryOne("SELECT VERSION()"), 'php_version' => phpversion(), 'php_sapi' => ucfirst(php_sapi_name()), 'php_extensions' => get_loaded_extensions(), 'php_register_globals' => (bool) ini_get('register_globals'), 'php_magic_quotes_gpc' => (bool) ini_get('magic_quotes_gpc'), 'php_safe_mode' => (bool) ini_get('safe_mode'), 'php_open_basedir' => (bool) strlen(ini_get('open_basedir')), 'php_upload_tmp_readable' => (bool) is_readable(ini_get('upload_tmp_dir') . DIRECTORY_SEPARATOR));
}
$params[] = XML_RPC_Encode($aTechStack);
// Add the registered email address
$params[] = new XML_RPC_Value(OA_Dal_ApplicationVariables::get('sync_registered_email'), 'string');
// Create the XML-RPC request message
$msg = new XML_RPC_Message("Revive.Sync", $params);
// Send the XML-RPC request message
if ($response = $client->send($msg, 10)) {
// XML-RPC server found, now checking for errors
if (!$response->faultCode()) {
// No fault! Woo! Get the response and return it!
$aReturn = array(0, XML_RPC_Decode($response->value()));
// Prepare cache
$cache = $aReturn[1];
// Update last run
OA_Dal_ApplicationVariables::set('sync_last_run', date('Y-m-d H:i:s'));
// Also write to the debug log
OA::debug("Sync: updates found!", PEAR_LOG_INFO);
} else {
// Boo! An error! (Well, maybe - if it's 800, yay!)
$aReturn = array($response->faultCode(), $response->faultString());
// Prepare cache
$cache = false;
// Update last run
if ($response->faultCode() == 800) {
// Update last run
OA_Dal_ApplicationVariables::set('sync_last_run', date('Y-m-d H:i:s'));
// Also write to the debug log
OA::debug("Sync: {$aReturn[1]}", PEAR_LOG_INFO);
} else {
// Write to the debug log
OA::debug("Sync: {$aReturn[1]} (code: {$aReturn[0]}", PEAR_LOG_ERR);
// Return immediately without writing to cache
return $aReturn;
}
}
OA_Dal_ApplicationVariables::set('sync_cache', serialize($cache));
OA_Dal_ApplicationVariables::set('sync_timestamp', time());
return $aReturn;
//.........这里部分代码省略.........