本文整理汇总了PHP中SoapError类的典型用法代码示例。如果您正苦于以下问题:PHP SoapError类的具体用法?PHP SoapError怎么用?PHP SoapError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SoapError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notify
/**
* notify
* Soap implementation to notify the soap clients of a resource management error
* @param msg String message to possibly display
*/
public function notify($msg = '')
{
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
header('Content-Type: text/xml; charset="ISO-8859-1"');
$error = new SoapError();
$error->set_error('resource_management_error');
//Override the description
$error->description = $msg;
$this->soapServer->methodreturn = array('result' => $msg, 'error' => $error->get_soap_array());
$this->soapServer->serialize_return();
$this->soapServer->send_response();
sugar_cleanup(true);
}
示例2: serve
/**
* This method calls functions on the implementation class and returns the output or Fault object in case of error to client
*
* @return unknown
*/
function serve()
{
if (empty($_REQUEST['method']) || !method_exists($this->implementation, $_REQUEST['method'])) {
if (empty($_REQUEST['method'])) {
echo '<pre>';
Reflection::export(new ReflectionClass(get_class($this->implementation)));
} else {
$er = new SoapError();
$er->set_error('invalid_call');
$this->fault($er);
}
} else {
$method = $_REQUEST['method'];
return $this->implementation->{$method}();
}
// else
}
示例3: serve
/**
* This method calls functions on the implementation class and returns the output or Fault object in case of error to client
*
* @return unknown
*/
function serve()
{
$GLOBALS['log']->info('Begin: SugarRestSerialize->serve');
$data = !empty($_REQUEST['rest_data']) ? $_REQUEST['rest_data'] : '';
if (empty($_REQUEST['method']) || !method_exists($this->implementation, $_REQUEST['method'])) {
$er = new SoapError();
$er->set_error('invalid_call');
$this->fault($er);
} else {
$method = $_REQUEST['method'];
$data = unserialize(from_html($data));
if (!is_array($data)) {
$data = array($data);
}
$GLOBALS['log']->info('End: SugarRestSerialize->serve');
return call_user_func_array(array($this->implementation, $method), $data);
}
// else
}
示例4: serve
/**
* This method calls functions on the implementation class and returns the output or Fault object in case of error to client
*
* @return unknown
*/
function serve()
{
if (empty($_REQUEST['method']) || !method_exists($this->implementation, $_REQUEST['method'])) {
if (empty($_REQUEST['method'])) {
echo '<pre>';
$reflect = new ReflectionClass(get_class($this->implementation));
$restWSDL = $reflect->__toString();
$restWSDL = preg_replace('/@@.*/', "", $restWSDL);
echo $restWSDL;
} else {
$er = new SoapError();
$er->set_error('invalid_call');
$this->fault($er);
}
} else {
$method = $_REQUEST['method'];
return $this->implementation->{$method}();
}
// else
}
示例5: serve
/**
* This method calls functions on the implementation class and returns the output or Fault object in case of error to client
*
* @return unknown
*/
function serve()
{
$GLOBALS['log']->info('Begin: SugarRestJSON->serve');
$json_data = !empty($_REQUEST['rest_data']) ? $GLOBALS['RAW_REQUEST']['rest_data'] : '';
if (empty($_REQUEST['method']) || !method_exists($this->implementation, $_REQUEST['method'])) {
$er = new SoapError();
$er->set_error('invalid_call');
$this->fault($er);
} else {
$method = $_REQUEST['method'];
$json = getJSONObj();
$data = $json->decode($json_data);
if (!is_array($data)) {
$data = array($data);
}
$res = call_user_func_array(array($this->implementation, $method), $data);
$GLOBALS['log']->info('End: SugarRestJSON->serve');
return $res;
}
// else
}
示例6: handle_set_entries
function handle_set_entries($module_name, $name_value_lists, $select_fields = FALSE)
{
global $beanList, $beanFiles, $app_list_strings, $current_user;
$error = new SoapError();
$ret_values = array();
if (empty($beanList[$module_name])) {
$error->set_error('no_module');
return array('ids' => array(), 'error' => $error->get_soap_array());
}
if (!check_modules_access($current_user, $module_name, 'write')) {
$error->set_error('no_access');
return array('ids' => -1, 'error' => $error->get_soap_array());
}
$class_name = $beanList[$module_name];
require_once $beanFiles[$class_name];
$ids = array();
$count = 1;
$total = sizeof($name_value_lists);
foreach ($name_value_lists as $name_value_list) {
$seed = new $class_name();
$seed->update_vcal = false;
//See if we can retrieve the seed by a given id value
foreach ($name_value_list as $value) {
if ($value['name'] == 'id') {
$seed->retrieve($value['value']);
break;
}
}
$dataValues = array();
foreach ($name_value_list as $value) {
$val = $value['value'];
if ($seed->field_name_map[$value['name']]['type'] == 'enum' || $seed->field_name_map[$value['name']]['type'] == 'radioenum') {
$vardef = $seed->field_name_map[$value['name']];
if (isset($app_list_strings[$vardef['options']]) && !isset($app_list_strings[$vardef['options']][$val])) {
if (in_array($val, $app_list_strings[$vardef['options']])) {
$val = array_search($val, $app_list_strings[$vardef['options']]);
}
}
} else {
if ($seed->field_name_map[$value['name']]['type'] == 'multienum') {
$vardef = $seed->field_name_map[$value['name']];
if (isset($app_list_strings[$vardef['options']]) && !isset($app_list_strings[$vardef['options']][$value])) {
$items = explode(",", $val);
$parsedItems = array();
foreach ($items as $item) {
if (in_array($item, $app_list_strings[$vardef['options']])) {
$keyVal = array_search($item, $app_list_strings[$vardef['options']]);
array_push($parsedItems, $keyVal);
}
}
if (!empty($parsedItems)) {
$val = encodeMultienumValue($parsedItems);
}
}
}
}
//Apply the non-empty values now since this will be used for duplicate checks
//allow string or int of 0 to be updated if set.
if (!empty($val) || ($val === '0' || $val === 0)) {
$seed->{$value}['name'] = $val;
}
//Store all the values in dataValues Array to apply later
$dataValues[$value['name']] = $val;
}
if ($count == $total) {
$seed->update_vcal = false;
}
$count++;
//Add the account to a contact
if ($module_name == 'Contacts') {
$GLOBALS['log']->debug('Creating Contact Account');
add_create_account($seed);
$duplicate_id = check_for_duplicate_contacts($seed);
if ($duplicate_id == null) {
if ($seed->ACLAccess('Save') && ($seed->deleted != 1 || $seed->ACLAccess('Delete'))) {
//Now apply the values, since this is not a duplicate we can just pass false for the $firstSync argument
apply_values($seed, $dataValues, false);
$seed->save();
if ($seed->deleted == 1) {
$seed->mark_deleted($seed->id);
}
$ids[] = $seed->id;
}
} else {
//since we found a duplicate we should set the sync flag
if ($seed->ACLAccess('Save')) {
//Determine if this is a first time sync. We find out based on whether or not a contacts_users relationship exists
$seed->id = $duplicate_id;
$seed->load_relationship("user_sync");
$beans = $seed->user_sync->getBeans();
$first_sync = empty($beans);
//Now apply the values and indicate whether or not this is a first time sync
apply_values($seed, $dataValues, $first_sync);
$seed->contacts_users_id = $current_user->id;
$seed->save();
$ids[] = $duplicate_id;
//we have a conflict
}
}
} else {
//.........这里部分代码省略.........
示例7: error
/**
* This function sets the fault object on the NUSOAP
*
* @param SoapError $errorObject - This is an object of type SoapError
* @access public
*/
public function error($errorObject)
{
$GLOBALS['log']->info('Begin: NusoapSoap->error');
// report all failures as caused by client since we don't have the needed attribute
// in existing error definitions
$this->server->fault('SOAP-ENV:Client', $errorObject->getName(), '', array('code' => $errorObject->getFaultCode(), 'message' => $errorObject->getDescription()));
$GLOBALS['log']->info('End: NusoapSoap->error');
}
示例8: get_encoded_portal_zip_file
function get_encoded_portal_zip_file($session, $md5file, $last_sync, $is_md5_sync = 1)
{
// files might be big
global $sugar_config;
ini_set("memory_limit", "-1");
$md5 = "";
$data = "";
$error = new SoapError();
$the_error = "";
if (!validate_authenticated($session)) {
$the_error = "Invalid session";
}
require "install/data/disc_client.php";
$tempdir_parent = create_cache_directory("disc_client");
$temp_dir = tempnam($tempdir_parent, "sug");
sugar_mkdir($temp_dir, 0775);
$temp_file = tempnam($temp_dir, "sug");
write_encoded_file($md5file, $temp_dir, $temp_file);
$ignore = false;
//generate md5 files on server
require_once $temp_file;
$server_files = array();
// used later for removing unneeded local files
$zip_file = tempnam(tempdir_parent, $session);
$root_files = array();
$custom_files = array();
$file_list = array();
if (!$is_md5_sync) {
if (is_dir("portal")) {
$root_files = findAllTouchedFiles("portal", array(), $last_sync);
}
if (is_dir("custom/portal")) {
$custom_files = findAllTouchedFiles("custom/portal", array(), $last_sync);
}
$all_src_files = array_merge($root_files, $custom_files);
foreach ($all_src_files as $src_file) {
$ignore = false;
foreach ($disc_client_ignore as $ignore_pattern) {
if (preg_match("#" . $ignore_pattern . "#", $src_file)) {
$ignore = true;
}
}
if (!$ignore) {
//we have to strip off portal or custom/portal before the src file to look it up
$key = str_replace('custom/portal/', '', $src_file);
$key = str_replace('portal/', '', $key);
if ($client_file_list != null && isset($client_file_list[$key])) {
//we have found a file out of sync
$file_list[] = $src_file;
//since we have processed this element of the client
//list of files, remove it from the list
unset($client_file_list[$key]);
} else {
//this file does not exist on the client side
$file_list[] = $src_file;
}
}
}
} else {
if (is_dir("portal")) {
$root_files = findAllFiles("portal", array());
}
if (is_dir("custom/portal")) {
$custom_files = findAllFiles("custom/portal", array());
}
$all_src_files = array_merge($root_files, $custom_files);
foreach ($all_src_files as $src_file) {
$ignore = false;
foreach ($disc_client_ignore as $ignore_pattern) {
if (preg_match("#" . $ignore_pattern . "#", $src_file)) {
$ignore = true;
}
}
if (!$ignore) {
$value = md5_file($src_file);
//we have to strip off portal or custom/portal before the src file to look it up
$key = str_replace('custom/portal/', '', $src_file);
$key = str_replace('portal/', '', $key);
if ($client_file_list != null && isset($client_file_list[$key])) {
if ($value != $client_file_list[$key]) {
//we have found a file out of sync
$file_list[] = $src_file;
//since we have processed this element of the client
//list of files, remove it from the list
}
unset($client_file_list[$key]);
} else {
//this file does not exist on the client side
$file_list[] = $src_file;
}
}
}
}
zip_files_list($zip_file, $file_list, '|.*portal/|');
$contents = sugar_file_get_contents($zip_file);
// encode data
$data = base64_encode($contents);
unlink($zip_file);
return array('result' => $data, 'error' => $error->get_soap_array());
}
示例9: portal_set_newsletters
function portal_set_newsletters($session, $subscribe_ids, $unsubscribe_ids)
{
global $beanList, $beanFiles;
$error = new SoapError();
if (!portal_validate_authenticated($session)) {
$error->set_error('invalid_session');
return array('result_count' => -1, 'entry_list' => array(), 'error' => $error->get_soap_array());
}
require_once 'modules/Campaigns/utils.php';
$contact = new Contact();
$contact->retrieve($_SESSION['user_id']);
if (!empty($contact->id)) {
foreach ($subscribe_ids as $campaign_id) {
subscribe($campaign_id, null, $contact, true);
}
foreach ($unsubscribe_ids as $campaign_id) {
unsubscribe($campaign_id, $contact);
}
}
return $error->get_soap_array();
}
示例10: portal_get_entry_list_limited
function portal_get_entry_list_limited($session, $module_name, $where, $order_by, $select_fields, $row_offset, $limit)
{
global $beanList, $beanFiles, $portal_modules;
$error = new SoapError();
if (!portal_validate_authenticated($session)) {
$error->set_error('invalid_session');
return array('result_count' => -1, 'entry_list' => array(), 'error' => $error->get_soap_array());
}
if ($_SESSION['type'] == 'lead') {
$error->set_error('no_access');
return array('result_count' => -1, 'entry_list' => array(), 'error' => $error->get_soap_array());
}
if (empty($beanList[$module_name])) {
$error->set_error('no_module');
return array('result_count' => -1, 'entry_list' => array(), 'error' => $error->get_soap_array());
}
if ($module_name == 'Cases') {
if (!isset($_SESSION['viewable'][$module_name])) {
get_cases_in_contacts(get_contacts_in());
get_cases_in_accounts(get_accounts_in());
}
$sugar = new aCase();
$list = get_related_list(get_module_in($module_name), new aCase(), $where, $order_by, $row_offset, $limit);
} else {
if ($module_name == 'Contacts') {
$sugar = new Contact();
$list = get_related_list(get_module_in($module_name), new Contact(), $where, $order_by);
} else {
if ($module_name == 'Accounts') {
$sugar = new Account();
$list = get_related_list(get_module_in($module_name), new Account(), $where, $order_by);
} else {
if ($module_name == 'Bugs') {
if (!isset($_SESSION['viewable'][$module_name])) {
get_bugs_in_contacts(get_contacts_in());
get_bugs_in_accounts(get_accounts_in());
}
$list = get_related_list(get_module_in($module_name), new Bug(), $where, $order_by, $row_offset, $limit);
} else {
if ($module_name == 'KBDocuments') {
} else {
if ($module_name == 'FAQ') {
} else {
$error->set_error('no_module_support');
return array('result_count' => -1, 'entry_list' => array(), 'error' => $error->get_soap_array());
}
}
}
}
}
}
$output_list = array();
$field_list = array();
foreach ($list as $value) {
//$loga->fatal("Adding another account to the list");
$output_list[] = get_return_value($value, $module_name);
$_SESSION['viewable'][$module_name][$value->id] = $value->id;
if (empty($field_list)) {
$field_list = get_field_list($value);
}
}
$output_list = filter_return_list($output_list, $select_fields, $module_name);
$field_list = filter_field_list($field_list, $select_fields, $module_name);
return array('result_count' => sizeof($output_list), 'next_offset' => 0, 'field_list' => $field_list, 'entry_list' => $output_list, 'error' => $error->get_soap_array());
}
示例11: get_modified_relationships
/**
* get_modified_relationships
*
* Get a list of the relationship records that have a date_modified value set within a specified date range. This is used to
* help facilitate sync operations. The module_name should be "Users" and the related_module one of "Meetings", "Calls" and
* "Contacts".
*
* @param xsd:string $session String of the session id
* @param xsd:string $module_name String value of the primary module to retrieve relationship against
* @param xsd:string $related_module String value of the related module to retrieve records off of
* @param xsd:string $from_date String value in YYYY-MM-DD HH:MM:SS format of date_start range (required)
* @param xsd:string $to_date String value in YYYY-MM-DD HH:MM:SS format of ending date_start range (required)
* @param xsd:int $offset Integer value of the offset to begin returning records from
* @param xsd:int $max_results Integer value of the max_results to return; -99 for unlimited
* @param xsd:int $deleted Integer value indicating deleted column value search (defaults to 0). Set to 1 to find deleted records
* @param xsd:string $module_user_id String value of the user id (optional, but defaults to SOAP session user id anyway) The module_user_id value
* here ought to be the user id of the user initiating the SOAP session
* @param tns:select_fields $select_fields Array value of fields to select and return as name/value pairs
* @param xsd:string $relationship_name String value of the relationship name to search on
* @param xsd:string $deletion_date String value in YYYY-MM-DD HH:MM:SS format for filtering on deleted records whose date_modified falls within range
* this allows deleted records to be returned as well
*
* @return Array records that match search criteria
*/
function get_modified_relationships($session, $module_name, $related_module, $from_date, $to_date, $offset, $max_results, $deleted = 0, $module_user_id = '', $select_fields = array(), $relationship_name = '', $deletion_date = '')
{
global $beanList, $beanFiles, $current_user;
$error = new SoapError();
$output_list = array();
if (empty($from_date)) {
$error->set_error('invalid_call_error, missing from_date');
return array('result_count' => 0, 'next_offset' => 0, 'field_list' => $select_fields, 'entry_list' => array(), 'error' => $error->get_soap_array());
}
if (empty($to_date)) {
$error->set_error('invalid_call_error, missing to_date');
return array('result_count' => 0, 'next_offset' => 0, 'field_list' => $select_fields, 'entry_list' => array(), 'error' => $error->get_soap_array());
}
self::$helperObject = new SugarWebServiceUtilv4_1();
if (!self::$helperObject->checkSessionAndModuleAccess($session, 'invalid_session', $module_name, 'read', 'no_access', $error)) {
Log::info('End: SugarWebServiceImpl->get_modified_relationships');
return;
}
// if
if (empty($beanList[$module_name]) || empty($beanList[$related_module])) {
$error->set_error('no_module');
return array('result_count' => 0, 'next_offset' => 0, 'field_list' => $select_fields, 'entry_list' => array(), 'error' => $error->get_soap_array());
}
global $current_user;
if (!self::$helperObject->check_modules_access($current_user, $module_name, 'read') || !self::$helperObject->check_modules_access($current_user, $related_module, 'read')) {
$error->set_error('no_access');
return array('result_count' => 0, 'next_offset' => 0, 'field_list' => $select_fields, 'entry_list' => array(), 'error' => $error->get_soap_array());
}
if ($max_results > 0 || $max_results == '-99') {
global $sugar_config;
$sugar_config['list_max_entries_per_page'] = $max_results;
}
// Cast to integer
$deleted = (int) $deleted;
$query = "(m1.date_modified > " . db_convert("'" . $GLOBALS['db']->quote($from_date) . "'", 'datetime') . " AND m1.date_modified <= " . db_convert("'" . $GLOBALS['db']->quote($to_date) . "'", 'datetime') . " AND {0}.deleted = {$deleted})";
if (isset($deletion_date) && !empty($deletion_date)) {
$query .= " OR ({0}.date_modified > " . db_convert("'" . $GLOBALS['db']->quote($deletion_date) . "'", 'datetime') . " AND {0}.date_modified <= " . db_convert("'" . $GLOBALS['db']->quote($to_date) . "'", 'datetime') . " AND {0}.deleted = 1)";
}
if (!empty($current_user->id)) {
$query .= " AND m2.id = '" . $GLOBALS['db']->quote($current_user->id) . "'";
}
//if($related_module == 'Meetings' || $related_module == 'Calls' || $related_module = 'Contacts'){
$query = string_format($query, array('m1'));
//}
require_once 'soap/SoapRelationshipHelper.php';
$results = retrieve_modified_relationships($module_name, $related_module, $query, $deleted, $offset, $max_results, $select_fields, $relationship_name);
$list = $results['result'];
foreach ($list as $value) {
$output_list[] = self::$helperObject->array_get_return_value($value, $results['table_name']);
}
$next_offset = $offset + count($output_list);
return array('result_count' => count($output_list), 'next_offset' => $next_offset, 'entry_list' => $output_list, 'error' => $error->get_soap_array());
}
示例12: get_required_upgrades
function get_required_upgrades($soapclient, $session)
{
global $sugar_config, $sugar_version;
require_once 'vendor/nusoap//nusoap.php';
$errors = array();
$upgrade_history = new UpgradeHistory();
$upgrade_history->disable_row_level_security = true;
$installeds = $upgrade_history->getAllOrderBy('date_entered ASC');
$history = array();
require_once 'soap/SoapError.php';
$error = new SoapError();
foreach ($installeds as $installed) {
$history[] = array('id' => $installed->id, 'filename' => $installed->filename, 'md5' => $installed->md5sum, 'type' => $installed->type, 'status' => $installed->status, 'version' => $installed->version, 'date_entered' => $installed->date_entered, 'error' => $error->get_soap_array());
}
$result = $soapclient->call('get_required_upgrades', array('session' => $session, 'client_upgrade_history' => $history, 'client_version' => $sugar_version));
$tempdir_parent = create_cache_directory("disc_client");
$temp_dir = tempnam($tempdir_parent, "sug");
sugar_mkdir($temp_dir, 0775);
$upgrade_installed = false;
if (empty($soapclient->error_str) && $result['error']['number'] == 0) {
foreach ($result['upgrade_history_list'] as $upgrade) {
$file_result = $soapclient->call('get_encoded_file', array('session' => $session, 'filename' => $upgrade['filename']));
if (empty($soapclient->error_str) && $result['error']['number'] == 0) {
if ($file_result['md5'] == $upgrade['md5']) {
$newfile = write_encoded_file($file_result, $temp_dir);
unzip($newfile, $temp_dir);
global $unzip_dir;
$unzip_dir = $temp_dir;
if (file_exists("{$temp_dir}/manifest.php")) {
require_once "{$temp_dir}/manifest.php";
global $manifest_arr;
$manifest_arr = $manifest;
if (!isset($manifest['offline_client_applicable']) || $manifest['offline_client_applicable'] == true || $manifest['offline_client_applicable'] == 'true') {
if (file_exists("{$temp_dir}/scripts/pre_install.php")) {
require_once "{$temp_dir}/scripts/pre_install.php";
pre_install();
}
if (isset($manifest['copy_files']['from_dir']) && $manifest['copy_files']['from_dir'] != "") {
$zip_from_dir = $manifest['copy_files']['from_dir'];
}
$source = "{$temp_dir}/{$zip_from_dir}";
$dest = getcwd();
copy_recursive($source, $dest);
if (file_exists("{$temp_dir}/scripts/post_install.php")) {
require_once "{$temp_dir}/scripts/post_install.php";
post_install();
}
//save newly installed upgrade
$new_upgrade = new UpgradeHistory();
$new_upgrade->filename = $upgrade['filename'];
$new_upgrade->md5sum = $upgrade['md5'];
$new_upgrade->type = $upgrade['type'];
$new_upgrade->version = $upgrade['version'];
$new_upgrade->status = "installed";
$new_upgrade->save();
$upgrade_installed = true;
}
}
}
}
}
}
return $upgrade_installed;
}
示例13: login
/**
* Log the user into the application
*
* @param UserAuth array $user_auth -- Set user_name and password (password needs to be
* in the right encoding for the type of authentication the user is setup for. For Base
* sugar validation, password is the MD5 sum of the plain text password.
* @param String $application -- The name of the application you are logging in from. (Currently unused).
* @param array $name_value_list -- Array of name value pair of extra parameters. As of today only 'language' and 'notifyonsave' is supported
* @return Array - id - String id is the session_id of the session that was created.
* - module_name - String - module name of user
* - name_value_list - Array - The name value pair of user_id, user_name, user_language, user_currency_id, user_currency_name,
* - user_default_team_id, user_is_admin, user_default_dateformat, user_default_timeformat
* @exception 'SoapFault' -- The SOAP error, if any
*/
public function login($user_auth, $application, $name_value_list = array())
{
$GLOBALS['log']->info('Begin: SugarWebServiceImpl->login');
global $sugar_config;
$error = new SoapError();
$user = BeanFactory::getBean('Users');
$success = false;
$authController = AuthenticationController::getInstance();
if (!empty($user_auth['encryption']) && $user_auth['encryption'] === 'PLAIN' && $authController->authController->userAuthenticateClass != "LDAPAuthenticateUser") {
$user_auth['password'] = md5($user_auth['password']);
}
$isLoginSuccess = $authController->login($user_auth['user_name'], $user_auth['password'], array('passwordEncrypted' => true));
$usr_id = $user->retrieve_user_id($user_auth['user_name']);
if ($usr_id) {
$user->retrieve($usr_id);
}
if ($isLoginSuccess) {
if ($_SESSION['hasExpiredPassword'] == '1') {
$error->set_error('password_expired');
$GLOBALS['log']->fatal('password expired for user ' . $user_auth['user_name']);
LogicHook::initialize();
$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
self::$helperObject->setFaultObject($error);
return;
}
if (!empty($user) && !empty($user->id) && !$user->is_group) {
$success = true;
global $current_user;
$current_user = $user;
}
} else {
if ($usr_id && isset($user->user_name) && $user->getPreference('lockout') == '1') {
$error->set_error('lockout_reached');
$GLOBALS['log']->fatal('Lockout reached for user ' . $user_auth['user_name']);
LogicHook::initialize();
$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
self::$helperObject->setFaultObject($error);
return;
} else {
if ($authController->authController->userAuthenticateClass == "LDAPAuthenticateUser" && (empty($user_auth['encryption']) || $user_auth['encryption'] !== 'PLAIN')) {
$error->set_error('ldap_error');
LogicHook::initialize();
$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
self::$helperObject->setFaultObject($error);
return;
} else {
if (function_exists('mcrypt_cbc')) {
$password = self::$helperObject->decrypt_string($user_auth['password']);
if ($authController->login($user_auth['user_name'], $password) && isset($_SESSION['authenticated_user_id'])) {
$success = true;
}
}
}
}
}
if ($success) {
session_start();
global $current_user;
//$current_user = $user;
self::$helperObject->login_success($name_value_list);
$current_user->loadPreferences();
$_SESSION['is_valid_session'] = true;
$_SESSION['ip_address'] = query_client_ip();
$_SESSION['user_id'] = $current_user->id;
$_SESSION['type'] = 'user';
$_SESSION['avail_modules'] = self::$helperObject->get_user_module_list($current_user);
$_SESSION['authenticated_user_id'] = $current_user->id;
$_SESSION['unique_key'] = $sugar_config['unique_key'];
$current_user->call_custom_logic('after_login');
$GLOBALS['log']->info('End: SugarWebServiceImpl->login - succesful login');
$nameValueArray = array();
global $current_language;
$nameValueArray['user_id'] = self::$helperObject->get_name_value('user_id', $current_user->id);
$nameValueArray['user_name'] = self::$helperObject->get_name_value('user_name', $current_user->user_name);
$nameValueArray['user_language'] = self::$helperObject->get_name_value('user_language', $current_language);
$cur_id = $current_user->getPreference('currency');
$nameValueArray['user_currency_id'] = self::$helperObject->get_name_value('user_currency_id', $cur_id);
$nameValueArray['user_is_admin'] = self::$helperObject->get_name_value('user_is_admin', is_admin($current_user));
$nameValueArray['user_default_team_id'] = self::$helperObject->get_name_value('user_default_team_id', $current_user->default_team);
$nameValueArray['user_default_dateformat'] = self::$helperObject->get_name_value('user_default_dateformat', $current_user->getPreference('datef'));
$nameValueArray['user_default_timeformat'] = self::$helperObject->get_name_value('user_default_timeformat', $current_user->getPreference('timef'));
$num_grp_sep = $current_user->getPreference('num_grp_sep');
$dec_sep = $current_user->getPreference('dec_sep');
$nameValueArray['user_number_seperator'] = self::$helperObject->get_name_value('user_number_seperator', empty($num_grp_sep) ? $sugar_config['default_number_grouping_seperator'] : $num_grp_sep);
$nameValueArray['user_decimal_seperator'] = self::$helperObject->get_name_value('user_decimal_seperator', empty($dec_sep) ? $sugar_config['default_decimal_seperator'] : $dec_sep);
$nameValueArray['mobile_max_list_entries'] = self::$helperObject->get_name_value('mobile_max_list_entries', $sugar_config['wl_list_max_entries_per_page']);
//.........这里部分代码省略.........
示例14: handle_set_entries
function handle_set_entries($module_name, $name_value_lists, $select_fields = FALSE)
{
global $beanList, $beanFiles;
$error = new SoapError();
$ret_values = array();
if (empty($beanList[$module_name])) {
$error->set_error('no_module');
return array('ids' => array(), 'error' => $error->get_soap_array());
}
global $current_user;
if (!check_modules_access($current_user, $module_name, 'write')) {
$error->set_error('no_access');
return array('ids' => -1, 'error' => $error->get_soap_array());
}
$class_name = $beanList[$module_name];
require_once $beanFiles[$class_name];
$ids = array();
$count = 1;
$total = sizeof($name_value_lists);
foreach ($name_value_lists as $name_value_list) {
$seed = new $class_name();
$seed->update_vcal = false;
foreach ($name_value_list as $value) {
if ($value['name'] == 'id') {
$seed->retrieve($value['value']);
break;
}
}
foreach ($name_value_list as $value) {
$val = $value['value'];
if ($seed->field_name_map[$value['name']]['type'] == 'enum') {
$vardef = $seed->field_name_map[$value['name']];
if (isset($app_list_strings[$vardef['options']]) && !isset($app_list_strings[$vardef['options']][$value])) {
if (in_array($val, $app_list_strings[$vardef['options']])) {
$val = array_search($val, $app_list_strings[$vardef['options']]);
}
}
}
$seed->{$value}['name'] = $val;
}
if ($count == $total) {
$seed->update_vcal = false;
}
$count++;
//Add the account to a contact
if ($module_name == 'Contacts') {
$GLOBALS['log']->debug('Creating Contact Account');
add_create_account($seed);
$duplicate_id = check_for_duplicate_contacts($seed);
if ($duplicate_id == null) {
if ($seed->ACLAccess('Save') && ($seed->deleted != 1 || $seed->ACLAccess('Delete'))) {
$seed->save();
if ($seed->deleted == 1) {
$seed->mark_deleted($seed->id);
}
$ids[] = $seed->id;
}
} else {
//since we found a duplicate we should set the sync flag
if ($seed->ACLAccess('Save')) {
$seed->id = $duplicate_id;
$seed->contacts_users_id = $current_user->id;
$seed->save();
$ids[] = $duplicate_id;
//we have a conflict
}
}
} else {
if ($module_name == 'Meetings' || $module_name == 'Calls') {
//we are going to check if we have a meeting in the system
//with the same outlook_id. If we do find one then we will grab that
//id and save it
if ($seed->ACLAccess('Save') && ($seed->deleted != 1 || $seed->ACLAccess('Delete'))) {
if (empty($seed->id) && !isset($seed->id)) {
if (!empty($seed->outlook_id) && isset($seed->outlook_id)) {
//at this point we have an object that does not have
//the id set, but does have the outlook_id set
//so we need to query the db to find if we already
//have an object with this outlook_id, if we do
//then we can set the id, otherwise this is a new object
$order_by = "";
$query = $seed->table_name . ".outlook_id = '" . $seed->outlook_id . "'";
$response = $seed->get_list($order_by, $query, 0, -1, -1, 0);
$list = $response['list'];
if (count($list) > 0) {
foreach ($list as $value) {
$seed->id = $value->id;
break;
}
}
//fi
}
//fi
}
//fi
$seed->save();
$ids[] = $seed->id;
}
//fi
} else {
//.........这里部分代码省略.........
示例15: retrieve_relationship_query
function retrieve_relationship_query($module_name, $related_module, $relationship_query, $show_deleted, $offset, $max_results)
{
global $beanList, $beanFiles, $dictionary, $current_user;
$error = new SoapError();
$result_list = array();
if (empty($beanList[$module_name]) || empty($beanList[$related_module])) {
$error->set_error('no_module');
return array('query' => "", 'module_1' => "", 'join_table' => "", 'error' => $error->get_soap_array());
}
$row = retrieve_relationships_properties($module_name, $related_module);
if (empty($row)) {
$error->set_error('no_relationship_support');
return array('query' => "", 'module_1' => "", 'join_table' => "", 'error' => $error->get_soap_array());
}
$module_1 = $row['lhs_module'];
$mod_key = $row['join_key_lhs'];
$module_2 = $row['rhs_module'];
$mod2_key = $row['join_key_rhs'];
$table = $row['join_table'];
if (empty($table)) {
return array('query' => "", 'module_1' => "", 'join_table' => "", 'error' => $error->get_soap_array());
}
$mod = BeanFactory::getBean($module_1);
$mod2 = BeanFactory::getBean($module_2);
$query = "SELECT rt.* FROM {$table} rt ";
$query .= " inner join {$mod->table_name} m1 on rt.{$mod_key} = m1.id ";
$query .= " inner join {$mod2->table_name} m2 on rt.{$mod2_key} = m2.id ";
//rrs bug: 29890 - if record on Offline Client is assigned to a team the user does not have access to
//then it will not sync to server, but the relationship will. We will assume the user would like to ignore team
//level security; however, I have added it as an variable "DISABLE_ROW_LEVEL_SECURITY" to this file (see above) so that it can be changed
//by the server and synced down.
if (defined('DISABLE_ROW_LEVEL_SECURITY')) {
$mod->disable_row_level_security = DISABLE_ROW_LEVEL_SECURITY;
$mod2->disable_row_level_security = DISABLE_ROW_LEVEL_SECURITY;
}
if (!$mod->disable_row_level_security) {
if (!empty($mod->field_defs['team_id'])) {
$query .= " INNER JOIN (select tst.team_set_id from team_sets_teams tst ";
$query .= " INNER JOIN team_memberships tm1 ON tst.team_id = tm1.team_id\n\t\t\t\t\t AND tm1.user_id = '{$current_user->id}'\n\t\t\t\t\t\t AND tm1.deleted=0 group by tst.team_set_id) m1_tf on m1_tf.team_set_id = m1.team_set_id ";
}
}
if (!$mod2->disable_row_level_security) {
if (!empty($mod2->field_defs['team_id'])) {
$query .= " INNER JOIN (select tst.team_set_id from team_sets_teams tst ";
$query .= " INNER JOIN team_memberships tm2 ON tst.team_id = tm2.team_id\n\t\t\t\t\t AND tm2.user_id = '{$current_user->id}'\n\t\t\t\t\t\t AND tm2.deleted=0 group by tst.team_set_id) m2_tf on m2_tf.team_set_id = m2.team_set_id ";
}
}
if (!empty($relationship_query)) {
$query .= ' WHERE ' . $relationship_query;
}
return array('query' => $query, 'module_1' => $module_1, 'join_table' => $table, 'error' => $error->get_soap_array());
}