本文整理汇总了PHP中OA::disableErrorHandling方法的典型用法代码示例。如果您正苦于以下问题:PHP OA::disableErrorHandling方法的具体用法?PHP OA::disableErrorHandling怎么用?PHP OA::disableErrorHandling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA
的用法示例。
在下文中一共展示了OA::disableErrorHandling方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAllMaintenanceStatisticsTables
/**
* Tests creating/dropping all of the MPE temporary tables.
*
* Requirements:
* Test 1: Test that all MPE temporary tables can be created and dropped.
*/
function testAllMaintenanceStatisticsTables()
{
$tmpTables = array('tmp_ad_impression', 'tmp_ad_click', 'tmp_tracker_impression_ad_impression_connection', 'tmp_tracker_impression_ad_click_connection', 'tmp_ad_connection');
// Test 1
$conf =& $GLOBALS['_MAX']['CONF'];
$conf['table']['prefix'] = '';
$oDbh =& OA_DB::singleton();
foreach ($tmpTables as $tableName) {
$query = "SELECT * FROM {$tableName}";
OA::disableErrorHandling();
$result = $oDbh->query($query);
OA::enableErrorHandling();
$this->assertEqual(strtolower(get_class($result)), 'mdb2_error');
}
$oTable =& OA_DB_Table_Statistics::singleton();
foreach ($tmpTables as $tableName) {
$oTable->createTable($tableName);
}
$aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
foreach ($tmpTables as $tableName) {
// Test that the table has been created
$query = "SELECT * FROM {$tableName}";
$result = $oDbh->query($query);
$this->assertTrue($result);
// Test that the table can be dropped
// Use a different query to overcome MDB2 query buffering
$query = "SELECT foo FROM {$tableName}";
OA::disableErrorHandling();
$result = $oDbh->query($query);
OA::enableErrorHandling();
$this->assertEqual(strtolower(get_class($result)), 'mdb2_error');
}
// Restore the testing environment
TestEnv::restoreEnv();
}
示例2: display
/**
* A method to launch and display the widget
*
* @param array $aParams The parameters array, usually $_REQUEST
*/
function display()
{
if (!$this->oTpl->is_cached()) {
OA::disableErrorHandling();
$oRss = new XML_RSS($this->url);
$result = $oRss->parse();
OA::enableErrorHandling();
// ignore bad character error which could appear if rss is using invalid characters
if (PEAR::isError($result)) {
if (!strstr($result->getMessage(), 'Invalid character')) {
PEAR::raiseError($result);
// rethrow
$this->oTpl->caching = false;
}
}
$aPost = array_slice($oRss->getItems(), 0, $this->posts);
foreach ($aPost as $key => $aValue) {
$aPost[$key]['origTitle'] = $aValue['title'];
if (strlen($aValue['title']) > 38) {
$aPost[$key]['title'] = substr($aValue['title'], 0, 38) . '...';
}
}
$this->oTpl->assign('title', $this->title);
$this->oTpl->assign('feed', $aPost);
$this->oTpl->assign('siteTitle', $this->siteTitle);
$this->oTpl->assign('siteUrl', $this->siteUrl);
}
$this->oTpl->display();
}
示例3: execute
function execute($aParams)
{
$this->oUpgrade =& $aParams[0];
$this->oDbh =& OA_DB::singleton();
$prefix = $GLOBALS['_MAX']['CONF']['table']['prefix'];
if ($this->oDbh->dbsyntax == 'pgsql') {
$oTable =& $this->oUpgrade->oDBUpgrader->oTable;
foreach ($oTable->aDefinition['tables'] as $tableName => $aTable) {
foreach ($aTable['fields'] as $fieldName => $aField) {
if (!empty($aField['autoincrement'])) {
// Check actual sequence name
$oldSequenceName = $this->getLinkedSequence($prefix . $tableName, $fieldName);
if ($oldSequenceName) {
$newSequenceName = OA_DB::getSequenceName($this->oDbh, $tableName, $fieldName);
if ($oldSequenceName != $newSequenceName) {
$this->logOnly("Non standard sequence name found: " . $oldSequenceName);
$qTable = $this->oDbh->quoteIdentifier($prefix . $tableName, true);
$qField = $this->oDbh->quoteIdentifier($fieldName, true);
$qOldSequence = $this->oDbh->quoteIdentifier($oldSequenceName, true);
$qNewSequence = $this->oDbh->quoteIdentifier($newSequenceName, true);
OA::disableErrorHandling();
$result = $this->oDbh->exec("ALTER TABLE {$qOldSequence} RENAME TO {$qNewSequence}");
if (PEAR::isError($result)) {
if ($result->getCode() == MDB2_ERROR_ALREADY_EXISTS) {
$result = $this->oDbh->exec("DROP SEQUENCE {$qNewSequence}");
if (PEAR::isError($result)) {
$this->logError("Could not drop existing sequence {$newSequenceName}: " . $result->getUserInfo());
return false;
}
$result = $this->oDbh->exec("ALTER TABLE {$qOldSequence} RENAME TO {$qNewSequence}");
}
}
if (PEAR::isError($result)) {
$this->logError("Could not rename {$oldSequenceName} to {$newSequenceName}: " . $result->getUserInfo());
return false;
}
$result = $this->oDbh->exec("ALTER TABLE {$qTable} ALTER {$qField} SET DEFAULT nextval(" . $this->oDbh->quote($qNewSequence) . ")");
if (PEAR::isError($result)) {
$this->logError("Could not set column default to sequence {$newSequenceName}: " . $result->getUserInfo());
return false;
}
OA::enableErrorHandling();
$result = $oTable->resetSequenceByData($tableName, $fieldName);
if (PEAR::isError($result)) {
$this->logError("Could not reset sequence value for {$newSequenceName}: " . $result->getUserInfo());
return false;
}
$this->logOnly("Successfully renamed {$oldSequenceName} to {$newSequenceName}");
}
} else {
$this->logOnly("No sequence found for {$tableName}.{$fieldName}");
}
}
}
}
}
return true;
}
示例4: testCheckOperationIntervalValue
/**
* A method to test the checkOperationIntervalValue() method.
*
*/
function testCheckOperationIntervalValue()
{
OA::disableErrorHandling();
for ($i = -1; $i <= 61; $i++) {
$result = OX_OperationInterval::checkOperationIntervalValue($i);
if ($i == 1 || $i == 2 || $i == 3 || $i == 4 || $i == 5 || $i == 6 || $i == 10 || $i == 12 || $i == 15 || $i == 20 || $i == 30 || $i == 60) {
$this->assertTrue($result);
} else {
$this->assertTrue(PEAR::isError($result));
}
$result = OX_OperationInterval::checkOperationIntervalValue(120);
$this->assertTrue(PEAR::isError($result));
}
OA::enableErrorHandling();
}
示例5: resetSequence
/**
* Resets a (postgresql) sequence to 1
* similar to OA_DB_Table::resetSequence()
* DOESN'T SEEM TO WORK THO
*
* @param string $sequence the name of the sequence to reset
* @return boolean true on success, false otherwise
*/
function resetSequence($tableName)
{
$aConf = $GLOBALS['_MAX']['CONF'];
$oDbh = OA_DB::singleton();
if ($aConf['database']['type'] == 'pgsql') {
OA_DB::setCaseSensitive();
$aSequences = $oDbh->manager->listSequences();
OA_DB::disableCaseSensitive();
if (is_array($aSequences)) {
OA::debug('Resetting sequence ' . $sequence, PEAR_LOG_DEBUG);
OA::disableErrorHandling(null);
$tableName = substr($aConf['table']['prefix'] . $tableName, 0, 29) . '_';
foreach ($aSequences as $k => $sequence) {
if (strpos($sequence, $tableName) === 0) {
$sequence = $oDbh->quoteIdentifier($sequence . '_seq', true);
$result = $oDbh->exec("SELECT setval('{$sequence}', 1, false)");
break;
}
}
OA::enableErrorHandling();
if (PEAR::isError($result)) {
OA::debug('Unable to reset sequence on table ' . $tableName, PEAR_LOG_ERR);
return false;
}
}
} else {
if ($aConf['database']['type'] == 'mysql') {
$tableName = $aConf['table']['prefix'] . $tableName;
OA::disableErrorHandling();
$result = $oDbh->exec("ALTER TABLE {$tableName} AUTO_INCREMENT = 1");
OA::enableErrorHandling();
if (PEAR::isError($result)) {
OA::debug('Unable to reset sequence on table ' . $tableName, PEAR_LOG_ERR);
return false;
}
}
}
return true;
}
示例6: putSyncSettings
/**
* 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;
}
示例7: _execQuery
function _execQuery($query)
{
OA::disableErrorHandling();
$result = $this->oDbh->exec($query);
OA::enableErrorHandling();
if (PEAR::isError($result)) {
return false;
}
return $result;
}
示例8: setUp
function setUp()
{
OA::disableErrorHandling();
}
示例9: parseLogFile
function parseLogFile()
{
$oDbh =& OA_DB::singleton();
OA::disableErrorHandling();
$fpsql = fopen(MAX_PATH . "/var/sql.log", 'r');
if (!$fpsql) {
$aResult[]['error'] = 'unable to open file ' . MAX_PATH . "/var/sql.log";
$aResult[]['error'] = 'to create ' . MAX_PATH . '/var/sql.log, trigger logging by setting [debug] logSQL="select|update|insert|delete (as appropriate) in your conf file.';
$aResult[]['error'] = 'running the devel explain utility also creates mysqlsla.log which can be fed to mysqlsla for analysis: mysqlsla --user <dbuser> --host <dbhost> --port <dbport> --te --sort e --raw mysqlsla.log > mysqlsla.txt';
$aResult[]['error'] = 'running the devel explain utility also creates mysqlqp.log which can be fed to mysql-query-profiler for analysis: mysql-query-profiler --user <dbuser> --host <dbhost> --port <dbport> --database <dbname> mysqlqp.log > mysqlqp.txt
';
return $aResult;
}
while ($v = fgets($fpsql, 4096)) {
$aQueries[] = $v;
}
fclose($fpsql);
$aQueries = array_unique($aQueries);
if (count($aQueries) > 1) {
// write a log for use by mysqlsla
$fpsla = fopen(MAX_PATH . "/var/mysqlsla.log", 'w');
fwrite($fpsla, "USE {$oDbh->connected_database_name};\n");
// write a log for use by mysql-query-profiler
$fpmqp = fopen(MAX_PATH . "/var/mysqlqp.log", 'w');
foreach ($aQueries as $k => $v) {
if (substr_count($v, 'tmp_') == 0) {
$i = preg_match('/((\\[(?P<type>[\\w]+)\\])(?P<query>[\\w\\W\\s]+))/', $v, $aMatches);
if ($i) {
$type = $aMatches['type'];
$query = trim($aMatches['query']);
$aResult[$k]['query'] = $query;
if ($type == 'prepare' || strpos($query, 'PREPARE MDB2_STATEMENT') === 0) {
$aResult[$k]['error'] = 'cannot execute statement: ' . $query;
} else {
$result = $oDbh->getAssoc('EXPLAIN ' . $query);
if (!PEAR::isError($result)) {
$aResult[$k]['result'] = $result;
fwrite($fpsla, $query . "\n");
fwrite($fpmqp, $query . "\n\n");
} else {
//$aResult[$k]['error'] = $result->getUserInfo();
$aResult[$k]['error'] = 'failed to explain statement: ' . $query;
}
}
}
}
}
fclose($fpsla);
fclose($fpmqp);
$aConf = $GLOBALS['_MAX']['CONF']['database'];
$cmd = "sudo /usr/local/sbin/mysqlsla --user {$aConf['username']} --host {$aConf['host']} --port {$aConf['port']} --time-each-query --sort e --top 50 --flush-qc --avg 10 --raw mysqlsla.log > mysqlsla.txt";
$fpsla = fopen(MAX_PATH . "/var/mysqlslarun", 'w');
fwrite($fpsla, $cmd);
fclose($fpsla);
$cmd = "mysql-query-profiler --user {$aConf['username']} --host {$aConf['host']} --port {$aConf['port']} --database {$aConf['name']} mysqlqp.log > mysqlqp.txt";
$fpmqp = fopen(MAX_PATH . "/var/mysqlqprun", 'w');
fwrite($fpmqp, $cmd);
fclose($fpmqp);
}
OA::enableErrorHandling();
return $aResult;
}
示例10: testValidateTableName
/**
* Method to test function validateDatabaseName in MDB2 Manager modules
*/
function testValidateTableName()
{
$aConf = $GLOBALS['_MAX']['CONF'];
OA::disableErrorHandling();
$vals = array(0, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 58, 59, 60, 61, 62, 63, 64, 91, 92, 93, 94, 96, 123, 124, 125, 126, 156, 255);
//$pattern = '';
foreach ($vals as $i) {
//$pattern.= '\\x'.dechex($i);
$result = OA_DB::validateTableName('o' . chr($i) . '_table');
$this->assertTrue(PEAR::isError($result), 'chr(' . $i . ') /' . dechex($i));
}
if ($aConf['database']['type'] == 'mysql') {
$result = OA_DB::validateTableName('abcdefghij1234567890123456789012345678901234567890123456789012345');
//65 chars
$this->assertTrue(PEAR::isError($result));
$this->assertTrue(OA_DB::validateTableName('abcdefghij123456789012345678901234567890123456789012345678901234'));
//64 chars
$this->assertTrue(OA_DB::validateTableName('aBcDeFgHiJkLmNoPqRsTuVwXyZ_$1234567890'));
$result = OA_DB::validateTableName('2_$');
$this->assertFalse(PEAR::isError($result));
$result = OA_DB::validateTableName('$_2');
$this->assertFalse(PEAR::isError($result));
$result = OA_DB::validateTableName('_$2');
$this->assertFalse(PEAR::isError($result));
}
if ($aConf['database']['type'] == 'pgsql') {
$result = OA_DB::validateTableName('abcdefghij123456789012345678901234567890123456789012345678901234');
//64 chars
$this->assertTrue(PEAR::isError($result));
$this->assertTrue(OA_DB::validateTableName('abcdefghij12345678901234567890123456789012345678901234567890123'));
//63 chars
$result = OA_DB::validateTableName('0x_table');
$this->assertTrue(PEAR::isError($result));
$result = OA_DB::validateTableName(' x_table');
$this->assertTrue(PEAR::isError($result));
$this->assertTrue(OA_DB::validateTableName('aBcDeFgHiJkLmNoPqRsTuVwXyZ_$1234567890'));
$result = OA_DB::validateTableName('2_$');
$this->assertTrue(PEAR::isError($result));
$result = OA_DB::validateTableName('$_2');
$this->assertTrue(PEAR::isError($result));
$result = OA_DB::validateTableName('_$2');
$this->assertFalse(PEAR::isError($result));
}
OA::enableErrorHandling();
}
示例11: OA_Admin_UI_Model_PageHeaderModel
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/lib/OA/Dal/ApplicationVariables.php';
require_once MAX_PATH . '/lib/OA/Sync.php';
require_once MAX_PATH . '/lib/max/language/Loader.php';
Language_Loader::load('settings');
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN);
/*-------------------------------------------------------*/
/* HTML framework */
/*-------------------------------------------------------*/
$title = $GLOBALS['strPlatformHashRegenerate'];
$oHeaderModel = new OA_Admin_UI_Model_PageHeaderModel($title);
phpAds_PageHeader('account-settings-index', $oHeaderModel);
/*-------------------------------------------------------*/
/* Main code */
/*-------------------------------------------------------*/
$platformHash = OA_Dal_ApplicationVariables::generatePlatformHash();
if (OA_Dal_ApplicationVariables::set('platform_hash', $platformHash)) {
echo $GLOBALS['strNewPlatformHash'] . " " . $platformHash;
$oSync = new OA_Sync();
OA::disableErrorHandling();
$oSync->checkForUpdates();
OA::enableErrorHandling();
} else {
$this->oLogger->logError('Error inserting Platform Hash into database');
echo $GLOBALS['strPlatformHashInsertingError'];
}
/*-------------------------------------------------------*/
/* HTML framework */
/*-------------------------------------------------------*/
phpAds_PageFooter();
示例12: testDropTable
/**
* A method to test the drop table method.
*
* Requirements:
* Test 1: Test that a table can be dropped.
* Test 2: Test that a temporary table can be dropped.
* Test 3: Test that a tablename with uppercase prefix can be dropped.
* Test 4: Test that a tablename with a mixed prefix can be dropped.
*/
function testDropTable()
{
// Test 1
$conf =& $GLOBALS['_MAX']['CONF'];
$prefix = $conf['table']['prefix'];
$oDbh =& OA_DB::singleton();
$table = $oDbh->quoteIdentifier($prefix . 'foo', true);
$oTable = new OA_DB_Table();
$query = "CREATE TABLE {$table} ( a INTEGER )";
$oDbh->query($query);
$aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
$this->assertEqual($aExistingTables[0], $prefix . 'foo');
$this->assertTrue($oTable->dropTable($prefix . 'foo'));
$aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
$this->assertEqual(count($aExistingTables), 0, $prefix . 'foo');
//TestEnv::restoreEnv();
// Test 2
$conf =& $GLOBALS['_MAX']['CONF'];
$oDbh =& OA_DB::singleton();
$oTable = new OA_DB_Table();
$table = $oDbh->quoteIdentifier($prefix . 'foo', true);
$query = "CREATE TEMPORARY TABLE {$table} ( a INTEGER )";
$oDbh->query($query);
// Test table exists with an insert
$query = "INSERT INTO {$table} (a) VALUES (37)";
$result = $oDbh->query($query);
$this->assertTrue($result);
$this->assertTrue($oTable->dropTable($prefix . 'foo'));
// Test table does not exist with an insert
$query = "INSERT INTO {$table} (a) VALUES (37)";
OA::disableErrorHandling();
$result = $oDbh->query($query);
OA::enableErrorHandling();
$this->assertEqual(strtolower(get_class($result)), 'mdb2_error');
//TestEnv::restoreEnv();
// Test 3
$conf =& $GLOBALS['_MAX']['CONF'];
$conf['table']['prefix'] = 'OA_';
$prefix = $conf['table']['prefix'];
$oDbh =& OA_DB::singleton();
$table = $oDbh->quoteIdentifier($prefix . 'foo', true);
$query = "CREATE TABLE {$table} ( a INTEGER )";
$oDbh->query($query);
$aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
$this->assertEqual($aExistingTables[0], 'OA_foo');
$this->assertTrue($oTable->dropTable('OA_foo'));
$aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
$this->assertEqual(count($aExistingTables), 0, 'Table OA_foo');
//TestEnv::restoreEnv();
// Test 4
$conf =& $GLOBALS['_MAX']['CONF'];
$conf['table']['prefix'] = 'oA_';
$prefix = $conf['table']['prefix'];
$oDbh =& OA_DB::singleton();
$table = $oDbh->quoteIdentifier($prefix . 'foo', true);
$oTable = new OA_DB_Table();
$query = "CREATE TABLE {$table} ( a INTEGER )";
$oDbh->query($query);
$aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
$this->assertEqual($aExistingTables[0], 'oA_foo');
$this->assertTrue($oTable->dropTable('oA_foo'));
$aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
$this->assertEqual(count($aExistingTables), 0, 'Table oA_foo');
//TestEnv::restoreEnv();
}
示例13: resetSequence
/**
* Resets a (postgresql) sequence to a value
*
* Note: the value parameter is ignored on MySQL. Autoincrements will always be resetted
* to 1 or the highest value already present in the table.
*
* @param string $sequence the name of the sequence to reset
* @param int $value the sequence value for the next entry
* @return boolean true on success, false otherwise
*/
function resetSequence($sequence, $value = 1)
{
$aConf = $GLOBALS['_MAX']['CONF'];
OA::debug('Resetting sequence ' . $sequence, PEAR_LOG_DEBUG);
OA::disableErrorHandling(null);
if ($aConf['database']['type'] == 'pgsql') {
if ($value < 1) {
$value = 1;
} else {
$value = (int) $value;
}
$sequence = $this->oDbh->quoteIdentifier($sequence, true);
$result = $this->oDbh->exec("SELECT setval('{$sequence}', {$value}, false)");
OA::enableErrorHandling();
if (PEAR::isError($result)) {
OA::debug('Unable to reset sequence ' . $sequence, PEAR_LOG_ERR);
return false;
}
} else {
if ($aConf['database']['type'] == 'mysql') {
$result = $this->oDbh->exec("ALTER TABLE {$GLOBALS['_MAX']['CONF']['table']['prefix']}{$sequence} AUTO_INCREMENT = 1");
OA::enableErrorHandling();
if (PEAR::isError($result)) {
OA::debug('Unable to reset auto increment on table ' . $sequence, PEAR_LOG_ERR);
return false;
}
}
}
return true;
}
示例14: 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;
}
示例15: generateTags
function generateTags($zoneId, $codeType, $aParams = null)
{
// Backwards Compatibity Array for code types
$aBackwardsCompatibityTypes = array('adframe' => 'invocationTags:oxInvocationTags:adframe', 'adjs' => 'invocationTags:oxInvocationTags:adjs', 'adlayer' => 'invocationTags:oxInvocationTags:adlayer', 'adview' => 'invocationTags:oxInvocationTags:adview', 'adviewnocookies' => 'invocationTags:oxInvocationTags:adviewnocookies', 'local' => 'invocationTags:oxInvocationTags:local', 'popup' => 'invocationTags:oxInvocationTags:popup', 'xmlrpc' => 'invocationTags:oxInvocationTags:xmlrpc');
// Translate old code type to new Component Identifier
if (array_key_exists($codeType, $aBackwardsCompatibityTypes)) {
$codeType = $aBackwardsCompatibityTypes[$codeType];
}
if ($this->checkIdExistence('zones', $zoneId)) {
$doZones = OA_Dal::staticGetDO('zones', $zoneId);
if (!$this->checkPermissions(null, 'affiliates', $doZones->affiliateid, OA_PERM_ZONE_INVOCATION)) {
return false;
}
$aAllowedTags = $this->getAllowedTags();
if (!in_array($codeType, $aAllowedTags)) {
$this->raiseError('Field \'codeType\' must be one of the enum: ' . join(', ', $aAllowedTags));
return false;
}
if (!empty($codeType)) {
require_once MAX_PATH . '/lib/max/Admin/Invocation.php';
$maxInvocation = new MAX_Admin_Invocation();
// factory plugin for this $codetype
OA::disableErrorHandling();
$invocationTag = OX_Component::factoryByComponentIdentifier($codeType);
OA::enableErrorHandling();
if ($invocationTag === false) {
$this->raiseError('Error while factory invocationTag plugin');
return false;
}
$invocationTag->setInvocation($maxInvocation);
$aParams['zoneid'] = $zoneId;
$aParams['codetype'] = $codeType;
$buffer = $maxInvocation->generateInvocationCode($invocationTag, $aParams);
return $buffer;
} else {
$this->raiseError('Parameter codeType wrong');
}
}
return false;
}