function show_errors() { // display errors if ($this->errors) { if (!$this->errors_to_function) { echo '<ul class="errors">'; foreach ($this->errors as $name => $error) { echo '<li><div class="error_icon"></div>' . ucfirst(str_ireplace('[field]', $name, $error)) . '</li>'; } echo '</ul><div class="clear"> </div>'; } else { Errors::merge($this->errors); } } }
foreach ($items as $order => $id) { if (in_array('page_map_reorders', $table_fields) && $table == 'admin_pages') { $rec = DB::getRecord('admin_pages', $id, 0, 1); if ($rec['page_map_reorders'] > 0) { continue; } } DB::update($table, array('order' => $i), $id); $i++; } } } if (is_array($_REQUEST['page_map'])) { if (is_array($_REQUEST['page_map']['methods'])) { foreach ($_REQUEST['page_map']['methods'] as $order => $id) { DB::update('admin_controls_methods', array('order' => $order), $id); } } if (is_array($_REQUEST['page_map']['pages'])) { foreach ($_REQUEST['page_map']['pages'] as $order => $id) { DB::update('admin_pages', array('order' => $order, 'page_map_reorders' => 1), $id); } } } if (!$errors) { Messages::add($CFG->ajax_save_message); Messages::display(); } else { Errors::merge($errors); Errors::display(); }
static function sendSMS($authy_id = false) { global $CFG; API::add('User', 'sendSMS', array($authy_id)); $query = API::send(); $response = $query['User']['sendSMS']['results'][0]; if (!$response || !is_array($response)) { Errors::add(Lang::string('security-com-error')); } elseif ($response['success'] == false) { Errors::merge($response['errors']); } else { return true; } }
} else { API::token($token1); if ($_REQUEST['action'] == 'edit') { API::add('APIKeys', 'edit', array($permissions)); } elseif ($_REQUEST['action'] == 'add') { API::add('APIKeys', 'add'); } elseif ($_REQUEST['action'] == 'delete') { API::add('APIKeys', 'delete', array($remove_id1)); } $query = API::send(); if (!empty($query['error'])) { if ($query['error'] == 'security-com-error') { Errors::add(Lang::string('security-com-error')); } if ($query['error'] == 'authy-errors') { Errors::merge($query['authy_errors']); } if ($query['error'] == 'security-incorrect-token') { Errors::add(Lang::string('security-incorrect-token')); } } if ($_REQUEST['action'] == 'delete' && !$query['APIKeys']['delete']['results'][0]) { Link::redirect('api-access.php?error=delete'); } if (!is_array(Errors::$errors)) { if ($_REQUEST['action'] == 'edit') { Link::redirect('api-access.php?message=edit'); } elseif ($_REQUEST['action'] == 'add') { $secret = $query['APIKeys']['add']['results'][0]; Messages::add(Lang::string('api-add-message')); $info_message = str_replace('[secret]', $secret, Lang::string('api-add-show-secret'));
function saveToDB() { global $CFG; if (!User::isLoggedIn()) { return false; } $table = $table ? $table : 'cart'; if (is_array($_SESSION['cart'])) { foreach ($_SESSION['cart'] as $row) { $row['user_id'] = User::$info['id']; if (!DB::insert($table, $row)) { $id = $row['item_id']; $errors[$id] = $CFG->cart_item_conversion_error; } } } if ($errors) { Errors::merge($errors); return false; } else { return true; } }