本文整理汇总了PHP中AError类的典型用法代码示例。如果您正苦于以下问题:PHP AError类的具体用法?PHP AError怎么用?PHP AError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_system_check
/**
* Main driver for running system check
* @since 1.2.4
* @param $registry
* @param $mode ('log', 'return')
* @return array
*
* Note: This is English text only. Can be call before database and languges are loaded
*/
function run_system_check($registry, $mode = 'log')
{
$mlog = $counts = array();
$mlog[] = check_install_directory($registry);
$mlog = array_merge($mlog, check_file_permissions($registry));
$mlog = array_merge($mlog, check_php_configuraion($registry));
$mlog = array_merge($mlog, check_server_configuration($registry));
$counts['error_count'] = $counts['warning_count'] = $counts['notice_count'] = 0;
foreach ($mlog as $message) {
if ($message['type'] == 'E') {
if ($mode == 'log') {
//only save errors to the log
$error = new AError($message['body']);
$error->toLog()->toDebug();
$registry->get('messages')->saveError($message['title'], $message['body']);
}
$counts['error_count']++;
} else {
if ($message['type'] == 'W') {
if ($mode == 'log') {
$registry->get('messages')->saveWarning($message['title'], $message['body']);
}
$counts['warning_count']++;
} else {
if ($message['type'] == 'N') {
if ($mode == 'log') {
$registry->get('messages')->saveNotice($message['title'], $message['body']);
}
$counts['notice_count']++;
}
}
}
}
return array($mlog, $counts);
}
示例2: save
public function save()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$output = array();
$this->loadLanguage('tool/rl_manager');
$this->document->setTitle($this->language->get('heading_title'));
if ($this->request->is_POST() && $this->_validateRLTypeForm($this->request->post)) {
$post_data = $this->request->post;
$rm = new AResourceManager();
if ($rm->updateResourceType($post_data)) {
$output['result_text'] = $this->language->get('text_success');
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($output));
} else {
$error = new AError('');
$err_data = array('error_text' => 'Unable to save resource type');
return $error->toJSONResponse('VALIDATION_ERROR_406', $err_data);
}
} else {
$error = new AError('');
$err_data = array('error_text' => $this->error);
return $error->toJSONResponse('VALIDATION_ERROR_406', $err_data);
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例3: update
public function update()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify('listing_grid/location_zones')) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/location_zones'), 'reset_value' => true));
}
$this->loadModel('localisation/zone');
$this->loadLanguage('localisation/zone');
switch ($this->request->post['oper']) {
case 'del':
$this->loadModel('localisation/location');
$ids = explode(',', $this->request->post['id']);
if (!empty($ids)) {
foreach ($ids as $id) {
$this->model_localisation_location->deleteLocationZone($id);
}
}
break;
default:
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例4: update_field
/**
* update only one field
*
* @return void
*/
public function update_field()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify('listing_grid/store')) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/store'), 'reset_value' => true));
}
$this->loadLanguage('setting/store');
$this->loadModel('setting/store');
if (isset($this->request->get['id'])) {
//request sent from edit form. ID in url
foreach ($this->request->post as $key => $value) {
$err = $this->_validateField($key, $value);
if (!empty($err)) {
$dd = new ADispatcher('responses/error/ajaxerror/validation', array('error_text' => $err));
return $dd->dispatch();
}
$data = array($key => $value);
$this->model_setting_store->editStore($this->request->get['id'], $data);
}
return;
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例5: update
public function update()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify($this->rt)) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), $this->rt), 'reset_value' => true));
}
$this->loadModel('localisation/language_definitions');
$this->loadLanguage('localisation/language_definitions');
$this->view->assign('success', $this->session->data['success']);
if (isset($this->session->data['success'])) {
unset($this->session->data['success']);
}
$this->document->setTitle($this->language->get('heading_title'));
if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->_validateForm()) {
foreach ($this->request->post['language_definition_id'] as $lang_id => $id) {
$data = array('language_id' => $lang_id, 'section' => $this->request->post['section'], 'block' => $this->request->post['block'], 'language_key' => $this->request->post['language_key'], 'language_value' => $this->request->post['language_value'][$lang_id]);
if ($id) {
$this->model_localisation_language_definitions->editLanguageDefinition($id, $data);
} else {
$this->model_localisation_language_definitions->addLanguageDefinition($data);
}
}
$this->view->assign('success', $this->language->get('text_success'));
}
$this->_getForm();
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例6: not_found
public function not_found()
{
//build not_found responce
$this->loadLanguage('error/not_found');
$error = new AError('');
$err_data = array('error_title' => $this->language->get('heading_title'), 'error_text' => $this->language->get('text_not_found'));
return $error->toJSONResponse('NOT_FOUND_404', $err_data);
}
示例7: writeToLog
/**
* SOAP request/response logging to a file
*/
function writeToLog($client)
{
if (!($logfile = fopen(TRANSACTIONS_LOG_FILE, "a"))) {
$error = new AError("Cannot open " . TRANSACTIONS_LOG_FILE . " file.\n");
$error->toLog()->toMessages->toDebug();
exit(1);
}
fwrite($logfile, sprintf("\r%s:- %s", date("D M j G:i:s T Y"), $client->__getLastRequest() . "\n\n" . $client->__getLastResponse()));
}
示例8: updateField
public function updateField()
{
$this->loadLanguage('forms_manager/forms_manager');
$this->loadModel('tool/forms_manager');
if (!$this->_validateFieldForm($this->request->post) || !$this->request->get['form_id']) {
$error = new AError('');
return $error->toJSONResponse('VALIDATION_ERROR_406', array('error_text' => $this->error));
}
$data = $this->request->post;
$data['form_id'] = $this->request->get['form_id'];
$this->model_tool_forms_manager->updateFormFieldData($data);
$this->response->setOutput('');
}
示例9: __construct
/**
* @param string $filename
* @throws AException
*/
public function __construct($filename)
{
if (file_exists($filename) && ($info = getimagesize($filename))) {
$this->file = $filename;
$this->info = array('width' => $info[0], 'height' => $info[1], 'bits' => $info['bits'], 'mime' => $info['mime'], 'channels' => $info['channels']);
$this->registry = Registry::getInstance();
$this->image = $this->get_gd_resource($filename);
} else {
$error = new AError('Error: Cannot load image ' . $filename);
$error->toMessages()->toDebug()->toLog();
return false;
}
return true;
}
示例10: __construct
/**
* @param string $type
*/
public function __construct($type)
{
$this->registry = Registry::getInstance();
//NOTE: Storefront can not access all resource at once. Resource type required
if ($type) {
$this->type = $type;
//get type details
$this->_loadType();
}
if (!$this->type_id) {
$message = "Error: Incorrect or missing resource type ";
$error = new AError($message);
$error->toLog()->toDebug();
}
}
示例11: update
public function update()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify($this->rt)) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), $this->rt), 'reset_value' => true));
}
$this->loadModel('localisation/language_definitions');
$this->loadLanguage('localisation/language_definitions');
if ($this->request->is_POST()) {
$output = array('error_text' => '', 'result_text' => '');
if ($this->_validateForm()) {
foreach ($this->request->post['language_definition_id'] as $lang_id => $id) {
$data = array('language_id' => $lang_id, 'section' => $this->request->post['section'], 'block' => $this->request->post['block'], 'language_key' => $this->request->post['language_key'], 'language_value' => $this->request->post['language_value'][$lang_id]);
if ($id) {
$this->model_localisation_language_definitions->editLanguageDefinition($id, $data);
} else {
$this->model_localisation_language_definitions->addLanguageDefinition($data);
}
}
$output['result_text'] = $this->language->get('text_success');
} else {
foreach ($this->error as $err) {
if (is_array($err)) {
$error_text[] = implode('<br>', $err);
} else {
$error_text[] = $err;
}
}
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_406', array('error_text' => $error_text, 'reset_value' => true));
}
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($output));
} else {
$this->view->assign('success', $this->session->data['success']);
if (isset($this->session->data['success'])) {
unset($this->session->data['success']);
}
$this->document->setTitle($this->language->get('heading_title'));
$this->_getForm();
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例12: main
public function main()
{
if (!$this->user->canModify('setting/setting_quick_form')) {
$this->error['warning'] = $this->language->get('error_permission');
}
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$output = array('result_text' => '');
$this->loadModel('setting/setting');
$this->loadLanguage('setting/setting');
$this->loadLanguage('common/header');
$this->view->assign('success', $this->session->data['success']);
if (isset($this->session->data['success'])) {
unset($this->session->data['success']);
}
$setting = explode('-', $this->request->get['active']);
$this->data['group'] = $setting[0];
$this->data['setting_key'] = $setting[1];
$this->data['store_id'] = !isset($this->session->data['current_store_id']) ? $setting[2] : $this->session->data['current_store_id'];
if (is_int(strpos($this->data['setting_key'], 'config_description'))) {
$this->data['setting_key'] = substr($this->data['setting_key'], 0, strrpos($this->data['setting_key'], '_'));
$this->request->get['active'] = $this->data['group'] . '-' . $setting[1] . '-' . $this->data['store_id'];
} else {
$this->request->get['active'] = $this->data['group'] . '-' . $this->data['setting_key'] . '-' . $this->data['store_id'];
}
$this->document->setTitle($this->language->get('heading_title'));
if ($this->request->is_POST()) {
if ($this->_validateForm($this->data['group'])) {
$this->model_setting_setting->editSetting($this->data['group'], $this->request->post, $this->data['store_id']);
$output['result_text'] = $this->language->get('text_success');
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($output));
} else {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_406', array('error_text' => $this->error, 'reset_value' => true));
}
} else {
$this->_getForm();
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例13: onControllerResponsesListingGridExtension_InitData
public function onControllerResponsesListingGridExtension_InitData()
{
if ($this->baseObject_method != 'update') {
return null;
}
$that = $this->baseObject;
if ($that->request->get['id'] != 'default_pp_express') {
return false;
}
if (!has_value($that->request->post['default_pp_express_custom_bg_color'])) {
return false;
}
$that->request->post['default_pp_express_custom_bg_color'] = ltrim($that->request->post['default_pp_express_custom_bg_color'], '#');
$is_valid = $this->_check_valid_colorhex($that->request->post['default_pp_express_custom_bg_color']);
if (!$is_valid) {
$that->loadLanguage('default_pp_express/default_pp_express');
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => $that->language->get('default_pp_express_error_bg_color'), 'reset_value' => false));
}
}
示例14: addStatus
public function addStatus($order_status_id, $status_text_id)
{
$order_status_id = (int) $order_status_id;
//preformat text_id at first
$status_text_id = preformatTextID($status_text_id);
if (in_array($order_status_id, array_keys($this->statuses)) || in_array($status_text_id, $this->statuses)) {
$error_text = 'Error: Cannot add new order status with id ' . $order_status_id . ' and text id ' . $status_text_id . ' into AOrderStatus class.';
$e = new AError($error_text);
$e->toLog()->toDebug();
return false;
}
if (!$status_text_id) {
$error_text = 'Error: Cannot add new order status with id ' . $order_status_id . ' and empty text id';
$e = new AError($error_text);
$e->toLog()->toDebug();
return false;
}
$this->statuses[$order_status_id] = $status_text_id;
return true;
}
示例15: buildTask
public function buildTask()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->data['output'] = array();
if ($this->request->is_POST() && $this->_validate()) {
$this->loadModel('tool/backup');
$task_details = $this->model_tool_backup->createBackupTask('manual_backup', $this->request->post);
if (!$task_details) {
$this->errors = array_merge($this->errors, $this->model_tool_backup->errors);
$error = new AError('files backup error');
return $error->toJSONResponse('APP_ERROR_402', array('error_text' => implode(' ', $this->errors), 'reset_value' => true));
} else {
$this->data['output']['task_details'] = $task_details;
}
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($this->data['output']));
}